VU Math: Intro to Our Computer Systems

Converting  Mathematics  to  Web-Readable  Form

What is the best way to post mathematical documents on the web? Well, that depends on who your intended audience is, what software you expect that audience to have, how long the document is, how high a quality of typesetting you want the document to have, and how quickly or easily you want the audience to be able to read it.


How to Use ps2pdf

One of the formats you can use for posting math is pdf ("portable document format"), which people can read using the Adobe's free Acrobat Reader. To use that format, first create a postscript file (see our web page about TeX), and then use the ps2pdf command. For instance,
ps2pdf  filename.ps  filename.pdf
The advantages to this method are (i) it's fairly easy, and (ii) it produces a web-viewable page that has slightly higher resolution than the dvi2gif method described below. The disadvantages are (a) its resolution is still less than ideal, (b) a few people in your intended audience still don't have Acrobat Reader, and (c) even the people who do have Acrobat Reader have to wait a few seconds each time it loads.


How to Use dvi2gif

We have a program called "dvi2gif" installed in our computer system. The program is really very easy to use; the instructions look long only because I've put in lots of details.
  1. Move your dvi file into a directory of its own, if you want to avoid mixing together too many different unrelated files in one directory.
  2. If your dvi file is named "myfile.dvi", type "dvi2gif myfile" -- don't bother typing the ".dvi" after the "myfile".
  3. Wait a few moments while dvi2gif does its stuff. It will create a collection of gif files, one for each page of your tex output. These will be named "myfile-p1.gif", "myfile-p2.gif", etc. It will also create a very basic web page, called "myfile.html." When dvi2gif is done, the computer will prompt you for your next command. Type "ls" or "ls -t" to see what files it has created.
  4. The dvi2gif program assumes you wrote your tex files to print on ordinary 8.5 inch by 11 inch paper. If you intended to use a larger page, you're out of luck. If you intended to use a smaller page, you can crop your gif files using any appropriate graphics editor (e.g., Lview). If you don't know how to do that, don't worry about it; it just means that your gif files have larger margins than necessary.
  5. The file "myfile.html" is a very minimal web page. It contains nothing more than links to the gif files. This html page is very crude; it is not really intended for you to post publicly. However, it will save you a little work. Before you delete this minimal web page, you can use cut-and-paste to copy its links into some more elaborate web page of your own. Edit the links if your web page is not in the same directory as the gif files.

By the way, dvi2gif was written by Chip Turner, one of our students; it is a script which knits together some complicated instructions worked out earlier by Prof. Ellingham.


How to Use Windows in place of dvi2gif

Here is a technique that can be used on any Windows-based computer (Windows 3.1 or Windows 95). Create your document (e.g., using TeX), and then preview it on screen using one of the usual previewer programs (e.g., dviwin). Use a previewer that is Windows-compatible. While the desired display is on-screen, press the "Print Screen" key on your keyboard. That will copy the current screen display into the "clipboard" part of memory. Now minimize or close all the programs, start up any graphics editor, maximize its window (i.e., full screen), and then use its "Edit ... Paste" command. This will paste that remembered screen display into the graphics editor. Now edit it however you like, and then save it as a gif file. If you're doing math, you're probably doing black-and-white, so you should save the file as monochrome, not color (to keep the filesize from being unnecessarily large). If the program asks you whether you want the image dithered, say "no"; dithering will probably just blur your black-and-white.

One drawback to this method is that it is somewhat tedious; it takes many steps. Another drawback is that it only works for one screenful at a time; in some cases you may want to create a larger image that covers 2 or 3 screenfuls. That can be done by pasting together several smaller images, if you know how to use your graphics editor, but again it is rather tedious.


How to Use latex2html

You can create a few small, in-line gifs and use them as needed, for your mathematical expressions. This permits you to write mathematics directly in html pages, though perhaps a bit crudely. For instance, in the line displayed below, I'm using a gif for an integral sign; the rest of the formula is just text.

[picture of integral sign] cos x dx = sin x + C

