TEX

Section: User Commands (1)
Updated: 23 January 1994
Index Return to Main Contents
 

NAME

tex, virtex - text formatting and typesetting  

SYNOPSIS

tex [ first line ]

virtex [ first line ]  

DESCRIPTION

TeX formats the interspersed text and commands contained in the named files and outputs a typesetter independent file (called DVI, which is short for DeVice Independent). TeX capabilities and language are described in The TeX book.

TeX is normally used with a large body of precompiled macros, and there are several specific formatting systems, such as LaTeX, which require the support of several macro files. The basic programs as compiled are called initex and virtex, and are distinguished by the fact that initex can be used to precompile macros into a .fmt file, which is used by virtex. On the other hand, virtex starts more quickly and can read a precompiled .fmt file, but it cannot create one. It is the version of TeX which is usually invoked in production, as opposed to installation.

Any arguments given on the command line to the TeX programs are passed to them as the first input line. (But it is often easier to type extended arguments as the first input line, since Unix shells tend to gobble up or misinterpret TeX's favorite symbols, like backslashes, unless you quote them.) As described in The TeX book, that first line should begin with a filename or a \controlsequence. The normal usage is to say

tex paper
to start processing paper.tex. The name paper will be the ``jobname'', and is used in forming output filenames. If TeX doesn't get a filename in the first line, the jobname is texput. The default extension, .tex, can be overridden by specifying an extension explicitly.

If there is no paper.tex in the current directory, TeX will look through a search path of directories to try to find it. If paper is the ``jobname'', a log of error messages, with rather more detail than normally appears on the screen, will appear in paper.log, and the output file will be in paper.dvi. The system library directory /ade/lib/texmf/tex contains the basic macro package plain.tex, described in The TeX book, as well as several others. Except when .fmt files are being prepared it is unnecessary to \input plain, since almost all instances of TeX begin by loading plain.fmt. This means that all of the control sequences discussed in The TeX book are known when you invoke tex. For a discussion of .fmt files, see below.

The e response to TeX's error prompt causes the system default editor to start up at the current line of the current file. The environment variable TEXEDIT can be used to change the editor used. It can contain a string with "%s" indicating where the filename goes and "%d" indicating where the decimal line number (if any) goes. For example, a TEXEDIT string for vi can be set with the csh command

setenv TEXEDIT "/usr/ucb/vi +%d %s"
A convenient file in the library is null.tex, containing nothing. When TeX can't find a file it thinks you want to input, it keeps asking you for another filename; responding `null' gets you out of the loop if you don't want to input anything. You can also type your EOF character (usually control-D).

The initex and virtex programs can be used to create fast-loading versions of TeX based on macro source files. The initex program is used to create a format (.fmt) file that permits fast loading of fonts and macro packages. After processing the fonts and definitions desired, a \dump command will create the format file. The format file is used by virtex. It needs to be given a format filename as the first thing it reads. A format filename is preceded by an &, which needs to be escaped with \, or quoted, to prevent misinterpretation by the Unix shell if given on the command line.

Fortunately, it is no longer necessary to make explicit references to the format file. The present version of TeX, when compiled from this distribution, looks at its own command line to determine what name it was called under. It then uses that name, with the .fmt suffix appended, to search for the appropriate format file. During installation, one format file with the name tex.fmt, with only the plain.tex macros defined, should have been created. This will be your format file when you invoke virtex with the name tex. You can also create a file mytex.fmt using initex, so that this will be loaded when you invoke virtex with the name mytex. To make the whole thing work, it is necessary to link virtex to all the names of format files that you have prepared. Hard links will do for system-wide equivalences and Unix systems which do not use symbolic links. Symbolic links can be used for access to formats for individual projects. For example: virtex can be hard linked to tex in the general system directory for executable programs, but an individual version of TeX will more likely be linked to a private version by a symbolic link:

ln -s /ade/bin/virtex $HOME/bin/mytex

Another approach is to set up an alias using, for example, csh(1):

alias mytex virtex \&myfmt
Besides being more cumbersome, however, this approach is not available to systems which do not accept aliases. Finally, there is a program known as undump(1) which takes the headers from an a.out file (e.g., virtex) and applies them to a core image which has been dumped by the Unix quit signal. This is very system-dependent, and produces extremely large files when used with a large-memory version of TeX. This can produce executables which load faster, but the executables also consume more disk space.

When looking for a font f, TeX (and its companion programs) first look for a file starting with f in the various font directories (see the next section). If no such file is found, it then looks for a file texfonts.map in each of the font directories in turn. Each non-blank non-comment line of texfonts.map specifies mappings from one name to another. (Comments start with % and continue to the end of the line.) The target name is the first word (words are separated by spaces or tabs) and the source name is the second. (Subsequent words are ignored, so that information intended for other programs can be given there.) Thus, going back to f for a moment, if TeX reads a texfonts.map entry that looks like g f it will then search for a font file starting with g.  

ENVIRONMENT

See the Kpathsearch library documentation (the `Path specifications' node) for precise details of how the environment variables are used.

One caveat: In most TeX formats, you cannot use ~ in a filename you give directly to TeX, because ~ is an active character, and hence is expanded, not taken as part of the filename. Other programs, such as Metafont, do not have this problem.

All the programs in the web2c distribution (as well as some others) use this same search method.

Normally, TeX puts its output files in the current directory. If any output file cannot be opened there, it tries to open it in the directory specified in the environment variable TEXMFOUTPUT. There is no default value for that variable. For example, if you say tex paper and the current directory is not writable, if TEXMFOUTPUT has the value /tmp, TeX attempts to create /tmp/paper.log (and /tmp/paper.dvi, if any output is produced.)

TEXINPUTS
Search path for \input and \openin files. This should probably start with ``.'', so that user files are found before system files. Default: @DEFAULT_TEX_PATH@
TEXFONTS
Search path for font metric (.tfm) files. Default: @DEFAULT_TFM_PATH@
TEXFORMATS
Search path for format files. Default: @DEFAULT_FMT_PATH@
TEXPOOL
search path for initex internal strings. Default: @DEFAULT_TEXPOOL_PATH@
TEXEDIT
Command template for switching to editor. Default: vi +%d %s
MAKETEXTEX
Arguments to pass to the MakeTeXTeX script before the filename to create. None by default. (If set, also implies invoking MakeTeXTeX.)
USE_MAKETEXTEX
If set, a program MakeTeXTeX is invoked when TeX cannot find an input file (before it complains about ``can't find file''). If neither MAKETEXTEX nor USE_MAKETEXTEX are set, whether MakeTeXTeX is invoked is the choice of installer.
MAKETEXTFM
Analogous.
USE_MAKETEXTFM
Analogous.
 

FILES

/ade/lib/texmf/ini/tex.pool
Encoded text of TeX's messages.
/ade/lib/texmf/fonts/texfonts.map
Filename mapping definitions.
/ade/lib/texmf/fonts//*.tfm
Metric files for TeX's fonts.
/ade/lib/texmf/fonts//*.nnn{gf,pk}
Character bitmaps for various devices. These files are not used by TeX.
/ade/lib/texmf/ini/*.fmt
Predigest TeX format (.fmt) files.
/ade/lib/texmf/tex//plain.tex
The basic macro package described in the TeX book.
 

SEE ALSO

mf(1), undump(1),
Donald E. Knuth, The TeX book, Addison-Wesley, 1986, ISBN 0-201-13447-0.
Leslie Lamport, LaTeX - A Document Preparation System, Addison-Wesley, 1985, ISBN 0-201-15790-X.
Michael Spivak, The Joy of TeX , 2nd edition, Addison-Wesley, 1990, ISBN 0-8218-2997-1.
TUGboat (the journal of the TeX Users Group).  

TRIVIA

TeX, pronounced properly, rhymes with ``blecchhh.'' The proper spelling in typewriter-like fonts is ``TeX'' and not ``TEX'' or ``tex.''  

AUTHORS

TeX was designed by Donald E. Knuth, who implemented it using his Web system for Pascal programs. It was ported to Unix at Stanford by Howard Trickey, and at Cornell by Pavel Curtis. The version now offered with the Unix TeX distribution is that generated by the Web to C system (web2c), originally written by Tomas Rokicki and Tim Morgan.


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT
FILES
SEE ALSO
TRIVIA
AUTHORS

This document was created by man2html, using the manual pages.
Time: 15:35:49 GMT, January 15, 2023