Man Pages

tex - phpMan tex - phpMan

Command: man perldoc info search(apropos)  


File: web2c.info,  Node: tex invocation,  Next: Initial TeX,  Up: TeX

4.1 `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' (*note References::).

   TeX, Metafont, and MetaPost process the command line (described
here) and determine their memory dump (fmt) file in the same way (*note
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 (*note
Supported file formats: (kpathsea)Supported file formats.), 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
(*note Introduction: (dvips)Top.) 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
`mktextfm' to create any nonexistent TFM files.  You can disable this
at configure-time or runtime (*note mktex configuration:
(kpathsea)mktex configuration.).  This is enabled mostly for the sake
of the EC 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 implications).  To alleviate this,
there is a configuration variable `openout_any', which selects one of
three levels of security.  When it is set to `a' (for "any"), no
restrictions are imposed.  When it is set to `r' (for "restricted"),
filenames beginning with `.' are disallowed (except `.tex' because
LaTeX needs it).  When it is set to `p' (for "paranoid") additional
restrictions are imposed: an absolute filename must refer to a file in
(a subdirectory) of `TEXMFOUTPUT', and any attempt to go up a directory
level is forbidden (that is, paths may not contain a `..'  component).
The paranoid setting is the default.  (For backwards compatibility, `y'
and `1' are synonyms of `a', while `n' and `0' are synonyms for `r'.)

   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' (*note Common options::):
`-enc'
`-[no]-file-line-error'
`-fmt=FMTNAME'
`-halt-on-error'
`-ini'
`-interaction=STRING'
`-ipc'
`-ipc-start'
`-jobname=STRING'
`-kpathsea-debug=NUMBER'
`-[no]parse-first-line'
`-output-directory'
`-progname=STRING'
`-recorder'
`-translate-file=TCXFILE'
`-8bit'
     These options are common to TeX, Metafont, and MetaPost.  *Note
     Common options::.

`-enc'
     Enable encTeX extensions, such as `\mubyte'.  This can be used to
     support Unicode UTF-8 input encoding.  See
     `http://www.olsak.net/enctex.html'.

`-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.  *Note IPC and
     TeX: IPC and TeX.

     These options are available only if the `--enable-ipc' option was
     specified to `configure' during installation of Web2c.

`-mktex=FILETYPE'
`-no-mktex=FILETYPE'
     Turn on or off the `mktex' script associated with FILETYPE.  The
     only values that make sense for FILETYPE are `tex' and `tfm'.

`-mltex'
     If we are `INITEX' (*note Initial and virgin::), enable MLTeX
     extensions such as `\charsubdef'.  Implicitly set if the program
     name is `mltex'.  *Note MLTeX: MLTeX.

`-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'
`-no-shell-escape'
     Enable (or disable) the `\write18{SHELL-COMMAND}' feature.  This
     is also enabled if the environment variable or config file value
     `shell_escape' is set to `t' (but the `-no-shell-escape' command
     line option overrides this).  (For backwards compatibility, `y'
     and `1' are accepted as synonyms of `t').  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'.)

`-src-specials'
`-src-specials=STRING'
     This option makes TeX output specific source information using
     `\special' commands in the DVI file. These `\special' track the
     current file name and line number.

     Using the first form of this option, the `\special' commands are
     inserted automatically.

     In the second form of the option, STRING is a comma separated list
     of the following values: `cr', `display', `hbox', `math', `par',
     `parend', `vbox'. You can use this list to specify where you want
     TeX to output such commands. For example, `-src-specials=cr,math'
     will output source information every line and every math formula.

     These commands  can  be used with  the  appropriate DVI viewer and
     text editor to switch from the current position in the editor to
     the same position in the viewer and back from the viewer to the
     editor.

     This option works by inserting `\special' commands into the token
     stream, and thus in principle these additional tokens can be
     recovered or seen by the tricky-enough macros.  If you run across
     a case, let us know, because this counts as a bug.  However, such
     bugs are very hard to fix, requiring significant changes to TeX,
     so please don't count on it.

     Redefining `\special' will not affect the functioning of this
     option.  The commands inserted into the token stream are
     hard-coded to always use the `\special' primitive.

     TeX does not pass the trip test when this option is enabled.