Some disadvantages are already apparent: (1) It's hard to get the spacing just right. (2) You'd better give the web page a background color of white, to match the background color of the gifs. (3) If the person viewing the web page changes his or her font size, this does not change the sizes of the gifs, so there really is no way to make the symbols stay the right size with this method. (4) It may take a lot of work to create all the little gifs, if you're doing them by hand.

However, you don't have to do them by hand, if your favorite flavor of Tex is Latex (as opposed to Plain Tex, AMS-Tex, or some other variant). You can use the latex2html program. Here is how to use it:

  1. If your latex file is named "myfile.tex", type "latex2html myfile.tex".
  2. Wait a long time -- or a very long time, if your document is long. You'll see some activity on the screen, while different programs talk to each other and create files for you. It's not done until the computer gives you back your usual prompt -- a percent sign, or whatever is your usual prompt. The program sometimes pauses for several seconds with "GS>" on the screen, but that's not your prompt; you still have to keep waiting when you get that.
  3. When the program is done, you'll find that it has created a new subdirectory called "myfile" within the directory that you started in. In that new directory, you'll find a large number of gif files, plus three html files and a bunch of other miscellaneous files. You can delete all those miscellaneous files -- they're just log files, byproducts of the program's work.
  4. The main html file is "myfile.html". Try running Netscape on that file, to see how it looks. The latex2html program does fairly well with simple tex, but it won't always work well with complicated macros or sophisticated spacing. You may have to fix those things by hand -- i.e., by editing the html file. Evidently, this technique is only for people who know at least a little html and a little latex.
  5. The two other html files are "node1.html" and "node2.html." Those contain information about the latex2html program. It would be courteous to leave those in, but if you really want to you can delete those files, and edit the "myfile.html" file so that it no longer contains links to "node1.html" and "node2.html".

Though the html file described above may be difficult to construct, it should display properly on essentially any version of any graphical browser -- Netscape, Explorer, Mosaic, etc.

The latex2html program does have one serious flaw: it does not convert paragraph breaks in the LaTeX document to paragraph breaks in the HTML document. You can add the paragraph breaks manually in the HTML document, or if you prefer you can just insert the code

\begin{rawhtml}<P>\end{rawhtml}
at appropriate places in your LaTeX document.

We have a recent version of latex2html. Also, we have online documentation about latex2html. You can go to any text terminal on our system, and type "man latex2html", to get a brief text explanation. For a longer manual, go to one of our X-Windows terminals, type

to start up a local copy of Netscape; then go to this page, and click on this link: Or, if you're at home and using a modem, get on Netscape and use this URL (which begins with "ftp" rather than the usual "http"), but replace "username" with your username: You'll be prompted for your password.


Text-encoded mathematical symbols

If you are willing to assume that your intended audience has a graphical browser that is not extremely old, there are some additional techniques that you can take advantage of: Since around 1996 or 1997, most grahical browsers have enabled certain kinds of mathematics to be displayed directly, without using gifs.

For instance, subscripts and superscripts can be displayed with the "sub" and "sup" tags. If you want to display x-sub-3 and x-cubed in an HTML page, you could display them with these commands:

x<sub>3</sub>   and   x<sup>3</sup>
You can see the results right here:
x3   and   x3
if you're using a recent browser to read this document.

Unusual characters (ASCII/Unicode)

As far back as HTML 2.0, there was already a way to code some unusual characters for display in HTML documents. Each code begins with an ampersand and ends with a semicolon. Between those two characters are either a pound sign and some numbers, or -- for often-used charactes -- an abbreviated name. For instance,

Numeric codeName codeResult
&#38;&amp;&
&#60;&lt;<
&#62;&gt;>
&#160;&nbsp;(non-breaking space)

You must use the ascii encoding if you wish any of the characters & < > to appear on your web page. Just typing the characters you see on the keyboard won't work; those keystrokes will be interpreted as special codes by most web browsers. (If this explanation confuses you, just view the source file for this page.)

A non-breaking space is a space that looks just like an ordinary space between two words -- but it will keep those two words glued together, so that a line break cannot occur between them.

