TEX(1)
okay bestie, buckle up: this is TEX(1) from the General Commands Manual, and we're doing TeX together. π This is part one of three, and no cap, every single filename, flag, path, and warning is staying exactly intact. fr fr.
β¨ NAME β¨
tex, initex - text formatting and typesetting. π That's the whole vibe: these are the text-formatting and typesetting girlies.
π SYNOPSIS π
tex [options] [&format] [ file [ more-input ] | [ \more-input ]
π DESCRIPTION π
Run the TeX typesetter on file[.tex], usually creating file.dvi. If the file argument has no extension, .tex will be appended to it. β¨
The normal usage is literally this:
tex paper
to process paper.tex with TeX. The name paper will be the so-called "jobname", and it's used in forming output filenames. If TeX doesn't get a filename in the first line, the jobname is texput. When looking for a file, TeX looks for the name with and without the default extension (.tex) appended, unless the name already contains that extension. If paper is the jobname, a log of error messages β with rather more detail than normally appears on the screen β will be written to paper.log, and the output file will be paper.dvi. The --jobname option sets the jobname explicitly. π
TeX formats the interspersed text and commands contained in the input and outputs a so-called DVI file, which is short for DeVice Independent. DVI files are a device-independent binary representation of the pages in the output document. They can be displayed online (e.g., xdvi(1)), translated to PDF (dvipdfmx(1)), PostScript (dvips(1)), or otherwise manipulated. Other engines (pdftex(1), luatex(1)), descendants of original TeX, can output PDF directly. π
TeX's capabilities and language are described in many places (see the references), including Donald Knuth's original book, The TeXbook. TeX is normally used with a large body of precompiled macros, called a format. Knuth's original format is named plain. Other formats, notably latex(1), are much larger, but still implemented entirely as TeX macros. π¦
πΈ Command line processing πΈ
To process the command line, after first reading any option(s) (listed below), if the first non-option argument does not begin with an escape character (normally a backslash), TeX internally prepends \input to the non-option arguments. Whether the \input was prepended or not, TeX then processes the text as normal TeX input, including macro expansion. π«
With no non-option arguments, TeX gives you a ** interactive prompt; whatever text you enter is processed in exactly the same way as non-option command line arguments. π
Examples:
tex fooβ executes"\input foo".tex foo barβ executes"\input foo bar", which inputsfoo.texand then typesets the string"bar".tex \\endβ executes\end; here the double backslash is one common way of escaping the backslash for the shell. TeX must see only one backslash. π
To reiterate, the text of an input filename, as well as any text following a filename, is subject to TeX's macro expansion. As a result, a ~ character is normally not usable within a filename, since ~ is conventionally defined to be an active character that expands into several primitive tokens, which can't be part of a filename. You can usually use \string~ to get a literal ~ character. More on input filenames: https://tug.org/texinfohtml/web2c.html#Input-filenames π«Ά
π Format (.fmt) selection π
With an argument &format, TeX reads the set of precompiled commands contained in the (binary) file format.fmt instead of the default tex.fmt (searched for using the TEXFORMATS path; see environment section below). This is sometimes more convenient than the -fmt format option, which is equivalent. β¨
The TeX implementation in TeX Live (a.k.a. Web2C) looks at its command line to find the name it was invoked as. When called as initex (or when the -ini option is given, which is equivalent) it can be used to precompile macros into a .fmt file. When called as virtex it will use the plain format. Nowadays, if either or both of the executables initex and virtex exist, they are symbolic links to the tex executable; the virtex symlink is not made by default in TeX Live. π
When invoked as any other name, TeX will use that name as the name of the format to use. Most notably, when invoked as tex the format file tex.fmt is read, which is identical to the plain format. The commands defined by the plain format are described in Appendix B of The TeXbook, among other places (see references below). The other TeX engines follow the same convention; for example, the latex command is a symlink to the pdftex binary, and reads latex.fmt. π
This implementation of TeX can look in the first line of the file paper.tex to see if it begins with the magic two-character sequence %&. If the first line begins with %&format -translate-file tcxname then TeX will use the named format and (if specified) translation table tcxname to process the source file. Either the format name or the -translate-file specification may be omitted, but not both. This overrides the format selection based on the name by which the program is invoked. The -parse-first-line option or the parse_first_line configuration variable controls whether this behavior is enabled. It is disabled for the original TeX, and enabled for all other engines. π
π¦ Input encodings π¦
TeX, predating Unicode as it does, reads input byte by byte, and has no native recognition for UTF-8 or any other encoding. This is also the case for pdfTeX. However, to a large extent, UTF-8 can be parsed at the TeX macro level, and packages have been developed for this. For native recognition of Unicode, the engines luatex(1) and xetex(1) are available, with corresponding formats. π
π Error handling π
TeX's error messages can be rather unfortunately cryptic. As general advice, sometimes only the first error matters, so it's worth trying to fix that first. Cutting down the input file can be helpful if mysteries remain. For more advice, including on a few specific problems: https://texfaq.org/index#errors π iykyk.
A convenient file in most distributions 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, aka Ctrl+D). π«Ά
When TeX reports an error, by default it puts you into an interactive dialog with a ? prompt. Responding with another ? shows you the available responses, for example, x quits immediately. 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 may 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 specifying emacs to be run can be set like this (in Bourne shell syntax): π
TEXEDIT="emacs +%d %s"; export TEXEDIT
To debug problems with finding files, see the --kpathsea-debug option below. π
β¨ OPTIONS β¨
Okay so TeX (in TeX Live and Web2C) understands these command line options, and most of them are also supported by the derived engines. No cap.
You can start options with either - or -- β this doc and others use - and -- interchangeably, so don't stress. Options can be separated from their values with either an = character or whitespace. If a filename or other non-option starts with a dash, put it after an option --. All the programs in the TeX family (and many non-TeX programs too; this command-line parsing comes originally from the GNU getopt_long_only(3) library function) follow these conventions.
In TeX and the other engines, all options must precede any non-option arguments, due to the peculiarities of TeX's first-line parsing described above. For the TeX utilities, options and non-options can be given in any order.
-helpβ Print help message and exit.-cnf-line stringβ Parsestringas atexmf.cnfconfiguration line. See the Kpathsea manual.-encβ Enable the encTeX extensions. This option is only effective in combination with-ini. For documentation of the encTeX extensions seehttp://www.olsak.net/enctex.html.-[no-]file-line-errorβ Print error messages in the formfile:line:error, which is similar to the way many other compilers format them. By default, or with-no-, TeX's default error format is used, usually starting with an!character.-file-line-error-styleβ This is the old name of the-file-line-erroroption.-fmt formatβ Useformatas the name of the format to be used, instead of the name by which TeX was called or a%&line. (See above and below for more on formats.)-halt-on-errorβ Exit with an error code when an error is encountered during processing.-iniβ Start in INI mode, which is used to dump formats. The INI mode can be used for typesetting, but no format is preloaded, and basic initializations like setting catcodes may be required.-interaction modeβ Sets the interaction mode. The mode can be eitherbatchmode,nonstopmode,scrollmode, anderrorstopmode. The meaning of these modes is the same as that of the corresponding\commands.-ipcβ Send DVI output to a socket as well as the usual output file. Whether this option is available is the choice of the installer.-ipc-startβ As-ipc, and starts the server at the other end as well. Whether this option is available is the choice of the installer.-jobname nameβ Usenamefor the job name, instead of deriving it from the name of the input file. (See above.)-kpathsea-debug bitmaskβ Sets path searching debugging flags according to thebitmask. See the Kpathsea manual for details:https://tug.org/texinfohtml/kpathsea.html#Debugging-[no-]mktex fmtβ Enable (disable)mktexfmt, wherefmtmust betex, ortfm. See the Kpathsea manual:https://tug.org/texinfohtml/kpathsea.html#mktex-scripts-mltexβ Enable MLTeX (Multi-lingual TeX) extensions. Only effective in combination with-ini. More info:https://tug.org/texinfohtml/web2c.html#MLTeX-output-comment stringβ Usestringfor the DVI file comment instead of the date.-output-directory directoryβ Write output files indirectoryinstead of the current directory. Look up input files indirectoryfirst, then along the normal search path. See also the description below of theTEXMFOUTPUTenvironment variable.-[no-]parse-first-lineβ Enable (or disable) checking the first line of the main input file for%&and, if so, parsing it to look for a format name or a-translate-fileoption.-progname nameβ Pretend to be programnamefor purposes of Kpathsea lookups. This affects both the format used and the search paths.-recorderβ Enable the filename recorder. This outputs a machine-readable trace of all files opened for input and output in a file with the usual jobname and extension.fls.-[no-]shell-escapeβ Allow (or disallow) documents to execute arbitrary shell commands via the\write18{command}construct. This feature is normally restricted for security reasons to a very few known-safe programs.
Security tea, bestie π¨: use this option, which enables execution of any command at all, only for trusted documents. More on shell escapes: https://tug.org/texinfohtml/web2c.html#Shell-escapes
-src-specialsβ Insert source specials into thedvifile. This is used forsynctex(1). In editors that support SyncTeX, you can click in the output window and get back to the corresponding location in the source.-src-specials whereβ Insert source specials in certain places of the DVI file;whereis a comma-separated value list:cr,display,hbox,math,par,parent, orvbox.-translate-file tcxnameβ Use the translation table in the filetcxnameto set the mapping of input characters and re-mapping of output characters.-default-translate-file tcxnameβ Like-translate-fileexcept that a%&line can override this setting.-8bitβ Make all characters printable by default.-versionβ Print version information and exit.
πΈ ENVIRONMENT πΈ
Numerous environment variables can be used to find files. A few are mentioned here, but see the Kpathsea(rch) library documentation (e.g., https://tug.org/texinfohtml/kpathsea.html#TeX-support) for a more comprehensive list, and how they are used. The kpsewhich(1) utility can be used to query the values of the variables. In Kpathsea specifications, // means to search subdirectories recursively.
Every variable setting in texmf.cnf can be overridden by the environment variable of the same (or associated) name, as explained tersely at the top of texmf.cnf, and more completely in the Kpathsea documentation.
TEXMFOUTPUTβ 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 variableTEXMFOUTPUT. There is no default value for that variable. For example, if you saytex paperand the current directory is not writable, ifTEXMFOUTPUThas the value/tmp, TeX attempts to create/tmp/paper.log(and/tmp/paper.dvi, if any output is produced.)TEXMFOUTPUTis also checked for input files, as TeX often generates files that need to be subsequently read; for input, no suffixes (such as.tex) are added; the input name is simply checked as given.
If the -output-directory option is given, TeX sets TEXMFOUTPUT in the environment to its value, so that programs invoked by TeX have it available.
More on output file location: https://tug.org/texinfohtml/web2c.html#Output-file-location
TEXINPUTSβ Search path for\inputand\openinfiles. By default, this starts with.(a period, meaning the current directory as usual), so that user files are found before system files. An empty path component will be replaced with the paths defined in thetexmf.cnffile. For example, setTEXINPUTSto".:/home/user/tex:"to prepend the current directory and/home/user/texto the standard search path.TEXMFDOTDIRβ In TeX Live'stexmf.cnf,TEXINPUTSand other paths don't start literally with., but rather with$TEXMFDOTDIR, which in turn defaults to.. This indirection makes it easy to, for example, search the current directory and all its subdirectories for everything: setTEXMFDOTDIRto.//.TEXFORMATSβ Search path for format files (.fmt). They are typically stored under theTEXMFSYSVARdirectory. You can find the exact location oftex.fmt(for example) with thiskpsewhichinvocation:kpsewhich -engine=/ -all tex.fmtTEXPOOLβ Search path for TeX's internal strings (.pool); this is only relevant for original TeX; the extended engines all have the strings compiled into the binary.TFMFONTSβ Search path for font metric (.tfm) files.TEXEDITβ Command template for switching to editor (see above). The default, usuallyvi, is set when TeX is compiled.
π FILES π
The locations of the files mentioned below varies from system to system. Use the kpsewhich utility to find their locations.
texmf.cnfβ Configuration file. This contains definitions of search paths as well as other configuration parameters likeparse_first_line.tex.poolβ Text file containing TeX's internal strings.*.tfmβ Metric files for TeX's fonts.*.fmtβ Predigested TeX format (.fmt) files.$TEXMFMAIN/tex/plain/base/plain.texβ The basic macro package described in The TeXbook.$TEXMFMAIN/tex/plain/config/tex.iniβ The driver file that builds the plain format file,tex.fmt, in TeX Live.
π BUGS π
This version of TeX implements a number of extensions, which technically conflict with the definition of original TeX (although almost never make a difference in practice). When such extensions are enabled, the banner printed when TeX starts is changed to print TeXk instead of TeX.
This version of TeX fails to trap arithmetic overflow when dimensions are added or subtracted. Cases where this occurs are rare, but when it does the program may crash, and/or the generated DVI file will be invalid. Patches to catch such overflow cases would be welcome. π
Knuth still accepts new bug reports for TeX, but only reviews them every several years. They are vetted in advance by a small group of experienced volunteers. For a list of submitted reports and other information: https://tug.org/texmfbug
Naturally, bugs in engines other than original TeX should be directed to their respective mailing lists and maintainers.
π SEE ALSO π
okay bestie, here's your reading list, and it is stacked π
The classic tomes, no cap:
- Donald E. Knuth, The TeXbook, Addison-Wesley.
- Leslie Lamport, LaTeX: A Document Preparation System, Addison-Wesley.
π free docs on the TeX language π
- Petr Olsak, TeX in a Nutshell: https://ctan.org/pkg/tex-nutshell
- Plain TeX documentation topic on CTAN: https://ctan.org/topic/tut-plaintex
- Victor Eijkhout, TeX By Topic, A TeXnician's reference: https://www.eijkhout.net/tex/tex-by-topic.html
- Paul W. Abrahams, Kathryn Hargreaves, Karl Berry, TeX for the Impatient, all about TeX, plain TeX, and
eplain(1)β and it's available in French and Chinese translations too, we love an inclusive icon π«Ά: https://ctan.org/pkg/impatient
π¦ some online info π¦
- Getting Started with TeX, LaTeX, and friends β a short web page with selected resources: https://tug.org/begin
- David Bausum, TeX primitive control sequences: https://tug.org/utilities/plain/cseq.html
- Levels of TeX, briefly describing the various engines and formats: https://tug.org/levels
- TeX Live web pages: https://tug.org/texlive
- Web2C Texinfo manual and web page: https://tug.org/web2c
- Kpathsea Texinfo manual and web page: https://tug.org/kpathsea
- Sources for the TeX-world literate programs, as pdf: https://ctan.org/pkg/knuth-pdf
- TUGboat β the journal of the TeX Users Group, and yes submissions are welcome, main character energy fr π₯: https://tug.org/TUGboat
If you find TeX useful, please consider joining or supporting the TeX Users Group, or another user group in your area. lowkey iconic of you π https://tug.org https://tug.org/usergroups.html
π TRIVIA π
okay so this one is my favorite part. TeX, pronounced properly, rhymes with ``blecchhh''. π literally. not "teks", not "tex", blecchhh.
And the proper spelling in typewriter-like fonts is TeX'' and **not** TEX'' or ``tex''. The way that capitalization is load-bearing, bestie. <rainbow>TeX</rainbow> or nothing. periodt. π
πΈ AUTHORS πΈ
TeX was created 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 included in TeX Live β the current Unix TeX distribution β is generated by the Web2C system originally written by Tomas Rokicki and Tim Morgan. absolute legends, all of them π«Ά
Where to yell about stuff:
- Bug reports in original TeX (exceedingly rare, like spotting a unicorn π¦): https://tug.org/texmfbug
- Public mailing list for implementation questions and reports: https://lists.tug.org/tex-k
- Public discussion list for TeX Live: https://lists.tug.org/tex-live
- Public discussion list for all things TeX (and LaTeX): https://lists.tug.org/texhax
and that's the whole page, bestie!! π this version is from Web2C 2026, dated 24 January 2026 β go forth and typeset something gorgeous. mwah πβ¨
π¦ where this page comes from
- alpine 3.24: texmf-dist-doc 2026.0-r0 Β· LPPL-1.0 AND LPPL-1.1 AND LPPL-1.2 AND LPPL-1.3a AND LPPL-1.3c AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms