HyperTeX

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:
• The source code for xhdvi, the modified X windows dvi previewer, is available via anonymous ftp at snorri.chem.washington.edu:/pub/hypertex, courtesy of Arthur Smith (asmith@bigsky.chem.washington.edu). The latest version at the time of this (18 Jun 95) was xhdvi_0.8a, and it was tested on sun, hp, and sgi -- by popular request, here are some precompiled xhdvi binaries and Install_Notes.
• A compiled version of TeXview.app, the nExtstep dvi previewer augmented for hypertex, was originally provided by Dmitri Linde (dmitri@physics.stanford.edu [also the author of InstantTeX.app]). Mark Doyle has significantly extended Dmitri's original version with the addition of multiple views and multiple documents. The README gives a more complete overview of the current features and known bugs. The latest binary (as of 29 March 1995) is available at HyperTeXview0.1beta1 or via ftp at this URL. NeXT TeX users might also be interested in NeXTTeX 2000.
(There are still some known minor bugs and desired enhancements for the above two.)

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:

• lanlmac.tex: My modified version of harvmac.tex (last updated 7/26/94), works seamlessly to convert pre-existing harvmac-based source to hypertex (see examples below).
• hyperlatex.tex: (Somewhat outdated and for LaTeX 2.09 only) For latex-based source, automatically upgrades latex macros to hyperlatex (install in tex/inputs directory). This file is input before the \documentstyle when using LaTeX, and will automatically cause the relevant .hty files (if present) to be included after the associated .sty file. Some .hty files to install in tex/inputs (each containing modifications to the corresponding .sty file) are:
• aps.hty, prabib.hty, revtex.hty, espcrc2.hty, article.hty, book.hty, report.hty, fleqn.hty, vanilla.hty
• To define a convenient hlatex format using a format (.fmt) file, use hlatex.tex to generate hlatex.fmt (e.g. on unix systems, use: initex \&latex hlatex.tex) and install in tex/formats directory. This format will automatically \input hyperlatex at the beginning of all documents. Command line use of hlatex.fmt is system dependent: on unix systems, create a link (e.g. ln -s latex hlatex), then the command hlatex file replaces latex file to produce automatic hyperlatex.
• hyperref: A well-maintained LaTeX2e hyper package by Sebastian Rahtz. Available from your friendly CTAN sites in /tex-archive/macros/latex/contrib/supported/hyperref.
• Your preferred macropackage (Just do it.)

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:
• harvsamp.dvi : A sample file illustrating the modified harvmac macros, with source harvsamp.tex.
• hyperlh88.tar.gz: by popular demand, dvi file plus figures for my 1988 Les Houches lectures "Applied Conformal Field Theory" (266kb .gz file gunzips to 911kb). Good example of pre-existing source that painlessly retexs with new macros (harvmac/lanlmac) into much more functional form with large numbers of internal links to sections, subsections, eqns, refs, figs, etc.
• hypertasi92.tar.gz: dvi file plus figures from hep-th/9304011 [abs], 200 page set of lecture notes using harvmac/lanlmac. (note that 392kb .gz file gunzips to 1.6Mb -- but worthwhile as another impressive example of pre-existing source that automatically recompiles with thousands of internal linkages [couldn't be faked...].)
• emdual.tar.gz dvi plus two figures from hep-th/9407087 [abs], a random paper (just received, by Seiberg and Witten) that also uses harvmac.
• ambjorn.dvi: The dvi file from hep-lat/9405022 [abs], an example file from the e-print archives using latex (article style).
• anomalkap.dvi: The dvi file from hep-lat/9309014 [abs], an example file from the e-print archives using revtex.
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.

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/.

pg@xxx.lanl.gov