summaryrefslogtreecommitdiff
path: root/info/beginlatex/html/chapter10.html
blob: b1ffa32efed357cf81461c461e3cc3bc56f48f9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "/dtds/html4t.dtd">

<!--Generated from beginlatex.XML.xml with typebook-html.xslt on 2005-04-04T01:02:52--><html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   
      <title>Formatting information: Chapter 10&nbsp;&#8212; Compatibility with other systems</title>
      <link rel="stylesheet" href="typebook.css" type="text/css">
      <meta http-equiv="Content-Style-Type" content="text/css">
   </head>
   <body>
      <table width="100%">
         <tr>
            <th class="title" width="66%">
               <h1><a name="doctitle">Formatting information</a></h1>
               <h2>A beginner's introduction to typesetting with
                  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></h2>
               <h3>Chapter 10&nbsp;&#8212; Compatibility with other systems</h3>
               <h3>Peter Flynn</h3>
               <h4>Silmaril Consultants<br>Textual Therapy Division
               </h4><br>v. 3.6 (March 2005)
            </th>
            <td class="toc" width="33%">
               <h4><a name="doctoc">Contents</a></h4>
               <dl>
                  <dd class=""><a href="intro.html#intro">Introduction</a></dd>
                  <dd class=""><a href="foreword.html#foreword">Foreword</a></dd>
                  <dd class=""><a href="preface.html#preface">Preface</a></dd>
               </dl>
               <ol>
                  <li class=""><a href="chapter1.html#get">Installing <span class="TEX">T<span class="E">E</span>X</span> and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></li>
                  <li class=""><a href="chapter2.html#plaintext">Using your editor to create documents</a></li>
                  <li class=""><a href="chapter3.html#basic">Basic document structures</a></li>
                  <li class=""><a href="chapter4.html#process">Typesetting, viewing and printing</a></li>
                  <li class=""><a href="chapter5.html#ctan">CTAN, packages, and online help</a></li>
                  <li class=""><a href="chapter6.html#otherdoc">Other document structures</a></li>
                  <li class=""><a href="chapter7.html#texttools">Textual tools</a></li>
                  <li class=""><a href="chapter8.html#typo">Fonts and layouts</a></li>
                  <li class=""><a href="chapter9.html#macros">Programmability (macros)</a></li>
                  <li class="current"><a href="chapter10.html#compat">Compatibility with other systems</a></li>
               </ol>
               <ol type="A">
                  <li class=""><a href="appendixA.html#cnf">Configuring <span class="TEX">T<span class="E">E</span>X</span> search paths</a></li>
                  <li class=""><a href="appendixB.html#tugform"><span class="TEX">T<span class="E">E</span>X</span> Users Group membership</a></li>
                  <li class=""><a href="appendixC.html#asciicharset">The ASCII character set</a></li>
                  <li class=""><a href="appendixD.html#gfdl">GNU Free Documentation License</a></li>
               </ol>
               <dl>
                  <dd class=""><a href="bibliography.html#biblio">References</a></dd>
                  <dd class=""><a href="index.html#index">Index</a></dd>
               </dl>
            </td>
         </tr>
         <tr>
            <td class="credits">
               <p>This edition of <cite>Formatting
                     	  Information</cite> was prompted by the generous help I
                  	have received from <span class="TEX">T<span class="E">E</span>X</span> users too numerous to mention
                  	individually. Shortly after TUGboat published the November
                  	2003 edition, I was reminded by a spate of email of the
                  	fragility of documentation for a system like <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> which is
                  	constantly under development. There have been revisions to
                  	packages; issues of new distributions, new tools, and new
                  	interfaces; new books and other new documents; corrections to
                  	my own errors; suggestions for rewording; and in one or two
                  	cases mild abuse for having omitted package X which the author
                  	felt to be indispensable to users. &para;&nbsp;I am grateful as always to the people who sent me
                  	corrections and suggestions for improvement. Please keep them
                  	coming: only this way can this book reflect what people
                  	want to learn. The same limitation still applies, however: no
                  	mathematics, as there are already a dozen or more excellent
                  	books on the market&nbsp;&#8212; as well as other online
                  	documents&nbsp;&#8212; dealing with mathematical typesetting in
                  <span class="TEX">T<span class="E">E</span>X</span> and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> in finer and better detail than I am
                  	capable of. &para;&nbsp;The structure remains the same, but I have revised and
                  	rephrased a lot of material, especially in the earlier
                  	chapters where a new user cannot be expected yet to have
                  	acquired any depth of knowledge. Many of the screenshots have
                  	been updated, and most of the examples and code fragments have
                  	been retested. &para;&nbsp;As I was finishing this edition, I was asked to review
                  	an article for <cite><a href="http://www.tug.org/pracjourn/" name="C3">The Prac<span class="TEX">T<span class="E">E</span>X</span> Journal</a></cite>, which
                  	grew out of the Practical <span class="TEX">T<span class="E">E</span>X</span> Conference in 2004. The
                  	author specifically took the writers of documentation to task
                  	for failing to explain things more clearly, and as I read
                  	more, I found myself agreeing, and resolving to clear up some
                  	specific problems areas as far as possible. It is very
                  	difficult for people who write technical documentation to
                  	remember how they struggled to learn what has now become a
                  	familiar system. So much of what we do is second nature, and a
                  	lot of it actually has nothing to do with the software, but
                  	more with the way in which we view and approach information,
                  	and the general level of knowledge of computing. If I have
                  	obscured something by making unreasonable assumptions about
                  	<em>your</em> knowledge, please let me know so
                  	that I can correct&nbsp;it. 
                  <p>Peter Flynn is author of <cite><a href="bibliography.html#htmlbook" name="C4">The HTML Handbook</a></cite> and <cite><a href="bibliography.html#sgmltools" name="C5">Understanding SGML and XML Tools</a></cite>, and editor of <cite><a href="http://www.ucc.ie/xml/" name="C6">The XML FAQ</a></cite>.
                  </p>
               </p>
            </td>
            <td class="legal">
               <p>
                  <p>This document is Copyright &copy; 1999&#8211;2005 by
                     Silmaril Consultants under the terms of what is now the GNU
                     Free Documentation License (copyleft).
                  </p>
                  <p>Permission is granted to copy, distribute and/or modify
                     this document under the terms of the GNU Free Documentation
                     License, Version 1.2 or any later version published by the
                     Free Software Foundation; with no Invariant Sections, no
                     Front-Cover Texts, and no Back-Cover Texts. A copy of the
                     license is included in the section entitled <cite><a href="http://www.fsf.org/copyleft/fdl.html" name="C1">The GNU Free Documentation License</a></cite>.
                  </p>
                  <p>You are allowed to distribute, reproduce, and modify it
                     without fee or further requirement for consent subject to the
                     conditions in <a href="appendixD.html#gfdl-4">section D.5</a>. The author has
                     asserted his right to be identified as the author of this
                     document. If you make useful modifications you are asked to
                     inform the author so that the master copy can be updated. See
                     the full text of the License in <a href="appendixD.html#gfdl">Appendix D</a>.
                     
                  </p>
               </p>
            </td>
         </tr>
      </table>
      <div class="chapter">
         <table width="100%">
            <tr>
               <td align="center"><small><i class="chaphead"><b><a name="compat">CHAPTER</a></b></i></small><br><table border="1">
                     <tr>
                        <td class="chapno">10</td>
                     </tr>
                  </table>
               </td>
               <td><pre class="spacing"></pre></td>
               <td>
                  <p>&nbsp;</p>
                  <h1>Compatibility with other systems</h1>
               </td>
               <td class="toc">
                  <p>&nbsp;</p>
                  <ol>
                     <li><a href="#tolatex">Converting into <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></li>
                     <li><a href="#latexto">Converting out of <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></li>
                  </ol>
               </td>
               <td align="right"><a href="#doctoc"><img src="top.png" title="Table of Contents" width="32" alt="ToC" align="right" border="0"></a></td>
            </tr>
         </table>
         <p>As we saw in <a href="chapter2.html#plaintext">Chapter 2</a>, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> uses
            plain-text files, so they can be read and written by any
            standard application that can open text files. This helps
            preserve your information over time, as the plain-text format
            cannot be obsoleted or hijacked by any manufacturer or sectoral
            interest, and it will always be readable on any computer, from
            your handheld (yes, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is available for some <small><a href="intro.html#PDA" class="acroref" name="A216" title="Personal Digital Assistant">PDA</a></small>s, see <a href="chapter10.html#zaurus">Figure 10.1</a>) to the
            biggest supercomputer.
         </p>
         <div class="figure" align="center">
            <hr>
            <caption><i>Figure 10.1</i>:&nbsp;<a name="zaurus"><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> editing and processing on the Sharp Zaurus 5500
                  	PDA</a></caption>
            <div align="center" style="margin:12px"><img src="zedit.png" width="30%"> &nbsp; <img src="zlatex.png" width="30%"> &nbsp; <img src="qpdf.png" width="30%"></div>
            <hr>
         </div>
         <p>However, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is intended as the last stage of the
            editorial process: formatting for print or display. If you have
            a requirement to re-use the text in some other
            environment&nbsp;&#8212; a database perhaps, or on the Web or a
            <small>CD-ROM</small> or <small><a href=".html#DVD" class="acroref" name="A218" title="Digital Versatile Disk">DVD</a></small>, or in Braille or voice output&nbsp;&#8212; then
            it should probably be edited, stored, and maintained in
            something neutral like the <a name="XML" class="acroref" href="http://www.ucc.ie/xml/">Extensible Markup
               	Language</a>&nbsp;(<small>XML</small>), and only converted to <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> when a
            typeset copy is needed.
         </p>
         <p>Although <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> has many structured-document features in
            common with <small><a href="chapter10.html#SGML" class="acroref" name="A220" title="Standard Generalized Markup Language">SGML</a></small> and <small><a href="chapter10.html#XML" class="acroref" name="A221" title="Extensible Markup Language">XML</a></small>, it can still only be processed by the
            <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> and <i><a name="p227">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i> programs.
            Because its macro features make it almost infinitely
            redefinable, processing it requires a program which can unravel
            arbitrarily complex macros, and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> and its siblings are
            the only programs which can do that effectively. Like other
            typesetters and formatters (Quark
            <i><a name="p228">XPress</a></i>,
            <i><a name="p229">PageMaker</a></i>,
            <i><a name="p230">FrameMaker</a></i>, Microsoft
            <i><a name="p231">Publisher</a></i>, <i><a name="p232">3B2</a></i> etc.), <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> is largely a
            one-way street leading to typeset printing or display
            formatting.
         </p>
         <p>Converting <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to some other format therefore means you
            will unavoidably lose some formatting, as <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> has features
            that others systems simply don't possess, so they cannot be
            translated&nbsp;&#8212; although there are several ways to minimise
            this loss. Similarly, converting other formats into <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
            often means editing back the stuff the other formats omit
            because they only store appearances, not structure.
         </p>
         <p>However, there are at least two excellent systems for
            converting <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> directly to <a name="HTML" class="acroref">HyperText
               	Markup Language</a>&nbsp;(<small>HTML</small>) so you can publish it on the web, as
            we shall see in <a href="chapter10.html#latexto">section 10.2</a>.
         </p>
         <div class="sect1">
            <h2><a href="#compat"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.1 <a name="tolatex">Converting into <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></h2>
            <p>There are several systems which will save their text in
               <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> format. The best known is probably the <span class="LYX">L<span class="Y">Y</span>X</span> editor
               	(see <a href="chapter2.html#lyxwin">Figure 2.1</a>), which is a wordprocessor-like
               	interface to <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> for Windows and Unix. Both the
               	<i><a name="p233">AbiWord</a></i> and
               	<i><a name="p234">Kword</a></i> wordprocessors on Linux
               	systems have a very good <b>Save
                  	  As</b>...<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> output, so they can be used to
               	open Microsoft <i><a name="p235">Word</a></i> documents and
               	convert to
               	<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. Several maths packages like the
               	<i><a name="p236">EuroMath</a></i> editor, and the
               	<i><a name="p237">Mathematica</a></i> and
               	<i><a name="p238">Maple</a></i> analysis packages, can also
               	save material in <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> format.
            </p>
            <p>In general, most other wordprocessors and DTP systems
               	either don't have the level of internal markup
               	sophistication needed to create a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> file, or they lack
               	a suitable filter to enable them to output what they do have.
               	Often they are incapable of outputting any kind of structured
               	document, because they only store what the text looks like,
               	not why it's there or what role it fulfills. There are
               	two ways out of this:
            </p>
            <ul>
               <li>
                  <p>Use the <span class="guimenu">File</span>&#8594;<span class="guimenuitem">Save
                        	      As...</span> menu item to save the
                     	    wordprocessor file as <small><a href="chapter10.html#HTML" class="acroref" name="A223" title="HyperText Markup Language">HTML</a></small>,
                     	    rationalise the <small><a href="chapter10.html#HTML" class="acroref" name="A224" title="HyperText Markup Language">HTML</a></small> using
                     <a name="raggett">Dave  Raggett</a>'s <a href="http://tidy.sourceforge.net/"><i><a name="p239">HTML
                              		Tidy</a></i></a>, and convert the resulting
                     	    <a name="XHTML" class="acroref">Extensible HyperText Markup
                        	      Language</a>&nbsp;(<small>XHTML</small>) to <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> with any of the standard
                     	    <small><a href="chapter10.html#XML" class="acroref" name="A226" title="Extensible Markup Language">XML</a></small> tools (see below).
                  </p>
               </li>
               <li>
                  <p>Use a specialist conversion tool like EBT's
                     	    <i><a name="p240">DynaTag</a></i> (supposedly available
                     	    from Enigma, if you can persuade them they have a copy to
                     	    sell you; or you may still be able to get it from <a href="http://www.rbii.com/">Red Bridge
                        	      Interactive</a> in Providence, RI). It's
                     	    expensive and they don't advertise it, but for bulk
                     	    conversion of consistently-marked
                     	    <i><a name="p241">Word</a></i> files into XML it beats
                     	    everything else hands down. The
                     	    <i><a name="p242">Word</a></i> files
                     	    <em>must</em> be consistent, though, and must
                     	    use named styles from a stylesheet, otherwise no system on
                     	    earth is going to be able to guess what it means.
                  </p>
               </li>
            </ul>
            <p>There is of course a third way, suitable for large volumes
               	only: send it off to the Pacific Rim to be retyped into XML or
               	<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. There are hundreds of companies from India to
               	Polynesia who do this at high speed and low cost with very
               	high accuracy. It sounds crazy when the document is already in
               	electronic form, but it's a good example of the problem
               	of low quality of wordprocessor markup that this solution
               	exists at all.
            </p>
            <p>You will have noticed that most of the solutions lead to
               	one place: <small><a href="chapter10.html#SGML" class="acroref" name="A227" title="Standard Generalized Markup Language">SGML</a></small><sup><a href="#F53">1</a></sup> or <small><a href="chapter10.html#XML" class="acroref" name="A231" title="Extensible Markup Language">XML</a></small>. As explained
               	above and elsewhere, these formats are the only ones devised
               	so far capable of storing sufficient information in
               	machine-processable, publicly-accessible form to enable your
               	document to be recreated in multiple output formats.  Once
               	your document is in <small><a href="chapter10.html#XML" class="acroref" name="A232" title="Extensible Markup Language">XML</a></small>, there is a
               	large range of software available to turn it into other
               	formats, including <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. Processors in any of the common
               	<small><a href="chapter10.html#SGML" class="acroref" name="A233" title="Standard Generalized Markup Language">SGML</a></small>/<small><a href="chapter10.html#XML" class="acroref" name="A234" title="Extensible Markup Language">XML</a></small>
               	processing languages like the <a name="DSSSL" class="acroref">Document
                  	  Style Semantics and Specification Language</a>&nbsp;(<small>DSSSL</small>), the
               	<a name="XSLT" class="acroref">Extensible Stylesheet Language
                  	  [Transformations]</a>&nbsp;(<small>XSLT</small>),
               	<i><a name="p243">Omnimark</a></i>,
               	<i><a name="p244">Metamorphosis</a></i>,
               	<i><a name="p245">Balise</a></i>, etc. can easily be written
               	to output <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, and this approach is extremely
               	common.
            </p>
            <p>Much of this will be simplified when wordprocessors
               	support native, arbitrary <small><a href="chapter10.html#XML" class="acroref" name="A237" title="Extensible Markup Language">XML</a></small>/<small><a href="chapter10.html#XSLT" class="acroref" name="A238" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> as a
               	standard feature, because <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> output will become much
               	simpler to produce.
            </p>
            <ul>
               <li>
                  <p>Sun's <i><a name="p246">Star Office</a></i> and
                     	    its Open Source sister,
                     	    <i><a name="p247">OpenOffice</a></i>, have used XML as
                     	    their native file format for several years, and there is a
                     	    project at the <a name="OASIS" class="acroref">Organisation for the
                        	      Advancement of Structured Information Systems</a>&nbsp;(<small>OASIS</small>)
                     	    for developing a common <small><a href="chapter10.html#XML" class="acroref" name="A240" title="Extensible Markup Language">XML</a></small>
                     	    office file format based on those used by these two
                     	    packages, which has been proposed to the <a name="ISO" class="acroref">International Organization for
                        	      Standardization</a>&nbsp;(<small>ISO</small>) in Geneva as a candidate for
                     	    an International Standard.
                  </p>
               </li>
               <li>
                  <p><i><a name="p248">WordPerfect</a></i> has also had a
                     	    native <small><a href="chapter10.html#SGML" class="acroref" name="A242" title="Standard Generalized Markup Language">SGML</a></small> (and now <small><a href="chapter10.html#XML" class="acroref" name="A243" title="Extensible Markup Language">XML</a></small>) editor for many years, which will
                     	    work with any <a name="DTD" class="acroref">Document Type
                        	      Definition</a>&nbsp;(<small>DTD</small>) (but not a Schema; and at the time
                     	    of writing (2005) it still used a proprietary stylesheet
                     	    format).
                  </p>
               </li>
               <li>
                  <p>Microsoft has had a half-hearted &#8216;Save
                     	      As...XML&#8217; for a while, using an
                     	    internal and formerly largely undocumented Schema
                     	    (recently published at last). The
                     	    &#8216;Professional&#8217; versions of
                     	    <i><a name="p249">Word</a></i> and
                     	    <i><a name="p250">Excel</a></i> in
                     	    <i><a name="p251">Office&nbsp;11</a></i> (Office 2003 for
                     	    XP) now have full support for arbitrary Schemas and a real
                     	    <small><a href="chapter10.html#XML" class="acroref" name="A245" title="Extensible Markup Language">XML</a></small> editor, albeit with a rather
                     	    primitive interface, but there is no conversion to or from
                     	    <i><a name="p252">Word</a></i>'s
                     	    <code>.doc</code> format.<sup><a href="#F54">2</a></sup></p>
                  <p>However, help comes in the shape of <a name="rd">Ruggero Dambra</a>'s
                     	    <i><a name="p256">WordML2<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i>, which is an
                     	    <small><a href="chapter10.html#XSLT" class="acroref" name="A250" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> stylesheet to transform an
                     	    <small><a href="chapter10.html#XML" class="acroref" name="A251" title="Extensible Markup Language">XML</a></small> document in this internal
                     	    Schema (WordML) into <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span>&#949;</span> format.
                     	    Download it from any <small><a href="chapter5.html#CTAN" class="acroref" name="A252" title="Comprehensive Archive Network">CTAN</a></small> server
                     	    in <code>/support/WordML2LaTeX</code>.
                  </p>
               </li>
               <li>
                  <p><a name="rtf2latex2e"></a>Among the conversion programs on <small><a href="chapter5.html#CTAN" class="acroref" name="A253" title="Comprehensive Archive Network">CTAN</a></small> is <a name="us">Ujwal Sath&shy;yam</a>'s
                     	    <i><a name="p257">rtf2latex2e</a></i>, which converts
                     	    <a name="RTF" class="acroref">Rich Text Format</a>&nbsp;(<small>RTF</small>) files (output
                     	    by many wordprocessors) to <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span>&#949;</span>. The package
                     	    description says it has support
                     	    for figures and tables, equations are read as figures, and
                     	    it can the handle the latest <small><a href="chapter10.html#RTF" class="acroref" name="A255" title="Rich Text Format">RTF</a></small>
                     	    versions from Microsoft Word 97/98/2000, StarOffice, and
                     	    other wordprocessors. It runs on Macs, Linux, other Unix
                     	    systems, and Windows.
                  </p>
               </li>
            </ul>
            <p>When these efforts coalesce into generalised support for
               	arbitrary <small><a href="chapter10.html#DTD" class="acroref" name="A256" title="Document Type Definition">DTD</a></small>s and Schemas, it will
               	mean a wider choice of editing interfaces, and when they
               	achieve the ability to run <small><a href="chapter10.html#XSLT" class="acroref" name="A257" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small>
               	conversion into
               <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> from within these editors,  such as is done at the
               	moment with <i><a name="p258">Emacs</a></i> or
               	<i><a name="p259">XML Spy</a></i>, we will have full
               	convertability.
            </p>
            <ol class="footnotes" start="1">
               <li><a name="F53">The <a name="SGML" class="acroref">Standard Generalized Markup
                        	      Language</a>&nbsp;(<small>SGML</small>) itself is little used now for new
                     	    projects, as the software support for its daughter
                     	    <small><a href="chapter10.html#XML" class="acroref" name="A229" title="Extensible Markup Language">XML</a></small> is far greater, but there
                     	    are still hundreds of large document repositories in
                     	    <small><a href="chapter10.html#SGML" class="acroref" name="A230" title="Standard Generalized Markup Language">SGML</a></small> still growing their
                     	    collection by adding documents.</a></li>
            </ol>
            <ol class="footnotes" start="2">
               <li><a name="F54">Which is silly, given that Microsoft used to make
                     		one of the best
                     		<i><a name="p253">Word</a></i>-to-<small><a href="chapter10.html#SGML" class="acroref" name="A246" title="Standard Generalized Markup Language">SGML</a></small> converters ever, which was
                     		bi-directional (yes, it could round-trip
                     		<i><a name="p254">Word</a></i> to <small><a href="chapter10.html#SGML" class="acroref" name="A247" title="Standard Generalized Markup Language">SGML</a></small> and back to
                     		<i><a name="p255">Word</a></i> and back into <small><a href="chapter10.html#SGML" class="acroref" name="A248" title="Standard Generalized Markup Language">SGML</a></small>). But they dropped it on the
                     		floor when <small><a href="chapter10.html#XML" class="acroref" name="A249" title="Extensible Markup Language">XML</a></small>
                     		arrived.</a></li>
            </ol>
            <div class="sect2">
               <h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.1.1 Getting <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> out of XML
               </h3>
               <p>Assuming you can get your document out of its
                  	  wordprocessor format into <small><a href="chapter10.html#XML" class="acroref" name="A258" title="Extensible Markup Language">XML</a></small> by
                  	  some method, here is a very brief example of how to turn it
                  	  into <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>.
               </p>
               <p>You can of course buy and install a fully-fledged
                  	  commercial <small><a href="chapter10.html#XML" class="acroref" name="A259" title="Extensible Markup Language">XML</a></small> editor with
                  	  <small><a href="chapter10.html#XSLT" class="acroref" name="A260" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> support, and run this
                  	  application within it. However, this is beyond the reach of
                  	  many users, so to do this unaided you just need to install
                  	  three pieces of software: <a href="http://java.sun.com/j2se/1.4.2/download.html"><i><a name="p260">Java</a></i></a>, 
                  	  <a href="http://saxon.sourceforge.net/"><i><a name="p261">Saxon</a></i></a> 
                  	  and the <a href="http://www.docbook.org/xml/4.2/index.html">DocBook
                     	    4.2 DTD</a> (<small><a href="chapter6.html#URI" class="acroref" name="A261" title="Uniform Resource Indicator">URI</a></small>s are
                  	  correct at the time of writing). None of these has a visual
                  	  interface: they are run from the command-line in the same
                  	  way as is possible with <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>.
               </p>
               <p>As an example, let's take the above paragraph, as
                  	  typed or imported into <i><a name="p262">AbiWord</a></i>
                  	  (see
                  	<a href="chapter10.html#abidoc">Figure 10.1</a>). This is stored as a single
                  	  paragraph with highlighting on the product names (italics),
                  	  and the names are also links to their Internet sources, just
                  	  as they are in this document. This is a convenient way to
                  	  store two pieces of information in the same place.
               </p>
               <div class="figure" align="center">
                  <hr>
                  <caption><i>Figure 10.1</i>:&nbsp;<a name="abidoc">Sample paragraph in
                        	    <i><a name="p263">AbiWord</a></i> converted to <small><a href="chapter10.html#XML" class="acroref" name="A262" title="Extensible Markup Language">XML</a></small></a></caption>
                  <div align="center" style="margin:12px"><img src="abiword.png" width="100%"></div>
                  <hr>
               </div>
               <p><i><a name="p264">AbiWord</a></i> can export in DocBook
                  	  format, which is an <small><a href="chapter10.html#XML" class="acroref" name="A263" title="Extensible Markup Language">XML</a></small> vocabulary
                  	  for describing technical (computer)
                  	  documents&#8211;it's what I use for this book.
                  	  <i><a name="p265">AbiWord</a></i> can also export <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>,
                  	  but we're going make our own
                  	  version, working from the <small><a href="chapter10.html#XML" class="acroref" name="A264" title="Extensible Markup Language">XML</a></small>
                  	  (Brownie points for the reader who can guess why I'm
                  	  not just accepting the <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> conversion output).
               </p>
               <p>Although <i><a name="p266">AbiWord</a></i>'s
                  	  default is to output an <small><a href="chapter10.html#XML" class="acroref" name="A265" title="Extensible Markup Language">XML</a></small>&nbsp;book document
                  	  type, we'll convert it to a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> article document
                  	  class. Notice that <i><a name="p267">AbiWord</a></i> has
                  	  correctly output the expected section and title markup
                  	  empty, even though it's not used. Here's the
                  	  <small><a href="chapter10.html#XML" class="acroref" name="A266" title="Extensible Markup Language">XML</a></small> output (I've changed the
                  	  linebreaks to keep it within the bounds of this page
                  	  size):
               </p>
               <blockquote><pre class="tiny">
&lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"&gt;
&lt;book&gt;
&lt;!-- ===================================================================== --&gt;
&lt;!-- This DocBook file was created by AbiWord.                    --&gt;
&lt;!-- AbiWord is a free, Open Source word processor.                --&gt;
&lt;!-- You may obtain more information about AbiWord at www.abisource.com --&gt;
&lt;!-- ===================================================================== --&gt;
  &lt;chapter&gt;
    &lt;title&gt;&lt;/title&gt;
    &lt;section role="unnumbered"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;para&gt;You can of course buy and install a fully-fledged commercial XML 
editor with XSLT support, and run this application within it. However, this 
is beyond the reach of many users, so to do this unaided you just need to 
install three pieces of software: &lt;ulink
url="http://java.sun.com/j2se/1.4.2/download.html"&gt;&lt;emphasis&gt;Java&lt;/emphasis&gt;&lt;/ulink&gt;,
&lt;ulink 
url="http://saxon.sourceforge.net"&gt;&lt;emphasis&gt;Saxon&lt;/emphasis&gt;&lt;/ulink&gt;, and 
the &lt;ulink url="http://www.docbook.org/xml/4.2/index.html"&gt;DocBook 4.2 DTD&lt;/ulink&gt; 
(URIs are correct at the time of writing). None of these has a visual 
interface: they are run from the command-line in the same way as is possible 
with L&lt;superscript&gt;A&lt;/superscript&gt;T&lt;subscript&gt;E&lt;/subscript&gt;X.&lt;/para&gt; 
    &lt;/section&gt;
  &lt;/chapter&gt;
