{
    "mode": "info",
    "parameter": "tex",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/tex/json",
    "generated": "2026-11-15T14:48:13Z",
    "sections": {
        "File: web2c.info,  Node: tex invocation,  Next: Initial TeX,  Up: TeX": {
            "content": "",
            "subsections": [
                {
                    "name": "5.1 'tex' invocation",
                    "content": ""
                }
            ]
        },
        "TeX (usually invoked as 'tex') formats the given text and commands, and": {
            "content": "outputs a corresponding device-independent representation of the typeset\ndocument.  This section merely describes the options available in the",
            "subsections": []
        },
        "Web2c implementation.  For a complete description of the TeX typesetting": {
            "content": "language, see 'The TeXbook' (*note References::).\n\nTeX, Metafont, and MetaPost process the command line (described here)\nand determine their memory dump (fmt) file in the same way (*note Memory\ndumps::).  Synopses:\n\ntex [OPTION]... [TEXNAME[.tex]] [TEX-COMMANDS]\ntex [OPTION]... \\FIRST-LINE\ntex [OPTION]... &FMT ARGS\n\nTeX searches the usual places for the main input file TEXNAME (*note\n(kpathsea)Supported file formats::), extending TEXNAME with '.tex' if\nnecessary.  To see all the relevant paths, set the environment variable\n'KPATHSEADEBUG' to '-1' before running the program.\n\nAfter TEXNAME is read, TeX processes any remaining TEX-COMMANDS on\nthe command line as regular TeX input.  Also, if the first non-option\nargument begins with a TeX escape character (usually '\\'), TeX processes\nall non-option command-line arguments as a line of regular TeX input.\n\nIf no arguments or options are specified, TeX prompts for an input\nfile name with ''.\n\nTeX writes the main DVI output to the file 'BASETEXNAME.dvi', where\nBASETEXNAME is the basename of TEXNAME, or 'texput' if no input file was\nspecified.  A DVI file is a device-independent binary representation of\nyour TeX document.  The idea is that after running TeX, you translate\nthe DVI file using a separate program to the commands for a particular\noutput device, such as a PostScript printer (*note Introduction:\n(dvips)Top.) or an X Window System display (see xdvi(1)).\n\nTeX also reads TFM files for any fonts you load in your document with\nthe '\\font' primitive.  By default, it runs an external program named\n'mktextfm' to create any nonexistent TFM files.  You can disable this at\nconfigure-time or runtime (*note (kpathsea)mktex configuration::).  This\nis enabled mostly for the sake of the EC fonts, which can be generated\nat any size.\n\nTeX can write output files, via the '\\openout' primitive; this opens\na security hole vulnerable to Trojan horse attack: an unwitting user\ncould run a TeX program that overwrites, say, '~/.rhosts'.  (MetaPost\nhas a 'write' primitive with similar implications).  To alleviate this\nand similar problems the functions 'kpathseaoutnameok' and\n'kpathseainnameok' from the Kpathsea library (*note (kpathsea)Calling\nsequence::) are used to determine if a given filename is acceptable to\nbe opened for output or input, depending on the setting of the\nconfiguration variables 'openoutany' and 'openinany': 'a' (for \"any\",\nthe default for 'openinany'), 'r' (for \"restricted\"), or 'p' (for\n\"paranoid\", the default for 'openoutany').\n\nIn any case, all '\\openout' filenames are recorded in the log file,\nexcept those opened on the first line of input, which is processed when\nthe log file has not yet been opened.\n\nThe program accepts the following options, as well as the standard\n'-help' and '-version' (*note Common options::):\n'-enc'\n'-[no]-file-line-error'\n'-fmt=FMTNAME'\n'-halt-on-error'\n'-ini'\n'-interaction=STRING'\n'-ipc'\n'-ipc-start'\n'-jobname=STRING'\n'-kpathsea-debug=NUMBER'\n'-[no]parse-first-line'\n'-output-directory'\n'-progname=STRING'\n'-recorder'\n'-translate-file=TCXFILE'\n'-8bit'\nThese options are common to TeX, Metafont, and MetaPost.  *Note\nCommon options::.\n\n'-enc'\nEnable encTeX extensions, such as '\\mubyte'.  This can be used to\nsupport the Unicode UTF-8 input encoding, although using an engine\nwith native Unicode support is more common nowadays.\n<http://www.olsak.net/enctex.html>.\n\n'-ipc'\n'-ipc-start'\nWith either option, TeX writes its DVI output to a socket as well\nas to the usual '.dvi' file.  With '-ipc-start', TeX also opens a\nserver program at the other end to read the output.  *Note IPC and\nTeX: IPC and TeX.\n\nThese options are available only if the '--enable-ipc' option was\nspecified to 'configure' during installation of Web2c.\n\n'-mktex=FILETYPE'\n'-no-mktex=FILETYPE'\nTurn on or off the 'mktex' script associated with FILETYPE.  For\nTeX proper, FILETYPE can only be 'tex' and 'tfm', but for pdfTeX\nand luaTeX, it can also be 'pk'.\n\n'-mltex'\nIf we are 'INITEX' (*note Initial and virgin::), enable MLTeX\nextensions such as '\\charsubdef'.  Implicitly set if the program\nname is 'mltex'.  *Note MLTeX: MLTeX.\n\n'-output-comment=STRING'\nUse STRING as the DVI file comment.  Ordinarily, this comment\nrecords the date and time of the TeX run, but if you are doing\nregression testing, you may not want the DVI file to have this\nspurious difference.  This is also taken from the environment\nvariable and config file value 'outputcomment'.\n\n'-shell-escape'\n'-no-shell-escape'\n'-shell-restricted'\nEnable, or disable, or enable with restrictions the\n'\\write18{SHELL-COMMAND}' feature for external executing shell\ncommands.  *Note Shell escapes::.\n\n'-enable-write18'\n'-disable-write18'\nSynonyms for '-shell-escape' and '-no-shell-escape', for\ncompatibility with MiKTeX.  (MiKTeX also accepts both pairs of\noptions.)  *Note Shell escapes::.\n\n'-src-specials'\n'-src-specials=STRING'\nThis option makes TeX output specific source information using\n'\\special' commands in the DVI file.  These '\\special' track the\ncurrent file name and line number.\n\nUsing the first form of this option, the '\\special' commands are\ninserted automatically.\n\nIn the second form of the option, STRING is a comma separated list\nof the following values: 'cr', 'display', 'hbox', 'math', 'par',\n'parend', 'vbox'.  You can use this list to specify where you want\nTeX to output such commands.  For example, '-src-specials=cr,math'\nwill output source information every line and every math formula.\n\nThese commands can be used with the appropriate DVI viewer and text\neditor to switch from the current position in the editor to the\nsame position in the viewer and back from the viewer to the editor.\n\nThis option works by inserting '\\special' commands into the token\nstream, and thus in principle these additional tokens can be\nrecovered or seen by the tricky-enough macros.  If you run across a\ncase, let us know, because this counts as a bug.  However, such\nbugs are very hard to fix, requiring significant changes to TeX, so\nplease don't count on it.\n\nRedefining '\\special' will not affect the functioning of this\noption.  The commands inserted into the token stream are hard-coded\nto always use the '\\special' primitive.\n\nTeX does not pass the trip test when this option is enabled.\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}