We should contrast three main types of documents:
So much for the general theory. Now let's look at some very simple examples.
| A sample tex source code | A sample html source code |
|
|
| The resulting tex display | The resulting html display |
![]() |
|
The particulars are different, but the basic concept is the same. (In fact, TeX and HTML are, more or less, two special cases of SGML. But that's probably more technical and less useful than is appropriate for most readers of this document.) Here are some other main differences between TeX and HTML:
| TeX | HTML |
| Designed to work well with the complicated spacing required by mathematical expressions. For instance, it can handle fractions and matrices quite well. | Includes special tools for web pages -- for instance, links. |
| The source file "myfile.tex" is sent through a program called "tex", which creates an output file called "myfile.dvi". The "dvi" originally stood for "device independent", but that is somewhat misleading -- the file may behave differently on different computers, depending on what tex fonts and other information are installed on those computers. The dvi file can be used to create another file, such as "myfile.ps" (for "postscript"). Some printers are equipped with software to print dvi or ps files. Some operating systems, such as Windows, can be equipped with software to display dvi or ps files. | The only file stored is the "myfile.htm" or "myfile.html". It can be sent through a "browser" program such as Netscape or MSIExplorer, which displays the result on the screen but generally does not save that display as a file. |