Many accented and other foreign-alphabet symbols can be encoded by number; most of them can also be encoded by name. I have put charts of those on a separate page. Many mathematical and other symbols can be encoded by number, but I am not aware of any name abbreviations available for the same characters:

CodeResult  CodeResult  CodeResult  CodeResult
&#130;  &#131;ƒ  &#132;  &#133;
&#134;  &#135;  &#136;ˆ  &#137;
&#139;  &#145;  &#146;  &#147;
&#148;  &#149;  &#150;  &#151;
&#152;˜  &#153;  &#155;  &#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;¿  &#215;×  &#247;÷

Using these built-in characters instead of small gifs saves some downloading time -- i.e., your intended audience will not have to wait as long for the material to load into his or her viewing screen. Moreover, these built-in characters may make it easier for you to edit a web page: You can do everything in one file, using just one text editor; you don't have to keep track of dozens of separate little files. But be cautioned that these characters are not necessarily exhibited properly on all browsers.

Symbol font

Some browsers can handle the "symbol" font. This is true of Exporer 5.5 and higher, and Netscape 4 on Windows; it is also true after some adjustments are made in the settings of Macs or Unix computers or in Netscape 6 or Mozilla. The adjustments have been explained by Ian Hutchinson, author of TtH, a program for aumatically converting TeX to HTML.

Ascii codeResult  Ascii codeResult
<font face=symbol>A</font>A   <font face=symbol>a</font>a
<font face=symbol>B</font>B   <font face=symbol>b</font>b
<font face=symbol>C</font>C   <font face=symbol>c</font>c
<font face=symbol>D</font>D   <font face=symbol>d</font>d
<font face=symbol>E</font>E   <font face=symbol>e</font>e
<font face=symbol>F</font>F   <font face=symbol>f</font>f
<font face=symbol>G</font>G   <font face=symbol>g</font>g
<font face=symbol>H</font>H   <font face=symbol>h</font>h
<font face=symbol>I</font>I   <font face=symbol>i</font>i
<font face=symbol>J</font>J   <font face=symbol>j</font>j
<font face=symbol>K</font>K   <font face=symbol>k</font>k
<font face=symbol>L</font>L   <font face=symbol>l</font>l
<font face=symbol>M</font>M   <font face=symbol>m</font>m
<font face=symbol>N</font>N   <font face=symbol>n</font>n
<font face=symbol>O</font>O   <font face=symbol>o</font>o
<font face=symbol>P</font>P   <font face=symbol>p</font>p
<font face=symbol>Q</font>Q   <font face=symbol>q</font>q
<font face=symbol>R</font>R   <font face=symbol>r</font>r
<font face=symbol>S</font>S   <font face=symbol>s</font>s
<font face=symbol>T</font>T   <font face=symbol>t</font>t
<font face=symbol>U</font>U   <font face=symbol>u</font>u
<font face=symbol>V</font>V   <font face=symbol>v</font>v
<font face=symbol>W</font>W   <font face=symbol>w</font>w
<font face=symbol>X</font>X   <font face=symbol>x</font>x
<font face=symbol>Y</font>Y   <font face=symbol>y</font>y
<font face=symbol>Z</font>Z   <font face=symbol>z</font>z
<font face=symbol>^</font>^   <font face=symbol>@</font>@

The preceding technique only shows the "low ascii" characters of the "symbol" font. The "symbol" font also includes "high ascii" characters, which correspond to control-characters such as control-I or control-shift-I. Those are hard to edit, using ordinary text editors. However, we can encode those control-characters with ascii too. The result makes a slightly longer and more cumbersome ascii code, but it still occupies far fewer bits than does a graphical image.

