It is easier to add hypertext capability to TeX than to simulate the TeX typesetting environment within www browsers. (And for scientific text, total author control over formatting and fonts is frequently preferred.) The standard promoted here is to insert \special commands that add the necessary structure to the .dvi file. For example,
\def\href#1#2{\special{html:<a href="#1">}{#2}\special{html:</a>}}
allows one to surround text with the necessary specials, so that
Here is a link to \href{http://xxx.lanl.gov/}{xxx}.
will insert the desired anchored text. The link can be to an arbitrary network URL (including e.g. photos, movies, sound files, mathematica files, etc.) Downward compatibility is ensured, since dvi drivers that do not recognize the \specials will ignore them (although some, such as dvips, will currently issue warnings at each occurrence).

The object is not only to provide hyperlink functionality to external (network) resources, but also to provide a means of transmitting much of the important structural and contextual information (sections, subsections, equations, references, ...) already contained in the underlying .tex for suitable gui postprocessing, whether directly by .dvi previewer or after higher level translation (e.g. to .pdf).

dvi Previewers

Two dvi previewers are currently under development to implement this functionality: (There are still some known minor bugs and desired enhancements for the above two.)


Adobe has implemented a modification of Postscript called Acrobat (with file extension .pdf = portable document format). It is essentially a version of uuencoded compressed postscript with a full hyperlink overlay. (There are now .pdf viewers for Unix, pc Windows, and Macintosh; though some still in beta, available via anonymous ftp from ftp.adobe.com) In addition, pdf files are searchable and indexable. The dvihps driver (generalizing dvips in the obvious way) allows passing the hypertext information from the .dvi to the .ps file in the form of pdf marks that are picked up by the Acrobat distiller, giving a most powerful method for producing automatically hyperlinked .pdf. (Then the relation of hyper .dvi to hyper .ps or .pdf is the same as is currently the relation between .dvi and .ps; with ultimate translation to hyper .ps or .pdf giving a more portable final hyperlinked format.) Indeed this was the original motivation for hypertex -- when I saw Acrobat Exchange demo'ed in fall '93, it seemed auspicious to have all of the hyperlink capability but horrifying to contemplate armies of people adding hyperlink overlays "by hand" after the fact, especially when much of the contextual structure is already present in the .tex source, only to be lost in the conversion to .dvi then e.g. to postscript. We decided then that \special's were the natural means to pass this structure out from the .tex source to be picked up from the .dvi level by subsequent drivers. (For some updated comments on pdf [10/94], see this mail message.)

hyperPS and hyperhacked Ghostview

For information on the above mentioned modified dvips driver (written by Mark Doyle) that picks up the embedded hyperlink info from the .dvi file, see this README_HPS.

For information on a modified version of ghostview (written by Tanmoy Bhattacharya) that interprets the embedded hyperPS commands (i.e. without necessity of passing to Adobe's ps -> pdf distiller), see this README-ghosthview. Note that the next version of ghostscript (now undergoing beta testing [6/95]) will incorporate this functionality.

But wait, there's more...

Since latex and other standard macropackages are already highly structured, by simple modification of the underlying macros it is possible to add extensive hypertext capabilities to pre-existing .tex source (i.e., for equations, figures, references, pagenumbers, etc.). Moreover these macro redefinitions insert standardized <a name=""> anchors that allow reference to third party papers in standard form (if compiled using the same macropackages), e.g. by appending #equation.2.3, #page.7, #figure.4, #table.2, etc., to the associated URL.

hyperbasics.tex are simple low level hypertext macros (as in the example at the top of this page), written by Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov) that implement the standard format for external reference. They can be used directly or can be called by straightforward modifications of existing macropackages. Tested macropackages include:

Example .dvi files

It has been an impressive exercise to grab files from the e-print archives and hypertex them using the above modified macros. All examples have essentially "just worked". Here are a few example files: Some more examples of hyperdvi files can be found in tanmoy's hyperdvi directory. These files are mainly documentation about TeX, automatically generated from the web files. He has also made available hyperwebmac.tex (modified version of webmac.tex that is used to process .tex generated from .web by weave), hypercwebmac.tex (modified version of cwebmac.tex [version 2.1] that is used to process .tex generated from .w by cweave), and hyperncwebmac.tex (same as above for cwebmac.tex version 3.0). LaTeX2e.conf is (untested) contributed software or latex2e users.

External and relative URL's

The above macros are set up to generate automatically only linkages internal to files. External URL's can easily be added by hand (as in the example at the top of this page), others could be added automatically (e.g. references to arch-ive/papernum could easily be parsed to <a href="http://xxx.lanl.gov/e-print/arch-ive/papernum"> ). Eventually various conventions used in writing will change (e.g. figures will typically be small thumbnail images linked to external viewers, and similarly for other resources; and the text itself will be restructured to take advantage of branched exposition).

Currently the nExtstep HyperTeXview.app is set up to message external URL's to OmniWeb.app (soon will support SpiderWoman, the first browser to support base/relative URL pairs), and works well for absolute URL's under NS3.2 (uses the "open URL" service exported by OmniWeb, some examples inserted in harvsamp). On X, messaging from xhdvi to e.g. Mosaic can be implemented using the primitive Mosaic "remote control" (xhdvi calls the executable specified by the environment variable $WWWBROWSER on any URL it does not understand). An implementation for opening e.g. external dvi files from within dvi files exists (see xhdvi/mosaic on nqcd), but needs simplification pending improved www client capabilities.

It is clearly silly to reproduce html transport capabilities within .dvi (or .pdf) viewers, but the current generation of www clients does not allow very sophisticated in/out messaging. Ideally, when a www client opens a .dvi (or .pdf) viewer on a file, it should pass a "base URL" to the viewer. When the viewer encounters a relative URL, it should be able to message its base URL together with the relative URL back to the www client which will parse and retrieve. Currently, however, www clients such as Mosaic for X allow neither passing a URL to an external browser nor sophisticated messaging back. It is hoped that the next generation of www clients will separate the html transport from the html viewing and allow more generalized messaging to/from the transport object. (Perhaps this is a job for the "WWW consortium".)

For the time being, however, use of absolute URL's still provides impressive hypertex functionality.

Additional clarifying comments

In answer to some early questions raised, the following comments are paraphrased From: asmith@bigsky.chem.washington.edu (Arthur Smith), Date: Wed, 27 Jul 94 00:14:07 -0700 :

Note that hypertex is not intended as a replacement to HTML, nor are the viewers intended as a replacement to Mosaic or other www browser --- it is intended more to represent an early generation of alternative document viewer with closer ties to the Web (somewhat along the lines of the ghostscript or xv viewers currently used, but with the added benefit of hypertext within the TeX/dvi/pdf documents themselves).

The advantages are: no need for complex conversions of pre-existing TeX files into HTML, and no need to wait for a future version of html with support for equations. In addition, the macro capabilities of TeX allow hypertext to be created with little or no effort on the part of the author. It is anticipated that this will be ideal for scientists and mathematicians who already use TeX. We hope that the tools will be sufficiently popular to motivate improvements that may allow TeX documents (whether in dvi format or pdf) to be tied even more closely to the Web than is possible with our first generation set of tools. They are now at least sufficiently usable to allow a single line change of a TeX file to create the hyperdvi files on the server side, a single button click on a Web browser to bring up a hyperdvi document, and with a little more initial effort on the author's side, a single button click in the dvi viewer on the reader's side to bring up related documents.

This directory is also available via anonymous ftp at xxx.lanl.gov:/pub/hypertex/ .
Tanmoy's files are instead available via anonymous ftp at gita.lanl.gov:/people/tanmoy/ .
Mark's files are also available via anonymous ftp at gita.lanl.gov:/people/doyle/ .
Hypertex announcements are also archived in hypermail format at http://math.albany.edu:8800/hm/ht/a/.