{
    "mode": "man",
    "parameter": "TEX",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/TEX/1/json",
    "generated": "2026-06-15T13:53:27Z",
    "synopsis": "tex [options] [&format] [file|\\commands]",
    "sections": {
        "NAME": {
            "content": "tex, initex - text formatting and typesetting\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "tex [options] [&format] [file|\\commands]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Run  the  TeX typesetter on file, usually creating file.dvi.  If the file argument has no ex‐\ntension, \".tex\" will be appended to it.  Instead of a filename, a set of TeX commands can  be\ngiven,  the  first  of which must start with a backslash.  With a &format argument TeX uses a\ndifferent set of precompiled commands, contained in format.fmt; it is usually better  to  use\nthe -fmt format option instead.\n\nTeX  formats  the  interspersed  text and commands contained in the named files and outputs a\ntypesetter independent file (called DVI, which is short for DeVice Independent).  TeX's capa‐\nbilities  and  language are described in The TeXbook.  TeX is normally used with a large body\nof precompiled macros, and there are several specific  formatting  systems,  such  as  LaTeX,\nwhich require the support of several macro files.\n\nThis  version of TeX looks at its command line to see what name it was called under.  If they\nexist, then both initex and virtex are symbolic links to the tex executable.  When called  as\ninitex  (or  when  the  -ini option is given) it can be used to precompile macros into a .fmt\nfile.  When called as virtex it will use the plain format.  When called under any other name,\nTeX will use that name as the name of the format to use.  For example, when called as tex the\ntex format is used, which is identical to the plain format.   The  commands  defined  by  the\nplain  format  are documented in The TeXbook.  Other formats that are often available include\nlatex and amstex.\n\nThe non-option command line arguments to the TeX program are passed to it as the first  input\nline.  (But it is often easier to type extended arguments as the first input line, since UNIX\nshells tend to gobble up or misinterpret TeX's favorite symbols, like backslashes, unless you\nquote  them.)   As  described in The TeXbook, that first line should begin with a filename, a\n\\controlsequence, or a &formatname.\n\nThe normal usage is to say\ntex paper\nto start processing paper.tex.  The name paper will be the ``jobname'', and is used in  form‐\ning  output  filenames.  If TeX doesn't get a filename in the first line, the jobname is tex‐\nput.  When looking for a file, TeX looks for the name with and without the default  extension\n(.tex)  appended,  unless  the  name already contains that extension.  If paper is the ``job‐\nname'', a log of error messages, with rather more detail than normally appears on the screen,\nwill appear in paper.log, and the output file will be in paper.dvi.\n\nThis version of TeX can look in the first line of the file paper.tex to see if it begins with\nthe magic sequence %&.  If the first line begins with %&format  -translate-file tcxname  then\nTeX  will use the named format and translation table tcxname to process the source file.  Ei‐\nther the format name or the -translate-file specification may be omitted, but not both.  This\noverrides  the  format  selection  based  on  the  name by which the program is invoked.  The",
            "subsections": [
                {
                    "name": "-parse-first-line",
                    "content": "behaviour is enabled.\n\nThe e response to TeX's error prompt causes the system default editor to start up at the cur‐\nrent line of the current file.  The environment variable TEXEDIT can be used  to  change  the\neditor  used.   It may contain a string with \"%s\" indicating where the filename goes and \"%d\"\nindicating where the decimal line number (if any) goes.  For example, a  TEXEDIT  string  for\nemacs can be set with the sh command\nTEXEDIT=\"emacs +%d %s\"; export TEXEDIT\n\nA convenient file in the library is null.tex, containing nothing.  When TeX can't find a file\nit thinks you want to input, it keeps asking you for another filename; responding `null' gets\nyou  out of the loop if you don't want to input anything.  You can also type your EOF charac‐\nter (usually control-D).\n"
                }
            ]
        },
        "OPTIONS": {
            "content": "This version of TeX understands the following command line options.\n",
            "subsections": [
                {
                    "name": "-cnf-line",
                    "content": "Parse string as a texmf.cnf configuration line.  See the Kpathsea manual.\n"
                },
                {
                    "name": "-enc -ini",
                    "content": "For documentation of the encTeX extensions see http://www.olsak.net/enctex.html.\n"
                },
                {
                    "name": "-file-line-error",
                    "content": "Print error messages in the form file:line:error which is similar to the way many com‐\npilers format them.\n"
                },
                {
                    "name": "-no-file-line-error",
                    "content": "Disable printing error messages in the file:line:error style.\n"
                },
                {
                    "name": "-file-line-error-style",
                    "content": "This is the old name of the -file-line-error option.\n"
                },
                {
                    "name": "-fmt",
                    "content": "Use format as the name of the format to be used, instead of the name by which TeX  was\ncalled or a %& line.\n"
                },
                {
                    "name": "-halt-on-error",
                    "content": "Exit with an error code when an error is encountered during processing.\n"
                },
                {
                    "name": "-help",
                    "content": ""
                },
                {
                    "name": "-ini",
                    "content": "setting, but no format is preloaded, and basic initializations like  setting  catcodes\nmay be required.\n"
                },
                {
                    "name": "-interaction",
                    "content": "Sets the interaction mode.  The mode can be either batchmode, nonstopmode, scrollmode,\nand errorstopmode.  The meaning of these modes is the same as that of the  correspond‐\ning \\commands.\n"
                },
                {
                    "name": "-ipc",
                    "content": "available is the choice of the installer.\n"
                },
                {
                    "name": "-ipc-start",
                    "content": "As -ipc, and starts the server at the other end  as  well.   Whether  this  option  is\navailable is the choice of the installer.\n"
                },
                {
                    "name": "-jobname",
                    "content": "Use name for the job name, instead of deriving it from the name of the input file.\n"
                },
                {
                    "name": "-kpathsea-debug",
                    "content": "Sets path searching debugging flags according to the bitmask.  See the Kpathsea manual\nfor details.\n"
                },
                {
                    "name": "-mktex",
                    "content": "Enable mktexfmt, where fmt must be either tex or tfm.\n"
                },
                {
                    "name": "-mltex -ini",
                    "content": ""
                },
                {
                    "name": "-no-mktex",
                    "content": "Disable mktexfmt, where fmt must be either tex or tfm.\n"
                },
                {
                    "name": "-output-comment",
                    "content": "Use string for the DVI file comment instead of the date.\n"
                },
                {
                    "name": "-output-directory",
                    "content": "Write output files in directory instead of the current directory.  Look up input files\nin  directory  first,  then along the normal search path.  See also description of the\nTEXMFOUTPUT environment variable.\n"
                },
                {
                    "name": "-parse-first-line",
                    "content": "If the first line of the main input file begins with %& parse it to look  for  a  dump\nname or a -translate-file option.\n"
                },
                {
                    "name": "-no-parse-first-line",
                    "content": "Disable parsing of the first line of the main input file.\n"
                },
                {
                    "name": "-progname",
                    "content": "Pretend to be program name.  This affects both the format used and the search paths.\n"
                },
                {
                    "name": "-recorder",
                    "content": "Enable  the  filename recorder.  This leaves a trace of the files opened for input and\noutput in a file with extension .fls.\n"
                },
                {
                    "name": "-shell-escape",
                    "content": "Enable the \\write18{command} construct.  The command can be any shell  command.   This\nconstruct is normally disallowed for security reasons.\n"
                },
                {
                    "name": "-no-shell-escape",
                    "content": "Disable the \\write18{command} construct, even if it is enabled in the texmf.cnf file.\n"
                },
                {
                    "name": "-src-specials",
                    "content": "Insert source specials into the DVI file.\n"
                },
                {
                    "name": "-src-specials",
                    "content": "Insert  source specials in certain places of the DVI file.  where is a comma-separated\nvalue list: cr, display, hbox, math, par, parent, or vbox.\n"
                },
                {
                    "name": "-translate-file",
                    "content": "Use the tcxname translation table to set the mapping of input characters  and  re-map‐\nping of output characters.\n"
                },
                {
                    "name": "-default-translate-file",
                    "content": "Like -translate-file except that a %& line can overrule this setting.\n"
                },
                {
                    "name": "-version",
                    "content": "Print version information and exit.\n"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "See  the  Kpathsearch  library documentation (the `Path specifications' node) for precise de‐\ntails of how the environment variables are used.  The kpsewhich utility can be used to  query\nthe values of the variables.\n\nOne caveat: In most TeX formats, you cannot use ~ in a filename you give directly to TeX, be‐\ncause ~ is an active character, and hence is expanded, not taken as  part  of  the  filename.\nOther programs, such as Metafont, do not have this problem.\n\nTEXMFOUTPUT\nNormally, TeX puts its output files in the current directory.  If any output file can‐\nnot be opened there, it tries to open it in the directory specified in the environment\nvariable  TEXMFOUTPUT.   There is no default value for that variable.  For example, if\nyou say tex paper and the current directory is not writable, if  TEXMFOUTPUT  has  the\nvalue  /tmp,  TeX attempts to create /tmp/paper.log (and /tmp/paper.dvi, if any output\nis produced.)  TEXMFOUTPUT is also checked for input files,  as  TeX  often  generates\nfiles that need to be subsequently read; for input, no suffixes (such as ``.tex'') are\nadded by default, the input name is simply checked as given.\n\nTEXINPUTS\nSearch path for \\input and \\openin files.  This should probably start with  ``.'',  so\nthat  user  files  are found before system files.  An empty path component will be re‐\nplaced with the paths defined in the texmf.cnf file.  For example,  set  TEXINPUTS  to\n\".:/home/user/tex:\"  to  prepend  the  current directory and ``/home/user/tex'' to the\nstandard search path.\n\nTEXFORMATS\nSearch path for format files.\n\nTEXPOOL\nsearch path for tex internal strings.\n\nTEXEDIT\nCommand template for switching to editor.  The default, usually vi, is set when TeX is\ncompiled.\n\nTFMFONTS\nSearch path for font metric (.tfm) files.\n\nNotes  for  Debian  developers: please keep in mind, that this version of the TeX interpreter\nignores the SOURCEDATEEPOCH variable. Instead the current timestamp is written into the DVI\nfile.  If  you  need  a reproducible time stamp, please use any engine based on pdfTeX, e.g.,\netex, pdftex, latex, pdflatex.\n",
            "subsections": []
        },
        "FILES": {
            "content": "The location of the files mentioned below varies from system to system.   Use  the  kpsewhich\nutility to find their locations.\n\ntexmf.cnf\nConfiguration  file.   This contains definitions of search paths as well as other con‐\nfiguration parameters like parsefirstline.\n\ntex.pool\nText file containing TeX's internal strings.\n\ntexfonts.map\nFilename mapping definitions.\n\n*.tfm  Metric files for TeX's fonts.\n\n*.fmt  Predigested TeX format (.fmt) files.\n\n$TEXMFMAIN/tex/plain/base/plain.tex\nThe basic macro package described in the TeXbook.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "This manual page is not meant to be exhaustive.  The complete documentation for this  version\nof TeX can be found in the info manual Web2C: A TeX implementation.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "This  version  of TeX implements a number of optional extensions.  In fact, many of these ex‐\ntensions conflict to a greater or lesser extent with the definition of TeX.  When such exten‐\nsions  are  enabled,  the  banner printed when TeX starts is changed to print TeXk instead of\nTeX.\n\nThis version of TeX fails to trap arithmetic overflow  when  dimensions  are  added  or  sub‐\ntracted.   Cases  where this occurs are rare, but when it does the generated DVI file will be\ninvalid.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "mf(1),\nDonald E. Knuth, The TeXbook, Addison-Wesley, 1986, ISBN 0-201-13447-0.\nLeslie  Lamport,  LaTeX  -  A  Document  Preparation  System,  Addison-Wesley,   1985,   ISBN\n0-201-15790-X.\nK. Berry, Eplain: Expanded plain TeX, https://tug.org/eplain\nMichael Spivak, The Joy of TeX, 2nd edition, Addison-Wesley, 1990, ISBN 0-8218-2997-1.\nTUGboat (the journal of the TeX Users Group).  https://tug.org/TUGboat\n",
            "subsections": []
        },
        "TRIVIA": {
            "content": "TeX,  pronounced  properly, rhymes with ``blecchhh.''  The proper spelling in typewriter-like\nfonts is ``TeX'' and not ``TEX'' or ``tex.''\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "TeX was created by Donald E. Knuth, who implemented it using his Web system for  Pascal  pro‐\ngrams.   It was ported to Unix at Stanford by Howard Trickey, and at Cornell by Pavel Curtis.\nThe version now offered with the Unix TeX distribution is that generated by the Web to C sys‐\ntem (web2c), originally written by Tomas Rokicki and Tim Morgan.\n\nThe encTeX extensions were written by Petr Olsak.\n\n\n\nWeb2C 2022/dev                              6 August 2019                                     TEX(1)",
            "subsections": []
        }
    },
    "summary": "tex, initex - text formatting and typesetting",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Parse string as a texmf.cnf configuration line. See the Kpathsea manual."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "For documentation of the encTeX extensions see http://www.olsak.net/enctex.html."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print error messages in the form file:line:error which is similar to the way many com‐ pilers format them."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Disable printing error messages in the file:line:error style."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This is the old name of the -file-line-error option."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use format as the name of the format to be used, instead of the name by which TeX was called or a %& line."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Exit with an error code when an error is encountered during processing."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "setting, but no format is preloaded, and basic initializations like setting catcodes may be required."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Sets the interaction mode. The mode can be either batchmode, nonstopmode, scrollmode, and errorstopmode. The meaning of these modes is the same as that of the correspond‐ ing \\commands."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "available is the choice of the installer."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "As -ipc, and starts the server at the other end as well. Whether this option is available is the choice of the installer."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use name for the job name, instead of deriving it from the name of the input file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Sets path searching debugging flags according to the bitmask. See the Kpathsea manual for details."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Enable mktexfmt, where fmt must be either tex or tfm."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Disable mktexfmt, where fmt must be either tex or tfm."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use string for the DVI file comment instead of the date."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Write output files in directory instead of the current directory. Look up input files in directory first, then along the normal search path. See also description of the TEXMFOUTPUT environment variable."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "If the first line of the main input file begins with %& parse it to look for a dump name or a -translate-file option."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Disable parsing of the first line of the main input file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Pretend to be program name. This affects both the format used and the search paths."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Enable the filename recorder. This leaves a trace of the files opened for input and output in a file with extension .fls."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Enable the \\write18{command} construct. The command can be any shell command. This construct is normally disallowed for security reasons."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Disable the \\write18{command} construct, even if it is enabled in the texmf.cnf file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Insert source specials into the DVI file."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Insert source specials in certain places of the DVI file. where is a comma-separated value list: cr, display, hbox, math, par, parent, or vbox."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Use the tcxname translation table to set the mapping of input characters and re-map‐ ping of output characters."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Like -translate-file except that a %& line can overrule this setting."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Print version information and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "mf",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mf/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Compile a DVI document from TeX source files.",
        "examples": [
            {
                "description": "Compile a DVI document",
                "command": "tex {{source.tex}}"
            },
            {
                "description": "Compile a DVI document, specifying an output directory",
                "command": "tex -output-directory={{path/to/directory}} {{source.tex}}"
            },
            {
                "description": "Compile a DVI document, exiting on each error",
                "command": "tex -halt-on-error {{source.tex}}"
            }
        ]
    }
}