tex2page(1) makes Web pages from LaTeX and plain-TeX documents


    tex2page --help
    tex2page --version
    tex2page <pathname>


The command

    tex2page <pathname>

converts the TeX source file <pathname> to the HTML file <jobname>.html, where <jobname> is the basename of <pathname>. Some auxiliary HTML files and some image files may also be created.

The argument <pathname> can be a full or relative pathname. If the latter, it is reckoned relative to the current directory. The extension may be omitted if it is .tex.

In order to resolve cross-references, it may be necessary to invoke tex2page a couple of times. The log displayed on the console will inform you if such is the case. This log is also saved in the file <jobname>.hlog.

If tex2page is called with the option `--help', it prints a help message and exits.

If tex2page is called with the option `--version', it prints version information and exits.

If tex2page is called without an argument, or if the argument is neither a valid option nor an existing file, then tex2page prints a brief help message and exits. If you repeatedly (i.e., five or more times) call it faultily despite its helpful advice, tex2page will visibly lose its patience.

The complete documentation for tex2page is included in the tex2page distribution, and may also be viewed on the Web at



tex2page uses the same search path as TeX to search for \input and \openin files. The default search path is implementation-dependent but can be changed by setting the environment variable TEXINPUTS to a list of colon-separated directories. (If you wish to merely prepend your list to the default list, end your list with a colon.)

Add two trailing forward slashes to any directory in TEXINPUTS that you want to recursively search all subdirectories of.

If the environment variable TIIPINPUTS is set, tex2page will use the TIIPINPUTS value as its search path instead of TEXINPUTS. TIIPINPUTS does not support the double-slash mechanism of TEXINPUTS.


If tex2page encounters a fatal error in the document, it displays the prompt

    Type e to edit file at point of error; x to quit

If you type x, tex2page immediately exits.

If however you type e, a text editor is fired up, showing the offending file -- which may or may not be the main input file -- at the line containing the error. The particular editor chosen and the arguments with which it is called depends on the environment variables TEXEDIT or EDITOR.

If the environment variable TEXEDIT is set, tex2page uses its string value as the editor call to use. A possible value for TEXEDIT is "vim +%d %s". This calls the editor vim with %s replaced by the offending file's name, and %d replaced by the number of the offending line.

If TEXEDIT is not set, the value of the environment variable EDITOR is chosen as the editor. Unlike TEXEDIT which contains the editor call as a template, EDITOR contains simply the editor's name. If EDITOR is also not set, vi is chosen as the editor.

The editor specified in EDITOR is called with the arguments " +<n> <f>", where <f> is the offending file's name and <n> is the offending line number. It is not possible to alter the way the file and line arguments are supplied, but fortunately this style is accepted by vi, emacs, and all their clones. If you use an editor that requires a different argument style, use TEXEDIT.


By default, tex2page generates its output HTML files in the current directory. You can specify a different directory by naming it in one of the following files:

    <jobname>.hdir in the current directory, or
    .tex2page.hdir in the current directory, or
    .tex2page.hdir in your home directory;

where <jobname> is the basename of the input document. The first of these three files that exists overrides the rest.

The name in the .hdir file can be, or contain, the TeX control-sequence \jobname, which expands to <jobname>, the basename of the input document.


Before processing a TeX source file whose basename is <jobname>, tex2page will automatically load the file <jobname>.t2p, if it exists. <jobname>.t2p is a good place to put macros that are specific to the HTML version of the document.


tex2page recognizes some commands that are not supplied in the LaTeX or plain-TeX formats -- typically these are commands that add value to the HTML output. In order to keep an input document that uses these extra commands processable by TeX, working TeX definitions are provided in the TeX macro file tex2page.tex and the LaTeX macro package file tex2page.sty. Copy these macro files from the tex2page distribution to a directory in your TEXINPUTS.

Plain-TeX documents can use

    \input tex2page

while LaTeX documents can use



tex2page runs on Scheme or Common Lisp. It may also make use of the following programs: BibTeX, MakeIndex, Ghostscript, Dvips, MetaPost, and the NetPBM library.

Out of the box, tex2page runs in MzScheme, but the distribution includes configuration information to allow tex2page to run on a variety of Scheme and Common Lisp implementations. See file INSTALL.


Email to dorai @ ccs.neu.edu.


Copyright 1997-2009 by Dorai Sitaram.

Permission to distribute and use this work for any purpose is hereby granted provided this copyright notice is included in the copy. This work is provided as is, with no warranty of any kind.