TeX2page is invoked in much the same way as
plain TeX or LaTeX.1 Recall how
these programs are called: Given a TeX
source file with the relative or full pathname
jobname is the basename of
the file and
.ext is its extension,
you type either
at the operating-system command line. You do not need
to mention the extension
.ext if it is
This creates the output DVI file,
in the working directory.
TeX2page is called analogously. To create the HTML
version of the same file
.ext is optional if it is
jobname.html in the working directory.
To try this out, copy into your working directory the
story.tex provided in all TeX
Call TeX2page on it:
TeX2page will get cracking on
the following commentary, or log, on your console:
This is TeX2page, Version 4p4k3 (MzScheme 200, unix) (story.tex) Added missing \end  Output written on story.html (1 page).
TeX2page is now done, and the result of its labors
is the HTML file
The log file
contains a copy of the above log, and is useful
if you didn't or couldn't keep track of the console
(perhaps because the log was too long).
The log says that
story.tex lacked a
document-ending command such as
and that TeX2page assumed one anyway. Also, only
one HTML page was created, and its name is
story.html. TeX2page could in some cases produce
auxiliary HTML pages in addition to
the main HTML page
for larger documents). The auxiliary HTML pages
are reachable from
by navigation links (sec 3.1). As each
auxiliary HTML page is completed, the log will show the
, etc. The
in this log refers to the only HTML file created, viz,
All this is of course almost exactly analogous to the
way you type
tex story to get
story.tex, with the log going into
This is TeX, Version 3.14159 (Web2C 7.3.1) (format=tex 2001.9.7) 24 FEB 2002 15:50 **story (story.tex ) *\bye Output written on story.dvi (1 page, 668 bytes).
The only real difference is
that TeX will not add the missing
\end on its
own, but instead waits for the user to supply it
explicitly from the console.2 Note that the bracketed numbers now refer
to physical pages.
Thus, from one TeX source file, you can get both a
.dvi and a browsable
using the same calling conventions.
As with TeX, the filenames encountered by TeX2page in
the document are first looked for relative to the
working directory. If not found there, they are looked
for in the directories listed in the environment
TIIPINPUTS. This is analogous to TeX
looking for files in
Error recovery in TeX2page is also exactly analogous to TeX, but we will postpone that discussion to sec 10.
Like most recent versions of TeX, TeX2page also
supports the standard self-identification arguments
--version. These arguments elicit
help only if there isn't an input file (eg,
--help.tex) that could match them.
TeX2page called without an argument displays a help message and exits. Unlike TeX, TeX2page will not try to conjure up an input document based purely on console chitchat with an increasingly befuddled user.
In all these cases, the help displayed on the console
is also saved in the specially named log file
You may load the
tex2page.ss into Scheme
and call the
tex2page with the name of the TeX file
(require (lib "tex2page.ss" "tex2page")) (tex2page filename)
You can call the procedure
tex2page several times from the same Scheme
session, on the same file or on different files.
By default, TeX2page generates the output HTML files and other auxiliary files (sec A) in the current working directory. You can tell TeX2page to place its output and auxiliary files in a different directory and thus avoid cluttering up your working directory.
The files used for specifying the target directory are:
jobname.hdir in the working directory,
.tex2page.hdir in the working directory, and
.tex2page.hdir in the user's
directory. The first line of the first of these files
that exists is taken to be the name of the target
If none of the files exists, the current working
directory is the target directory.
For example, if
story.hdir contains the
story as its first line, the HTML
and aux files are created in a subdirectory
of the current directory.
The filename may contain the TeX control sequence
\jobname, which expands to the basename of the TeX
document. To always use an auxiliary subdirectory with
the same name as the basename of the TeX document, have
~/.tex2page.hdir contain the line
\jobname'' (without quotes).
1 Hereafter, we will use TeX to mean any format of TeX, and plain TeX when we specifically mean the ``plain'' format.
2 The file
\end only to demonstrate some interactive
capabilities of TeX, which are not relevant for
value can use a quite complicated syntax, which is why
TeX2page uses its own environment variable instead of
simply reusing TeX's
TEXINPUTS. However, to make a
virtue out of a necessity, it is quite unnecessary for
TeX2page to attempt parsing most of the TeX files that
are accessible via
TEXINPUTS. Furthermore, you can
have files in
TIIPINPUTS usefully shadow