Go to the first, previous, next, last section, table of contents.


tex invocation

TeX (usually invoked as tex) formats the given text and commands, and outputs a corresponding device-independent representation of the typeset document. This section merely describes the options available in the Web2c implementation. For a complete description of the TeX typesetting language, see The TeXbook (see section References).

TeX, Metafont, and MetaPost process the command line (described here) and determine their memory dump (fmt) file in the same way (see section Memory dumps). Synopses:

tex [option]... [texname[.tex]] [tex-commands]
tex [option]... \first-line
tex [option]... &fmt args

TeX searches the usual places for the main input file texname (see section `Supported file formats' in Kpathsea), extending texname with `.tex' if necessary. To see all the relevant paths, set the environment variable KPATHSEA_DEBUG to `-1' before running the program.

After texname is read, TeX processes any remaining tex-commands on the command line as regular TeX input. Also, if the first non-option argument begins with a TeX escape character (usually \), TeX processes all non-option command-line arguments as a line of regular TeX input.

If no arguments or options are specified, TeX prompts for an input file name with `**'.

TeX writes the main DVI output to the file `basetexname.dvi', where basetexname is the basename of texname, or `texput' if no input file was specified. A DVI file is a device-independent binary representation of your TeX document. The idea is that after running TeX, you translate the DVI file using a separate program to the commands for a particular output device, such as a PostScript printer (see section `Introduction' in Dvips) or an X Window System display (see xdvi(1)).

TeX also reads TFM files for any fonts you load in your document with the \font primitive. By default, it runs an external program named `MakeTeXTFM' to create any nonexistent TFM files. You can disable this at configure-time or runtime (see section `MakeTeX configuration' in Kpathsea). This is enabled mostly for the sake of the DC fonts, which can be generated at any size.

TeX can write output files, via the \openout primitive; this opens a security hole vulnerable to Trojan horse attack: an unwitting user could run a TeX program that overwrites, say, `~/.rhosts'. (MetaPost has a write primitive with similar implication). To alleviate this, there is a configuration variable `openout_any'; by default, this is set to `0', which disallows writing to any filename beginning with `.' except `.tex' (for the sake of the LaTeX distribution). If set to `1', any file can be written. In any case, all \openout filenames are recorded in the log file, except those opened on the first line of input, which is processed when the log file has not yet been opened. (If you as a TeX administrator wish to implement more stringent rules on \openout, modifying the function openoutnameok in `web2c/lib/texmfmp.c' is intended to suffice.)

The program accepts the following options, as well as the standard `-help' and `-version' (see section Common options):

`-kpathsea-debug=number'
`-ini'
`-fmt=fmtname'
`-progname=string'
These options are common to TeX, Metafont, and MetaPost. See section Common options.
`-extend-jobname=word'
Determine how TeX constructs the name of its output files (`.dvi', `.log', `.fmt'). word is one of `never', `maybe' (the default), or `always':
`maybe'
(default) If the input filename ends in one of these extensions:
.drv .dtx .ins .ltx .tex .texi .texinfo .txi
then TeX strips the extension; thus, `foo.tex' produces `foo.dvi', but `foo.bar.tex' produces `foo.bar.dvi'.
`never'
Never strip the extension: `foo.tex' produces `foo.tex.dvi'.
`always'
Always strip the extension: `foo.bar' produces `foo.dvi'. (This is the behavior of the original TeX program.)
`-ipc'
`-ipc-start'
With either option, TeX writes its DVI output to a socket as well as to the usual `.dvi' file. With `-ipc-start', TeX also opens a server program at the other end to read the output. See section IPC and TeX. These options are available only if the `--enable-ipc' option was specified to configure during installation of Web2c.
`-maketex=filetype'
`-no-maketex=filetype'
Turn on or off the `MakeTeX' script associated with filetype. The only values that make sense for filetype are `tex' and `tfm',
`-mltex'
If INITEX (see section Initial and virgin), enable MLTeX extensions such as \charsubdef. Implicitly set if the program name is mltex. See section MLTeX: Multi-lingual TeX.
`-output-comment=string'
Use string as the DVI file comment. Ordinarily, this comment records the date and time of the TeX run, but if you are doing regression testing, you may not want the DVI file to have this spurious difference. This is also taken from the environment variable and config file value `output_comment'.
`-shell-escape'
Enable the `\write18{shell-command}' feature. This is also enabled if the environment variable or config file value `shell_escape' is set to anything non-null that does not start with `n' or `0'. It is disabled by default to avoid security problems. When enabled, the shell-command string (which first undergoes the usual TeX expansions, just as in `\special') is passed to the command shell (via the C library function `system'). The output of shell-command is not diverted anywhere, so it will not appear in the log file. The system call either happens at `\output' time or right away, according to the absence or presence of the `\immediate' prefix, as usual for \write. (If you as a TeX administrator wish to implement more stringent rules on what can be executed, you will need to modify `tex.ch'.)


Go to the first, previous, next, last section, table of contents.