TEX(1)
๐ TEX(1) โ General Commands Manual ๐
okay bestie, so tex(1) is THE moment. this is the actual TeX typesetter, the blueprint, the blueprint's blueprint. let me tell you everything, no gatekeeping ๐
โจ NAME โจ
tex, initex โ text formatting and typesetting ๐ฆ
โจ SYNOPSIS โจ
tex [options] [&format] [file|\commands]
โจ DESCRIPTION โจ
so basically you run the TeX typesetter on file, and it's usually gonna make file.dvi. if the file argument has no extension, .tex gets appended to it โ like a little automatic glow-up โจ. and instead of a filename you can also just hand it a set of TeX commands, but heads up: the first of those has to start with a backslash, no exceptions.
with a &format argument, TeX uses a totally different set of precompiled commands living inside format.fmt. tho ngl, it's usually better to use the -fmt format option instead. iykyk.
TeX formats the interspersed text and commands inside the named files and outputs a typesetter independent file called DVI, which is short for DeVice Independent ๐. all of TeX's capabilities and its whole language are described in The TeXbook. TeX normally vibes with a big body of precompiled macros, and there are several specific formatting systems like LaTeX that need the support of several macro files.
this version of TeX looks at its command line to see what name it was called under, which is so main character of it:
- if they exist, both
initexandvirtexare symbolic links to thetexexecutable. - when called as
initex(or when you pass the-inioption) it can precompile macros into a.fmtfile ๐ฅ - when called as
virtexit uses theplainformat. - when called under any other name, TeX uses that name as the name of the format to use. for example, when called as
tex, thetexformat is used, which is identical to theplainformat.
the commands defined by the plain format are documented in The TeXbook. other formats that are often available include latex and amstex ๐
the non-option command line arguments to the TeX program get passed to it as the first input line. (tho honestly it's often easier to type extended arguments as the first input line, because UNIX shells tend to gobble up or misinterpret TeX's favorite symbols โ like backslashes โ unless you quote them. the shell is NOT respectful ๐ญ.) as described in The TeXbook, that first line should begin with a filename, a \controlsequence, or a &formatname.
the normal usage is to say
tex paper
to start processing paper.tex. the name paper will be the jobname'', and it's used when 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 way more detail than normally shows up on your screen โ will appear in paper.log, and the output file will be in paper.dvi. she keeps receipts ๐ซถ
this version of TeX can look at the first line of the file paper.tex to see if it begins with the magic sequence %&. if the first line begins with
%&format -translate-file tcxname
then TeX will use the named format and 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 behaviour is enabled.
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 for emacs can be set with the sh command
TEXEDIT="emacs +%d %s"; export TEXEDIT
a convenient file in the library is null.tex, containing absolutely nothing (iconic, honestly). 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) ๐
โจ OPTIONS โจ
this version of TeX understands the following command line options. buckle up bestie, there's a lot and they're all important:
-cnf-linestring โ parse string as 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.-file-line-errorโ print error messages in the formfile:line:error, which is similar to the way many compilers format them.-no-file-line-errorโ disable printing error messages in thefile:line:errorstyle.-file-line-error-styleโ this is the old name of the-file-line-erroroption.-fmtformat โ use format as the name of the format to be used, instead of the name by which TeX was called or a%&line.-halt-on-errorโ exit with an error code when an error is encountered during processing.-helpโ print help message and exit.-iniโ start in INI mode, which is used to dump formats. INI mode can be used for typesetting, but no format is preloaded, and basic initializations like setting catcodes may be required.-interactionmode โ sets the interaction mode. 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.-jobnamename โ use name for the job name, instead of deriving it from the name of the input file.-kpathsea-debugbitmask โ sets path searching debugging flags according to the bitmask. see the Kpathsea manual for details.-mktexfmt โ enablemktexfmt, where fmt must be eithertexortfm.-mltexโ enable MLTeX extensions. only effective in combination with-ini.-no-mktexfmt โ disablemktexfmt, where fmt must be eithertexortfm.-output-commentstring โ use string for the DVI file comment instead of the date.-output-directorydirectory โ 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 the description of theTEXMFOUTPUTenvironment variable.-parse-first-lineโ if the first line of the main input file begins with%&, parse it to look for a dump name or a-translate-fileoption.-no-parse-first-lineโ disable parsing of the first line of the main input file.-prognamename โ pretend to be program name. this affects both the format used and the search paths.-recorderโ enable the filename recorder. this leaves a trace of the files opened for input and output in a file with extension.fls.-shell-escapeโ enable the\write18{command}construct. the command can be any shell command. this construct is normally disallowed for security reasons ๐จ-no-shell-escapeโ disable the\write18{command}construct, even if it is enabled in thetexmf.cnffile.-src-specialsโ insert source specials into the DVI file.-src-specialswhere โ insert source specials in certain places of the DVI file. where is a comma-separated value list:cr,display,hbox,math,par,parent, orvbox.-translate-filetcxname โ use the tcxname translation table to set the mapping of input characters and re-mapping of output characters.-default-translate-filetcxname โ like-translate-fileexcept that a%&line can overrule this setting.-versionโ print version information and exit.
โจ ENVIRONMENT โจ
see the Kpathsearch library documentation (the Path specifications' node) for precise details of how the environment variables are used. the kpsewhich` utility can be used to query the values of the variables.
one caveat bestie: in most TeX formats, you cannot use~in a filename you give directly to TeX, because~is an active character, and hence is expanded, not taken as part of the filename. other programs, such as Metafont, do not have this problem.
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 by default, the input name is simply checked as given.TEXINPUTSโ search path for\inputand\openinfiles. this should probably start with.'', so that user files are found before system files. an empty path component will be replaced with the paths defined in the `texmf.cnf` file. for example, set `TEXINPUTS` to `".:/home/user/tex:"` to prepend the current directory and/home/user/tex'' to the standard search path.TEXFORMATSโ search path for format files.TEXPOOLโ search path for tex internal strings.TEXEDITโ command template for switching to editor. the default, usuallyvi, is set when TeX is compiled.TFMFONTSโ search path for font metric (.tfm) files.
โจ FILES โจ
the location 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.texfonts.mapโ filename mapping definitions.*.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.
โจ NOTES โจ
this manual page is not meant to be exhaustive. the complete documentation for this version of TeX can be found in the info manual Web2C: A TeX implementation.
๐ BUGS ๐
Okay bestie, listen. This version of TeX implements a number of optional extensions. And likeโฆ many of these extensions conflict to a greater or lesser extent with the definition of TeX. Which is a whole thing. ๐ When such extensions are enabled, the banner printed when TeX starts is changed to print TeXk instead of TeX. So if you ever see TeXk up top, that's why โ she's got her little extensions on, iykyk. โจ
Also, not to be dramatic, but: 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 generated DVI file will be invalid. ๐ So likeโฆ keep an eye on your dimensions, babe. That DVI? Not gonna be okay.
๐ SEE ALSO ๐
mf(1)โ her sibling, the font queen ๐- Donald E. Knuth, The TeXbook, Addison-Wesley, 1986, ISBN
0-201-13447-0. The holy text, fr fr. ๐ - Leslie Lamport, LaTeX - A Document Preparation System, Addison-Wesley, 1985, ISBN
0-201-15790-X. The one that made everybody's thesis happen. โจ - K. Berry, Eplain: Expanded plain TeX, https://tug.org/eplain
- Michael Spivak, The Joy of TeX, 2nd edition, Addison-Wesley, 1990, ISBN
0-8218-2997-1. The title is not lying, it is a joy. ๐ฆ - TUGboat (the journal of the TeX Users Group). https://tug.org/TUGboat โ yes the user group is literally called TUG and the journal is called TUGboat, we love a consistent brand. ๐ข
๐ธ TRIVIA ๐ธ
TeX, pronounced properly, rhymes with blecchhh.'' ๐ญ That's it. That's the pronunciation. And the proper spelling in typewriter-like fonts is TeX'' and not TEX'' or tex.'' โ so bestie, case matters, do not come at her with lowercase. ๐
๐ AUTHORS ๐
TeX was created by Donald E. Knuth, who implemented it using his Web system for Pascal programs. Then it got ported to Unix at Stanford by Howard Trickey, and at Cornell by Pavel Curtis. The version now offered with the Unix TeX distribution is that generated by the Web to C system (web2c), originally written by Tomas Rokicki and Tim Morgan. Legends only. ๐ซถ
The encTeX extensions were written by Petr Olsak. ๐
And that's the whole page, bestie โ this was Web2C 2025, dated 6 August 2019. Go make something beautiful with her. ๐โจ๐
๐ฆ where this page comes from
- alpine 3.24: texlive-doc 2026.0-r0 ยท GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: texlive-tex 12:svn77830-105.fc44 ยท Knuth-CTAN
- fedora 44: texlive-tex 12:svn77830-111.fc44 ยท Knuth-CTAN
- opensuse-leap 16.0: texlive-tex 2025.221.3.141592653svn73848-160000.3.1 ยท SUSE-TeX
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms