Debian Codegraph @

texmf-dist/source/generic/tex4ht/tex4ht-word.tex

raw
1 % $Id: tex4ht-word.tex 65 2010-11-17 19:16:45Z karl $
2 % compile 3 times: latex tex4ht-word
3 % or xhlatex tex4ht-word "html,3,sections+"
4
5 % Copyright (C) 2009-2010 TeX Users Group
6 % Copyright (C) 2000-2009 Eitan M. Gurari
7 % Released under LPPL 1.3c+.
8 % See tex4ht-cpright.tex for license text.
9
10 %%%%%%%%%%%%%%%%%% load style files %%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \ifx \HTML\UnDef
13 \def\HTML{htmlw}
14 \def\CONFIG{\jobname}
15 \def\MAKETITLE{\author{Eitan M. Gurari}}
16 \def\next{\input mktex4ht.4ht \endinput}
17 \expandafter\next
18 \fi
19
20 \input{common.tex}
21 \input{tex4ht-cpright.tex}
22
23 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24 \section{Preamble}
25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26
27 \<htmlw\><<<
28 % htmlw.4ht (|version), generated from |jobname.tex
29 % Copyright (C) 2009-2010 TeX Users Group
30 % Copyright (C) |CopyYear.2000. Eitan M. Gurari
31 |<TeX4ht copywrite|>
32 >>>
33
34
35
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 \section{General}
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39
40 \<configure htmlw tex4ht\><<<
41 % \Configure{Picture}{.wmf}
42 >>>
43
44 \<configure htmlw latex\><<<
45 \Css{body {text-align:both;}}
46 >>>
47
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 \section{Char Set}
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51
52
53
54 \<configure htmlw babel\><<<
55 \def\:temp#1#2{%
56 \def\:tempa{#1}\ifx \languagename\:tempa
57 \def\A:charset{#2}\ifx \A:charset\empty\else
58 \def\A:charset{charset=#2}%
59 \fi\fi}
60 \:temp{afrikaans}{windows-1252}
61 \:temp{arabic}{windows-1256}
62 \:temp{austrian}{windows-1252}
63 \:temp{brazilian}{windows-1252}
64 \:temp{brazil}{windows-1252}
65 \:temp{catalan}{windows-1252}
66 \:temp{croatian}{windows-1251}
67 \:temp{czech}{windows-1251}
68 \:temp{danish}{windows-1252}
69 \:temp{dutch}{windows-1252}
70 \:temp{estonian}{windows-1251}
71 \:temp{finnish}{windows-1252}
72 \:temp{francais}{windows-1252}
73 \:temp{frenchb}{windows-1252}
74 \:temp{french}{windows-1252}
75 \:temp{galician}{windows-1252}
76 \:temp{germanb}{windows-1252}
77 \:temp{german}{windows-1252}
78 \:temp{greek}{windows-1253}
79 \:temp{hebrew}{windows-1255}
80 \:temp{hungarian}{windows-1250}
81 \:temp{ngerman}{windows-1252}
82 \:temp{norsk}{windows-1252}
83 \:temp{nynorsk}{windows-1252}
84 \:temp{polish}{windows-1252}
85 \:temp{polutonikogreek}{windows-1253}
86 \:temp{portuges}{windows-1252}
87 \:temp{portuguese}{windows-1252}
88 \:temp{romanian}{windows-1250}
89 \:temp{russian}{windows-1251}
90 \:temp{scottish}{windows-1252}
91 \:temp{slovak}{windows-1250}
92 \:temp{slovene}{windows-1250}
93 \:temp{spanish}{windows-1252}
94 \:temp{swedish}{windows-1252}
95 \:temp{ukrainian}{windows-1251}
96 \:temp{uppersorbian}{windows-1252}
97 \:temp{welsh}{windows-1252}
98 >>>
99
100
101 \<configure htmlw austrian\><<<
102 \def\A:charset{charset=windows-1252}
103 >>>
104 \<configure htmlw catalan\><<<
105 \def\A:charset{charset=windows-1252}
106 >>>
107 \<configure htmlw croatian\><<<
108 \def\A:charset{charset=windows-1251}
109 >>>
110 \<configure htmlw czech\><<<
111 \def\A:charset{charset=windows-1251}
112 >>>
113 \<configure htmlw danish\><<<
114 \def\A:charset{charset=windows-1252}
115 >>>
116 \<configure htmlw dutch\><<<
117 \def\A:charset{charset=windows-1252}
118 >>>
119 \<configure htmlw english\><<<
120 \def\A:charset{charset=windows-1251}
121 >>>
122 \<configure htmlw estonian\><<<
123 \def\A:charset{charset=windows-1251}
124 >>>
125 \<configure htmlw finnish\><<<
126 \def\A:charset{charset=windows-1252}
127 >>>
128 \<configure htmlw francais\><<<
129 \def\A:charset{charset=windows-1252}
130 >>>
131 \<configure htmlw galician\><<<
132 \def\A:charset{charset=windows-1252}
133 >>>
134 \<configure htmlw germanb\><<<
135 \def\A:charset{charset=windows-1252}
136 >>>
137 \<configure htmlw greek\><<<
138 \def\A:charset{charset=windows-1253}
139 >>>
140 \<configure htmlw hebrew\><<<
141 \def\A:charset{charset=windows-1255}
142 >>>
143 \<configure htmlw ngermanb\><<<
144 \def\A:charset{charset=windows-1252}
145 >>>
146 \<configure htmlw norsk\><<<
147 \def\A:charset{charset=windows-1252}
148 >>>
149 \<configure htmlw polish\><<<
150 \def\A:charset{charset=windows-1252}
151 >>>
152 \<configure htmlw portuges\><<<
153 \def\A:charset{charset=windows-1252}
154 >>>
155 \<configure htmlw romanian\><<<
156 \def\A:charset{charset=windows-1250}
157 >>>
158 \<configure htmlw russianb\><<<
159 \def\A:charset{charset=windows-1251}
160 >>>
161 \<configure htmlw scottish\><<<
162 \def\A:charset{charset=windows-1252}
163 >>>
164 \<configure htmlw slovak\><<<
165 \def\A:charset{charset=windows-1250}
166 >>>
167 \<configure htmlw slovene\><<<
168 \def\A:charset{charset=windows-1250}
169 >>>
170 \<configure htmlw spanish\><<<
171 \def\A:charset{charset=windows-1252}
172 >>>
173 \<configure htmlw swedish\><<<
174 \def\A:charset{charset=windows-1252}
175 >>>
176 \<configure htmlw ukraineb\><<<
177 \def\A:charset{charset=windows-1251}
178 >>>
179 \<configure htmlw usorbian\><<<
180 \def\A:charset{charset=windows-1252}
181 >>>
182 \<configure htmlw welsh\><<<
183 \def\A:charset{charset=windows-1252}
184 >>>
185
186
187 \<configure htmlw hebtex\><<<
188 \def\A:charset{charset=windows-1255}
189 >>>
190
191 \<configure htmlw exerquiz\><<<
192 \def\A:charset{charset=windows-1252}
193 >>>
194
195
196 \<configure htmlw tex4ht\><<<
197 \def\A:charset{charset=windows-1252}
198 >>>
199
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201 \section{Etc}
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
203
204
205
206
207
208 \<configure htmlw alphanum\><<<
209 \Configure{toclvld}
210 {}{}
211 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
212 \HCode{<p class="MsoHeading6">}\TitleMark\space\HtmlParOff}
213 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
214 \Configure{toclvle}
215 {}{}
216 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
217 \HCode{<p class="MsoHeading7">}\TitleMark\space\HtmlParOff}
218 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
219 \Configure{toclvlf}
220 {}{}
221 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
222 \HCode{<p class="MsoHeading8">}\TitleMark\space\HtmlParOff}
223 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
224 \Configure{toclvlg}
225 {}{}
226 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
227 \HCode{<p class="MsoHeading9">}\TitleMark\space\HtmlParOff}
228 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
229 \Configure{toclvlh}
230 {}{}
231 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
232 \HCode{<p class="MsoHeading10">}\TitleMark\space\HtmlParOff}
233 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
234 \Configure{toclvli}
235 {}{}
236 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
237 \HCode{<p class="MsoHeading11">}\TitleMark\space\HtmlParOff}
238 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
239 \Configure{toclvlj}
240 {}{}
241 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
242 \HCode{<p class="MsoHeading12">}\TitleMark\space\HtmlParOff}
243 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
244 \Configure{toclvlk}
245 {}{}
246 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
247 \HCode{<p class="MsoHeading13">}\TitleMark\space\HtmlParOff}
248 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
249 \Configure{toclvll}
250 {}{}
251 {\ifvmode \IgnorePar\fi \EndP\IgnorePar
252 \HCode{<p class="MsoHeading14">}\TitleMark\space\HtmlParOff}
253 {\HCode{</p>}\HtmlParOn \IgnoreIndent \par}
254
255 \Css{p.MsoHeading6 {margin-top:12.0pt;
256 margin-right:0cm;
257 margin-bottom:3.0pt;
258 margin-left:0cm;
259 font-size:11.0pt;}}
260 \Css{p.MsoHeading7 {margin-top:12.0pt;
261 margin-right:0cm;
262 margin-bottom:3.0pt;
263 margin-left:0cm;
264 font-size:12.0pt;}}
265 \Css{p.MsoHeading8 {margin-top:12.0pt;
266 margin-right:0cm;
267 margin-bottom:3.0pt;
268 margin-left:0cm;
269 font-size:12.0pt;
270 font-style:italic;}}
271 \Css{p.MsoHeading9 {margin-top:12.0pt;
272 margin-right:0cm;
273 margin-bottom:3.0pt;
274 margin-left:0cm;
275 font-size:11.0pt;
276 font-family:Arial;}}
277 >>>
278
279
280
281 \begin{verbatim}
282 >> But they should go for h6, h7, h8 ... (which is not the case now).
283
284 EG> But HTML does not recognize h* tags besides h1--h5. What we can do is
285 EG> to set diffent CSS code there--however, I didn't see differents in
286 EG> fonts there. -eitan
287
288 This is true as far as plain html is concerned. But you can use higher
289 h? if you are planning to convert to *.doc because word interprets h1 as
290 heading 1 or h9 as heading 9 (presumably) as long as they are defined in
291 normal.dot.
292
293 EG> Do you know how can I inspect the content of that file? Under
294 EG> emacs it all looks like junk. -eitan
295
296 Which file do you mean? --- I suppose normal.dot. I do not think that
297 there is a possibility to view that file (apart from looking at it
298 with an hex editor).
299
300 But you can see the result quite easily if you produce an html-file
301 with several headings (lets say h1 to h9) and load that file into
302 word. After saving that file in a word format (*.doc) you will realize
303 that your headings are assigned to word's styles Heading 1 to Heading
304 9. Start then a new document with a different template. Let's say
305 thesis. Copy the hole text by Edit/Select All, Edit/Copy and Edit/Paste
306 into the new document. Then you will realize that all headings are
307 formated according to the heading styles of the thesis template.
308
309 This feature makes tex4ht even more interesting for converting
310 latex to word. Because you can write your texts with latex, convert
311 them to word and use then a template which is given to you by your
312 publisher. Unfortunately, German publishers do that quite often now
313 because nearly 90 % of all German lawyers are using word for writing
314 their essays these days.
315 \end{verbatim}
316
317
318
319
320
321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322 \section{Plain Footnotes}
323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
324
325 \<configure htmlw plain\><<<
326 \:CheckOption{fn-in}\if:Option
327 |<inline footnote plain|>
328 |<inline footnote css|>
329 \fi
330 >>>
331
332 \<inline footnote plain\><<<
333 \Configure{vfootnote}
334 {|<mark inline vfootnote|>}
335 {|<open inline vfootnote|>}
336 {|<close inline vfootnote|>}
337 \Css{span.MsoFootnoteReference {vertical-align:super;}}
338 >>>
339
340 \<mark inline vfootnote\><<<
341 \Link{fn\FNnum}{fn\FNnum-bk}\HCode{<span class="MsoFootnoteReference">}%
342 \ifx \FNmark\empty +\else \FNmark\fi\HCode{</span>}\EndLink
343 >>>
344
345
346
347 \<open inline vfootnote\><<<
348 |<open inline footnote box|>
349 \Link{fn\FNnum-bk}{fn\FNnum}\HCode{<span class="MsoFootnoteReference">}%
350 \ifx \FNmark\empty +\else \FNmark\fi
351 \space\HCode{</span>}\EndLink
352 >>>
353
354 \<close inline vfootnote\><<<
355 |<close inline footnote box|>
356 >>>
357
358 \<footnote par\><<<
359 \Configure{HtmlPar}
360 {\EndP\HCode{<!--l. \the\inputlineno-->}\HCode{<p
361 \csname a:!P\endcsname class="MsoFootnoteText">}}
362 {\EndP\HCode{<!--l. \the\inputlineno-->}\HCode{<p
363 \csname a:!P\endcsname class="MsoFootnoteText">}}
364 {\:xhtml{\Tg</p>}}
365 {\:xhtml{\Tg</p>}}
366 >>>
367
368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369 \section{Latex Footnotes}
370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371
372
373 \<configure htmlw Preamble\><<<
374 \:CheckOption{fn-out}\if:Option \else
375 \Log:Note{for offline footnotes use
376 command line option `fn-out'}
377 \edef\Preamble{\Preamble,fn-in}
378 \fi
379 >>>
380
381
382
383 \<configure htmlw latex\><<<
384 \:CheckOption{fn-in}\if:Option
385 |<inline footnote mark|>
386 |<inline footnote text|>
387 |<inline footnote css|>
388 \fi
389 >>>
390
391
392 \<inline footnote mark\><<<
393 \Configure{footnotemark}
394 {\leavevmode |<inline fn mark /Link|>%
395 \NoFonts
396 \Tag{|<footnote id|>}{}}
397 {\EndNoFonts
398 |<end inline fn mark /Link|>%
399 \expandafter\global\expandafter
400 \let\csname (|<footnote id|>-bk)\endcsname\def}
401 >>>
402
403
404 \<inline footnote text\><<<
405 \Configure{footnotetext}
406 {|<open inline footnote box|>%
407 \leavevmode |<inline fn text /Link|>%
408 \NoFonts
409 \Tag{|<footnote id|>-bk}{}
410 }
411 {\EndNoFonts |<end inline fn text /Link|>}
412 {\expandafter\global\expandafter
413 \let\csname (|<footnote id|>)\endcsname\def
414 |<close inline footnote box|>}
415 >>>
416
417
418
419 \<open inline footnote box\><<<
420 \SaveEndP\global\setbox\fn:box=\vtop\bgroup\ShowPar
421 |<footnote par|>%
422 \ifvoid\fn:box\else \csname unvbox\endcsname\fn:box\fi
423 >>>
424
425 \<close inline footnote box\><<<
426 \EndP\egroup\RecallEndP
427 >>>
428
429
430
431
432
433
434 \<inline fn text /Link\><<<
435 \ifTag{|<footnote id|>}
436 {\expandafter\ifx\csname (|<footnote id|>)\endcsname\def
437 \Link{|<footnote id|>-bk}{}%
438 \HCode{<span class="MsoFootnoteReference">}%
439 \else
440 \Link{|<footnote id|>-bk}{|<footnote id|>}%
441 \HCode{<span class="MsoFootnoteReference">}%
442 \fi
443 }
444 {\expandafter\ifx\csname (|<footnote id|>)\endcsname\def
445 \else
446 \Link{}{|<footnote id|>}%
447 \HCode{<span class="MsoFootnoteReference">}%
448 \fi
449 }%
450 >>>
451
452 \<end inline fn text /Link\><<<
453 \ifTag{|<footnote id|>}
454 {\space\HCode{</span>}\EndLink
455 }
456 {\expandafter\ifx\csname (|<footnote id|>)\endcsname\def
457 \else
458 \space\HCode{</span>}\EndLink
459 \fi
460 }%
461 >>>
462
463
464
465 \<mouseover inline fn mark /Link\><<<
466 |<start js|>%
467 \ifTag{|<footnote id|>-bk}
468 {\expandafter\ifx\csname (|<footnote id|>-bk)\endcsname\def
469 \Link[ |<mouseover-footnote arguments|>\Hnewline
470 ]{|<footnote id|>}{}%
471 \else
472 \Link[ |<mouseover-footnote arguments|>\Hnewline
473 ]{|<footnote id|>}{|<footnote id|>-bk}%
474 \fi
475 }
476 {\expandafter\ifx\csname (|<footnote id|>-bk)\endcsname\def
477 \else \Link[ |<mouseover-footnote arguments|>\Hnewline
478 ]{}{|<footnote id|>-bk}\fi
479 }%
480 >>>
481
482
483
484
485
486
487
488 \<inline fn mark /Link\><<<
489 \ifTag{|<footnote id|>-bk}
490 {\expandafter\ifx\csname (|<footnote id|>-bk)\endcsname\def
491 \Link{|<footnote id|>}{}%
492 \HCode{<span class="MsoFootnoteReference">}%
493 \else
494 \Link{|<footnote id|>}{|<footnote id|>-bk}%
495 \HCode{<span class="MsoFootnoteReference">}%
496 \fi
497 }
498 {\expandafter\ifx\csname (|<footnote id|>-bk)\endcsname\def
499 \else
500 \Link{}{|<footnote id|>-bk}
501 \HCode{<span class="MsoFootnoteReference">}%
502 \fi
503 }%
504 >>>
505
506
507 \<end inline fn mark /Link\><<<
508 \ifTag{|<footnote id|>-bk}
509 {\HCode{</span>}\EndLink}
510 {\expandafter\ifx\csname (|<footnote id|>-bk)\endcsname\def
511 \else \HCode{</span>}\EndLink\fi
512 }%
513 >>>
514
515
516
517
518 \<inline footnote css\><<<
519 \Css{span.footnotetext{ font-size:80\%; font-style:italic; } }
520 \Css{div.footnotes{border-bottom:0;}}
521 >>>
522
523
524 \<ams footnotes\><<<
525 \:CheckOption{fn-in}\if:Option
526 \Css{span.MsoFootnoteReference {vertical-align:super;}}
527 \fi
528 >>>
529
530
531 \<footnote id\><<<
532 fn\FNnum x\minipageNum
533 >>>
534
535
536 \<configure htmlw amsart\><<<
537 |<ams footnotes|>
538 >>>
539
540 \<configure htmlw amsproc\><<<
541 |<ams footnotes|>
542 >>>
543
544 \<configure htmlw amsbook\><<<
545 |<ams footnotes|>
546 >>>
547
548
549 \endinput