&lt;/book&gt;
	  </pre></blockquote>
               <p>The <small><a href="chapter10.html#XSLT" class="acroref" name="A267" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> language lets us
                  	  create templates for each type of element in an <small><a href="chapter10.html#XML" class="acroref" name="A268" title="Extensible Markup Language">XML</a></small> document. In our example, there are
                  	  only three which need handling, as we did not create chapter
                  	  or section titles (DocBook requires them to be present, but
                  	  they don't have to be used).
               </p>
               <ul>
                  <li>
                     <p>para, for the
                        	      paragraph[s];
                     </p>
                  </li>
                  <li>
                     <p>ulink, for the URIs;</p>
                  </li>
                  <li>
                     <p>emphasis, for the
                        	      italicisation.
                     </p>
                  </li>
               </ul>
               <p>I'm going to cheat over the superscripting and
                  	  subscripting of the letters in the <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> logo, and use my
                  	  editor to replace the whole thing with the
                  	  <code class="command"><a name="c319">\LaTeX</a></code> command. In the other three cases,
                  	  we already know how <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> deals with these, so we can
                  	  write our templates (see <a href="chapter10.html#xslcode">Figure 10.2</a>).
               </p>
               <div class="figure" align="center">
                  <hr>
                  <caption><i>Figure 10.2</i>:&nbsp;<a name="xslcode"><small><a href="chapter10.html#XSLT" class="acroref" name="A269" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> script to convert the
                        	    paragraph</a></caption>
                  <blockquote><pre class="footnotesize">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;xsl:stylesheet 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0"&gt;
  &lt;xsl:output method="text"/&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:text&gt;\documentclass{article}
\usepackage{url}&lt;/xsl:text&gt;
    &lt;xsl:apply-templates/&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="book"&gt;
    &lt;xsl:text&gt;\begin{document}&lt;/xsl:text&gt;
    &lt;xsl:apply-templates/&gt;
    &lt;xsl:text&gt;\end{document}&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="para"&gt;
    &lt;xsl:apply-templates/&gt;
    &lt;xsl:text&gt;&amp;#x000A;&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="ulink"&gt;
    &lt;xsl:apply-templates/&gt;
    &lt;xsl:text&gt;\footnote{\url{&lt;/xsl:text&gt;
    &lt;xsl:value-of select="@url"/&gt;
    &lt;xsl:text&gt;}}&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="emphasis"&gt;
    &lt;xsl:text&gt;\emph{&lt;/xsl:text&gt;
    &lt;xsl:apply-templates/&gt;
    &lt;xsl:text&gt;}&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
	    </pre></blockquote>
                  <hr>
               </div>
               <p>If you run this through
                  	  <i><a name="p268">Saxon</a></i>, which is an <small><a href="chapter10.html#XSLT" class="acroref" name="A270" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> processor, you can output a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
                  	  file which you can process and view (see <a href="chapter10.html#paraview">Figure 10.3</a>).
               </p>
               <blockquote><pre class="scriptsize">
$ java -jar /usr/local/saxonb8-0/saxon8.jar -o para.ltx \
para.dbk para.xsl
$ latex para.ltx
This is TeX, Version 3.14159 (Web2C 7.3.7x)
(./para.ltx
LaTeX2e &lt;2001/06/01&gt;
Loading CZ hyphenation patterns: Pavel Sevecek, v3, 1995
Loading SK hyphenation patterns: Jana Chlebikova, 1992
Babel &lt;v3.7h&gt; and hyphenation patterns for english, 
dumylang, nohyphenation, czech, slovak, german, ngerman, 
danish, spanish, catalan, finnish, french, ukenglish, greek, 
croatian, hungarian, italian, latin, mongolian, dutch, 
norwegian, polish, portuguese, russian, ukrainian, 
serbocroat, swedish, loaded. 
(/usr/TeX/texmf/tex/latex/base/article.cls
Document Class: article 2001/04/21 v1.4e Standard LaTeX 
document class (/usr/TeX/texmf/tex/latex/base/size10.clo))
(/usr/TeX/texmf/tex/latex/ltxmisc/url.sty) (./para.aux) 
[1] (./para.aux) )
Output written on para.dvi (1 page, 1252 bytes).
Transcript written on para.log.
$ xdvi para &amp;
	  </pre></blockquote>
               <div class="figure" align="center">
                  <hr>
                  <caption><i>Figure 10.3</i>:&nbsp;<a name="paraview">Displaying the typeset paragraph</a></caption>
                  <div align="center" style="margin:12px"><img src="para.png" width="60%"></div>
                  <blockquote><pre class="scriptsize">
\documentclass{article}\usepackage{url}\begin{document}
      
      You can of course buy and install a fully-fledged commercial 
XML editor with XSLT support, and run this application within it. 
However, this is beyond the reach of many users, so to do this 
unaided you just need to install three pieces of software: 
\emph{Java}\footnote{\url{http://java.sun.com/j2se/1.4.2/download.html}},
\emph{Saxon}\footnote{\url{http://saxon.sourceforge.net}}, and the 
DocBook 4.2 DTD\footnote{\url{http://www.docbook.org/xml/4.2/index.html}} 
(URIs are correct at the time of writing). None of these has a visual 
interface: they are run from the command-line in the same way as is 
possible with \LaTeX.
  
\end{document}
	    </pre></blockquote>
                  <hr>
               </div>
               <p>Writing <small><a href="chapter10.html#XSLT" class="acroref" name="A271" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> is not hard, but
                  	  requires a little learning. The output method here is
                  	  <code class="literal">text</code>, which is <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>'s file
                  	  format (<small><a href="chapter10.html#XSLT" class="acroref" name="A272" title="Extensible Stylesheet Language [Transformations]">XSLT</a></small> can also output
                  	  <small><a href="chapter10.html#HTML" class="acroref" name="A273" title="HyperText Markup Language">HTML</a></small> and other formats of
                  	  XML).
               </p>
               <ol type="1">
                  <li>
                     <p>The first template matches
                        	      &#8216;<code class="literal">/</code>&#8217;, which is
                        	      the document root (before the book
                        	      start-tag). At this stage we output the text
                        	      <code class="literal">\documentclass{article}</code> and
                        	      <code class="literal">\usepackage{url}</code>. The
                        	      &#8216;<code class="literal">apply-templates</code>&#8217; 
                        	      instructions tells the processor to carry on processing,
                        	      looking for more matches. <small><a href="chapter10.html#XML" class="acroref" name="A274" title="Extensible Markup Language">XML</a></small>
                        	      comments get ignored, and any elements which don't
                        	      match a template simply have their contents passed
                        	      through until the next match occurs.
                     </p>
                  </li>
                  <li>
                     <p>The book template outputs the
                        	      <code class="literal">\begin{document}</code> and the
                        	      <code class="literal">\end{document}</code> commands, and between
                        	      them to carry on processing.
                     </p>
                  </li>
                  <li>
                     <p>The para template just outputs
                        	      its content, but follows it with a linebreak (using the
                        	      hexadecimal character code <code class="literal">x000A</code> (see
                        	      the <small><a href="chapter2.html#ASCII" class="acroref" name="A275" title="American Standard Code for Information Interchange">ASCII</a></small> chart in <a href="appendixC.html#asciicodes">Table C.1</a>).
                     </p>
                  </li>
                  <li>
                     <p>The ulink template outputs its
                        	      content but follows it with a footnote using the
                        	      <code class="command"><a name="c320">\url</a></code> command to output the value of
                        	      the url attribute.
                     </p>
                  </li>
                  <li>
                     <p>The emphasis template surrounds
                        	      its content with <code class="literal">\emph{</code> and
                        	      <code class="literal">}</code>.
                     </p>
                  </li>
               </ol>
               <p>This is a relatively trivial example, but it serves to
                  	  show that it's not hard to output <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> from
                  	  <small><a href="chapter10.html#XML" class="acroref" name="A276" title="Extensible Markup Language">XML</a></small>. In fact there is a set of
                  	  templates already written to produce <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> from a DocBook
                  	  file at
                  	  <a href="http://www.dpawson.co.uk/docbook/tools.html#d4e2905"><tt>http://www.dpawson.co.uk/docbook/tools.html#d4e2905</tt></a></p>
            </div>
         </div>
         <div class="sect1">
            <h2><a href="#compat"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.2 <a name="latexto">Converting out of <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></h2>
            <p>This is much harder to do comprehensively. As noted
               	earlier, the <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> file format really requires the <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
               	program itself in order to process all the packages and
               	macros, because there is no telling what complexities authors
               	have added themselves (what a lot of this book is
               	about!).
            </p>
            <p>Many authors and editors rely on custom-designed or
               	homebrew converters, often written in the standard shell
               	scripting languages (Unix shells, Perl, Python, Tcl, etc).
               	Although some of the packages presented here are also written
               	in the same languages, they have some advantages and
               	restrictions compared with private conversions:
            </p>
            <ul>
               <li>
                  <p>Conversion done with the standard utilities (eg awk,
                     	    tr, sed, grep, detex, etc) can be faster for
                     	    <i>ad hoc</i> translations, but it
                     	    is easier to obtain consistency and a more sophisticated
                     	    final product using
                     	  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2<small><a href="chapter10.html#HTML" class="acroref" name="A277" title="HyperText Markup Language">HTML</a></small> or
                     	    <span class="TEX">T<span class="E">E</span>X</span>4ht&nbsp;&#8212; or one of the other systems
                     	    available.
                  </p>
               </li>
               <li>
                  <p>Embedding additional non-standard control sequences in
                     	  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> source code may make it harder to edit and
                     	    maintain, and will definitely make it harder to port to
                     	    another system.
                  </p>
               </li>
               <li>
                  <p>Both the above methods (and others) provide a fast and
                     	    reasonable reliable way to get documents authored in
                     	    <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> onto the Web in an acceptable&nbsp;&#8212; if not
                     	    optimal&nbsp;&#8212; format.
                  </p>
               </li>
               <li>
                  <p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2<small><a href="chapter10.html#HTML" class="acroref" name="A278" title="HyperText Markup Language">HTML</a></small> was written to
                     	    solve the problem of getting <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>-with-mathematics
                     	    onto the Web, in the days before MathML and math-capable
                     	    browsers.
                     	    <span class="TEX">T<span class="E">E</span>X</span>4ht was written to turn <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> documents into Web
                     	    hypertext&nbsp;&#8212; mathematics or not.
                  </p>
               </li>
            </ul>
            <div class="sect2">
               <h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.2.1 Conversion to <i><a name="p269">Word</a></i></h3>
               <p>There are several programs on <small><a href="chapter5.html#CTAN" class="acroref" name="A279" title="Comprehensive Archive Network">CTAN</a></small> to do
                  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>-to-<i><a name="p270">Word</a></i> and similar
                  	  conversions, but they do not all handles everything <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
                  	  can throw at them, and some only handle a subset of the
                  	  built-in commands of default
                  	  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>. Two in particular, however, have a good
                  	  reputation, although I haven't used either of them (I
                  	  stay as far away from <i><a name="p271">Word</a></i> as
                  	  possible):
               </p>
               <ul>
                  <li>
                     <p><i><a name="p272">latex2rtf</a></i> by <a name="wh">Wilfried Hennings</a>, <a name="fd">Fernando Dorner</a>, and <a name="ag">Andreas Granzer</a> translates
                        	      <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> into <small><a href="chapter10.html#RTF" class="acroref" name="A280" title="Rich Text Format">RTF</a></small>&nbsp;&#8212; the
                        	      opposite of the <i><a name="p273">rtf2latex2e</a></i>
                        	      mentioned in <a href="chapter10.html#rtf2latex2e">the 4th item</a>. <small><a href="chapter10.html#RTF" class="acroref" name="A281" title="Rich Text Format">RTF</a></small> can be read by most
                        	      wordprocessors, and this program preserves layout and
                        	      formatting for most <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> documents using standard
                        	      built-in commands.
                     </p>
                  </li>
                  <li>
                     <p><a name="kac">KirillA Chikrii</a>'s <i><a name="p274"><span class="TEX">T<span class="E">E</span>X</span>2Word</a></i> for
                        	      Microsoft Windows is a converter plug-in for
                        	      <i><a name="p275">Word</a></i> to let it open <span class="TEX">T<span class="E">E</span>X</span>
                        	      and <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> documents. The author's company claims
                        	      that &#8216;virtually any existing <span class="TEX">T<span class="E">E</span>X</span>/<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
                        		package can be supported by <i><a name="p276"><span class="TEX">T<span class="E">E</span>X</span>2Word</a></i>&#8217;
                        	      because it is customisable.
                     </p>
                  </li>
               </ul>
               <p>One easy route into wordprocessing, however, is the
                  	  reverse of the procedures suggested in the preceding
                  	  section: convert <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> to <small><a href="chapter10.html#HTML" class="acroref" name="A282" title="HyperText Markup Language">HTML</a></small>,
                  	  which many wordprocessors read easily. The following
                  	  sections cover two packages for this.
               </p>
            </div>
            <div class="sect2">
               <h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.2.2 <i><a name="p277"><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2HTML</a></i></h3>
               <p>As its name suggests, <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2<small><a href="chapter10.html#HTML" class="acroref" name="A283" title="HyperText Markup Language">HTML</a></small> is a system to convert <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>
                  	  structured documents to <small><a href="chapter10.html#HTML" class="acroref" name="A284" title="HyperText Markup Language">HTML</a></small>. Its
                  	  main task is to reproduce the document structure as a set of
                  	  interconnected <small><a href="chapter10.html#HTML" class="acroref" name="A285" title="HyperText Markup Language">HTML</a></small> files. Despite
                  	  using Perl,
                  	  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2<small><a href="chapter10.html#HTML" class="acroref" name="A286" title="HyperText Markup Language">HTML</a></small> relies very heavily
                  	  on standard Unix facilities like the
                  	  <i><a name="p278">NetPBM</a></i> graphics package and the
                  	  pipe syntax. Microsoft Windows is not well suited to this
                  	  kind of composite processing, although all the required
                  	  facilities are available for download in various forms and
                  	  should in theory allow the package to run&nbsp;&#8212; but reports
                  	  of problems are common.
               </p>
               <ul>
                  <li>
                     <p>The sectional structure is preserved, and
                        	      navigational links are generated for the standard Next,
                        	      Previous, and Up directions.
                     </p>
                  </li>
                  <li>
                     <p>Links are also used for the cross-references,
                        	      citations, footnotes, ToC, and lists of figures and
                        	      tables.
                     </p>
                  </li>
                  <li>
                     <p>Conversion is direct for common elements like lists,
                        	      quotes, paragraph-breaks, type-styles, etc, where there
                        	      is an obvious <small><a href="chapter10.html#HTML" class="acroref" name="A287" title="HyperText Markup Language">HTML</a></small>
                        	      equivalent.
                     </p>
                  </li>
                  <li>
                     <p>Heavily formatted objects such as math and diagrams
                        	      are converted to images.
                     </p>
                  </li>
                  <li>
                     <p>There is no support for homebrew macros.</p>
                  </li>
               </ul>
               <p>There is, however, support for arbitrary hypertext
                  	  links, symbolic cross-references between &#8216;evolving
                  	    remote documents&#8217;, conditional text, and the
                  	  inclusion of raw <small><a href="chapter10.html#HTML" class="acroref" name="A288" title="HyperText Markup Language">HTML</a></small>. These are
                  	  extensions to
                  	  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>, implemented as new commands and
                  	  environments.
               </p>
               <p><span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2<small><a href="chapter10.html#HTML" class="acroref" name="A289" title="HyperText Markup Language">HTML</a></small> outputs a
                  	  directory named after the input filename, and all the output
                  	  files are put in that directory, so the output is
                  	  self-contained and can be uploaded to a server as it
                  	  stands.
               </p>
            </div>
            <div class="sect2">
               <h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.2.3 <i><a name="p279"><span class="TEX">T<span class="E">E</span>X</span>4ht</a></i></h3>
               <p><span class="TEX">T<span class="E">E</span>X</span>4ht operates differently from
                  	  <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span>2<small><a href="chapter10.html#HTML" class="acroref" name="A290" title="HyperText Markup Language">HTML</a></small>: it uses the <span class="TEX">T<span class="E">E</span>X</span>
                  	  program to process the file, and handles conversion in a set
                  	  of postprocessors for the common <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> packages. It can
                  	  also output to <small><a href="chapter10.html#XML" class="acroref" name="A291" title="Extensible Markup Language">XML</a></small>, including
                  	  <a name="TEI" class="acroref">Text Encoding Initiative</a>&nbsp;(<small>TEI</small>) and
                  	  DocBook, and the OpenOffice and WordXML formats, and it can
                  	  create <span class="TEX">T<span class="E">E</span>X</span>info format
                  	  manuals.
               </p>
               <p>By default, documents retain the single-file structure
                  	  implied by the original, but there is again a set of
                  	  additional configuration directives to make use of the
                  	  features of hypertext and navigation, and to split files for
                  	  ease of use.
               </p>
            </div>
            <div class="sect2">
               <h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.2.4 Extraction from PS and PDF
               </h3>
               <p>If you have the full version of Adobe
                  	  <i><a name="p280">Acrobat</a></i>, you can open a <small><a href="chapter4.html#PDF" class="acroref" name="A293" title="Portable Document Format">PDF</a></small> file created by
                  	  <i><a name="p281">pdf<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span></a></i>, select and copy all
                  	  the text, and paste it into <i><a name="p282">Word</a></i>
                  	  and some other wordprocessors, and retain some common
                  	  formatting of headings, paragraphs, and lists. Both
                  	  solutions still require the wordprocessor text to be edited
                  	  into shape, but they preserve enough of the formatting to
                  	  make it worthwhile for short documents. Otherwise, use the
                  	  <i><a name="p283">pdftotext</a></i> program to extract
                  	  everything from the <small><a href="chapter4.html#PDF" class="acroref" name="A294" title="Portable Document Format">PDF</a></small> file as
                  	  plain (paragraph-formatted) text.
               </p>
            </div>
            <div class="sect2">
               <h3><a href="#doctoc"><img src="up.png" title="Chapter Contents" width="32" alt="ToC" align="right" border="0"></a>10.2.5 Last resort: strip the markup
               </h3>
               <p>At worst, the <i><a name="p284">detex</a></i> program
                  	  on <small><a href="chapter5.html#CTAN" class="acroref" name="A295" title="Comprehensive Archive Network">CTAN</a></small> will strip a <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span class="E">E</span>X</span></span> file
                  	  of all markup and leave just the raw unformatted text, which
                  	  can then be re-edited. There are also programs to extract
                  	  the raw text from <small><a href="chapter4.html#DVI" class="acroref" name="A296" title="device-independent">DVI</a></small> and <a name="PS" class="acroref">PostScript</a>&nbsp;(<small>PS</small>) files.
               </p>
            </div>
         </div>
      </div>
      <hr>
      <table width="100%">
         <tr>
            <td align="left"><a href="chapter9.html"><img src="previous.png" alt="Previous" border="0"></a></td>
            <td align="center"><a href="#doctoc"><img src="top.png" alt="Top" border="0"></a></td>
            <td align="right"><a href="appendixA.html"><img src="next.png" alt="Next" border="0"></a></td>
         </tr>
      </table>
   </body>
</html>