New Mexico Tech Computer Center. Plain TeX quick reference


262 65 93KB

English Pages 9

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

New Mexico Tech Computer Center. Plain TeX quick reference

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

Plain TEX quick reference

Conventions used in this document The major sections are keyed to the corresponding chapter of Don Knuth’s The TEXbook.



[ ] ✿✿✿

Control sequence, e.g., \mymacro, \somedimen An integer from 0 to 255 An integer from 0 to 15 (file number), or -1 to read terminal An integer Optional item One or more of the preceding item

Chapter 2: Book printing vs. ordinary typing ---\thinspace

Hyphen (-) En-dash (–) Em-dash (—) Thin space:

❥❥

Chapter 3: Controlling TEX \input \endinput \ \TeX

Go read Stop reading this file Control space (where The TEX logo

is a space character)

Chapter 4: Fonts of type \rm \it \/ \sl \tt \bf \tenpoint \tenrm \font [scaled ] \magstephalf \magstep1 New Mexico Tech Computer Center

Roman (the default) Italic Italic correction; use for italic non-italic transition Slanted



Typewriter Bold extended Or \ninepoint, etc. Or \ninesl, etc. Load a font; =1000 for normal size Use after scaled to magnify by 1.095% Use after scaled to magnify by 1.2 Plain TEX quick reference

Page 1

\magstep2 \magstep3 \magstep4 \magstep5

Use after scaled to magnify by 1.44 Use after scaled to magnify by 1.728% Use after scaled to magnify by 2.0746% Use after scaled to magnify by 2.488%

Chapter 5: Grouping { ✿ ✿ ✿} \centerline{} \begingroup✿ ✿ ✿ \endgroup

Localize all changes between the {✿ ✿ ✿ } Center Functionally like { ✿ ✿ ✿ }

Chapter 6: Running TEX \relax \hsize= \tolerance= \raggedright

Do nothing Set horizontal size Allow bad interword spacing Allow right margin to vary

Chapter 7: How TEX reads what you type To change the way character is interpreted:

\catcode‘\= Here are the category codes, and an example of each:

0 (\) 1 ({) 2 (}) 3 ($) 4 (&) 5 (LF) 6 (#) 7 (^) 8 (_) 9 (NUL) 10 ( ) 11 (A–Z, a–z) 12 13 (~) 14 (%) 15 (DEL)

Escape character Begin group End group Math shift Tab separator End of line (newline) Parameter Superscript Subscript Ignored character Space Letter Other character Active character Comment Invalid character

To produce certain characters you’ll need these control sequences:

\$ New Mexico Tech Computer Center

$ Plain TEX quick reference

Page 2

\% \& \_ \string

% &

_

\csname✿ ✿ ✿ \endcsname \number \romannumeral \uppercase{✿ ✿ ✿ } \lowercase{✿ ✿ ✿ }

E.g., \string\TeX yields \, T, e, X, all in category 12 Convert tokens to a control sequence Yields the digits of as a token list E.g., \romannumeral 23 yields x, x, i, i, i Convert lowercase to uppercase Convert uppercase to lowercase

Chapter 8: The characters you type \char \char’ \char" \chardef= ^^@ ^^A ^^

Produces the character with decimal code Produces the character with octal code Produces the character with hex code Associate the character whose code is with control sequence The NUL character Control A In general, for less than 64, this produces character +64, otherwise it produces -64

Chapter 9: TEX’s Roman fonts Use

\‘e \’e \^o \"o \i \j \~n \=a \.s \u a \d n \v c \H o \t ii \b o \c c \aa \L \ss \o \dag

To get e` e´ oˆ o¨ ı n˜ a¯ _s a˘ n. cˇ o} ⑧ii o c¸¯ a˚ Ł ß ø ②

New Mexico Tech Computer Center

Grave accent Acute accent Circumflex Umlaut Dotless i, for diacriticals over letter i Dotless j Tilde Long mark Dot accent Short mark Dot under Hacek Long umlaut Tie-after Bar under Cedilla Circle-a Polish l Es-zet Slash-o Dagger Plain TEX quick reference

Page 3

\ddag \S \P \ae \AE \oe \OE

③ ① ④

æ Æ œ Œ

Double dagger Section symbol Paragraph symbol Ligatures

Chapter 10: Dimensions A can be expressed as a number followed by one of these units:

pt pc in bp cm mm dd cc sp

Point, 1/72.27′′ Pica = 12 pt Inch Big pt., 1/72′′ Centimeter Millimeter 1157 Didot pts. = 1238 pt Cicero = 12 dd Scaled point = 1/65536 pt

Use \magnification= to change the overall magnification of the document, where unity is 1000. Use true to get a dimension that is not affected by any \magnification that may be in effect.

Chapter 11: Boxes \hbox{} \vbox{}

Horizontal box: align baselines Vertical box: align reference points

Chapter 12: Glue A has the form:

[plus ] [minus ] Glue-related control sequences:

\smallskip \medskip \bigskip \vfil, \vfill \hfil, \hfill \hss, \vss \line{} New Mexico Tech Computer Center

3pt plus 1pt minus 1pt Twice \smallskip Twice \medskip Vertical fill, two strengths Horizontal fill, two strengths Infinite glue

\hbox to hsize{✿ ✿ ✿} Plain TEX quick reference

Page 4

\hbox to {✿ ✿ ✿ } Sized hbox; also works with \vbox \hbox spread {✿ ✿ ✿ } Natural size plus ; also \vbox \baselineskip= Baseline-to-baseline distance \lineskip= Use if baselines closer than \lineskiplimit \lineskiplimit= See previous item \prevdepth Depth of last box on main vertical list \nointerlineskip Suppress next interline glue \vtop Likcs \vbox but use top, not bottom, baseline \strut An invisible rule with 8.5 points of height and 3.5 \llap{} \rlap{}

points of depth Set to left of current position, hide width Same as \llap, but to right of current position

Chapter 13: Modes TEX operates in one of six modes at any given time: vertical internal vertical horizontal restricted horizontal math display math

Building the main vertical list Constructing a \vbox Building a paragraph Constructing an \hbox

$✿ ✿ ✿$ $$✿ ✿ ✿$$

Chapter 14: How TEX breaks paragraphs into lines Things that can appear in a horizontal list are placed in two categories: non-discardable discardable

box, discretionary, whatsit, vertical material glue, kern, penalty, math-on

Discardable items disappear at a line break.

\slash ~ \obeylines \break

Like /, but allow a line break after it Tie (non-break space) Treat newline as \par Break the line here; use \hfil\break to avoid stretching \discretionary{}{}{} Discretionary item: is the pre-break text, is the post-break text, and is used if there is no break \Discretionary hyphen \nobreak Don’t break the line here! \parindent= Set the paragraph indentation \parfillskip= Placed after last line in a paragraph \leftskip= Left margin skip New Mexico Tech Computer Center

Plain TEX quick reference

Page 5

\rightskip= \narrower

Right margin skip Reduce \leftskip and \rightskip by the size of

\parindent \parskip= \parshape=♥ ✐1 ❧1 ✐2 ❧2 \hangindent= \hangafter=

✿✿✿

\item{1.} \itemitem{a.} \prevgraf \looseness= \interlinepenalty= \clubpenalty= \widowpenalty= \brokenpenalty= \vadjust{✿ ✿ ✿} \everypar=✿ ✿ ✿

Inter-paragraph vertical spacing Special paragraph shape Set width of hanging indentation If is negative, indent the first lines, else indent all lines after the first Itemization, first level✿ ✿ ✿ ✿ ✿ ✿ and second Line count in previous/current paragraph Stretch ( for shrink) next paragraph lines Penalties for: interline breaks✿ ✿ ✿ ✿ ✿ ✿ break after the first line of a paragraph✿ ✿ ✿ ✿ ✿ ✿ break before the last line of a paragraph✿ ✿ ✿ ✿ ✿ ✿ and break at a discretionary Place material after the current line in the vertical list Insert token list before each paragraph

Chapter 15: How TEX makes lines into pages Things that can appear in a horizontal list are placed in two categories: non-discardable discardable

box, whatsit, mark, insertion glue, kern, penalty

Discardable items disappear at a page break.

\eject \smallbreak \medbreak \bigbreak \filbreak \raggedbottom \topinsert✿ ✿ ✿ \endinsert \pageinsert✿ ✿ ✿ \endinsert \midinsert✿ ✿ ✿\endinsert \supereject \footnote{}{} \count= \dimen= \skip= \muskip= \advance by \multiply by \divide by New Mexico Tech Computer Center

Break page; use \vfill\eject to avoid stretching Like \smallskip but also a good page break Same for \medskip✿ ✿ ✿ ✿ ✿ ✿ and \bigskip Keep text down to the next \filbreak on the same page Don’t stretch each page to \vsize Top-of-page insertion Full-page insertion Drop it here if you can Like \eject but also flush all insertions Attach a footnote to this point Count registers, signed 32-bit number Dimension registers Skip registers Math unit skip registers Add or subtract Multiply Divide Plain TEX quick reference

Page 6

\global \setbox= \box \copy \unhbox \unhcopy \unvbox, \unvcopy \showthe \showbox \newcount \newdimen \newskip \newmuskip \newbox

Prefix to transcend current scope Box registers Copy (destructive; set box to null) Non-destructive copy of box Unset glue and copy (destructive) Unset glue and copy (non-destructive) Vertical versions of \unhbox and \unhcopy Show count, dimen, or skip Show the contents of a box Allocate a new count register* Allocate a new dimension register* Allocate a new skip register* Allocate a new math unit skip register* Allocate other item*

*Note: Box 255, and count/dimen/skip/muskip registers 0–9 are special; none of the

\new commands will allocate 0–9. \insert \newinsert \box \count \dimen \skip \vsplit to

Insertion of type Allocate a new insertion type. Each insertion type is tied to: Where the material appears upon output Magnification factor: 1000=unity, 500 for doublecolumn Maximum insert size per page Extra space allocated on the page for this insert type Split off the first of box . Uses \splitmaxdepth, \splittopskip

Chapter 20: Definitions (also called Macros) \def[✿ ✿ ✿ ]{}

\long\def✿ ✿ ✿ \outer\def✿ ✿ ✿ \global\def✿ ✿ ✿ \gdef✿ ✿ ✿ \let= \futurelet

Define a macro, where consists of parameter identifiers of the form # optionally separated by delimiter strings Allow \par tokens in the arguments Allow only at outer level (not in arguments, preambles, ✿ ✿ ✿ ) Definition transcends current group Same as \global\def Give the current meaning of to

Equivalent to \let= followed by

\if\else\fi General form of \if \ifnum Compare numbers, where the can be any of New Mexico Tech Computer Center

Plain TEX quick reference

Page 7

\ifdim \ifodd \ifvmode \ifhmode \ifmmode \ifinner

Compare dimensions True if is odd If in vertical or internal vertical mode If in horizontal or restricted horizontal mode If in math or display math mode If in internal vertical, restricted horizontal, or nondisplay math mode \if Compare character codes (ignore categories) \ifcat Compare category codes (ignore character codes) \ifx Compare unexpanded tokens to see if they have the same function \ifvoid True if box N is empty \ifhbox True if box N contains an hbox✿ ✿ ✿ \ifvbox ✿ ✿ ✿ or vbox \ifeof True if input file is at end-of-file \iftrue Always take the true branch \iffalse Always take the false branch \ifcase[\or]✿ ✿ ✿[\else]\fi Expand the case corresponding to \newif Declare a Boolean switch \true Set a Boolean switch \false Clear a Boolean switch \newtoks Declare a token list register \jobname Unqualified filename, e.g., "book" for "book.dvi" \fontname Expands to the name of the font file. Note: Use \font for the current . \meaning Same as “\let\test= \show\test” \expandafter Saves unexpanded; expands including any arguments; then puts back at the front of the input \noexpand Expansion is , treated as \relax \the Expand internal quantity to token list \the Display the code number for , where ::= \catcode | \mathcode | \lccode | \uccode | \sfcode | \delcode \the\fontdimen Produces a dimension characteristic of that font, and selected by , e.g., 6 for the “em” dimension \showthe Same as \the, but display on the terminal \message Write message on terminal \edef✿ ✿ ✿ Expanded definition—expand arguments now \xdef✿ ✿ ✿ Same as \global\edef. Use \noexpand to control partial expansion within \edef. \openin= Open an input stream \newread Open the next input stream \closein Close an input stream \read to Input file to a token list register; use -1 for the terminal \loop\if\repeat

New Mexico Tech Computer Center

Plain TEX quick reference

Page 8

Expands , then evaluates the ; if true, expands and then returns to

Chapter 21: Making boxes \vrule \hrule \lastbox \unskip \leaders

Solid black box in horizontal mode. The default width is 0.4pt. Solid black box in vertical mode. The default height is 0.4pt. Remove the last box on the current horizontal or vertical list Remove the last item if it is glue or leaders Acts like but fills with where is a box or a rule. For tables of contents, use:

\def\leaderfill\leaders\hbox to 1em{\hss.\hss\hfill} then use this for each line:

\line{\leaderfill } \cleaders Like \leaders but centered in the space, and not \xleaders \openout= \closeout \write{} \immediate\write✿ ✿ ✿ \special{[ ]}

aligned Like \leaders but expanded to fill the space Open an output file Close an output file Write a token string (deferred until \shipout time) Write it now, don’t defer it until the output routine. Note: Use 16 for the to write on the terminal. Image insertion, for example

c 2001 by the New Written by John W. Shipman ([email protected]). This version printed 2003-06-30. Copyright Mexico Institute of Mining and Technology.

New Mexico Tech Computer Center

Plain TEX quick reference

Page 9