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 864 865 866 867 868 869 870 871 872 873 874
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html
><head><!--webguide.html from webguide.tex (TeX4ht, 2000-03-10 10:44:00)-->
<title>A Brief Guide to LaTeX{} Tools for Web Publishing</title><meta
http-equiv="Content-Type" content="text/html; charset=iso-8859-1" ><link
rel="stylesheet" type="text/css"
href="webguide.css"></head> <body
> <div align="center" class="maketitle">
<h2 class="titleHead">A Brief Guide to LaTeX Tools for Web Publishing</h2>
<div class="author" align="center"><span
class="cmr-12">Peter R. Wilson</span><sup ><span
class="cmsy-8">*</span></sup>
<br><span
class="cmtt-12">peter.r.wilson@boeing.com</span></div>
<br>
<div class="date" align="center"><span
class="cmr-12">11 March 2000</span></div>
<span class="thanks"></span>
<br ><span class="footnotetext"><sup><span
class="cmsy-10--109">*</span></sup>With helpful critiques by Eitan Gurari (<span
class="cmtt-10--109">gurari@cis.ohio-state.edu</span>) and David Wilson
(<span
class="cmtt-10--109">davidw@utopiatype.com.au</span>).</span></div><div><table width="100%"
class="abstract"><tr><td
>
<div class="center"
>
<span
class="cmbx-10">Abstract</span></div>
<!--53--><p class="noindent"><span
class="cmr-10">This document provides a brief guide to converting LaTeX documents to forms more</span>
<span
class="cmr-10">suitable for dissemination via the Web.</span>
</td></tr></table></div>
<h3 class="likesectionHead"><a
name="x1-1000"></a><a
name="QQ1-1-1"></a>Contents</h3>
<div class="tableofcontents">
<br> <span class="sectionToc">1 <a
href="#QQ1-1-3" name="QQ2-1-3">Introduction</a></span>
<br> <span class="subsectionToc">1.1 <a
href="#QQ1-1-4" name="QQ2-1-4">URLs</a></span>
<br> <span class="subsectionToc">1.2 <a
href="#QQ1-1-5" name="QQ2-1-5">Disclaimer</a></span>
<br> <span class="sectionToc">2 <a
href="#QQ1-1-6" name="QQ2-1-6">PDF</a></span>
<br> <span class="subsectionToc">2.1 <a
href="#QQ1-1-7" name="QQ2-1-7">From PostScript to PDF</a></span>
<br> <span class="subsectionToc">2.2 <a
href="#QQ1-1-8" name="QQ2-1-8">From DVI to PDF</a></span>
<br> <span class="subsectionToc">2.3 <a
href="#QQ1-1-9" name="QQ2-1-9">From LaTeX to PDF</a></span>
<br> <span class="subsectionToc">2.4 <a
href="#QQ1-1-10" name="QQ2-1-10">Fonts</a></span>
<br> <span class="subsectionToc">2.5 <a
href="#QQ1-1-11" name="QQ2-1-11">MetaPost</a></span>
<br> <span class="sectionToc">3 <a
href="#QQ1-1-13" name="QQ2-1-13">HTML</a></span>
<br> <span class="subsectionToc">3.1 <a
href="#QQ1-1-14" name="QQ2-1-14">Self-parsing systems</a></span>
<br> <span class="subsectionToc">3.2 <a
href="#QQ1-1-15" name="QQ2-1-15">TeX-based parsing system</a></span>
<br> <span class="sectionToc">4 <a
href="#QQ1-1-16" name="QQ2-1-16">Examples</a></span>
</div>
<h3 class="likesectionHead"><a
name="x1-2000"></a><a
name="QQ1-1-2"></a>List of Figures</h3>
<div class="tableofcontents"><span class="lofToc">1 <a
href="#x1-110011">Metapost illustration of an <span
class="cmcsc-10--109"><small
class="small-caps">E</small><small
class="small-caps">X</small><small
class="small-caps">P</small><small
class="small-caps">R</small><small
class="small-caps">E</small><small
class="small-caps">S</small><small
class="small-caps">S</small>-<small
class="small-caps">G</small> </span>diagram</a></span><br>
</div>
<h3 class="sectionHead"> 1 <a
name="x1-30001"></a><a
name="QQ1-1-3"></a>Introduction</h3>
<!--63--><p class="noindent">Publishing on the Web has rapidly achieved significant importance, for example, the International
Organization for Standardization (ISO) is moving towards electronic forms of International
Standard documents that are suitable for publishing on the Web, and in particular, documents
as PDF or HTML files rather than their traditional request for camera-ready paper
copy.
<!--70--><p class="indent"> Documents written using LaTeX [<a
href="#XLAMPORT94">Lam94</a>] tagging can be easily converted to PostScript, PDF
and HTML, all from the single electronic source. This guide briefly notes some of the ways that
this can be accomplished. Most of the programs and systems mentioned here are described in
more detail in [<a
href="#XGOOSSENS99">GR99</a>].
<!--77--><p class="indent"> I have made no attempt to design this document for Web publication. The typographical rules
for printing on paper are well founded, having been developed over hundreds of years.
Display on computer screens is a very different matter and requires a different set of
rules, most of which, as yet, are either in a state of flux or unavailable. For LaTeXers
who are interested in this topic I suggest a look at D. P. Story's work on AcroTeX (
<a
href="http://www.math.uakron.edu/~dpstory/acrotex.html" class="url" ><span
class="cmtt-10--109">http://www.math.uakron.edu/~dpstory/acrotex.html</span></a>). Further, for the example conversions I
have used only the minimal tool options necessary. Many of the tools have extensive capabilities
which are well documented in their accompanying user manuals; these should be consulted for
further information.
<h4 class="subsectionHead">1.1 <a
name="x1-40001.1"></a><a
name="QQ1-1-4"></a>URLs</h4>
<!--92--><p class="noindent">I have tried to provide URLs for the programs and systems mentioned here. Most LaTeX-related
software is available from the Comprehensive TeX Archive Network (CTAN). There are three
sites, <a
href="ftp://ctan.tug.org/tex-archive" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive</span></a> in the USA, <a
href="ftp://ftp.tex.ac.uk/tex-archive" class="url" ><span
class="cmtt-10--109">ftp://ftp.tex.ac.uk/tex-archive</span></a> in
the UK, and <a
href="ftp://ftp.dante.de/tex-archive" class="url" ><span
class="cmtt-10--109">ftp://ftp.dante.de/tex-archive</span></a> in Germany, as well as several mirror sites.
Usefully, the CTAN sites (but not necessarily a mirror site) supports on-the-fly zipping of files and
entire directories, which makes downloading a group of files less tedious than having to get them
one-by-one. Below, I have used <a
href="ftp://ctan.tug.org/tex-archive" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive</span></a> to stand for any of the three
CTAN sites.
<h4 class="subsectionHead">1.2 <a
name="x1-50001.2"></a><a
name="QQ1-1-5"></a>Disclaimer</h4>
<!--107--><p class="noindent">Nothing that is said in this document is meant to imply any endorsement or recommendation,
either positive or negative, concerning any systems or programs mentioned herein.
<!--111--><p class="indent"> Many of the systems or programs are `free' in the sense that they are either public domain or
their licences are roughly equivalent to the GNU Public License. Others are either commercial or
have more restricitive licenses or may require payment. Where known, programs and systems that
are not `free' are noted.
<h3 class="sectionHead"> 2 <a
name="x1-60002"></a><a
name="QQ1-1-6"></a>PDF</h3>
<!--120--><p class="noindent">The traditional output from a LaTeX (e.g., <span
class="cmss-10--109">*.tex</span>) file is a `device independent' <span
class="cmss-10--109">*.dvi </span>file. The <span
class="cmss-10--109">*.dvi</span>
file is then processed further to convert it to a format suitable for printing on a particular printing
device. In the vast majority of cases the final printable format has been PostScript,
obtained by running the <span
class="cmss-10--109">*.dvi </span>file through a program like <span
class="cmtt-10--109">dvips</span>, to generate a <span
class="cmss-10--109">*.ps</span>
file.
<!--127--><p class="indent"> PostScript was developed by Adobe Systems. The Portable Document Format (PDF) has
since also been developed by Adobe, and seems to be overtaking PostScript as the format of
choice for printing, and especially for display via the Web.
<!--132--><p class="indent"> DVI and PDF are somewhat similar in that they both describe where (electronic) ink is to be
put on (electronic) paper. PostScript also does this but at the same time it is a complete
programming language. This means that it is inherently more difficult, time consuming, and
computer intensive, to process PostScript than either DVI or PDF. This is probably the reason
behind the popularity of PDF on the Web.
<!--139--><p class="indent"> There are now several methods of producing a PDF (e.g., <span
class="cmss-10--109">*.pdf</span>) file from <span
class="cmss-10--109">*.tex</span>. These
include:
<ul class="itemize1">
<li class="itemize">Converting from PostScript to PDF; from <span
class="cmss-10--109">*.ps </span>to <span
class="cmss-10--109">*.pdf</span>.
</li>
<li class="itemize">Generate PDF from the device independent file; from <span
class="cmss-10--109">*.dvi </span>to <span
class="cmss-10--109">*.pdf</span>
</li>
<li class="itemize">Generate PDF directly from the LaTeX source; from <span
class="cmss-10--109">*.tex </span>to <span
class="cmss-10--109">*.pdf</span>.</li></ul>
<h4 class="subsectionHead">2.1 <a
name="x1-70002.1"></a><a
name="QQ1-1-7"></a>From PostScript to PDF</h4>
<!--153--><p class="noindent">There are basically two routes to getting from PostScript to PDF. The first of these is to use
Acrobat software from Adobe Systems, which essentially means the commercial <span
class="cmtt-10--109">Distiller</span>
program. <span
class="cmtt-10--109">Distiller </span>can read in a PostScript file and output a PDF file where the visual results
of printing the two files are identical. This, or any other, PDF file can be viewed and/or printed
via the charge-free Acrobat <span
class="cmtt-10--109">Reader </span>program. Note that when using <span
class="cmtt-10--109">Reader </span>the `fit to
paper' option may alter the page layout, for example by changing the height of the text
block.
<!--164--><p class="indent"> The second route is to use a non-Adobe converter program, like <span
class="cmtt-10--109">Ghostscript </span>which runs on
nearly all operating systems and which is obtainable from <a
href="http://www.cs.wisc.edu/~ghost" class="url" ><span
class="cmtt-10--109">http://www.cs.wisc.edu/~ghost</span></a>.
The <span
class="cmtt-10--109">Ghostscript </span>distribution comes with a script called <span
class="cmtt-10--109">ps2pdf </span>which performs the conversion.
The distribution also provides the popular <span
class="cmtt-10--109">Ghostview </span>program, which is a viewer for both
PostScript and PDF files.
<!--172--><p class="indent"> Another converter program, which does have some licensing conditions that may not be suitable
for all users, is <span
class="cmtt-10--109">PStill</span>; it is available from <a
href="http://www.this.net/~frank/pstill.html" class="url" ><span
class="cmtt-10--109">http://www.this.net/~frank/pstill.html</span></a>.
<h4 class="subsectionHead">2.2 <a
name="x1-80002.2"></a><a
name="QQ1-1-8"></a>From DVI to PDF</h4>
<!--179--><p class="noindent">Mark Wicks' <span
class="cmtt-10--109">dvipdfm </span>program ( <a
href="http://odo.kettering.edu/dvipdfm" class="url" ><span
class="cmtt-10--109">http://odo.kettering.edu/dvipdfm</span></a>) converts a <span
class="cmss-10--109">*.dvi </span>file to a
<span
class="cmss-10--109">*.pdf </span>file. The program is used in the same manner as <span
class="cmtt-10--109">dvips </span>and provides similar
capabilities.
<!--184--><p class="indent"> PostScript illustrations are handled in one of two ways. Simple PostScript generated by
the <span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small> </span>program [<a
href="#XHOBBY92">Hob92</a>] is included natively. Any other PostScript file is first
converted to PDF by using an external program like <span
class="cmtt-10--109">Ghostscript </span>and then inserted
into the output file. Illustrations in PDF, PNG and JPEG formats require no external
aids.
<!--191--><p class="indent"> <span
class="cmtt-10--109">dvipdfm </span>is written in C but there are some binaries for Linux systems.
<h4 class="subsectionHead">2.3 <a
name="x1-90002.3"></a><a
name="QQ1-1-9"></a>From LaTeX to PDF</h4>
<!--197--><p class="noindent">The <span
class="cmtt-10--109">pdfLaTeX </span>program being developed by Hàn Thê Thành is a modified version of TeX that
generates <span
class="cmss-10--109">*.pdf </span>instead of <span
class="cmss-10--109">*.dvi </span>output files. <span
class="cmtt-10--109">pdfLaTeX </span>is distributed with many of the free LaTeX
distributions, and is also obtainable from <a
href="ftp://ftp.cstug.cz/pub/tex/local/cstug/thanh" class="url" ><span
class="cmtt-10--109">ftp://ftp.cstug.cz/pub/tex/local/cstug/thanh</span></a>,
although it may be better to try <a
href="ftp://ctan.tug.org/tex-archive/systems/pdftex" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/systems/pdftex</span></a>.
<!--204--><p class="indent"> Running <span
class="cmtt-10--109">pdfLaTeX </span>is very similar to running LaTeX, but some minor changes are required to
the <span
class="cmss-10--109">*.tex </span>file. For example: <table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
% example.tex example latex file
\documentclass[...]{...}
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdftrue
\fi
\ifpdf
\pdfoutput=1
% \usepackage[pdftex]{graphicx} % uncomment if using graphicx
% \usepackage[pdftex]{hyperref} % uncomment if using hyperref
\else
% \usepackage{graphicx} % uncomment if using graphicx
% \usepackage{hyperref} % uncomment if using hyperref
\fi
....
</pre>
</td></tr></table>
<!--227--><p class="indent"> Running
<br class="newline"><span
class="cmtt-10--109">latex example</span>
<br class="newline">will produce <span
class="cmss-10--109">example.dvi</span>, while running
<br class="newline"><span
class="cmtt-10--109">pdflatex example</span>
<br class="newline">will produce <span
class="cmss-10--109">example.pdf</span>. It is thus very easy to generate both <span
class="cmss-10--109">*.dvi </span>and <span
class="cmss-10--109">*.pdf </span>from the same
LaTeX source file.
<!--234--><p class="indent"> <span
class="cmtt-10--109">pdflatex </span>will handle graphics files in the following formats: PDF, PNG, JPEG and TIFF, but
notice that (Encapsulated) PostScript is missing from this list. However, it can handle directly the
simple Encapsulated PostScript output by <span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small></span> [<a
href="#XHOBBY92">Hob92</a>]. It does, though, expect
<span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small> </span>files to have a <span
class="cmss-10--109">.mps </span>extension. To include PostScript from other sources it is necessary
to convert the PostScript to PDF.
<!--242--><p class="indent"> <span
class="cmtt-10--109">pdftex</span>, and hence <span
class="cmtt-10--109">pdflatex</span>, has some extra primitive commands that are not available in
TeX itself specifically for accessing aspects of the PDF format, for example to create hypertext
links, bookmarks or article threads. Consult the manual for details.
<!--248--><p class="indent"> Independently of <span
class="cmtt-10--109">pdflatex </span>the <span
class="cmtt-10--109">hyperref </span>package (
<a
href="ftp://ctan.tug.org/tex-archive/macros/latex/contrib/supported/hyperref" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/macros/latex/contrib/supported/hyperref</span></a>) extends the
functionality of the LaTeX cross-referencing commands to include hypertext links, and also ad hoc
hypertext links to, for example, external documents and URLs.
<h4 class="subsectionHead">2.4 <a
name="x1-100002.4"></a><a
name="QQ1-1-10"></a>Fonts</h4>
<!--256--><p class="noindent">The normal fonts used with LaTeX are the Computer Modern family developed by Knuth using
<span
class="cmcsc-10--109"><small
class="small-caps">M</small><small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small><small
class="small-caps">F</small><small
class="small-caps">O</small><small
class="small-caps">N</small><small
class="small-caps">T</small></span> [<a
href="#XKNUTH86b">Knu86</a>]. All <span
class="cmcsc-10--109"><small
class="small-caps">M</small><small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small><small
class="small-caps">F</small><small
class="small-caps">O</small><small
class="small-caps">N</small><small
class="small-caps">T</small> </span>fonts are in the form of bitmaps, which is unfortunate when it
comes to PDF. Typically, PDF will only use one size of each font for a document, and will scale
this if different font sizes are required. This normally works well as fonts used with PDF are
typically `Type 1' fonts (e.g., PostScript fonts) which are designed to be scaleable. Bitmap
fonts look terrible when scaled or printed at a resolution that they were not designed
for.
<!--266--><p class="indent"> In other words, expect bad results if you generate a PDF file with the original Computer
Modern fonts.
<!--269--><p class="indent"> Perhaps the easiest method of dealing with this is to use the most common PostScript fonts,
namely Times, Courier and Helvetica. All that is necessary is to add <span class="obeylines-h"><span
class="cmtt-10--109">\usepackage{times}</span></span> to the
document's preamble.
<!--273--><p class="indent"> Alternatively, if you need to use the CM fonts, perhaps because a lot of mathematics is
involved, many LaTeX distributions include Type 1 versions of the CM fonts. If you don't have
them they can be found at <a
href="ftp://ctan.tug.org/tex-archive/fonts/cm/ps-type1/bluesky" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/fonts/cm/ps-type1/bluesky</span></a>
and at <a
href="ftp://ctan.tug.org/tex-archive/fonts/amsfonts/ps-type1" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/fonts/amsfonts/ps-type1</span></a> for the AMS
fonts.
<!--279--><p class="indent"> Goossens <span
class="cmti-10--109">et al. </span>provide useful and general information on installing and using different fonts
with LaTeX [<a
href="#XGOOSSENS94">GMS94</a>], while for the fontophile, Alan Hoenig [<a
href="#XHOENIG98">Hoe98</a>] delves much more deeply into
the installation of PostScript fonts.
<!--284--><p class="indent"> TeX doesn't care about the particular shape of any glyph, nor how it is constructed or
represented, it only cares about the space occupied by each character (i.e., the <span
class="cmss-10--109">*.tfm </span>files). It is
the DVI processor that needs to know in detail about the fonts in a document. So, the DVI
processor has to be told to use Type 1 CM PostScript fonts. The following is for the
<span
class="cmtt-10--109">dvips </span>program. For convenience, let <span
class="cmtt-10--109">$TEXMF </span>stand for the root of the <span
class="cmtt-10--109">texmf </span>tree (e.g.,
<span
class="cmtt-10--109">/usr/teTeX/texmf</span>).
<!--294--><p class="indent"> <span
class="cmtt-10--109">dvips </span>looks in the <span
class="cmtt-10--109">$TEXMF/dvips/base/psfonts.map </span>to see if it can use any PostScript fonts.
This file starts off something like: <table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
bchb8r CHarterBT-Bold "TeXBase1Encoding ReEncodeFont" <8r.enc <bchb8a.pfb
...
</pre>
</td></tr></table> To get <span
class="cmtt-10--109">dvips </span>to use Type 1 versions of the CM fonts, additional lines must be added to
<span
class="cmss-10--109">psfonts.map </span>giving similar information about the fonts. The specification for CM fonts is simpler
and consists of lines like: <table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
cmb10 CMB10 <cmb10.pfb
cmbsy10 CMBSY10 <cmbsy10.pfb
...
</pre>
</td></tr></table> In the version of <span
class="cmtt-10--109">teTeX </span>that I use, this information is in files <span
class="cmss-10--109">bsr.map</span>, <span
class="cmss-10--109">bsr-interpolated.map</span>,
<span
class="cmss-10--109">cmcyr.map</span>, <span
class="cmss-10--109">hoekwater.map</span>, and <span
class="cmss-10--109">pl.map</span>, all in directory <span
class="cmtt-10--109">$TEXMF/dvips/config</span>.
<!--315--><p class="indent"> These files can either be copied by hand to the <span
class="cmss-10--109">psfonts.map </span>file in <span
class="cmtt-10--109">$TEXMF/dvips/base </span>or in a
modern <span
class="cmtt-10--109">teTeX </span>distribution (which should also have all the CM Type 1 font data) it is easiest to do
the following:
<ul class="itemize1">
<li class="itemize">In directory <span
class="cmtt-10--109">$TEXMF/dvips/config </span>copy the script file <span
class="cmtt-10--109">updmap </span>to, say, <span
class="cmtt-10--109">updmap.orig</span>.
</li>
<li class="itemize">Edit <span
class="cmtt-10--109">updmap </span>to comment the line <span
class="cmtt-10--109">type1</span>_<span
class="cmtt-10--109">default=false </span>and uncomment the line
<span
class="cmtt-10--109">type1</span>_<span
class="cmtt-10--109">default=true</span>.
</li>
<li class="itemize">Run the script via <span
class="cmtt-10--109">./updmap</span>.</li></ul>
<!--327--><p class="noindent">Another more general method is to edit the file <span
class="cmss-10--109">config.ps </span>in directory <span
class="cmtt-10--109">$TEXMF/dvips/config </span>and
at the appropriate place (which should be marked, but in any case after the line <span
class="cmtt-10--109">p psfonts.map</span>)
add lines like: <table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
p +bsr.map
p +bsr-interpolated.map
...
</pre>
</td></tr></table>
<!--337--><p class="indent"> Another option when using <span
class="cmtt-10--109">dvips </span>which avoids all of the above, is to call it with options,
like:
<br class="newline"><span class="obeylines-h"><span
class="cmtt-10--109">dvips</span> <span
class="cmtt-10--109">-Pamz</span> <span
class="cmtt-10--109">-Pcmz</span> <span
class="cmtt-10--109">-Ppdf</span> <span
class="cmtt-10--109">-j0</span> <span
class="cmtt-10--109">[other</span> <span
class="cmtt-10--109">options]</span> <span
class="cmtt-10--109">filename</span></span>
<br class="newline">and then use your prefered <span
class="cmss-10--109">*.ps </span>to <span
class="cmss-10--109">*.pdf </span>conversion process.
<h4 class="subsectionHead">2.5 <a
name="x1-110002.5"></a><a
name="QQ1-1-11"></a>MetaPost</h4>
<!--344--><p class="noindent">John Hobby's <span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small></span> [<a
href="#XHOBBY92">Hob92</a>] is a language based drawing program based on Knuth's
<span
class="cmcsc-10--109"><small
class="small-caps">M</small><small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small><small
class="small-caps">F</small><small
class="small-caps">O</small><small
class="small-caps">N</small><small
class="small-caps">T</small></span> [<a
href="#XKNUTH86b">Knu86</a>]. <span
class="cmcsc-10--109"><small
class="small-caps">M</small><small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small><small
class="small-caps">F</small><small
class="small-caps">O</small><small
class="small-caps">N</small><small
class="small-caps">T</small> </span>was principally designed for creating fonts, and generates
bitmapped output, while <span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small> </span>is principally for drawing general line illustrations and its
output is a particularly simple form of Encapsulated PostScript.
<a
name="x1-110011"></a>
<hr class="float"><div align="center" class="float"
><table class="float"><tr class="float"><td class="float"
>
<img
src="webguide0x.gif" alt="PIC" >
<br> <div align="center" class="caption"><table class="caption"
><tr valign="baseline" class="caption"><td class="id">Figure 1: </td><td
class="content">Metapost illustration of an <span
class="cmcsc-10--109"><small
class="small-caps">E</small><small
class="small-caps">X</small><small
class="small-caps">P</small><small
class="small-caps">R</small><small
class="small-caps">E</small><small
class="small-caps">S</small><small
class="small-caps">S</small>-<small
class="small-caps">G</small> </span>diagram</td></tr></table></div>
<a
name="x1-110011"></a>
</td></tr></table></div><hr class="endfloat">
This is not the place to describe <span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small></span>, but it can generate several output files, one for
each drawing, from a single input file called, say, <span
class="cmss-10--109">fred.mp</span>. The output files have a numeric
extension correspond to the number of the drawing. So, for example, it may generate files <span
class="cmss-10--109">fred.1</span>,
<span
class="cmss-10--109">fred.2 </span>and <span
class="cmss-10--109">fred.3</span>. For a document that is to be processed via <span
class="cmtt-10--109">LaTeX </span>these files can be included as
is. However, for processing through <span
class="cmtt-10--109">pdfLaTeX</span>, the files must have a <span
class="cmss-10--109">.mps </span>extension; for example
<span
class="cmss-10--109">fred1.mps</span>, <span
class="cmss-10--109">fred2.mps </span>and <span
class="cmss-10--109">fred3.mps</span>.
<!--371--><p class="indent"> Figure <a
href="#x1-110011">1</a> is a <span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small> </span>illustration that is included in this document by the code:
<table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
\begin{figure}
\centering
\ifpdf
\includegraphics{expeg6.mps}
\else
\includegraphics{expeg.6}
\fi
\caption{Metapost illustration of an \textsc{express-g} diagram}
\label{fig:mp}
\end{figure}
</pre>
</td></tr></table> where <span
class="cmss-10--109">expeg6.mps </span>is a copy of <span
class="cmss-10--109">expeg.6</span>, to cater for processing by either <span
class="cmtt-10--109">LaTeX </span>or <span
class="cmtt-10--109">pdfLaTeX</span>.
Actually, the following will also work: <table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
\begin{figure}
\centering
\includegraphics{expeg6.mps}
\caption{Metapost illustration of an \textsc{express-g} diagram}
\label{fig:mp}
\end{figure}
</pre>
</td></tr></table>
<!--397--><p class="indent"> The figure demonstrates part of the capabilities of the <span
class="cmtt-10--109">expressg </span><span
class="cmcsc-10--109">M<small
class="small-caps">E</small><small
class="small-caps">T</small><small
class="small-caps">A</small>P<small
class="small-caps">O</small><small
class="small-caps">S</small><small
class="small-caps">T</small> </span>package (
<a
href="ftp://ctan.tug.org/tex-archive/graphics/metapost/contrib/macros/expressg" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/graphics/metapost/contrib/macros/expressg</span></a>) for
drawing diagrams consisting of boxes, lines and annotations, such as flowcharts or ER
diagrams.
<h3 class="sectionHead"> 3 <a
name="x1-120003"></a><a
name="QQ1-1-13"></a>HTML</h3>
<!--406--><p class="noindent">There are a number of systems that convert a LaTeX tagged document into an HTML tagged
document. These can be divided into two classes:
<ol type="1" class="enumerate1"
>
<li class="enumerate"><a
name="x1-12002x1"></a>Systems that parse the <span
class="cmss-10--109">*.tex </span>file themselves.
</li>
<li class="enumerate"><a
name="x1-12004x2"></a>Systems that use TeX as the file parser.</li></ol>
<!--412--><p class="noindent">There are several that do their own parsing, but only one that I know of that uses TeX as the
parser.
<!--415--><p class="indent"> TeX is a macro language and the meaning of existing commands can be changed on the
fly, and also new commands can be defined on the fly [<a
href="#XKNUTH84a">Knu84</a>]. As perhaps the most
extreme example of this is David Carlisle's <span
class="cmss-10--109">xii.tex </span>TeX code, which is obtainable as
<a
href="ftp://ctan.tug.org/tex-archive/macros/plain/contrib/xii.tex" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/macros/plain/contrib/xii.tex</span></a>: <table width="100%"
class="verbatim"><tr class="verbatim"><td
class="verbatim"><pre class="verbatim">
\let~\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF
PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP
A@@FfPARR717273F737271P;ADDFRgniPAWW71FPATTFvePA**FstRsamP
AGGFRruoPAqq71.72.F717271PAYY7172F727171PA??Fi*LmPA&&71jfi
Fjfi71PAVVFjbigskipRPWGAUU71727374 75,76Fjpar71727375Djifx
:76jelse&U76jfiPLAKK7172F71l7271PAXX71FVLnOSeL71SLRyadR@oL
RrhC?yLRurtKFeLPFovPgaTLtReRomL;PABB71 72,73:Fjif.73.jelse
B73:jfiXF71PU71 72,73:PWs;AMM71F71diPAJJFRdriPAQQFRsreLPAI
I71Fo71dPA!!FRgiePBt'el@ lTLqdrYmu.Q.,Ke;vz vzLqpip.Q.,tz;
;Lql.IrsZ.eap,qn.i. i.eLlMaesLdRcna,;!;h htLqm.MRasZ.ilk,%
s$;z zLqs'.ansZ.Ymi,/sx ;LYegseZRyal,@i;@ TLRlogdLrDsW,@;G
LcYlaDLbJsW,SWXJW ree @rzchLhzsW,;WERcesInW qt.'oL.Rtrul;e
doTsW,Wk;Rri@stW aHAHHFndZPpqar.tridgeLinZpe.LtYer.W,:jbye
</pre>
</td></tr></table> If you run this through TeX (not LaTeX) I'm sure you will be surprised at the result.
<!--439--><p class="indent"> There is inevitably a problem when converting from LaTeX to HTML for a document that
includes figures/illustrations or anything more than the most simple mathematical typesetting as,
basically, HTML provides no support. Typically, mathematics and illustrations, are converted to a
picture format and then inserted into the HTML document as graphics, usually with a very poor
appearance.
<!--447--><p class="indent"> However, for mathematics the situation is starting to change because of the advent of
MathML ( <a
href="http://www.w3.org/TR/MathML2" class="url" ><span
class="cmtt-10--109">http://www.w3.org/TR/MathML2</span></a>). In particular the Milestone 13 release of Mozilla (
<a
href="http://www.mozilla.org/binaries.html" class="url" ><span
class="cmtt-10--109">http://www.mozilla.org/binaries.html</span></a>) is a MathML-enabled browser. Some examples,
generated by <span
class="cmtt-10--109">TeX4ht</span>, are available at <a
href="http://www.maths.ox.ac.uk/~gartside/mozSuccess" class="url" ><span
class="cmtt-10--109">http://www.maths.ox.ac.uk/~gartside/mozSuccess</span></a>.
<!--454--><p class="indent"> All the systems generate HTML tagged documents, with the particular tagging `style' set by
the system. It is advantageous to use a converter which either by default generates your desired
style, or which can be modified in some manner to do so.
<h4 class="subsectionHead">3.1 <a
name="x1-130003.1"></a><a
name="QQ1-1-14"></a>Self-parsing systems</h4>
<!--461--><p class="noindent">The self-parsing systems incorporate their own parsers for the TeX language. In essence, this
means that they `know' the meaning of common TeX commands, but probably not all possible
commands. It is advantageous to use a system that can be extended to deal with commands that
were not anticipated by the author.
<!--467--><p class="indent"> The only system I am familiar with in this class is Peter Wilson's <span
class="cmtt-10--109">ltx2x </span>program (
<a
href="ftp://ctan.tug.org/tex-archive/support/ltx2x" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/support/ltx2x</span></a>). This program works by replacing known
LaTeX commands, and their arguments, by user-specified text strings [<a
href="#XPRW96h">Wil96</a>]. It is unable to
handle anything more than very simple mathematics and ignores any pictures. The user-specified
command texts are kept in a simple command-table file. Within limits, new LaTeX commands
and environments may be specified within a command-table file and the command texts modified.
The <span
class="cmtt-10--109">ltx2x </span>program has been used to `detex' (i.e., remove all LaTeX commands) files,
convert to HTML, and convert to SGML. It cannot convert to XML due to a yet to be
resolved technical problem in dealing with end of paragraph tags. The program is written
in C and so requires a C compiler for installation. The system can be extended via
some C programming, in which case the <span
class="cmtt-10--109">flex </span>and <span
class="cmtt-10--109">bison </span>programs are also required.
There is no chance that <span
class="cmtt-10--109">ltx2x </span>would ever make any sense whatsoever of <span
class="cmss-10--109">xii.tex </span>on
page <a
href="#x1-120003">10</a>.
<!--485--><p class="indent"> Perhaps the most venerable system is the <span
class="cmtt-10--109">LaTeX2HTML </span>system
( <a
href="http://www-texdev.mpce.mq.edu.au/l2h/docs/manual" class="url" ><span
class="cmtt-10--109">http://www-texdev.mpce.mq.edu.au/l2h/docs/manual</span></a> or
<a
href="ftp://ctan.tug.org/tex-archive/support/latex2html" class="url" ><span
class="cmtt-10--109">ftp://ctan.tug.org/tex-archive/support/latex2html</span></a>), originally by Nikos Drakos
and now maintained by Ross Moore and others. This system is written using <span
class="cmtt-10--109">Perl </span>(
<a
href="ftp://ftp.uu.net/languages/perl" class="url" ><span
class="cmtt-10--109">ftp://ftp.uu.net/languages/perl</span></a>). It also requires a database management system such as the
Unix DBM or NDBM, or the GNU GDBM system. Further, it requires <span
class="cmtt-10--109">Ghostscript </span>and the
<span
class="cmtt-10--109">netpbm </span>library of graphics utilities ( <a
href="ftp://ftp.x.org/contrib/utilities" class="url" ><span
class="cmtt-10--109">ftp://ftp.x.org/contrib/utilities</span></a>). To extend or
change the default conversion style requires, I think, some Perl programming. A fuller description
and examples are given in [<a
href="#XGOOSSENS99">GR99</a>].
<!--497--><p class="indent"> Another converter is the <span
class="cmtt-10--109">TtH </span>program by Ian Hutchinson ( <a
href="http://hutchinson.belmont.ma.us/tth" class="url" ><span
class="cmtt-10--109">http://hutchinson.belmont.ma.us/tth</span></a>)
which is cost-free for non-commercial use; commercial use in this case is roughly by anyone who gets
paid while using it (but see <a
href="http://hutchinson.belmont.ma.us/tth/tth-commercial/email.html" class="url" ><span
class="cmtt-10--109">http://hutchinson.belmont.ma.us/tth/tth-commercial/email.html</span></a>
for the actual wording). There is also another version, <span
class="cmtt-10--109">TeX2HTML </span>( <a
href="http://www.tex2html.com" class="url" ><span
class="cmtt-10--109">http://www.tex2html.com</span></a>)
which is the `commercial GOLD version of the freeware <span
class="cmtt-10--109">Tth </span>by Ian Hutchinson'. These programs
run on the usual range of operating systems. An example of the output from <span
class="cmtt-10--109">TtH </span>is given
in [<a
href="#XGOOSSENS99">GR99</a>].
<h4 class="subsectionHead">3.2 <a
name="x1-140003.2"></a><a
name="QQ1-1-15"></a>TeX-based parsing system</h4>
<!--510--><p class="noindent">Eitan Gurari's <span
class="cmtt-10--109">TeX4ht </span>system appears to be unique in that it uses TeX as the
parser for the LaTeX document and instead effectively takes the <span
class="cmss-10--109">*.dvi </span>file as its
starting point for conversion to HTML. That is, it does not have to understand TeX
code and can, in fact, convert David Carlise's <span
class="cmss-10--109">xii.tex </span>(page <a
href="#x1-120003">10</a>) to HTML. The system
is available from <a
href="http://www.cis.ohio-state.edu/~gurari/TeX4ht/mn.html" class="url" ><span
class="cmtt-10--109">http://www.cis.ohio-state.edu/~gurari/TeX4ht/mn.html</span></a>. It
consists of two C programs, one package file, and a set of <span
class="cmss-10--109">*.4ht </span>configuration files, one
for each of the typical LaTeX classes and packages. It also requires ImageMagick (
<a
href="http://www.wizards.dupont.com/cristy/www/archives.html" class="url" ><span
class="cmtt-10--109">http://www.wizards.dupont.com/cristy/www/archives.html</span></a>) for handling illustrations and
non-simple mathematics. Simply speaking, the system is extended by writing new <span
class="cmss-10--109">*.4ht </span>file(s) and
its output modified by writing simple <span
class="cmss-10--109">*.cfg </span>file(s) that override the <span
class="cmss-10--109">*.4ht </span>file(s). At the moment,
the best and most detailed description is given in [<a
href="#XGOOSSENS99">GR99</a>].
<!--528--><p class="indent"> By default, <span
class="cmtt-10--109">TeX4ht </span>can generate a non-tagged file or a file tagged with either HTML3.2 or
HTML4.0. By writing appropriate <span
class="cmss-10--109">*.cfg </span>files it can be made to generate XML tagged files. The
system comes with a script called <span
class="cmtt-10--109">htlatex </span>which controls the conversion process from LaTeX;
there is also the <span
class="cmtt-10--109">httex </span>script for converting a TeX document. For instance, to convert the earlier
example LaTeX file, <span
class="cmss-10--109">example.tex </span>(page <a
href="#x1-90002.3">3</a>), to an HTML4.0 tagged document, it is enough to
run:
<br class="newline"><span
class="cmtt-10--109">htlatex example</span>
<br class="newline">which will then output <span
class="cmss-10--109">example.html</span>. Similarly, to convert <span
class="cmss-10--109">xii.tex </span>just run:
<br class="newline"><span
class="cmtt-10--109">httex xii</span>.
<h3 class="sectionHead"> 4 <a
name="x1-150004"></a><a
name="QQ1-1-16"></a>Examples</h3>
<!--543--><p class="noindent">Hopefully, you should find several versions of this document, all of which have been generated
from a single source file. These are:
<ul class="itemize1">
<li class="itemize"><span
class="cmss-10--109">webguide.tex </span>-- the LaTeX source.
</li>
<li class="itemize"><span
class="cmss-10--109">webguide.ps </span>-- A PostScript version from running <span
class="cmtt-10--109">latex </span>and <span
class="cmtt-10--109">dvips </span>on <span
class="cmss-10--109">webguide.tex</span>.
</li>
<li class="itemize"><span
class="cmss-10--109">webguide.pdf </span>-- A PDF version from runnning <span
class="cmtt-10--109">pdflatex </span>on <span
class="cmss-10--109">webguide.tex</span>.
</li>
<li class="itemize"><span
class="cmss-10--109">webguide.html </span>-- A HTML4.0 version from running <span
class="cmtt-10--109">htlatex </span>on <span
class="cmss-10--109">webguide.tex</span>.</li></ul>
<!--554--><p class="noindent">The HTML version uses the GIF file <span
class="cmss-10--109">webguide0x.gif </span>for the illustration; the file is automatically
generated by <span
class="cmtt-10--109">tex4ht </span>using the ImageMagick <span
class="cmtt-10--109">convert </span>program. The quality of the picture in the
viewed document depends on the particular viewer; different versions of Netscape, for example,
may display and print the diagram with very different rendering qualities. I asked TeX4ht to
generate this particular figure at 180dpi instead of the default 110dpi to improve the
quality.
<h3 class="likesectionHead"><a
name="x1-160004"></a><a
name="QQ1-1-17"></a>References</h3>
<div class="thebibliography"><p class="bibitem">
[GMS94] <a
name="XGOOSSENS94"></a>Michel Goossens, Frank Mittelbach, and Alexander Samarin. <span
class="cmti-10--109">The LaTeX</span>
<span
class="cmti-10--109">Companion</span>. Addison-Wesley Publishing Company, 1994.
</p><p class="bibitem">
[GR99] <a
name="XGOOSSENS99"></a>Michel Goossens and Sebastion Rahtz. <span
class="cmti-10--109">The LaTeX Web Companion - Integrating</span>
<span
class="cmti-10--109">TeX, HTML, and XML</span>. Addison-Wesley Publishing Company, 1999. (with Eitan
Gurari, Ross Moore, and Robert Sutor).
</p><p class="bibitem">
[Hob92] <a
name="XHOBBY92"></a>John Hobby. <span
class="cmti-10--109">‘A User’s Manual for MetaPost’</span>. Technical Report 162, AT&T Bell
Laboratories, Murray Hill, NJ, 1992.
</p><p class="bibitem">
[Hoe98] <a
name="XHOENIG98"></a>Alan Hoenig. <span
class="cmti-10--109">TeX Unbound - LaTeX and TeX Strategies for Fonts, Graphics, &</span>
<span
class="cmti-10--109">More</span>. Oxford University Press, 1998.
</p><p class="bibitem">
[Knu84] <a
name="XKNUTH84a"></a>Donald E. Knuth. <span
class="cmti-10--109">The TeXbook</span>. Addison-Wesley Publishing Company, 1984.
</p><p class="bibitem">
[Knu86] <a
name="XKNUTH86b"></a>Donald E. Knuth. <span
class="cmti-10--109">The METAFONTbook</span>. Addison-Wesley Publishing Company,
1986.
</p><p class="bibitem">
[Lam94] <a
name="XLAMPORT94"></a>Leslie Lamport. <span
class="cmti-10--109">LaTeX: A Document Preparation System</span>. Addison-Wesley
Publishing Company, second edition, 1994.
</p><p class="bibitem">
[Wil96] <a
name="XPRW96h"></a>Peter R. Wilson. <span
class="cmti-10--109">ltx2x: A LaTeX to X Auto-tagger</span>. NIST Report NISTIR, June
1996.
</p></div>
</body>
</html>
|