Ascii codeResult  Ascii codeResult
<font face=symbol>&#161;</font> ¡   <font face=symbol>&#162;</font> ¢
<font face=symbol>&#163;</font> £   <font face=symbol>&#164;</font> ¤
<font face=symbol>&#165;</font> ¥   <font face=symbol>&#166;</font> ¦
<font face=symbol>&#167;</font> §   <font face=symbol>&#168;</font> ¨
<font face=symbol>&#169;</font> ©   <font face=symbol>&#170;</font> ª
<font face=symbol>&#171;</font> «   <font face=symbol>&#172;</font> ¬
<font face=symbol>&#173;</font> ­   <font face=symbol>&#174;</font> ®
<font face=symbol>&#175;</font> ¯   <font face=symbol>&#176;</font> °
<font face=symbol>&#177;</font> ±   <font face=symbol>&#178;</font> ²
<font face=symbol>&#179;</font> ³   <font face=symbol>&#180;</font> ´
<font face=symbol>&#181;</font> µ   <font face=symbol>&#182;</font>
<font face=symbol>&#183;</font> ·   <font face=symbol>&#184;</font> ¸
<font face=symbol>&#185;</font> ¹   <font face=symbol>&#186;</font> º
<font face=symbol>&#187;</font> »   <font face=symbol>&#188;</font> ¼
<font face=symbol>&#189;</font> ½   <font face=symbol>&#190;</font> ¾
<font face=symbol>&#191;</font> ¿   <font face=symbol>&#192;</font> À
<font face=symbol>&#193;</font> Á   <font face=symbol>&#194;</font> Â
<font face=symbol>&#195;</font> Ã   <font face=symbol>&#196;</font> Ä
<font face=symbol>&#197;</font> Å   <font face=symbol>&#198;</font> Æ
<font face=symbol>&#199;</font> Ç   <font face=symbol>&#200;</font> È
<font face=symbol>&#201;</font> É   <font face=symbol>&#202;</font> Ê
<font face=symbol>&#203;</font> Ë   <font face=symbol>&#204;</font> Ì
<font face=symbol>&#205;</font> Í   <font face=symbol>&#206;</font> Î
<font face=symbol>&#207;</font> Ï   <font face=symbol>&#208;</font> Ð
<font face=symbol>&#209;</font> Ñ   <font face=symbol>&#210;</font> Ò
<font face=symbol>&#211;</font> Ó   <font face=symbol>&#212;</font> Ô
<font face=symbol>&#213;</font> Õ   <font face=symbol>&#214;</font> Ö
<font face=symbol>&#215;</font> ×   <font face=symbol>&#216;</font> Ø
<font face=symbol>&#217;</font> Ù   <font face=symbol>&#218;</font> Ú
<font face=symbol>&#219;</font> Û   <font face=symbol>&#220;</font> Ü
<font face=symbol>&#221;</font> Ý   <font face=symbol>&#222;</font> Þ
<font face=symbol>&#223;</font> ß   <font face=symbol>&#224;</font> à
<font face=symbol>&#225;</font> á   <font face=symbol>&#226;</font> â
<font face=symbol>&#227;</font> ã   <font face=symbol>&#228;</font> ä
<font face=symbol>&#229;</font> å   <font face=symbol>&#230;</font> æ
<font face=symbol>&#231;</font> ç   <font face=symbol>&#232;</font> è
<font face=symbol>&#233;</font> é   <font face=symbol>&#234;</font> ê
<font face=symbol>&#235;</font> ë   <font face=symbol>&#236;</font> ì
<font face=symbol>&#237;</font> í   <font face=symbol>&#238;</font> î
<font face=symbol>&#239;</font> ï      
<font face=symbol>&#241;</font> ñ   <font face=symbol>&#242;</font> ò
<font face=symbol>&#243;</font> ó   <font face=symbol>&#244;</font> ô
<font face=symbol>&#245;</font> õ   <font face=symbol>&#246;</font> ö
<font face=symbol>&#247;</font> ÷   <font face=symbol>&#248;</font> ø
<font face=symbol>&#249;</font> ù   <font face=symbol>&#250;</font> ú
<font face=symbol>&#251;</font> û   <font face=symbol>&#252;</font> ü
<font face=symbol>&#253;</font> ý   <font face=symbol>&#254;</font> þ


  A VU Math web page, updated 27 May 2002 by the department's webmaster. Your comments are welcome.