TEX(1)                                                     TEX(1)

     NAME
          tex, latex, slitex, bibtex, dvips, dviselect, mf, mktexlsr -
          text formatting and typesetting

     SYNOPSIS
          tex [ first-line ]

          latex file[.tex]

          slitex [ first-line ]

          dvips [ option ... ] dvifile

          dviselect [ -s ] [ -i infile ] [ -o outfile ] list of pages
          [ infile [ outfile ] ]

          bibtex auxname

          mf [ first-line ]

          mktexlsr

     DESCRIPTION
          Tex formats interspersed text and commands and outputs a
          .dvi (`device independent') file.

          An argument given on the command line behaves as the first
          input line.  That line should begin with a (possibly trun-
          cated) file name or a \controlsequence. Thus tex paper pro-
          cesses the file paper.tex.  The base name of paper becomes
          the jobname, and is used in forming output file names.  If
          no file is named, the jobname is texput.  The default .tex
          extension can be overridden by specifying an extension
          explicitly.

          The output is written on jobname.dvi, which can be printed
          using lp(1). A log of error messages goes into jobname.log.

          As well as the standard TeX fonts, many PostScript fonts can
          be used (see the contents of /sys/lib/tex/fonts/psvf).  The
          file testfont.tex (in the standard macro directory) will
          print a table of any font.

          The following environment variables adjust the behavior of
          tex. Search paths are lists of directories separated by
          colons.  The wildcard // may expand to any path, so
          /sys/lib/texmf// means the entire tree rooted at
          /sys/lib/texmf, and /usr//lib includes any directories named
          lib that sit anywhere under /usr.  Finally, braces may be
          used to specify alternatives, so that /a/{b:c}/d means

     Page 1                       Plan 9            (printed 11/23/24)

     TEX(1)                                                     TEX(1)

          /a/b/d or /a/c/d.

          If a directory contains a file called ls-R, that file is
          used as an index of the hierarchy rooted there.  These files
          may be created with mktexlsr (see below) If a sought file is
          not found in an ls-R listing, it is searched for by walking
          the directory or directory hierarchy as specified.  If the
          path begins with !!, the search is constrained to only look
          in the ls-R and not walk the hierarchy.  Thus
          !!/sys/lib/texmf// means the entire tree rooted at
          /sys/lib/texmf, but only consulting /sys/lib/texmf/ls-R to
          search for files.

          TEXINPUTS
            Search path for \input and \openin files.  It should be
            colon-separated, and start with dot.  Default:
            .:$home/lib/tex:!!/sys/lib/texmf/tex//
          TFMFONTS
            Search path for font metric files.  Default:
            .:!!/sys/lib/texmf/tex/fonts//tfm//
          PKFONTS
            Search path for font bitmaps.  Default:
            .:!!/sys/lib/texmf/fonts//pk//
          TEXFORMATS
            Search path for program format files.  Default:
            .:!!/sys/lib/texmf/web2c
          TEXPOOL
            Search path for strings.  Default:
            .:!!/sys/lib/texmf/web2c
          TEXEDIT
            Template for the switch-to-editor-on-error option, with %s
            for the file name and %d for the line number.  Default:
            /bin/ed %s
          MFINPUTS
            Search path for Metafont input files.  Default:
            .:!!/sys/lib/texmf/metafont//:!!/sys/lib/texmf/fonts//source//
          MPINPUTS
            Search path for MetaPost input files.  Default:
            .:!!/sys/lib/texmf/metapost//

          Slitex is a version of tex that is preloaded with a set of
          macros useful for creating viewgraphs.

          Latex is a version of tex with a standard set of macros
          loaded.  Latex produces file.dvi and a cross-referencing
          file, file.aux.  It might be necessary to run latex twice,
          to get all of the cross-referencing done properly.

          Bibtex is a bibliography processing program, often used in
          conjunction with latex. Bibtex reads the top-level auxiliary
          (.aux) file output by latex and creates a bibliography
          (.bbl) file to be included in the LaTeX source file.  The

     Page 2                       Plan 9            (printed 11/23/24)

     TEX(1)                                                     TEX(1)

          auxname on the command line should be given without an
          extension.  Each \cite in the source file is looked up in
          bibliography files to gather together those used in the doc-
          ument.  Then a bibliography style file is executed to write
          a \thebibliography environment.

          The source file should have defined the bibliography (.bib)
          files to search with the \bibliography command, and the bib-
          liography style (.bst) file to execute with the
          \bibliographystyle command.  Bibtex searches the TEXINPUTS
          path for .bst files, and the BIBINPUTS path (default
          .:!!/sys/lib/texmf/bibtex//) for .bst files.  The LaTeX man-
          ual describes how to make bibliography files.

          Dvips converts .dvi files to PostScript, writing the result
          on standard output.  It is normally invoked by lp(1), but if
          invoked separately, the following options are useful:

          -r      reverse pages.  -r0 means don't reverse pages (if
                  reversing is default).

          -q0     Enable verbose chatter on standard error.

          -Pdev   output device: dev is one of ps (default for dvips),
                  psfonts, or bitmapfonts.  The ps device uses
                  PostScript fonts wherever possible, quickly creating
                  small documents that are not very portable (since
                  most sites and printers don't have the necessary
                  PostScript fonts installed).  The psfonts device
                  includes all necessary fonts in the files, and thus
                  quickly creates large portable documents.  These are
                  especially good for distilling (see distill(1)) into
                  PDF.  The bitmapfonts device behaves in the manner
                  most common in other tex installations: it creates
                  bitmap versions of each font and includes them in
                  the document, resulting in portable yet medium sized
                  documents that don't convert well to PDF.  If the
                  bitmap fonts needed do not exist, they will be cre-
                  ated on the fly, which takes a fair bit of time.

          -L      print paper in landscape mode.

          -Z      compress the fonts before sending them.

          -Z0     don't compress the fonts before sending them.

          The following environment variables affect dvips:

          PKFONTS    Search path for font bitmaps (PK files).
          VFFONTS    Search path for virtual font descriptions.

          Dviselect selects pages from a .dvi file, creating a new

     Page 3                       Plan 9            (printed 11/23/24)

     TEX(1)                                                     TEX(1)

          .dvi file.  A range is a string of the form first:last where
          both first and last are optional numeric strings, with nega-
          tive numbers indicated by a leading underscore character
          (_).  If both first and last are omitted, the colon may also
          be omitted, or may be replaced with an asterisk (*).  A TeX
          page selector is a list of pages separated by periods.  A
          list of pages is described by a set of page TeX page selec-
          tors, separated by commas and/or white space.  Dviselect
          actually looks at the ten count variables that TeX writes;
          the first of these (\count0) is the page number, with
          \count1 through \count9 having varied uses depending on
          which macro packages are in use.  (Typically \count1 is a
          chapter or section number.)  A page is included in
          dviselect's output if all its \count values are within any
          one of the ranges listed on the command line.  For example,
          the command `dviselect *.1,35:' might select everything in
          chapter 1, as well as pages 35 and up.

          Instead of \count values, dviselect can also select by abso-
          lute page number, indicated by a leading equal sign (=).
          Ranges of absolute pages are also allowed: `dviselect =3:7'
          will extract the third through seventh pages.

          Dvips understands some extended graphics commands that can
          be output using tpic specials in the TeX source.  Many of
          them work by building up a path of x,y pairs, and then doing
          something with the path.  The tpic coordinate system has its
          origin at the current dvi position when a drawing special is
          emitted; all length arguments are in units of milli-inches,
          and the y-axis goes positive downward.

          \special{pa x y}
               Add x,y to the current path.

          \special{fp}
               Flush the current path: draw it as a polygonal line and
               reset the path to be empty.

          \special{da dlen}
               Like fp but draw dashed line, with dashes dlen milli-
               inches long.

          \special{dt slen}
               Like fp but draw a dotted line, with dots slen apart.

          \special{sp}
               Like fp but draw a quadratic spline.  The spline goes
               through the midpoints of the segments of the path, and
               straight pieces extend it to the endpoints.

          \special{ar x y xr yr s e}
               Draw a circular or elliptical arc with center at x,y

     Page 4                       Plan 9            (printed 11/23/24)

     TEX(1)                                                     TEX(1)

               and radii xr and yr.  The arc goes clockwise from angle
               s to angle e (angles measured clockwise from the posi-
               tive x-axis).

          \special{pn n}
               Set line width (pen diameter) to nmilli-inches.

          \special{bk}
               Set shading to black (will fill the next object drawn
               with black).

          \special{sh}
               Set shading to grey.

          \special{wh}
               Set shading to white.

          \special{psfile=file options}
               Include file, which should be a PostScript illustra-
               tion, making its origin be the current dvi position.
               The default PostScript transformation matrix will be in
               effect, but it can be modified by the options, a list
               of space-separated key=value assignments.  Allowed keys
               are: hoffset, voffset, hscale, vscale, angle, If sup-
               plied, these values are supplied to PostScript
               translate,scale, and rotate commands, in that order.
               Also, keys hsize and vsize may be supplied, to cause
               clipping to those sizes.  Sizes and offsets should be
               specified in points, angles should be specified in
               degrees.

          All of the specials leave TeX at the same position on the
          page that it started in.

          Mf runs metafont, a program that produces fonts for TeX.  It
          is used by dvips when bitmaps for a given font at a given
          size do not exist.

          Mktexlsr is used to generate ls-R files for quick path
          searching.  It simulates the Unix command ``ls -LAR .''.

     FILES
          Directory containing files directly supporting
               the runtime environment of tex et al., such as .mem and
               .pool files.

          /sys/lib/texmf/web2c/texmf.cnf
               Configuration file listing the default search paths
               mentioned above.

          /sys/lib/texmf/tex
               Tex macros.

     Page 5                       Plan 9            (printed 11/23/24)

     TEX(1)                                                     TEX(1)

          /sys/lib/texmf/tex/latex
               Latex macros.

          /sys/lib/texmf/tex/latex/local
               Locally installed latex macros.

          /sys/lib/texmf/fonts
               Fonts, fonts, and more fonts.

          /sys/lib/texmf/dvips
               Miscellaneous configuration files and PostScript head-
               ers

          /sys/lib/texmf/doc
               Various documentation organized in the same manner as
               /sys/lib/texmf.

          /sys/lib/texmf/bin/$objtype, /sys/lib/texmf/bin/rc
               Auxiliary programs, such as mktexlsr, used by tex and
               friends.

     SOURCE
          /sys/src/cmd/tex

     SEE ALSO
          lp(1), mp(1), page(1), pic(1), proof(1), troff(1), delatex
          in deroff(1)
          D. E. Knuth, TheTEXbook, Addison-Wesley, 1984
          L. Lamport, LaTeX, A Document Preparation System, Addison-
          Wesley, 1985
          H. Trickey, ``Latex User Guide'', Unix Research System
          Programmer's Manual, Tenth Edition, Volume 2.
          Various documents in /sys/lib/texmf/doc.

     BUGS
          Should be spelled τεχ.
          The path notation is bizarre.

     Page 6                       Plan 9            (printed 11/23/24)