Plain T X quick reference E Conventions used in this document ThemajorsectionsarekeyedtothecorrespondingchapterofDonKnuth’sTheTEXbook. <cs> Controlsequence,e.g.,\mymacro,\somedimen <N> Anintegerfrom0to255 <file> Anintegerfrom0to15(filenumber),or-1toreadterminal <int> Aninteger [ ] Optionalitem ::: Oneormoreoftheprecedingitem Chapter 2: Book printing vs. ordinary typing - Hyphen(-) -- En-dash(–) --- Em-dash(—) \thinspace Thinspace: jj Chapter 3: Controlling T X E \input <file> Goread<file> \endinput Stopreadingthisfile \(cid:32) Controlspace(where(cid:32)isaspacecharacter) \TeX TheTEXlogo Chapter 4: Fonts of type \rm Roman(thedefault) \it Italic \/ Italiccorrection;useforitalic!non-italictransition \sl Slanted \tt Typewriter \bf Boldextended \tenpoint Or\ninepoint,etc. \tenrm Or\ninesl,etc. \font<cs> [scaled <int>] Loadafont;<int>=1000fornormalsize \magstephalf Useafterscaledtomagnifyby1.095% \magstep1 Useafterscaledtomagnifyby1.2 NewMexicoTechComputerCenter PlainTEXquickreference Page1 \magstep2 Useafterscaledtomagnifyby1.44 \magstep3 Useafterscaledtomagnifyby1.728% \magstep4 Useafterscaledtomagnifyby2.0746% \magstep5 Useafterscaledtomagnifyby2.488% Chapter 5: Grouping { :::} Localizeallchangesbetweenthe{:::} \centerline{<text>} Center<text> \begingroup:::\endgroup Functionallylike{:::} Chapter 6: Running T X E \relax Donothing \hsize=<dimen> Sethorizontalsize \tolerance=<int> Allowbadinterwordspacing \raggedright Allowrightmargintovary Chapter 7: How T X reads what you type E Tochangethewaycharacter<char>isinterpreted: \catcode‘\<char>=<category-number> Herearethecategorycodes,andanexampleofeach: 0 (\) Escapecharacter 1 ({) Begingroup 2 (}) Endgroup 3 ($) Mathshift 4 (&) Tabseparator 5 (LF) Endofline(newline) 6 (#) Parameter 7 (^) Superscript 8 (_) Subscript 9 (NUL) Ignoredcharacter 10 ((cid:32)) Space 11 (A–Z,a–z) Letter 12 Othercharacter 13 (~) Activecharacter 14 (%) Comment 15 (DEL) Invalidcharacter Toproducecertaincharactersyou’llneedthesecontrolsequences: \$ $ NewMexicoTechComputerCenter PlainTEXquickreference Page2 \% % \& & \_ _ \string<cs> E.g.,\string\TeXyields\,T,e,X,allincategory 12 \csname<token>:::\endcsname Converttokenstoacontrolsequence \number<int> Yieldsthedigitsof<int>asatokenlist \romannumeral<int> E.g.,\romannumeral 23yieldsx,x,i,i,i \uppercase{<token>:::} Convertlowercasetouppercase \lowercase{<token>:::} Convertuppercasetolowercase Chapter 8: The characters you type \char<int> Producesthecharacterwithdecimalcode<int> \char’<octal> Producesthecharacterwithoctalcode<octal> \char"<hex> Producesthecharacterwithhexcode<hex> \chardef<cs>=<int> Associate the character whose code is <int> with control sequence<cs> ^^@ TheNULcharacter ^^A ControlA ^^<char> Ingeneral,for<char>lessthan64,thisproducescharacter <char>+64,otherwiseitproduces<char>-64 Chapter 9: T X’s Roman fonts E Use Toget \‘e e` Graveaccent \’e e´ Acuteaccent \^o oˆ Circumflex \"o o¨ Umlaut \i ı Dotlessi,fordiacriticalsoverletteri \j Dotlessj \~n n˜ Tilde \=a a¯ Longmark \.s _s Dotaccent \u a a˘ Shortmark \d n n. Dotunder \v c cˇ Hacek \H o o} Longumlaut \t ii (cid:127)ii Tie-after \b o o Barunder ¯ \c c c¸ Cedilla \aa a˚ Circle-a \L Ł Polishl \ss ß Es-zet \o ø Slash-o \dag y Dagger NewMexicoTechComputerCenter PlainTEXquickreference Page3 \ddag z Doubledagger \S x Sectionsymbol \P { Paragraphsymbol \ae æ Ligatures \AE Æ \oe œ \OE Œ Chapter 10: Dimensions A<dimen>canbeexpressedasanumberfollowedbyoneoftheseunits: pt Point,1/72.27(cid:48)(cid:48) pc Pica=12pt in Inch bp Bigpt.,1/72(cid:48)(cid:48) cm Centimeter mm Millimeter dd 1157Didotpts. =1238pt cc Cicero=12dd sp Scaledpoint=1/65536pt Use\magnification=<int>tochangetheoverallmagnificationofthedocument,where unityis1000. Usetrue <dimen>togetadimensionthatisnotaffectedbyany\magnificationthat maybeineffect. Chapter 11: Boxes \hbox{<text>} Horizontalbox: alignbaselines \vbox{<text>} Verticalbox: alignreferencepoints Chapter 12: Glue A<glue>hastheform: <dimen> [plus <dimen>] [minus <dimen>] Glue-relatedcontrolsequences: \smallskip 3pt plus 1pt minus 1pt \medskip Twice\smallskip \bigskip Twice\medskip \vfil, \vfill Verticalfill,twostrengths \hfil, \hfill Horizontalfill,twostrengths \hss,\vss Infiniteglue \line{<text>} \hbox to hsize{:::} NewMexicoTechComputerCenter PlainTEXquickreference Page4 \hbox to <dimen>{:::} Sizedhbox;alsoworkswith\vbox \hbox spread <dimen>{:::} Naturalsizeplus<dimen>;also\vbox \baselineskip=<glue> Baseline-to-baselinedistance \lineskip=<glue> Useifbaselinescloserthan\lineskiplimit \lineskiplimit=<glue> Seepreviousitem \prevdepth Depthoflastboxonmainverticallist \nointerlineskip Suppressnextinterlineglue \vtop Likcs\vboxbutusetop,notbottom,baseline \strut An invisible rule with 8.5 points of height and 3.5 pointsofdepth \llap{<text>} Settoleftofcurrentposition,hidewidth \rlap{<text>} Sameas\llap,buttorightofcurrentposition Chapter 13: Modes TEXoperatesinoneofsixmodesatanygiventime: vertical Buildingthemainverticallist internalvertical Constructinga\vbox horizontal Buildingaparagraph restrictedhorizontal Constructingan\hbox math $:::$ displaymath $$:::$$ Chapter 14: How T X breaks paragraphs into lines E Thingsthatcanappearinahorizontallistareplacedintwocategories: non-discardable box,discretionary,whatsit,verticalmaterial discardable glue,kern,penalty,math-on Discardableitemsdisappearatalinebreak. \slash Like/,butallowalinebreakafterit ~ Tie(non-breakspace) \obeylines Treatnewlineas\par \break Break the line here; use \hfil\break to avoid stretching \discretionary{<pre>}{<post>}{<no>} Discretionaryitem: <pre>isthepre-breaktext,<post> isthepost-breaktext,and<no>isusedifthereisno break \- Discretionaryhyphen \nobreak Don’tbreakthelinehere! \parindent=<glue> Settheparagraphindentation \parfillskip=<glue> Placedafterlastlineinaparagraph \leftskip=<glue> Leftmarginskip NewMexicoTechComputerCenter PlainTEXquickreference Page5 \rightskip=<glue> Rightmarginskip \narrower Reduce \leftskip and \rightskip by the size of \parindent \parskip=<glue> Inter-paragraphverticalspacing \parshape=n i l i l ::: Specialparagraphshape 1 1 2 2 \hangindent=<dimen> Setwidthofhangingindentation \hangafter=<int> If<int>isnegative,indentthefirst(cid:0)<int>lines,else indentalllinesafterthefirst<int> \item{1.} Itemization,firstlevel::: \itemitem{a.} :::andsecond \prevgraf Linecountinprevious/currentparagraph \looseness=<int> Stretch((cid:0)forshrink)nextparagraph<int>lines \interlinepenalty=<int> Penaltiesfor: interlinebreaks::: \clubpenalty=<int> :::breakafterthefirstlineofaparagraph::: \widowpenalty=<int> :::breakbeforethelastlineofaparagraph::: \brokenpenalty=<int> :::andbreakatadiscretionary \vadjust{:::} Placematerialafterthecurrentlineintheverticallist \everypar=<token>::: Inserttokenlistbeforeeachparagraph Chapter 15: How T X makes lines into pages E Thingsthatcanappearinahorizontallistareplacedintwocategories: non-discardable box,whatsit,mark,insertion discardable glue,kern,penalty Discardableitemsdisappearatapagebreak. \eject Break page; use \vfill\eject to avoid stretching \smallbreak Like\smallskipbutalsoagoodpagebreak \medbreak Samefor\medskip::: \bigbreak :::and\bigskip \filbreak Keep text down to the next \filbreak on the samepage \raggedbottom Don’tstretcheachpageto\vsize \topinsert:::\endinsert Top-of-pageinsertion \pageinsert:::\endinsert Full-pageinsertion \midinsert:::\endinsert Dropithereifyoucan \supereject Like\ejectbutalsoflushallinsertions \footnote{<symbol>}{<text>} Attachafootnotetothispoint \count<N>=<int> Countregisters,signed32-bitnumber \dimen<N>=<dimen> Dimensionregisters \skip<N>=<glue> Skipregisters \muskip<N>=<muglue> Mathunitskipregisters \advance<reg> by <int> Addorsubtract \multiply<reg> by <int> Multiply \divide<reg> by <int> Divide NewMexicoTechComputerCenter PlainTEXquickreference Page6 \global Prefixtotranscendcurrentscope \setbox<N>=<text> Boxregisters \box<N> Copy(destructive;setbox<N>tonull) \copy<N> Non-destructivecopyofbox<N> \unhbox<N> Unsetglueandcopy(destructive) \unhcopy<N> Unsetglueandcopy(non-destructive) \unvbox,\unvcopy Verticalversionsof\unhboxand\unhcopy \showthe<item> Showcount,dimen,orskip \showbox<box> Showthecontentsofabox \newcount<cs> Allocateanewcountregister* \newdimen Allocateanewdimensionregister* \newskip Allocateanewskipregister* \newmuskip Allocateanewmathunitskipregister* \newbox Allocateotheritem* *Note: Box 255, and count/dimen/skip/muskip registers 0–9 are special; none of the \new<thing>commandswillallocate0–9. \insert<N><vert. material> Insertionoftype<N> \newinsert<cs> Allocateanewinsertiontype. Eachinsertiontype <N>istiedto: \box<N> Wherethematerialappearsuponoutput \count<N> Magnificationfactor: 1000=unity,500fordouble- column \dimen<N> Maximuminsertsizeperpage \skip<N> Extra space allocated on the page for this insert type \vsplit<N> to <dimen> Split off the first <dimen> of box <N>. Uses \splitmaxdepth,\splittopskip Chapter 20: Definitions (also called Macros) \def<cs>[<parm>:::]{<replacementtext>} Defineamacro,where<parm>consistsofparam- eteridentifiersoftheform#<int>optionallysep- aratedbydelimiterstrings \long\def::: Allow\partokensinthearguments \outer\def::: Allow only at outer level (not in arguments, preambles,:::) \global\def::: Definitiontranscendscurrentgroup \gdef::: Sameas\global\def \let<cs>=<token> Givethecurrentmeaningof<token>to<cs> \futurelet<cs><token1><token2> Equivalent to \let<cs>=<token2> followed by <token1><token2> \if<condition><true-text>\else<false-tex>\fi Generalformof\if \ifnum<int1><relation><int2> Compare numbers, where the <relation> can be anyof<,=,or> NewMexicoTechComputerCenter PlainTEXquickreference Page7 \ifdim<dim1><relation><dim2> Comparedimensions \ifodd<int> Trueif<int>isodd \ifvmode Ifinverticalorinternalverticalmode \ifhmode Ifinhorizontalorrestrictedhorizontalmode \ifmmode Ifinmathordisplaymathmode \ifinner Ifininternalvertical,restrictedhorizontal,ornon- displaymathmode \if<token1><token2> Comparecharactercodes(ignorecategories) \ifcat<token1><token2> Comparecategorycodes(ignorecharactercodes) \ifx<token1><token2> Compare unexpanded tokens to see if they have thesamefunction \ifvoid<N> TrueifboxNisempty \ifhbox<N> TrueifboxNcontainsanhbox::: \ifvbox<N> :::orvbox \ifeof<int> Trueifinputfile<int>isatend-of-file \iftrue Alwaystakethetruebranch \iffalse Alwaystakethefalsebranch \ifcase<int><case0-text>[\or<case1-text>]:::[\else<default-text>]\fi Expandthecasecorrespondingto<int> \newif<cs> DeclareaBooleanswitch<cs> \<cs>true SetaBooleanswitch \<cs>false ClearaBooleanswitch \newtoks<cs> Declareatokenlistregister \jobname Unqualifiedfilename,e.g.,"book"for"book.dvi" \fontname<font> Expands to the name of the font file. Note: Use \fontforthecurrent<font>. \meaning<token> Sameas“\let\test=<token> \show\test” \expandafter<token><text> Saves <token> unexpanded; expands <text> in- cluding any arguments; then puts <token> back atthefrontoftheinput \noexpand<token> Expansionis<token>,treatedas\relax \the<cs> Expandinternalquantitytotokenlist \the<codename> Displaythecodenumberfor<codename>,where <codename>::=\catcode|\mathcode|\lccode|\uccode|\sfcode|\delcode \the\fontdimen<int><font> Produces a dimension characteristic of that font, and selected by <int>, e.g., 6 for the “em” dimension \showthe<cs> Sameas\the,butdisplayontheterminal \message<token-list> Writemessageonterminal \edef<cs>::: Expandeddefinition—expandargumentsnow \xdef<cs>::: Same as \global\edef. Use \noexpand to con- trolpartialexpansionwithin\edef. \openin<file>=<filename> Openaninputstream \newread<cs> Openthenextinputstream \closein<file> Closeaninputstream \read<file> to<cs> Input file to a token list register; use -1 for the terminal \loop<prequel>\if<condition><sequel>\repeat NewMexicoTechComputerCenter PlainTEXquickreference Page8 Expands<prequel>,thenevaluatesthe<condition>; if true, expands <sequel> and then returns to <prequel> Chapter 21: Making boxes \vrule <dimitem> Solid black box in horizontal mode. The default widthis0.4pt. \hrule <dimitem> Solid black box in vertical mode. The default heightis0.4pt. \lastbox Remove the last box on the current horizontal or verticallist \unskip Removethelastitemifitisglueorleaders \leaders<fillitem><glue> Acts like <glue> but fills with <fillitem> where <fillitem>isaboxorarule. Fortablesofcontents, use: \def\leaderfill\leaders\hbox to 1em{\hss.\hss\hfill} thenusethisforeachline: \line{<text>\leaderfill <pageno>} \cleaders Like\leadersbutcenteredinthespace,andnot aligned \xleaders Like\leadersbutexpandedtofillthespace \openout<file>=<filename> Openanoutputfile \closeout<file> Closeanoutputfile \write<file>{<tokenlist>} Write a token string (deferred until \shipout time) \immediate\write::: Write it now, don’t defer it until the output rou- tine. Note: Use 16 for the <file> to write on the terminal. \special{<keyword>[ <arg>]} Imageinsertion,forexample WrittenbyJohnW.Shipman([email protected]). Thisversionprinted2003-06-30. Copyright(cid:13)c 2001bytheNew MexicoInstituteofMiningandTechnology. NewMexicoTechComputerCenter PlainTEXquickreference Page9