TeX Primitive Control Sequences
(Alphabetical Order)
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
top a b c d e f g h i j k l m n o p r s t u v w x y
(family order)
Control Sequences | Type | Description |
| above | d | is equivalent to `\abovewithdelims..'. |
| abovedisplayshortskip | pg | is alternate glue placed before a displayed equation. |
| abovedisplayskip | pg | is normal glue placed before a displayed equation. |
| abovewithdelims | c | is a generalized fraction command. |
| accent | c | places an accent on a character. |
| adjdemerits | pi | holds the demerits for visually incompatible adjacent lines. |
| advance | c | increases or decreases a numeric variable. |
| afterassignment | c | saves a token and inserts it after the next assignment. |
| aftergroup | c | saves a token and inserts it after the current group is complete. |
| atop | d | is equivalent to `\atopwithdelims..'. |
| atopwithdelims | d | is a generalized fraction command with an invisible fraction bar. |
Control Sequences | Type | Description |
| badness | iq | is 0-10,000 and represents the badness of the glue settings in the last constructed box. |
| baselineskip | pg | is glue added between lines to keep their baselines consistently spaced. |
| batchmode | c | acts like pressing Q in response to an error. |
| begingroup | c | starts a group that must be ended by \endgroup. |
| belowdisplayshortskip | pg | is alternate glue placed after a displayed equation. |
| belowdisplayskip | pg | is normal glue placed after a displayed equation. |
| binoppenalty | pi | is the penalty for a line break after a binary operation. |
| botmark | c | is the mark text most recently encountered on a page. |
| box | c | puts the box's contents in the current list and empties the box. |
| boxmaxdepth | pd | is the maximum possible depth of a vertical box. |
| brokenpenalty | pi | is the penalty added after a line ending with an hyphenated word. |
Control Sequences | Type | Description |
| catcode | iq | holds the category code for a character. |
| char | c | provides access to one of the 256 characters in a font. |
| chardef | iq | provides an alternate way to define a control sequence that returns a character. |
| cleaders | c | insert centered leaders. |
| closein | c | closes an auxiliary file opened for reading. |
| closeout | c | closes an auxiliary file opened for writing. |
| clubpenalty | pi | is the penalty added after the first line in a paragraph. |
| copy | c | puts the box's contents in the current list but does not empty the box. |
| count | iq | assigns an integer to a \count register. |
| countdef | c | creates a symbolic name for a \count register. |
| cr | c | is a visible command which ends one row in a table. |
| crcr | c | is an alternate to \cr. |
| csname | c | forms a control sequence name from the characters making up a collection of tokens. |
Control Sequences | Type | Description |
| day | pi | holds the current day of the month (1-31). |
| deadcycles | iq | is the number of times \output was called since the last \shipout. |
| def | c | defines a macro. |
| defaulthyphenchar | pi | is the \hyphenchar value to use when a new font is loaded. |
| defaultskewchar | pi | is -1 or the \skewchar value for a font when it is loaded. |
| delcode | iq | is -1 or the delimiter code for a character. |
| delimiter | c | specifies a delimiter. |
| delimiterfactor | pi | is the first parameter used to compute the size of delimeters required by \left and \right. |
| delimitershortfall | pd | is the second parameter used to compute the size of delimeters required by \left and \right. |
| dimen | iq | assigns a <dimen> to a \dimen register. |
| dimendef | c | creates a symbolic name for a \dimen register. |
| discretionary | c | specifies a discretionary break in a paragraph. |
| displayindent | pd | is the amount to shift a line holding a displayed equation. |
| displaylimits | c | restores normal conventions for using limits with operators. |
| displaystyle | c | selects display style: D or D'. |
| displaywidowpenalty | pi | is the penalty added after the penultimate line immediately preceeding a display. |
| displaywidth | pd | is the width of the line holding a displayed equation. |
| divide | c | divides a register by an integer. |
| doublehyphendemerits | pi | holds the demerits added if two consecutive lines end with discretionary breaks. |
| dp | iq | is the depth of a box. |
| dump | c | outputs a format file in INITEX; otherwise it is equivalent to \end. |
Control Sequences | Type | Description |
| edef | c | is similar to \def, except control sequences in the replacement text are expanded when the definition is made. |
| else | c | begins the false part of a conditional. |
| emergencystretch | pd | is glue used in the third pass made for bad paragraphs. |
| end | c | terminates the current job. |
| endcsname | c | is used with \csname to make a control sequence name. |
| endgroup | c | ends a group that was begun by \begingroup. |
| endinput | c | stops input from a file at the end of the current line. |
| endlinechar | pi | is the character added to the end of input lines. |
| eqno | c | puts an equation number at the right-hand margin. |
| errhelp | pt | is text displayed on the terminal if h is pressed after an \errmessage. |
| errmessage | c | displays text on the terminal and interrupts the program. |
| errorcontextlines | pi | is the number of lines to display on the terminal at an error. |
| errorstopmode | c | switches to normal interaction for processing errors. |
| escapechar | pi | is the character used for category 0 characters when outputting control sequences. |
| everycr | pt | holds tokens inserted after every \cr or nonredundent \crcr. |
| everydisplay | pt | holds tokens inserted at the start of every switch to display math mode. |
| everyhbox | pt | holds tokens inserted at the start of every hbox. |
| everyjob | pt | holds tokens which are inserted at the start of every job. |
| everymath | pt | holds tokens inserted at the start of every switch to math mode. |
| everypar | pt | holds tokens added at the beginning of every paragraph. |
| everyvbox | pt | holds tokens inserted at the start of every vbox. |
| exhyphenpenalty | pi | is the penalty for a line break after an explicit hyphen. |
| expandafter | c | `<token1><token2>' is equivalent to `<token1> expansion of <token2>'. |
Control Sequences | Type | Description |
| fam | pi | if 0-15, specifies the font family of class 7 (variable) math symbols. |
| fi | c | is the concluding command of a conditional. |
| finalhyphendemerits | pi | holds the demerits added if the penultimate line in a paragraph ends with a discretionary break. |
| firstmark | c | is the mark text first encountered on a page. |
| floatingpenalty | pi | is the penalty for insertions that are split between pages. |
| font | iq | loads information about a font into TeX's memory. |
| fontdimen | iq | holds font parameters. |
| fontname | c | returns the system file name for a font. |
| futurelet | c | `<cs> <token1> <token2>' is equivalent to `\let <cs> = <token2> <token1> <token2>'. |
Control Sequences | Type | Description |
| gdef | d | is equivalent to `\global\def'. |
| global | c | is an assignment prefix which makes the assignment transcend its group. |
| globaldefs | pi | if positive, all assignments are global; if negative, \global is ignored. |
Control Sequences | Type | Description |
| halign | c | begins the horizontal alignment of material (i.e., makes a table containing rows). |
| hangafter | pi | is the number of lines before hanging indentation changes. |
| hangindent | pd | is the amount of hanging indentation. |
| hbadness | pi | is the badness above which bad hboxes are reported. |
| hbox | c | constructs a box holding horizontal material. |
| hfil | d | inserts first order infinitely stretchable horizontal glue in a horizontal or math list. |
| hfill | d | inserts second order infinitely stretchable horizontal glue in a horizontal or math list. |
| hfilneg | d | cancels the stretchability of \hfil. |
| hfuzz | pd | is the overrun allowed before overfull hboxes are reported. |
| hoffset | pd | is a value added to the default 1-inch left margin. |
| holdinginserts | pi | is positive if insertions should remain dormant when \output is called. |
| hrule | c | makes a rule box in vertical mode. |
| hsize | pd | is the width of normal lines in a paragraph. |
| hskip | c | inserts horizontal glue in a horizontal or math list. |
| hss | d | inserts infinitely stretchable and shrinkable horizontal glue in a horizontal or math list. |
| ht | iq | is the height of a box. |
| hyphenation | c | adds words to the hyphenation exception dictionary for the current language. |
| hyphenchar | iq | holds the current hyphen character used with hyphenation. |
| hyphenpenalty | pi | is the penalty for a line break after a discretionary hyphen. |
Control Sequences | Type | Description |
| if | c | tests if two tokens have the same character codes (i.e., values 0-256). |
| ifcase | c | begins a multi-case conditional. |
| ifcat | c | tests if two tokens have the same category codes (i.e., values 0-16). |
| ifdim | c | compares two dimensions. |
| ifeof | c | tests for the end of a file. |
| iffalse | c | is a conditional which is always false. |
| ifhbox | c | is true if a box register contains an \hbox. |
| ifhmode | c | is true if TeX is in horizontal or restricted horizontal mode. |
| ifinner | c | is true if TeX is in internal vertical, restricted horizontal, or nondisplay math mode. |
| ifmmode | c | is true if TeX is in math or display math mode. |
| ifnum | c | compares two integers. |
| ifodd | c | tests for an odd integer. |
| iftrue | c | is a conditional which is always true. |
| ifvbox | c | is true if a box register contains a \vbox. |
| ifvmode | c | is true if TeX is in vertical or internal vertical mode. |
| ifvoid | c | is true if a box register is void. |
| ifx | c | tests if two tokens are the same. |
| ignorespaces | c | makes TeX read and expand tokens but do nothing until a nonspace token is reached. |
| immediate | c | performs the following output command without waiting for \shipout. |
| indent | c | begins a new paragraph indented by \parindent. |
| input | c | inserts a file at the current position in the source file. |
| inputlineno | iq | holds the line number of the line last read in the current input file. |
| insert | c | places material into an insertions class. |
| insertpenalties | iq | is a quantity used by TeX in two different ways. |
| interlinepenalty | pi | is the penalty added between lines in a paragraph. |
Control Sequences | Type | Description |
| jobname | c | is the underlying file name for a job. |
Control Sequences | Type | Description |
| kern | c | adds a kern item to the current list. |
Control Sequences | Type | Description |
| language | pi | selects a language to use with hyphenation and \patterns. |
| lastbox | c | is void or the last hbox or vbox on the current list. |
| lastkern | iq | is 0.0 pt or the last kern on the current list. |
| lastpenalty | iq | is 0 or the last penalty on the current list. |
| lastskip | iq | is 0.0 pt or the last glue or muglue on the current list. |
| lccode | iq | holds the lowercase value for a character. |
| leaders | c | fill space using specified glue with a box or rule. |
| left | c | makes TeX calculate the size of the delimiter needed at the left of a subformula. |
| lefthyphenmin | pi | is the minimum number of characters that must appear before the first hyphen in an hyphenated word. |
| leftskip | pg | is glue added at the left of every line in a paragraph. |
| leqno | c | puts an equation number at the left-hand margin. |
| let | c | gives a control sequence a token's current meaning. |
| limits | c | displays limits above and below large operators (class 1). |
| linepenalty | pi | is an amount added to the \badness calculated for every line in a paragraph. |
| lineskip | pg | is alternate interline glue used if the \baselineskip glue is not feasible. |
| lineskiplimit | pd | is the cutoff used to select between \baselineskip and \lineskip. |
| long | c | is a prefix for definitions which require multi-paragraph arguments. |
| looseness | pi | tells TeX to try and increase or decrease the number of lines in a paragraph. |
| lower | c | shifts a box down and appends it to the current horizontal or math list. |
| lowercase | c | converts tokens to lowercase. |
Control Sequences | Type | Description |
| mag | pi | holds the magnification ratio times 1000. |
| mark | c | specifies text which should be marked. |
| mathaccent | c | makes an accent atom from the mathchar and the following item. |
| mathbin | c | assigns class 2 (binary operation) to the following character or subformula. |
| mathchar | c | specifies a math character by giving its class, family, and font position. |
| mathchardef | d | provides an alternate way to define a control sequence that returns a math character. |
| mathchoice | c | specifies specific subformulas for the 4 main styles. |
| mathclose | c | assigns class 5 (closing) to the following character or subformula. |
| mathcode | iq | holds the math character (15-bit number) for each of the 256 characters with which TeX works. |
| mathinner | c | makes an inner atom holding the math field. |
| mathop | c | assigns class 1 (large operator) to following character or subformula. |
| mathopen | c | assigns class 4 (opening) to following character or subformula. |
| mathord | c | assigns class 0 (ordinary) to following character or subformula. |
| mathpunct | c | assigns class 6 (punctuation) to following character or subformula. |
| mathrel | c | assigns class 3 (relation) to following character or subformula. |
| mathsurround | pd | is extra space added when switching in and out of math mode. |
| maxdeadcycles | pi | is the maximum allowed value of \deadcycles before an error is generated. |
| maxdepth | pd | is the maximum depth of boxes on the main page. |
| meaning | c | adds characters describing a token to the output stream. |
| medmuskip | pm | is ``medium'' math glue inserted into formulas. |
| message | c | writes an expanded token list on the terminal and to the log file. |
| mkern | c | adds a math kern item to the current math list. |
| month | pi | holds the current month of the year (1-12). |
| moveleft | c | shifts a box left and appends it to the current vertical list. |
| moveright | c | shifts a box right and appends it to the current vertical list. |
| mskip | c | adds math glue to the current math list. |
| multiply | c | multiplies a register by an integer. |
| muskip | iq | assigns <muglue> to a \muskip register. |
| muskipdef | c | creates a symbolic name for a \muskip register. |
Control Sequences | Type | Description |
| newlinechar | pi | is the character which begins a new line of output. |
| noalign | c | inserts vertical mode material after a \cr in a table. |
| noboundary | c | if present, breaks ligatures and kerns. |
| noexpand | c | prevents the expansion of the following token. |
| noindent | c | begins a new paragraph that is not indented. |
| nolimits | c | displays limits to the right of large operators (class 1). |
| nonscript | c | ignores immediately following glue or kern in script and scriptscript styles. |
| nonstopmode | c | acts like pressing R in response to an error. |
| nulldelimiterspace | pd | is the width of a null or missing delimiter. |
| nullfont | iq | is a predefined font with no characters. |
| number | c | produces the decimal equivalent of numbers. |
Control Sequences | Type | Description |
| omit | c | is used in the body of a table to change an entry's template from the one in the preamble. |
| openin | c | opens an auxiliary file for reading. |
| openout | c | opens an auxiliary file for writing. |
| or | c | separates cases in an \ifcase conditional. |
| outer | c | is a prefix for a definition which restricts where the definition may be used. |
| output | pt | holds the token list used to typeset one page. |
| outputpenalty | pi | holds the penalty from the current page break. |
| over | d | is equivalent to `\overwithdelims..'. |
| overfullrule | pd | is the width of the rule appended to an overfull box. |
| overline | c | puts a line over the following character or subformula. |
| overwithdelims | d | is a generalized fraction command with preset fraction bar thickness. |
Control Sequences | Type | Description |
| pagedepth | iq | is the actual depth of the last box on the main page. |
| pagefilllstretch | iq | is the amount of third-order infinite stretchability in the current page. |
| pagefillstretch | iq | is the amount of second-order infinite stretchability in the current page. |
| pagefilstretch | iq | is the amount of first-order infinite stretchability in the current page. |
| pagegoal | iq | is the desired height of the current page. |
| pageshrink | iq | is the amount of finite shrinkability in the current page. |
| pagestretch | iq | is the amount of finite stretchability in the current page. |
| pagetotal | iq | is the accumulated height of the current page. |
| par | c | is an explicit command to end a paragraph. |
| parfillskip | pg | is glue which finishs the last line of a paragraph. |
| parindent | pd | is the width of indentation at the beginning of a paragraph. |
| parshape | iq | specifies an arbitrary paragraph shape. |
| parskip | pg | is extra glue put between paragraphs. |
| patterns | c | is used in INITEX to add patterns to the pattern dictionary for the current language. |
| pausing | pi | if positive, the program halts after every line is read from the input file and waits for a response from the user. |
| penalty | c | adds a penalty to the current list. |
| postdisplaypenalty | pi | is the penalty added immediately after a math display. |
| predisplaypenalty | pi | is the penalty added immediately before a math display. |
| predisplaysize | pd | is the effective width of the line preceeding a displayed equation. |
| pretolerance | pi | is the acceptable \badness of lines in a paragraph before hyphenation is attempted. |
| prevdepth | iq | is the depth of the last box added to the current vertical list. |
| prevgraf | iq | is the number of lines in the paragraph most recently completed or partially completed. |
Control Sequences | Type | Description |
| radical | c | makes a radical atom from the delimiter (27-bit number) and the math field. |
| raise | c | shifts a box up and appends it to the current horizontal or math list. |
| read | c | reads one or more lines from an auxiliary file. |
| relax | c | is a control sequence which typesets nothing. |
| relpenalty | pi | is the penalty for a line break after a relation. |
| right | c | makes TeX calculate the size of the delimiter needed at the right of a subformula. |
| righthyphenmin | pi | is the minimum number of characters that must appear after the last hyphen in an hyphenated word. |
| rightskip | pg | is glue added at the right of every line in a paragraph. |
| romannumeral | c | converts a number to lowercase roman numerals. |
Control Sequences | Type | Description |
| scriptfont | iq | specifies the script font for a family. |
| scriptscriptfont | iq | specifies the scriptscript font for a family. |
| scriptscriptstyle | c | selects scriptscript style: SS or SS'. |
| scriptspace | pd | is extra space added after a subscript or a superscript. |
| scriptstyle | c | selects script style: S or S'. |
| scrollmode | c | acts like pressing S in response to an error. |
| setbox | c | assigns an hbox, vbox, or vtop to a box register. |
| setlanguage | c | inserts a language whatsit in restricted horizontal mode. |
| sfcode | iq | holds the space factor value for a character. |
| shipout | c | sends the contents of a box to the dvi file. |
| show | c | writes a token's definition on the terminal and to the log file. |
| showbox | c | writes the contents of a box to the log file. |
| showboxbreadth | pi | is the maximum number of items per level written by \showbox and \showlists. |
| showboxdepth | pi | is the maximum level written by \showbox and \showlists. |
| showlists | c | writes information about current lists to the log file. |
| showthe | c | writes a value on the terminal and to the log file and interrupts the program. |
| skewchar | iq | is -1 or the character used to fine-tune the positioning of math accents. |
| skip | iq | assigns <glue> to a \skip register. |
| skipdef | c | creates a symbolic name for a \skip register. |
| spacefactor | iq | controls interword spacing. |
| spaceskip | pg | is alternate interword glue. |
| span | c | combines adjacent entries in a table into a single entry. |
| special | c | sends material to the dvi file for special processing. |
| splitbotmark | c | is the mark text of the last mark in the most recent \vsplit operation. |
| splitfirstmark | c | is the mark text of the first mark in the most recent \vsplit operation. |
| splitmaxdepth | pd | is the maximum depth of boxes created by \vsplit. |
| splittopskip | pg | is special glue placed inside the box created by \vsplit. |
| string | c | converts a control sequence to characters. |
Control Sequences | Type | Description |
| tabskip | pg | is optional glue put between columns in a table. |
| textfont | iq | specifies the text font for a family. |
| textstyle | c | selects text style: T or T'. |
| the | c | returns character tokens for an internal quantity's or parameter's current value. |
| thickmuskip | pm | is ``thick'' math glue inserted into formulas. |
| thinmuskip | pm | is ``thin'' math glue inserted into formulas. |
| time | pi | holds the current time in minutes after midnight (0-1439). |
| toks | iq | assigns <replacement text> to a \toks register. |
| toksdef | c | creates a symbolic name for a \toks register. |
| tolerance | pi | is the acceptable \badness of lines after hyphenation. |
| topmark | c | is the value of \botmark on the previous page. |
| topskip | pg | is special glue added before the first box on each page. |
| tracingcommands | pi | if positive, writes commands to the log file. |
| tracinglostchars | pi | if positive, writes characters not in the current font to the log file. |
| tracingmacros | pi | if positive, writes to the log file when expanding macros and arguments. |
| tracingonline | pi | if positive, writes diagnostic output to the terminal as well as to the log file. |
| tracingoutput | pi | if positive, writes contents of shipped out boxes to the log file. |
| tracingpages | pi | if positive, writes the page-cost calculations to the log file. |
| tracingparagraphs | pi | if positive, writes a summary of the line-breaking calculations to the log file. |
| tracingrestores | pi | if positive, writes save-stack details to the log file. |
| tracingstats | pi | if positive, writes memory usage statistics to the log file. |
Control Sequences | Type | Description |
| uccode | iq | holds the uppercase value for a character. |
| uchyph | pi | prevents hyphenation of uppercase words unless this is positive. |
| underline | c | puts a line under the following character or subformula. |
| unhbox | c | puts unwrapped hbox contents in the current list and empties the box. |
| unhcopy | c | puts unwrapped hbox contents in the current list but does not empty the box. |
| unkern | c | removes a kern from the current list. |
| unpenalty | c | removes a penalty from the current list. |
| unskip | c | removes a glue item from the current list. |
| unvbox | c | puts unwrapped vbox contents in the current list and empties the box. |
| unvcopy | c | puts unwrapped vbox contents in the current list but does not empty the box. |
| uppercase | c | converts tokens to uppercase. |
Control Sequences | Type | Description |
| vadjust | c | inserts a vertical list between two lines in a paragraph. |
| valign | c | begins the vertical alignment of material (i.e., makes a table containing columns). |
| vbadness | pi | is the badness above which bad vboxes are reported. |
| vbox | c | constructs a box holding vertical material. |
| vcenter | c | centers material with respect to the axis. |
| vfil | d | inserts first order infinitely stretchable vertical glue in a vertical list. |
| vfill | d | inserts second order infinitely stretchable vertical glue in a vertical list. |
| vfilneg | d | cancels the stretchability of \vfil. |
| vfuzz | pd | is the overrun allowed before overfull vboxes are reported. |
| voffset | pd | is a value added to the default 1-inch top margin. |
| vrule | c | makes a rule box in horizontal mode. |
| vsize | pd | is the desired height of the current page. |
| vskip | c | inserts vertical glue in a vertical list. |
| vsplit | c | removes a specified amount of material from a box register. |
| vss | d | insert infinitely stretchable and shrinkable vertical glue in a vertical list. |
| vtop | c | is an alternate way to construct a box holding vertical material. |
Control Sequences | Type | Description |
| wd | iq | is the width of a box. |
| widowpenalty | pi | is the penalty added after the penultimate line in a paragraph. |
| write | c | writes material to an auxiliary file. |
Control Sequences | Type | Description |
| xdef | d | is equivalent to `\global\edef'. |
| xleaders | c | insert expanded leaders. |
| xspaceskip | pg | is alternate intersentence glue. |
Control Sequences | Type | Description |
| year | pi | holds the current year (e.g., 2000). |
top a b c d e f g h i j k l m n o p r s t u v w x y
(family order)
TeX Primitive Control Sequences
(Family Order)
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Box | Type | Description |
| badness | iq | is 0-10,000 and represents the badness of the glue settings in the last constructed box. |
| box | c | puts the box's contents in the current list and empties the box. |
| boxmaxdepth | pd | is the maximum possible depth of a vertical box. |
| cleaders | c | insert centered leaders. |
| copy | c | puts the box's contents in the current list but does not empty the box. |
| dp | iq | is the depth of a box. |
| everyhbox | pt | holds tokens inserted at the start of every hbox. |
| everyvbox | pt | holds tokens inserted at the start of every vbox. |
| hbadness | pi | is the badness above which bad hboxes are reported. |
| hbox | c | constructs a box holding horizontal material. |
| hfuzz | pd | is the overrun allowed before overfull hboxes are reported. |
| hrule | c | makes a rule box in vertical mode. |
| ht | iq | is the height of a box. |
| lastbox | c | is void or the last hbox or vbox on the current list. |
| leaders | c | fill space using specified glue with a box or rule. |
| overfullrule | pd | is the width of the rule appended to an overfull box. |
| prevdepth | iq | is the depth of the last box added to the current vertical list. |
| setbox | c | assigns an hbox, vbox, or vtop to a box register. |
| unhbox | c | puts unwrapped hbox contents in the current list and empties the box. |
| unhcopy | c | puts unwrapped hbox contents in the current list but does not empty the box. |
| unvbox | c | puts unwrapped vbox contents in the current list and empties the box. |
| unvcopy | c | puts unwrapped vbox contents in the current list but does not empty the box. |
| vbadness | pi | is the badness above which bad vboxes are reported. |
| vbox | c | constructs a box holding vertical material. |
| vfuzz | pd | is the overrun allowed before overfull vboxes are reported. |
| vrule | c | makes a rule box in horizontal mode. |
| vtop | c | is an alternate way to construct a box holding vertical material. |
| wd | iq | is the width of a box. |
| xleaders | c | insert expanded leaders. |
Character | Type | Description |
| \] (control space) | c | inserts a control space. |
| accent | c | places an accent on a character. |
| catcode | iq | holds the category code for a character. |
| char | c | provides access to one of the 256 characters in a font. |
| chardef | iq | provides an alternate way to define a control sequence that returns a character. |
| endlinechar | pi | is the character added to the end of input lines. |
| escapechar | pi | is the character used for category 0 characters when outputting control sequences. |
| lccode | iq | holds the lowercase value for a character. |
| lowercase | c | converts tokens to lowercase. |
| newlinechar | pi | is the character which begins a new line of output. |
| number | c | produces the decimal equivalent of numbers. |
| romannumeral | c | converts a number to lowercase roman numerals. |
| sfcode | iq | holds the space factor value for a character. |
| string | c | converts a control sequence to characters. |
| uccode | iq | holds the uppercase value for a character. |
| uppercase | c | converts tokens to uppercase. |
Debugging | Type | Description |
| batchmode | c | acts like pressing Q in response to an error. |
| errhelp | pt | is text displayed on the terminal if h is pressed after an \errmessage. |
| errmessage | c | displays text on the terminal and interrupts the program. |
| errorcontextlines | pi | is the number of lines to display on the terminal at an error. |
| errorstopmode | c | switches to normal interaction for processing errors. |
| meaning | c | adds characters describing a token to the output stream. |
| message | c | writes an expanded token list on the terminal and to the log file. |
| nonstopmode | c | acts like pressing R in response to an error. |
| pausing | pi | if positive, the program halts after every line is read from the input file and waits for a response from the user. |
| scrollmode | c | acts like pressing S in response to an error. |
| show | c | writes a token's definition on the terminal and to the log file. |
| showbox | c | writes the contents of a box to the log file. |
| showboxbreadth | pi | is the maximum number of items per level written by \showbox and \showlists. |
| showboxdepth | pi | is the maximum level written by \showbox and \showlists. |
| showlists | c | writes information about current lists to the log file. |
| showthe | c | writes a value on the terminal and to the log file and interrupts the program. |
| tracingcommands | pi | if positive, writes commands to the log file. |
| tracinglostchars | pi | if positive, writes characters not in the current font to the log file. |
| tracingmacros | pi | if positive, writes to the log file when expanding macros and arguments. |
| tracingonline | pi | if positive, writes diagnostic output to the terminal as well as to the log file. |
| tracingoutput | pi | if positive, writes contents of shipped out boxes to the log file. |
| tracingpages | pi | if positive, writes the page-cost calculations to the log file. |
| tracingparagraphs | pi | if positive, writes a summary of the line-breaking calculations to the log file. |
| tracingrestores | pi | if positive, writes save-stack details to the log file. |
| tracingstats | pi | if positive, writes memory usage statistics to the log file. |
File I/O | Type | Description |
| closein | c | closes an auxiliary file opened for reading. |
| closeout | c | closes an auxiliary file opened for writing. |
| endinput | c | stops input from a file at the end of the current line. |
| immediate | c | performs the following output command without waiting for \shipout. |
| input | c | inserts a file at the current position in the source file. |
| inputlineno | iq | holds the line number of the line last read in the current input file. |
| openin | c | opens an auxiliary file for reading. |
| openout | c | opens an auxiliary file for writing. |
| output | pt | holds the token list used to typeset one page. |
| read | c | reads one or more lines from an auxiliary file. |
| shipout | c | sends the contents of a box to the dvi file. |
| special | c | sends material to the dvi file for special processing. |
| write | c | writes material to an auxiliary file. |
Glue | Type | Description |
| hfil | d | inserts first order infinitely stretchable horizontal glue in a horizontal or math list. |
| hfill | d | inserts second order infinitely stretchable horizontal glue in a horizontal or math list. |
| hfilneg | d | cancels the stretchability of \hfil. |
| hskip | c | inserts horizontal glue in a horizontal or math list. |
| hss | d | inserts infinitely stretchable and shrinkable horizontal glue in a horizontal or math list. |
| lastskip | iq | is 0.0 pt or the last glue or muglue on the current list. |
| unskip | c | removes a glue item from the current list. |
| vfil | d | inserts first order infinitely stretchable vertical glue in a vertical list. |
| vfill | d | inserts second order infinitely stretchable vertical glue in a vertical list. |
| vfilneg | d | cancels the stretchability of \vfil. |
| vskip | c | inserts vertical glue in a vertical list. |
| vss | d | insert infinitely stretchable and shrinkable vertical glue in a vertical list. |
Hyphenation | Type | Description |
| - (discretionary hyphen) | d | inserts a discretionary hyphen. |
| defaulthyphenchar | pi | is the \hyphenchar value to use when a new font is loaded. |
| discretionary | c | specifies a discretionary break in a paragraph. |
| hyphenation | c | adds words to the hyphenation exception dictionary for the current language. |
| hyphenchar | iq | holds the current hyphen character used with hyphenation. |
| language | pi | selects a language to use with hyphenation and \patterns. |
| lefthyphenmin | pi | is the minimum number of characters that must appear before the first hyphen in an hyphenated word. |
| patterns | c | is used in INITEX to add patterns to the pattern dictionary for the current language. |
| righthyphenmin | pi | is the minimum number of characters that must appear after the last hyphen in an hyphenated word. |
| setlanguage | c | inserts a language whatsit in restricted horizontal mode. |
| uchyph | pi | prevents hyphenation of uppercase words unless this is positive. |
Inserts | Type | Description |
| holdinginserts | pi | is positive if insertions should remain dormant when \output is called. |
| insert | c | places material into an insertions class. |
| insertpenalties | iq | is a quantity used by TeX in two different ways. |
| splitbotmark | c | is the mark text of the last mark in the most recent \vsplit operation. |
| splitfirstmark | c | is the mark text of the first mark in the most recent \vsplit operation. |
| splitmaxdepth | pd | is the maximum depth of boxes created by \vsplit. |
| splittopskip | pg | is special glue placed inside the box created by \vsplit. |
| vsplit | c | removes a specified amount of material from a box register. |
Job | Type | Description |
| day | pi | holds the current day of the month (1-31). |
| deadcycles | iq | is the number of times \output was called since the last \shipout. |
| dump | c | outputs a format file in INITEX; otherwise it is equivalent to \end. |
| end | c | terminates the current job. |
| everyjob | pt | holds tokens which are inserted at the start of every job. |
| jobname | c | is the underlying file name for a job. |
| mag | pi | holds the magnification ratio times 1000. |
| maxdeadcycles | pi | is the maximum allowed value of \deadcycles before an error is generated. |
| month | pi | holds the current month of the year (1-12). |
| time | pi | holds the current time in minutes after midnight (0-1439). |
| year | pi | holds the current year (e.g., 2000). |
Kern | Type | Description |
| kern | c | adds a kern item to the current list. |
| lastkern | iq | is 0.0 pt or the last kern on the current list. |
| lower | c | shifts a box down and appends it to the current horizontal or math list. |
| moveleft | c | shifts a box left and appends it to the current vertical list. |
| moveright | c | shifts a box right and appends it to the current vertical list. |
| raise | c | shifts a box up and appends it to the current horizontal or math list. |
| unkern | c | removes a kern from the current list. |
Logic | Type | Description |
| else | c | begins the false part of a conditional. |
| fi | c | is the concluding command of a conditional. |
| if | c | tests if two tokens have the same character codes (i.e., values 0-256). |
| ifcase | c | begins a multi-case conditional. |
| ifcat | c | tests if two tokens have the same category codes (i.e., values 0-16). |
| ifdim | c | compares two dimensions. |
| ifeof | c | tests for the end of a file. |
| iffalse | c | is a conditional which is always false. |
| ifhbox | c | is true if a box register contains an \hbox. |
| ifhmode | c | is true if TeX is in horizontal or restricted horizontal mode. |
| ifinner | c | is true if TeX is in internal vertical, restricted horizontal, or nondisplay math mode. |
| ifmmode | c | is true if TeX is in math or display math mode. |
| ifnum | c | compares two integers. |
| ifodd | c | tests for an odd integer. |
| iftrue | c | is a conditional which is always true. |
| ifvbox | c | is true if a box register contains a \vbox. |
| ifvmode | c | is true if TeX is in vertical or internal vertical mode. |
| ifvoid | c | is true if a box register is void. |
| ifx | c | tests if two tokens are the same. |
| or | c | separates cases in an \ifcase conditional. |
Macro | Type | Description |
| afterassignment | c | saves a token and inserts it after the next assignment. |
| aftergroup | c | saves a token and inserts it after the current group is complete. |
| begingroup | c | starts a group that must be ended by \endgroup. |
| csname | c | forms a control sequence name from the characters making up a collection of tokens. |
| def | c | defines a macro. |
| edef | c | is similar to \def, except control sequences in the replacement text are expanded when the definition is made. |
| endcsname | c | is used with \csname to make a control sequence name. |
| endgroup | c | ends a group that was begun by \begingroup. |
| expandafter | c | `<token1><token2>' is equivalent to `<token1> expansion of <token2>'. |
| futurelet | c | `<cs> <token1> <token2>' is equivalent to `\let <cs> = <token2> <token1> <token2>'. |
| gdef | d | is equivalent to `\global\def'. |
| global | c | is an assignment prefix which makes the assignment transcend its group. |
| globaldefs | pi | if positive, all assignments are global; if negative, \global is ignored. |
| let | c | gives a control sequence a token's current meaning. |
| long | c | is a prefix for definitions which require multi-paragraph arguments. |
| noexpand | c | prevents the expansion of the following token. |
| outer | c | is a prefix for a definition which restricts where the definition may be used. |
| relax | c | is a control sequence which typesets nothing. |
| the | c | returns character tokens for an internal quantity's or parameter's current value. |
| xdef | d | is equivalent to `\global\edef'. |
Marks | Type | Description |
| botmark | c | is the mark text most recently encountered on a page. |
| firstmark | c | is the mark text first encountered on a page. |
| mark | c | specifies text which should be marked. |
| topmark | c | is the value of \botmark on the previous page. |
Math | Type | Description |
| above | d | is equivalent to `\abovewithdelims..'. |
| abovedisplayshortskip | pg | is alternate glue placed before a displayed equation. |
| abovedisplayskip | pg | is normal glue placed before a displayed equation. |
| abovewithdelims | c | is a generalized fraction command. |
| atop | d | is equivalent to `\atopwithdelims..'. |
| atopwithdelims | d | is a generalized fraction command with an invisible fraction bar. |
| belowdisplayshortskip | pg | is alternate glue placed after a displayed equation. |
| belowdisplayskip | pg | is normal glue placed after a displayed equation. |
| binoppenalty | pi | is the penalty for a line break after a binary operation. |
| defaultskewchar | pi | is -1 or the \skewchar value for a font when it is loaded. |
| delcode | iq | is -1 or the delimiter code for a character. |
| delimiter | c | specifies a delimiter. |
| delimiterfactor | pi | is the first parameter used to compute the size of delimeters required by \left and \right. |
| delimitershortfall | pd | is the second parameter used to compute the size of delimeters required by \left and \right. |
| displayindent | pd | is the amount to shift a line holding a displayed equation. |
| displaylimits | c | restores normal conventions for using limits with operators. |
| displaystyle | c | selects display style: D or D'. |
| displaywidowpenalty | pi | is the penalty added after the penultimate line immediately preceeding a display. |
| displaywidth | pd | is the width of the line holding a displayed equation. |
| eqno | c | puts an equation number at the right-hand margin. |
| everydisplay | pt | holds tokens inserted at the start of every switch to display math mode. |
| everymath | pt | holds tokens inserted at the start of every switch to math mode. |
| fam | pi | if 0-15, specifies the font family of class 7 (variable) math symbols. |
| left | c | makes TeX calculate the size of the delimiter needed at the left of a subformula. |
| leqno | c | puts an equation number at the left-hand margin. |
| limits | c | displays limits above and below large operators (class 1). |
| mathaccent | c | makes an accent atom from the mathchar and the following item. |
| mathbin | c | assigns class 2 (binary operation) to the following character or subformula. |
| mathchar | c | specifies a math character by giving its class, family, and font position. |
| mathchardef | d | provides an alternate way to define a control sequence that returns a math character. |
| mathchoice | c | specifies specific subformulas for the 4 main styles. |
| mathclose | c | assigns class 5 (closing) to the following character or subformula. |
| mathcode | iq | holds the math character (15-bit number) for each of the 256 characters with which TeX works. |
| mathinner | c | makes an inner atom holding the math field. |
| mathop | c | assigns class 1 (large operator) to following character or subformula. |
| mathopen | c | assigns class 4 (opening) to following character or subformula. |
| mathord | c | assigns class 0 (ordinary) to following character or subformula. |
| mathpunct | c | assigns class 6 (punctuation) to following character or subformula. |
| mathrel | c | assigns class 3 (relation) to following character or subformula. |
| mathsurround | pd | is extra space added when switching in and out of math mode. |
| medmuskip | pm | is ``medium'' math glue inserted into formulas. |
| mkern | c | adds a math kern item to the current math list. |
| mskip | c | adds math glue to the current math list. |
| muskip | iq | assigns <muglue> to a \muskip register. |
| muskipdef | c | creates a symbolic name for a \muskip register. |
| nolimits | c | displays limits to the right of large operators (class 1). |
| nonscript | c | ignores immediately following glue or kern in script and scriptscript styles. |
| nulldelimiterspace | pd | is the width of a null or missing delimiter. |
| over | d | is equivalent to `\overwithdelims..'. |
| overline | c | puts a line over the following character or subformula. |
| overwithdelims | d | is a generalized fraction command with preset fraction bar thickness. |
| postdisplaypenalty | pi | is the penalty added immediately after a math display. |
| predisplaypenalty | pi | is the penalty added immediately before a math display. |
| predisplaysize | pd | is the effective width of the line preceeding a displayed equation. |
| radical | c | makes a radical atom from the delimiter (27-bit number) and the math field. |
| relpenalty | pi | is the penalty for a line break after a relation. |
| right | c | makes TeX calculate the size of the delimiter needed at the right of a subformula. |
| scriptfont | iq | specifies the script font for a family. |
| scriptscriptfont | iq | specifies the scriptscript font for a family. |
| scriptscriptstyle | c | selects scriptscript style: SS or SS'. |
| scriptspace | pd | is extra space added after a subscript or a superscript. |
| scriptstyle | c | selects script style: S or S'. |
| skewchar | iq | is -1 or the character used to fine-tune the positioning of math accents. |
| textfont | iq | specifies the text font for a family. |
| textstyle | c | selects text style: T or T'. |
| thickmuskip | pm | is ``thick'' math glue inserted into formulas. |
| thinmuskip | pm | is ``thin'' math glue inserted into formulas. |
| underline | c | puts a line under the following character or subformula. |
| vcenter | c | centers material with respect to the axis. |
Page | Type | Description |
| hoffset | pd | is a value added to the default 1-inch left margin. |
| maxdepth | pd | is the maximum depth of boxes on the main page. |
| pagedepth | iq | is the actual depth of the last box on the main page. |
| pagefilllstretch | iq | is the amount of third-order infinite stretchability in the current page. |
| pagefillstretch | iq | is the amount of second-order infinite stretchability in the current page. |
| pagefilstretch | iq | is the amount of first-order infinite stretchability in the current page. |
| pagegoal | iq | is the desired height of the current page. |
| pageshrink | iq | is the amount of finite shrinkability in the current page. |
| pagestretch | iq | is the amount of finite stretchability in the current page. |
| pagetotal | iq | is the accumulated height of the current page. |
| topskip | pg | is special glue added before the first box on each page. |
| voffset | pd | is a value added to the default 1-inch top margin. |
| vsize | pd | is the desired height of the current page. |
Paragraph | Type | Description |
| adjdemerits | pi | holds the demerits for visually incompatible adjacent lines. |
| baselineskip | pg | is glue added between lines to keep their baselines consistently spaced. |
| doublehyphendemerits | pi | holds the demerits added if two consecutive lines end with discretionary breaks. |
| emergencystretch | pd | is glue used in the third pass made for bad paragraphs. |
| everypar | pt | holds tokens added at the beginning of every paragraph. |
| finalhyphendemerits | pi | holds the demerits added if the penultimate line in a paragraph ends with a discretionary break. |
| hangafter | pi | is the number of lines before hanging indentation changes. |
| hangindent | pd | is the amount of hanging indentation. |
| hsize | pd | is the width of normal lines in a paragraph. |
| ignorespaces | c | makes TeX read and expand tokens but do nothing until a nonspace token is reached. |
| indent | c | begins a new paragraph indented by \parindent. |
| leftskip | pg | is glue added at the left of every line in a paragraph. |
| lineskip | pg | is alternate interline glue used if the \baselineskip glue is not feasible. |
| lineskiplimit | pd | is the cutoff used to select between \baselineskip and \lineskip. |
| looseness | pi | tells TeX to try and increase or decrease the number of lines in a paragraph. |
| noboundary | c | if present, breaks ligatures and kerns. |
| noindent | c | begins a new paragraph that is not indented. |
| par | c | is an explicit command to end a paragraph. |
| parfillskip | pg | is glue which finishs the last line of a paragraph. |
| parindent | pd | is the width of indentation at the beginning of a paragraph. |
| parshape | iq | specifies an arbitrary paragraph shape. |
| parskip | pg | is extra glue put between paragraphs. |
| pretolerance | pi | is the acceptable \badness of lines in a paragraph before hyphenation is attempted. |
| prevgraf | iq | is the number of lines in the paragraph most recently completed or partially completed. |
| rightskip | pg | is glue added at the right of every line in a paragraph. |
| spacefactor | iq | controls interword spacing. |
| spaceskip | pg | is alternate interword glue. |
| tolerance | pi | is the acceptable \badness of lines after hyphenation. |
| vadjust | c | inserts a vertical list between two lines in a paragraph. |
| xspaceskip | pg | is alternate intersentence glue. |
Penalties | Type | Description |
| brokenpenalty | pi | is the penalty added after a line ending with an hyphenated word. |
| clubpenalty | pi | is the penalty added after the first line in a paragraph. |
| exhyphenpenalty | pi | is the penalty for a line break after an explicit hyphen. |
| floatingpenalty | pi | is the penalty for insertions that are split between pages. |
| hyphenpenalty | pi | is the penalty for a line break after a discretionary hyphen. |
| interlinepenalty | pi | is the penalty added between lines in a paragraph. |
| lastpenalty | iq | is 0 or the last penalty on the current list. |
| linepenalty | pi | is an amount added to the \badness calculated for every line in a paragraph. |
| outputpenalty | pi | holds the penalty from the current page break. |
| penalty | c | adds a penalty to the current list. |
| unpenalty | c | removes a penalty from the current list. |
| widowpenalty | pi | is the penalty added after the penultimate line in a paragraph. |
Registers | Type | Description |
| advance | c | increases or decreases a numeric variable. |
| count | iq | assigns an integer to a \count register. |
| countdef | c | creates a symbolic name for a \count register. |
| dimen | iq | assigns a <dimen> to a \dimen register. |
| dimendef | c | creates a symbolic name for a \dimen register. |
| divide | c | divides a register by an integer. |
| multiply | c | multiplies a register by an integer. |
| skip | iq | assigns <glue> to a \skip register. |
| skipdef | c | creates a symbolic name for a \skip register. |
| toks | iq | assigns <replacement text> to a \toks register. |
| toksdef | c | creates a symbolic name for a \toks register. |
Tables | Type | Description |
| cr | c | is a visible command which ends one row in a table. |
| crcr | c | is an alternate to \cr. |
| everycr | pt | holds tokens inserted after every \cr or nonredundent \crcr. |
| halign | c | begins the horizontal alignment of material (i.e., makes a table containing rows). |
| noalign | c | inserts vertical mode material after a \cr in a table. |
| omit | c | is used in the body of a table to change an entry's template from the one in the preamble. |
| span | c | combines adjacent entries in a table into a single entry. |
| tabskip | pg | is optional glue put between columns in a table. |
| valign | c | begins the vertical alignment of material (i.e., makes a table containing columns). |
top Box Character Debugging File I/O Fonts Glue Hyphenation Inserts Job Kern Logic Macro Marks Math Page Paragraph Penalties Registers Tables
(alpha order)
Synopsis: \] (control space)
Description:
IN certain situations TeX ignores spaces (e.g., after a control word). In other situations it converts multiple spaces into a single space. A control space is used to force TeX to typeset a space [8]. A control space is required when using \nonfrenchspacing to fix the spacing after periods which occur in the middle of a sentence [74]. Regular spaces and blank lines are ignored in vertical mode. However, a control space in vertical mode begins a new paragraph [87]. In math mode regular spaces are ignored, and a control space is required to separate words [163]. A control space adds the same glue to a horizontal or math list that a <space token> with space factor 1000 adds [285 and 290]. Plain TeX defines \<tab> and \<return> so they return a control space [351]. Verbatim listings often make the space character active (category 13) and set it equal to a control space [381].
Example:
1. \def\thello{Hello}
2. \thello World. Whoops! \thello\ World.\par
3. \thello{} World. {\it\thello} World. {\bf\thello\ } World. {\bf\thello\ }World.
Produces: See typeset version.
Comments:
- The control space (on line 2) is only one way to add a needed space.
- Line 3 shows TeX does not remove spaces following a `}'.
- Note: an unwanted space follows the first bold hello (on line 3).
TeXbook References: 8. Also: 8, 10, 19, 73, 74, 86-87, 154, 163, 167, 283, 285, 290, 323, 351, 381.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \- (discretionary hyphen)
Description:
A discretionary hyphen inserts `\discretionary{\charh}{}{}' into a horizontal or math list, provided that h, the \hyphenchar of the current font, is between 0 and 255. Otherwise, it inserts `\discretionary{}{}{}' into the list [455]. If the command occurs in vertical mode, it starts a new paragraph [283]. TeX can break a compound word at an existing hyphen, but it does not apply its hyphenation routine to such words. So, a discretionary hyphen may be required to prevent a bad line break. For example `mass-produced' might need to be changed to `mass-pro\-duced' [96].
Example:
1. \def\tstoryA{There are cries, sobs, confusion among the people, and at
2. that moment the cardinal himself, the Grand Inquisitor, passes by the
3. cathedral. He is an old man . . .}
4. \def\tstoryB{There are cries, sobs, confusion a\-mong the p\-eople, and
5. at that moment the cardinal himself, the Grand Inquisitor, passes by
6. the cathedral. He is an old man . . .}
7. \setbox0=\vbox{\hsize=2.25in \tstoryA}
8. \setbox1=\vbox{\hsize=2.25in \tstoryB}
9. \hbox to \hsize{\box0\hfill\box1}
Produces: See typeset version.
Comments:
- Line 4 adds a discretionary hyphen to `among' and to `people'.
- TeX uses one and ignores the second.
TeXbook References: 455. Also: 95, 283, 287, 292, 455.
Related Primitives: discretionary, hyphenchar.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \/ (italic correction)
Description:
EVERY character in every font has a dimension called the italic correction. For most characters and most fonts that dimension is zero. But fonts that slant (e.g., an italics font) may have many characters with a nonzero dimension. In horizontal mode `\/' means ``add an explicit kern using the italic correction for the preceeding character or ligature to the current list'' [14 and 287]. But in math mode `\/' adds a kern of width zero to the current list [292].
Example:
1. \selffamily AA
2. [{\it f}] [{\it f\/}] [\/{\it f\/}] {\it [}f] {\it [\/}f\/]\par
3. \bgroup
4. \font\rm=cmr12 scaled 2000
5. \font\it=cmti12 scaled 2000
6. \rm[{\it f}] [{\it f\/}] [\/{\it f\/}] {\it [}f] {\it [\/}f\/]\par
7. \egroup\par
8. [\R0{\it f\/}] [\R1{\it f\/}] [\R2{\it f\/}] [\R3{\it f\/}] [\R4{\it f\/}]
9. [\R5{\it f\/}] [\R6{\it f\/}] [\R7{\it f\/}] [\R8{\it f\/}] [\R9{\it f\/}]
10. %\def\R#1{\dimen0=0.05em\multiply\dimen0 by #1\kern\dimen0\relax}
Produces: See typeset version.
Comments:
- This example uses roman and italics fonts for Caslon 224 and Computer Modern at 24 points.
- The first [f] (made by lines 2 and 6) shows an instance where the f\/ requires an italic correction. It is added in the second [f].
- TeX does not provide a pre-character italic correction, and the third [f] shows `[' does not have an italic correction. This is not a problem for CM, but it is for Caslon. It represents something that will need to be lived with or fixed by hand [\R4f].
- The last two examples show the Caslon [ does not have an italic correction, but the CM one does.
- Lines 8-9 shows several examples of hand kerning. The author's preference uses \R4. The definition of \R is shown on line 10.
- One of the lessons here is that changing fonts can introduce subtle problems.
TeXbook References: 14. Also: 14, 64, 287, 292, 306, 382, 455.
Related Primitives: font.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \above<dimen>
Description:
THIS command places the subformula preceeding \above over the subformula following \above. Then it places a rule whose thickness is <dimen> between the two subformulas. The command is a generalization of \over and \atop [143] and a special case of \abovewithdelims [152].
Example:
1. \def\tabove#1%
2. {%
3. {{2 \over 3}\above#1 {1 \over 6}} =
4. {{2 \over 3}\cdot{6 \over 1}} = {12 \over 3} = 4
5. }
6. $$\hbox{$\tabove{1pt}$,}\quad
7. \hbox{$\tabove{2pt}$,}\quad
8. \tabove{1pt},\quad
9. \tabove{2pt}$$
Produces: See typeset version.
Comments:
- Lines 1-5 define a macro which uses \above to typeset an expression that might appear in a fourth or fifth grade mathematics text. The macro has a single parameter which determines the thickness of the main fraction bar used in the first fraction.
- Lines 6-9 create a display and typeset the expression four times: twice in an \hbox in regular math mode and twice in display math mode.
TeXbook References: 143, 152. Also: 143, 152, 292, 444-445.
Related Primitives: over, atop, abovewithdelims.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \abovedisplayshortskip<glue>
Description:
AFTER TeX processes a math display, it adds the following items to the current vertical list: a penalty, glue, the actual display, glue, and a penalty. The two glue items are either the above and below displayskips or the above and below displayshortskips. The latter are used if: a) the display occurs at the start of a paragraph; b) the display follows another display; or c) the display occurs in the middle of a paragraph but does not have a left equation number and does not overlap the preceeding line of text [189].
Example:
\def\tfn#1#2#3#4#5% above & below regular & short skips + post-example skip
{%
\abovedisplayskip=#1
\belowdisplayskip=#2
\abovedisplayshortskip=#3
\belowdisplayshortskip=#4
\hfill The Fibonacci numbers are defined\break
by: $F_0=1$, $F_1=1$, and
$$F_n = F_{n-1} + F_{n-2} \hbox{, for } n \ge 2.$$
A related sequence $\{v_n\}$ is: 2, 1, 3, 4, 7, 11, 18, \char144\ It
satisfies $v_n$ = $x^n + y^n$, where $x = (1 + \sqrt 5)/ 2$
and $y = (1 - \sqrt 5)/ 2$.
\vskip#5
}
\tfn{12pt}{12pt}{0pt}{0pt}{1\baselineskip}
\tfn{12pt}{12pt}{3pt}{3pt}{0pt}
Produces: See typeset version.
Comments:
- These examples are similar to the ones for \abovedisplayskip only this time each example uses short display skips.
- The examples illustrate the two extremes of the short skip Plain TeX provides.
TeXbook References: 189. Also: 189, 274, 348, 415.
Related Primitives: belowdisplayshortskip, abovedisplayskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \abovedisplayskip<glue>
Description:
AFTER TeX processes a math display, it adds the following items to the current vertical list: a penalty, glue, the actual display, glue, and a penalty. The two glue items are either the above and below displayskips or the above and below displayshortskips. The former are used if: a) the display occurs in the middle of a paragraph and the display overlaps the preceeding line of text; or b) the display has a left equation number [189]. Also, the former are used before and after an alignment display [190].
Example:
\def\tfn#1#2#3#4#5% above & below regular & short skips + post-example skip
{%
\abovedisplayskip=#1
\belowdisplayskip=#2
\abovedisplayshortskip=#3
\belowdisplayshortskip=#4
The Fibonacci numbers are defined by: $F_0=1$, $F_1=1$, and
$$F_n = F_{n-1} + F_{n-2} \hbox{, for } n \ge 2.$$
A related sequence $\{v_n\}$ is: 2, 1, 3, 4, 7, 11, 18, \char144\ It
satisfies $v_n$ = $x^n + y^n$, where $x = (1 + \sqrt 5)/ 2$
and $y = (1 - \sqrt 5)/ 2$.
\vskip#5
}
\tfn{3pt}{3pt}{6pt}{6pt}{1\baselineskip}
\tfn{12pt}{12pt}{6pt}{6pt}{0pt}
Produces: See typeset version.
Comments:
- This example typesets the same material twice using regular display skips.
- The first example uses a small value for the glue placed before and after the display. It is what Plain TeX will make if the glue shrinks its maximum amount.
- The second example shows what Plain TeX will make if the glue neither stretches nor shrinks.
TeXbook References: 189. Also: 189, 190, 194, 274, 291, 348, 415.
Related Primitives: belowdisplayskip, abovedisplayshortskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \abovewithdelims<delim1><delim2><dimen>
Description:
THIS command is a generalized form of \above. It builds the same fraction \above does (with a line whose thickness is <dimen>). Then it puts <delim1> before the fraction and <delim2> after it. Both delimiters are scaled appropriately. If a `.' is used for either <delim>, TeX ignores the corresponding delimiter. In fact, \above<dimen> is an abbreviation for `\abovewithdelims..<dimen>'. All the other fraction commands are derived from this command [152].
Example:
1. \def\legendre{\overwithdelims()}
2. \def\tlA{\abovewithdelims()0.4pt}
3. \def\tlB{\abovewithdelims()1.0pt}
4. \def\tlC{\abovewithdelims()2.0pt}
5. $a\legendre p$, ${a\tlA p}$, ${a\tlB p}$, and ${a\tlC p}$.
6. $$\displaylines{{a\legendre p} = +1\hbox{,\quad if\quad}a\hbox{\ R }p,\qquad
7. {a\tlA p} = -1\hbox{,\quad if\quad}a\hbox{\ N }p,\qquad
8. {a\tlC p} = -1\hbox{,\quad if\quad}a\hbox{\ N }p.\cr}$$
Produces: See typeset version.
Comments:
- Lines 1-4 define four macros which make a Legendre symbol. The first macro uses \overwithdelims, and each of the remaining three use \abovewithdelims.
- Line 5 uses each macro to typeset an example in math mode.
- Lines 6-8 typeset three of the macros in display mode.
TeXbook References: 152. Also: 152, 292, 444-445.
Related Primitives: above, over, atop, overwithdelims, atopwithdelims.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \accent<8-bit number><optional assignments>
Description:
THIS command places an accent on a character. The <8-bit number> gives the position of the accent in the current font. The accent should be at the correct position for characters whose height is the x-height of the current font. The accent is raised or lowered to fit taller or shorter characters. The width of the result is the width of the character being accented [54]. The <optional assignments> stands for 0 or more assignments [275-278] other than \setbox. The character receiving the accent should be: a character with category code 11 or 12 (letter or other), a \char or \chardef token, or \noboundary. If a character does not follow the assignment, the result is the same as \char<8-bit number> [286]. Otherwise, the character is accented by the accent. After an accent TeX sets \spacefactor=1000 [287]. If \accent appears in vertical mode, a new paragraph is started [283]. Plain TeX sets up the basic accents for Computer Modern fonts [356]. If another font is used which has the accents in different positions, new definitions are required [nr].
Example:
1. % Accents for 9y encoding of Caslon 224:
2. \def\'#1{{\accent00 #1}}% acute
3. \def\u#1{{\accent01 #1}}% breve
4. \def\v#1{{\accent02 #1}}% hacek or check
5. \def\^#1{{\accent04 #1}}% circumflex or hat
6. \def\"#1{{\accent05 #1}}% umlaut
7. \def\.#1{{\accent06 #1}}% dot (over)
8. \def\`#1{{\accent07 #1}}% grave
9. \def\H#1{{\accent08 #1}}% long Hungarian umlaut
10. \def\=#1{{\accent09 #1}}% macron or bar
11. \def\r#1{{\accent11 #1}}% ring (open dot over)
12. \def\~#1{{\accent12 #1}}% tilde
13. \def\d#1{{\o@lign{\relax#1\crcr\hidewidth\sh@ft{10}.\hidewidth}}}% dot (under)
14. \def\b#1{{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}% bar (under)
15. \vbox to.2ex{\hbox{\char09}\vss}\hidewidth}}}
16. \def\c#1{\setbox\z@\hbox{#1}\dimen\z@=\dp\z@\ifdim\ht\z@=1ex\accent03 #1%cedilla
17. \else{\ooalign{\unhbox\z@\crcr\hidewidth\lower0.9\dimen\z@ %
18. \hbox{\char03}\hidewidth}}\fi}
19. \def\o#1{\setbox\z@\hbox{#1}\dimen\z@=\dp\z@\ifdim\ht\z@=1ex\accent10 #1% ogonek
20. \else{\ooalign{\unhbox\z@\crcr\hidewidth\lower0.9\dimen\z@ %
21. \hbox{\char10}\hidewidth}}\fi}
22. %
23. \'A \u B \v C \^D \"E \.F \`H \H I \=J \r K \~L \d M \b N \c O \o P \o A ---
24. \'a \u b \v c \^d \"e \.f \`g \H h \=k \r l \~m \d n \b o \c p \o q \o a
Produces: See typeset version.
Comments:
- The ``9y'' encoding is a custom encoding I made for Caslon 224.
- Lines 2-15 are a direct modification of the Plain TeX macros.
- Lines 16-18 modify Plain TeX's \c macro by adding the \lower command on line 17.
- Caslon 224 has an ogonek accent which is not in the Computer Modern fonts. The definition of \o on lines 19-21 is a straightforward modification of \c.
- Lines 23-24 use each accent to typeset a mixture of upper and lower case letters.
TeXbook References: 286-287, 356. Also: 9, 54, 86, 283, 286.
Related Primitives: char.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \adjdemerits=<number>
Description:
THIS value is added to the demerits calculated for a line, when TeX is breaking a paragraph into lines, if the line and the previous one are visually incompatible [98]. During the break-up, TeX classifies each line as: tight, decent, loose, or very loose. Also, it says two consecutive lines are visually incompatible if their classifications are not adjacent (i.e., a tight line followed by a loose or very loose one, or a decent line followed by a very loose one) [97].
Example:
\gdef\tstory{There are cries, sobs, confusion among the people, and
at that moment the cardinal himself, the Grand Inquisitor, passes by the
cathedral. He is an old man, almost ninety, tall and erect, with a
withered face and sunken eyes, in which there is still a gleam of light.
He is not dressed in his brilliant cardinal's robes, as he was the day
before, when he was burning the enemies of the Roman Church~\char144
\kern2em\hfill Fyodor Dostoyevsky, {\it The Brothers Karamazov}}
% The example for several primitives uses \tstory.
\hsize=2.5in
\setbox0=\vbox{\adjdemerits=0
\doublehyphendemerits=100000
\finalhyphendemerits=900000
\tstory\par}
\setbox1=\vbox{\adjdemerits=1000000
\doublehyphendemerits=100000
\finalhyphendemerits=900000
\tstory\par}
\hbox{\box0\kern0.25in\box1}
Produces: See typeset version.
Comments:
- This example continues the example on the \finalhyphendemerits reference page.
- The original paragraph (shown on the \doublehyphendemerits page) had several hyphen-related problems.
- Those problems are cleared up on the left paragraph. However, it still uses \adjdemerits=0.
- The paragraph on the right uses a large value for \adjdemerits and is slightly different from the left paragraph.
TeXbook References: 98. Also: +98, 273, @314, @348.
Related Primitives: doublehyphendemerits, finalhyphendemerits.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \advance<numeric variables> by <quantity>
Description:
THIS command is used to increase or decrease one of the <numeric variables>. The <quantity> should have a type compatible with the variable as shown in the following:
| \advance<integer variable> by <number>
|
| \advance<dimen variable> by <dimen>
|
| \advance<glue variable> by <glue>
|
| \advance<muglue variable> by <muglue>
|
An <integer variable> is: a) an explicit \count register (e.g., \count17); b) a control sequence specified using \countdef, \newcount, or something equivalent; or c) an integer parameter such as \tolerance or \widowpenalty. The dimen, glue, and muglue variables are similar. The ``by'' is optional [118 and 276].
Example:
1. \def\tpagenumber#1% page number.
2. {%
3. \bgroup
4. \count1=#1
5. \ifnum\count1 > 0
6. \edef\tpageA{\the\count1}%
7. \advance\count1 by 1
8. \def\tpageB{\the\count1}%
9. \else
10. \count1=-\count1% This makes the page > 0.
11. \edef\tpageA{\romannumeral\count1}%
12. \advance\count1 by 1
13. \def\tpageB{\romannumeral\count1}%
14. \fi
15. The current page number is: \tpageA. The next page number is: \tpageB.\par
16. \egroup
17. }
18. \tpagenumber{127}
19. \tpagenumber{-15}
Produces: See typeset version.
Comments:
- This example is not quite complete since the page number is not stored in a useful place.
- However, it shows one way to increase or decrease a counter and to typeset either the digits in a number or the letters in the roman numeral equivalent of the number.
- If \def is used instead of \edef on lines 6 and 11, the \tpageA macro will use the same value for \count1 that \tpageB uses.
TeXbook References: 118-119. Also: 21, 118-119, 218, 256, 276, 355.
Related Primitives: multiply, divide, count, dimen, skip, muskip.
For Additional Examples, see: day, ifnum, time
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \afterassignment<token>
Description:
THIS command saves <token> (without expansion [215]) and inserts it back into the input after the next assignment. If two \afterassignment commands occur before an assignment, only the second token is saved. If the next assignment is `\setboxn=\hbox{...}', the saved token is inserted immediately after the `{' just before tokens from \everyhbox. Assignments made by \setbox with \vbox or \vtop work the same way [279].
Example:
1. \def\ttrA#1{[#1]}
2. \def\ttrB#1%
3. {%
4. \setbox0=\hbox{{\selffamily AD [}}%
5. \setbox1=\hbox{{\selffamily AD ]}}%
6. \raise0.45\dp0\box0 %
7. {\selffamily AE #1}%
8. \raise0.45\dp1\box1 %
9. }%
10. \def\trtC#1{\def\tpage{#1}\afterassignment\ttrD\let\next=}
11. \def\ttrD
12. {%
13. \advance\tnotenumber by 1%
14. \unskip
15. \if\next.% the working version has other special cases: e.g., `)' `,'.
16. .\superscript{\the\tnotenumber}%
17. \else
18. \R1\superscript{\the\tnotenumber}\ \next
19. \fi
20. \global\setbox\tnotebox=\hbox
21. {%
22. \noindent
23. \unhbox\tnotebox
24. \superscript{\the\tnotenumber}%
25. \R1\tpage.\quad
26. }%
27. }
28. \def\texam#1{#1 --- This example \tr{151} illustrates work-in-progress
29. \tr{176--177}. Originally, all page references \tr{213 and 217} to
30. {\it The TeXBook} \tr{399} in the reference pages appeared directly
31. (e.g., |[151]|) \tr{255}.}
32. \let\tr=\ttrA
33. \setbox0=\vbox{\texam1}
34. \unvbox0\vskip1\baselineskip
35. \let\tr=\ttrB
36. \setbox0=\vbox{\texam2}
37. \unvbox0\vskip1\baselineskip
38. \let\tr=\trtC
39. \tnotenumber=0
40. \setbox\tnotebox=\hbox{}
41. \setbox0=\vbox{\texam3}
42. \unvbox0\vskip0.5\baselineskip\unhbox\tnotebox
Produces: See typeset version.
Comments:
- This is a long example, but it illustrates the power of \afterassignment, \let, \if and TeX in a real situation. The same source (lines 28-31) is made to appear in three distinct ways by changing a formatting routine.
- The basic question is ``How should page references to The TeXbook appear in the Description area on a reference page?'' The example shows three possibilities.
- The first paragraph is made by lines 1 and 28-34. In my opinion the brackets and page numbers in it are much too large.
- The second paragraph is made by lines 2-9, 28-31, and 35-37. I used trial-and-error before deciding on the values used on lines 4-8. Most of the reference pages were completed using this style before I decided there were enough entries like references 2, 3, and 5 to warrant giving the matter more attention.
- The third paragraph is the result of that attention. In my opinion it provides complete documentation in an unobstructive way.
- The one wrinkle is that footnotes should come after periods. After some more thought, I realized TeX could swap the period and the footnote on an as needed basis. That is the real point of this example.
- The third paragraph is made by lines 10-31 and 38-42. The macro \ttrC forms the link between the document and \ttrD which does the typesetting. First, \ttrC saves the reference in a temporary macro. Next, it says: ``read the first token after this macro and put it in \next; then do \ttrD.'' The next token will be a period (for notes 2 and 5) or the character following `}\]' for the other notes (e.g., an `i' for note 1).
- Line 14 removes the glue made by the space which preceeds each \ttr{} in the paragraph.
- Line 15 compares \next and `.'. If they are the same, TeX typesets a period and the correct footnote number. Otherwise, it inserts a small amount of glue (the \R1) and typesets the correct footnote number, a control space, and \next (the next token).
- Lines 20-26 are a quick and dirty way to build the line of references one at a time.
TeXbook References: 279. Also: 215, 279, 352, 364, 376, 401.
Related Primitives: aftergroup, expandafter, futurelet, noexpand.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \aftergroup<token>
Description:
THIS command saves <token> on TeX's save stack (without expansion [215]) and inserts it back into the input when the current group ends. If several \aftergroup commands occur in a group, each of the saved tokens is inserted in the same order the commands occurred [279].
Example:
1. \def\ta{Hello}
2. \def\tb{ World. }
3. \def\tc{How are you?}
4. \begingroup
5. \aftergroup\ta
6. \aftergroup\tb
7. \aftergroup\tc
8. \let\ua=\tc
9. \let\ub=\tb
10. \let\uc=\ta
11. \gdef\ta{I am}
12. \gdef\tb{ fine. }
13. \ua\ub\uc---1---\par
14. \endgroup
15. ---2---
Produces: See typeset version.
Comments:
- Lines 5-7 setup three aftergroup tokens, and lines 11-12 change two of the tokens.
- When the group ends, all three tokens appear with the correct values.
TeXbook References: 279. Also: 215, 279, 363, 374, 377, 379.
Related Primitives: afterassignment, expandafter, futurelet, noexpand.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \atop
Description:
THIS command places one subformula over a second subformula, only it doesn't put a line between the two subformulas as \over does [143]. The command is an abbreviation for `\atopwithdelims..' [152].
Example:
1. $n \atop k = n! / k!(n-k)!,$
2. \hbox{this doesn't work. It needs a pair of braces.}\par\vskip0.5\baselineskip
3. ${n \atop k} = n! / k!(n-k)!$, this looks okay, but it is missing ()'s.
4. $$n \atop k = n! / k!(n-k)!,\quad
5. \hbox{this doesn't work. It needs a pair of braces.}$$\par
6. $${n \atop k} = {n! \over k!(n-k)!} = n! / k!(n-k)!,\quad
7. \hbox{this looks okay, but it is missing the ()'s.}$$
Produces: See typeset version.
Comments:
- TeX's generalized fraction commands often require braces `{}'. Lines 1 and 4-5 show what happens if a required pair is omitted.
- Lines 3 and 6-7 show the corrected material.
- Several of the fractions shown above should be surrounded by parenthesis `()'. They are provided by \atopwithdelims.
TeXbook References: 143, 152. Also: 143, 145, 152, 178, 292, 444.
Related Primitives: over, above, atopwithdelims.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \atopwithdelims<delim1><delim2>
Description:
THIS command is a generalized form of \atop. It builds the same fraction \atop does (without a line). Then, it puts <delim1> before the fraction and <delim2> after it. Both delimiters are scaled appropriately. If a `.' is used for either <delim>, TeX ignores the corresponding delimiter. In fact, \atop is an abbreviation for `\atopwithdelims..'. Also, \atopwithdelims is derived from \abovewithdelims [152].
Example:
1. \def\tchoose{\atopwithdelims()}
2. \def\tc#1#2{{#1\tchoose #2}}
3. $\tc nk = {n \tchoose n-k} = n! / k!(n-k)!$\quad now have needed parenthesis.
4. $$\displaylines{\hbox{Also,}\qquad{n \tchoose k} = {n! \over k!(n-k)!}=
5. n!/k!(n-k!).\hfill\cr}$$
6. {\bf Theorem 75}.\quad If $p$ is a prime, then
7. $$\tc p1,\ \tc p2,\ldots,\ \tc p{p-1}$$
8. are divisible by $p$.
Produces: See typeset version.
Comments:
- Lines 1-2 provide an alternate to Plain TeX's \choose macro.
- The utility of \tc becomes apparent in the display made by line 7.
TeXbook References: 152. Also: 152, 292, 324, 360, 444.
Related Primitives: atop, abovewithdelims.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \badness
Description:
THIS is an internal quantity set after each box is made. It is between 0 and 10,000 unless the box is overfull. Then it is 1,000,000 [229]. If r is the glue set ratio [77], \badness is approximately min(100r3,10000) [97].
Example:
\def\badboxes#1#2%
{%
\overfullrule=0.25pt
\setbox0=\hbox spread#2{#1}%
\count12=\the\badness
\setbox1=\hbox to 2.5in{\box0\hfil\the\count12}%
\box1
}
\badboxes{The badness of this line is: }{-1em}
\badboxes{The badness of this line is: }{-0.5em}
\badboxes{The badness of this line is: }{-0.3em}
\badboxes{The badness of this line is: }{0em}
\badboxes{The badness of this line is: }{1em}
\badboxes{The badness of this line is: }{2em}
\badboxes{The badness of this line is: }{3em}
Produces: See typeset version.
Comments:
- The first line with a badness of 1,000,000 has a thin rule after `is: '. It is the rule placed at the end of overfull boxes. Normally, it is 5 points wide, but the \overfullrule command in \badboxes changed the width to 0.25 points.
- Two of the lines have the same \badness. However, one line is too tight and the other is too loose. So, \badness, by itself, cannot distinguish between tight and loose lines.
TeXbook References: 29, 229. Also: 214, 229, 271.
Related Primitives: hbadness, vbadness, pretolerance, tolerance, emergencystretch.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \baselineskip=<glue>
Description:
THIS parameter gives the desired glue which should separate boxes in a vertical list [78]. In actual practice TeX uses three other primitives to compute the interline glue placed between boxes: \prevdepth = p, \lineskip, and \lineskiplimit = l. Let the box about to be added have height h, and let \baselineskip = {b plus x minus y}. If p <= -1000pt, no interline glue is added. Otherwise, if b >= p + h + l, the glue `(b-p-h) plus x minus y' is added just before the new box. Otherwise, the \lineskip glue is placed just before the new box. After the new box is added, \prevdepth is set to its depth [80]. Text set using 10-point type often uses `\baselineskip = 12pt'. The same ratio (1.2) works well with point sizes from 7-14 points [nr]. To suppress interline glue between two boxes put `\prevdepth=-1000pt' just before the second one. To suppress interline glue between a number of boxes set `\baselineskip=-\maxdimen', `\lineskiplimit=\maxdimen', and `\lineksip=0pt' before the first box [352].
Example:
\parindent=2pc \hsize=4.75in% Point size in all examples is 10pt.
\baselineskip=11.5pt\tstory\par% The \adjdemerits reference page
\baselineskip=12pt\tstory\par% holds the definition of \tstory
\baselineskip=12.5pt\tstory\par
Produces: See typeset version.
Comments:
- These paragraphs show the effect of a small change in the space put between lines of text. The results are even more striking if several pages are typeset each with its own \baselineskip value.
TeXbook References: 78-80, 281. Also: 78-80, 104, 194, 253, 256, 274, 281, 342, 349, 351-352, 409, 414-415.
Related Primitives: lineskip, lineskiplimit, prevdepth.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \batchmode
Description:
NORMALLY, when TeX discovers an error in a file, it stops processing, displays a message on the terminal, and waits for instructions for what to do next. One option at this point is to press Q (run quietly). That tells TeX to continue processing without stopping if further errors arise and to suppress further output to the terminal [31]. If TeX encounters \batchmode in a file, then it begins to process the file just as if Q was entered in response to an error. This is a global change which continues until the end of the file or until one of the other `..mode' commands is encountered [32]. Certain errors cause TeX to stop processing prematurely in \batchmode (e.g., a missing file on an \input statement) [299].
Example:
1. \batchmode
2. .
3. .
4. .
5. \errorstopmode
Produces: See typeset version.
Comments:
- If TeX encounters errors on lines 2-4, it writes an error message to the log file, but it won't display a message on the terminal or stop for user input.
- After line 5 TeX resumes normal error processing.
TeXbook References: 32. Also: 32, 277, 299, 336.
Related Primitives: errorstopmode, nonstopmode, scrollmode.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \begingroup
Description:
THIS command begins a new level of grouping. That group must be terminated by \endgroup not by `}'. The mode doesn't change [279]. Groups begun by `{' and \begingroup must be properly nested; `{\begingroup}\endgroup' generates an error [21].
Example:
1. \catcode`\?=13 % make ? the special character for in-line verbatim
2. \def?{\begingroup\ccflip\getword}%
3. \def\getword#1?{#1\endgroup}%
4. Hello ?\World? How are you\char63\kern2.5pt?\char63? See you later.
Produces: See typeset version.
Comments:
- Line 1 makes `?' an active character.
- Line 2 defines `?'. The definition begins a new group; changes the catcodes of the characters used to control TeX ; and calls \getword.
- Line 3 shows \getword has a single parameter which is ended by a `?'. Thus, everything between the two `?'s gets typeset verbatim\mkindex{verbatim}. The \endgroup on line 3 matches the \begingroup on line 2. When \getword and the group ends, each of the catcodes changed on line 2 reverts to its normal value.
- Line 4 holds some sample text. Note, the ASCII value of a `?' is 63.
TeXbook References: 21, 279. Also: 21, 249, 262, 279, 380, 407, 419.
Related Primitives: endgroup.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \belowdisplayshortskip<glue>
Description:
AFTER TeX processes a math display, it adds the following items to the current vertical list: a penalty, glue, the actual display, glue, and a penalty. The two glue items are either the above and below displayskips or the above and below displayshortskips. The latter are used if: a) the display occurs at the start of a paragraph; b) the display follows another display; or c) the display occurs in the middle of a paragraph but does not have a left equation number and does not overlap the preceeding line of text [189].
Example:
1. \def\tfns#1#2#3#4#5#6% 4 skips, post-example skip, L/R equation # code.
2. {%
3. \abovedisplayskip=#1
4. \belowdisplayskip=#2
5. \abovedisplayshortskip=#3
6. \belowdisplayshortskip=#4
7. \hfill The Fibonacci numbers are defined\break
8. by: $F_0=1$, $F_1=1$, and
9. $$F_n = F_{n-1} + F_{n-2} \hbox{, for } n \ge 2.
10. \def\temptyF{#6}
11. \ifx\temptyF\empty
12. \leqno(13.12)$$
13. \else
14. \eqno(13.12)$$
15. \fi
16. A related sequence $\{v_n\}$ is: 2, 1, 3, 4, 7, 11, 18, \char144\ It
17. satisfies $v_n$ = $x^n + y^n$, where $x = (1 + \sqrt 5)/ 2$
18. and $y = (1 - \sqrt 5)/ 2$.
19. \vskip#5
20. }
21. \tfns{12pt}{12pt}{3pt}{3pt}{1\baselineskip}{}\par
22. \tfns{12pt}{12pt}{3pt}{3pt}{0pt}{-}
Produces: See typeset version.
Comments:
- This example is slightly more complicated than the other display skip examples. It uses lines 10-15 to insert an equation number either on the left or on the right of the display.
- Neither of the displays overlaps the previous line of text. However, the display made by line 21 has a left equation number and uses the regular (non-short) glue. The display made by line 22 has a right equation number and uses short glue.
TeXbook References: 189. Also: 189, 274, 348, 415.
Related Primitives: abovedisplayshortskip, belowdisplayskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \belowdisplayskip<glue>
Description:
AFTER TeX processes a math display, it adds the following items to the current vertical list: a penalty, glue, the actual display, glue, and a penalty. The two glue items are either the above and below displayskips or the above and below displayshortskips. The former are used if: a) the display occurs in the middle of a paragraph and the display overlaps the preceeding line of text; or b) the display has a left equation number [189]. Also, the former are used before and after an alignment display [190].
Example:
\def\tfn#1#2#3#4#5% above & below regular & short skips + post-example skip
{%
\abovedisplayskip=#1
\belowdisplayskip=#2
\abovedisplayshortskip=#3
\belowdisplayshortskip=#4
The Fibonacci numbers are defined by: $F_0=1$, $F_1=1$, and
$$F_n = F_{n-1} + F_{n-2} \hbox{, for } n \ge 2.\leqno(13.11)$$
A related sequence $\{v_n\}$ is: 2, 1, 3, 4, 7, 11, 18, \char144\ It
satisfies $v_n$ = $x^n + y^n$, where $x = (1 + \sqrt 5)/ 2$
and $y = (1 - \sqrt 5)/ 2$.
\vskip#5
}
\tfn{3pt}{3pt}{6pt}{6pt}{1\baselineskip}
\tfn{12pt}{12pt}{6pt}{6pt}{0pt}
Produces: See typeset version.
Comments:
- This example is similar to the one for \abovedisplayskip. It uses the regular (non-short) display skips.
- The first example shows what Plain TeX makes if the glue shrinks its maximum amount, and the second example shows what happens if Plain TeX's glue neither stretches nor shrinks.
TeXbook References: 189. Also: 189, 190, 194, 274, 291, 348, 415.
Related Primitives: abovedisplayskip, belowdisplayshortskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \binoppenalty
Description:
JUST as TeX does not randomly hyphenate words, it does not randomly break math expressions between lines in a paragraph. TeX only considers a break after a relation (e.g., = or <) or a binary operation (e.g., + or ×) [173]. TeX inserts a penalty after a binary operation [174] which is not enclosed in braces and is not part of a generalized fraction [173]. The actual value of the penalty added after a binary operation in an expression is the value of \binoppenalty at the end of the expression [101]. However, the penalty is not inserted if: a) the binary operation is the final item in the entire list; b) the value of the penalty is 10,000 or more; or c) the next item in the list is a penalty item [446-447].
TeXbook References: 174. Also: 101, 174, 272, 322, 348, 446.
Related Primitives: relpenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \botmark
Description:
THIS command holds the mark text that was most recently encountered on the page that was just boxed. It is null (i.e., empty) before the first page. It is equal to the previous \botmark, when a page contains no marks [258]. The value of \botmark is global (i.e., it is not affected by grouping) [259].
Example:
1. % These lines are from the macro that makes the reference page
2. % for a control sequence. See pages 260--261 in TTB for more details.
3. % We have: \def\CScs{ControlSequence}, e.g., \def\CScs{botmark}
4. % \box0 holds everything through the Synopsis line.
5. \mark{\currentcs\noexpand\else\CScs}
6. % Do \eject unless following \box0 will fit on current page.
7. % The \ifdim reference page shows this test.
8. \unvbox0%
9. \mark{\CScs\noexpand\else\CScs}
10. % Typeset the rest of the page.
11. \let\currentcs=\CScs
Produces: See typeset version.
Comments:
- It is tricky to get the correct guide word on the header line of these reference pages. Two things are required.
- First, lines 5 and 9 put a special mark before and after the start of each control sequence. Each mark contains two options separated by `\noexpand\else'.
- Second, the header routine for recto pages uses `\iftrue\botmark\fi' to select that page's guide word.
- The `if' statement expands to \currentcs unless the test referred to on lines 6-7 shows there is room for the start of the next command on the current page. If there is, the mark on line 9 appears on the current page, and the `if' statement expands to \CScs.
TeXbook References: 258-260. Also: 213, 258, 259-260, 262-263, 280.
Related Primitives: mark, firstmark, topmark.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \box<8-bit register number>
Description:
THERE are 256 box registers: \box0 to \box255. A \box command adds the contents of the box to the current list, and it empties the box. It often is better to use \unhbox or \unvbox since they remove the outermost layer of glue in the box. That allows the box's contents to mesh with the other items in the current list. The \copy command is similar to \box except \copy does not empty the box [120]. Plain TeX has a \newbox command which reserves a box for a special purpose [121]. Each insertion class (\insert) reserves a box for its use [122]. Also, \box255\mkindexA{box255} holds the current page which is used by the \output routine [253].
Example:
1. \setbox0=\hbox{\selffamily AB ``Hello, World.''}
2. \box0\par
3. \setbox1=\hbox{``You were in a box, but now you are not!''}
4. \box1\box0
Produces: See typeset version.
Comments:
- The \box0 command on line 4 does nothing because \box0 was emptied on line 2. See the \copy page for comparison.
TeXbook References: 120-122, 222. Also: 120-122, 151, 222, 278, 346, 354, 386, 387.
Related Primitives: copy, unhbox, unvbox, unhcopy, unvcopy.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \boxmaxdepth
Description:
THIS is a dimen parameter whose Plain TeX value is \maxdimen. It is used to fix the depth and height of vboxes. TeX ensures that the depth of a \vbox is no larger than \boxmaxdepth. If necessary, TeX moves the reference point in the vbox down and thereby increases the height and decreases the depth of the box. When a \vtop is constructed, \boxmaxdepth is not used [81]. An output routine often sets \boxmaxdepth to \maxdepth when it builds the body of each page [255].
Example:
1. \def\printboxdimensA#1%
2. {%
3. \boxmaxdepth=#1%
4. \global\setbox1=\vbox{\hrule height 10pt depth 10pt width 20pt}%
5. \the\boxmaxdepth&\the\ht1&\the\dp1&\the\wd1\cr
6. }
7. \halign
8. {\qquad\hfil#&&\quad\hfil#\cr
9. \bf boxmaxdepth&\bf height&\bf depth&\bf width\cr
10. \printboxdimensA{0pt}
11. \printboxdimensA{5pt}
12. \printboxdimensA{15pt}
13. \printboxdimensA{\maxdimen}
14. }
Produces: See typeset version.
Comments:
- Line 4 makes a \vbox whose dimensions are (10+10)x20.
- The rows in the table show how the height and depth of the box are related to the value of \boxmaxdepth.
- Each call to \printboxdimens actually produces one row (line 5) in the table that begins on line 7 and ends on line 14.
TeXbook References: 80-81. Also: 81, 113, 249, 255, 274, 348.
Related Primitives: maxdepth, vbox.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \brokenpenalty
Description:
AFTER TeX breaks a paragraph into lines, it moves each line to the containing vertical list. Normally, TeX places a penalty followed by interline glue between each pair of lines. If a line ends with a discretionary break (e.g., a hyphen), TeX adds \brokenpenalty to the penalties inserted immediately after the line [104].
TeXbook References: 104. Also: 104-105, 272, 348.
Related Primitives: clubpenalty, widowpenalty, interlinepenalty, hyphenpenalty, exhyphenpenalty, discretionary.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \catcode<8-bit number>
Description:
EACH of the 256 characters TeX may encounter is placed in one of 16 categories numbered 0-15 [37]. The command `\catcode`\{=1' assigns `{' to category 1 [39]. Category codes are changed to get verbatim listings [380].
| Category | Description | Plain TeX Value (Character and ASCII) |
| 0 | Escape character | \ | 92 |
| 1 | Beginning of Group | { | 123 |
| 2 | End of Group | } | 125 |
| 3 | Math shift | $ | 36 |
| 4 | Alignment tab | & | 38 |
| 5 | End of line | <return> | 13 |
| 6 | Parameter | # | 35 |
| 7 | Superscript | ^ | 94 |
| 8 | Subscript | _ | 95 |
| 9 | Ignored character | <null> | 0 |
| 10 | Space | 32 |
| 11 | Letter | A-Z and a-z | 65-90 and 97-122 |
| 12 | Other Character | none of above or below |
| 13 | Active Character | ~ | 126 |
| 14 | Comment Character | % | 37 |
| 15 | Invalid character | <delete> | 127 |
Example:
1. \catcode`\?=13 % make ? the special character for in-line verbatim
2. \def?{\begingroup\ccflip\getword}%
3. \def\getword#1?{#1\endgroup}%
4. %
5. ?\uppercase\expandafter{\romannumeral\year}\par?\par
6. ?\ { } & $ # ^ _ ~ % Did? you know that
7. ?\catcode`\{=1? assigns `\{' to category 1\char63
Produces: See typeset version.
Comments:
- Lines 1-3 should show how easy it is to make TeX do in-line verbatim\mkindex{verbatim} listings.
- The \ccflip macro changes the catcodes of the special TeX characters listed on line 6 and of the space character. See appendix A for more details.
- A character other than `?' may be used as the delimiting character provided each `?' on lines 1-3 is changed to the new character.
- Even though `?' is ASCII 63, TeX did not get confused by `\char63' on line 7.
TeXbook References: 37-39. Also: 39, 134, 214, 271, 305, 343, 380-382, 384, 390-391, 421, 424.
Related Primitives: lccode, sfcode, uccode.
For Additional Examples, see: mathchardef, span
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \char<8-bit number>
Description:
THIS command provides access to all the characters in the current font. The number should be in the range 0-255 [43]. It may be expressed in decimal, octal, hexadecimal, or one of several special TeX formats [44-45]. If \char appears in vertical mode, a new paragraph is started [283]. The command may be used in math mode [289].
Example:
1. \def\cp{\char152}% This will trigger an error at some point.
2. \def\bp{\char131\relax}% Need \relax or `131 }' (with a space).
3. \cp\ \uppercase\expandafter{\romannumeral\year}\par
4. At the exchange rate of \bp 1 = \$1.56, \$1000 is \bp 641.03.\par
5. cp = \meaning\cp\ and bp = \meaning\bp.
Produces: See typeset version.
Comments:
- Without the \relax (or a space) on line 2, TeX complains (at runtime) about a bad character code (with value 1311) on line 4. This is a variation of a common problem [71]. Note, the \chardef version of this example does not require \relax.
TeXbook References: 43-45. Also: 43-46, 76, 86, 155, 283, 286, 289, 340, 427, 452.
Related Primitives: accent, chardef, mathcode.
For Additional Examples, see: mathchoice
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \chardef<control sequence>=<number>
Description:
THIS is an efficient alternate to `\def<control sequence>{\char<number>}' [44]. Control sequences defined by \chardef may be used with `\the'. That combination returns <number> in decimal notation [214]. Expansion is suppressed when TeX is reading the <control sequence> [215]. TeX uses hexadecimal notation when it expands `\meaning<control sequence>' [336].
Example:
\chardef\cp=152
\chardef\bp=131
\cp\ \uppercase\expandafter{\romannumeral\year}\par
At the exchange rate of \bp 1 = \$1.56, \$1000 is \bp 641.03.\par
cp = \the\cp\ and bp = \meaning\bp.
Produces: See typeset version.
Comments:
- A comparison of this example with the one for \char shows the version using \def and \char also requires \relax to prevent subtle errors.
TeXbook References: 44. Also: 44, 121, 155, 210, 214, 215, 271, 277, 336, 343, 345, 356, 452.
Related Primitives: char, def.
For Additional Examples, see: meaning
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \cleaders<box or rule><glue>
Description:
LEADERS are used to fill space with a box or a rule. Normally, copies of a box will not completely fill a specified space. So, in addition to \leaders, TeX provides two additional ways to put boxes in the space. The first is \cleaders. It packs boxes tightly together and centers them in the specified space. The second is \xleaders. It breaks the leftover space into equal pieces and puts one piece between each box and on the left and right ends of the boxes. The result is an sbsb \char144\ sbs pattern where s stands for one of the pieces of space and b for one of the boxes [224].
Example:
1. \def\sampletocA#1#2%
2. {%
3. \setbox0=\hbox to 25pt{\vrule height 0.4pt depth 0pt width 25pt}
4. \setbox1=\hbox to 25pt{\vrule\hfil #2}% coincidence that both boxes use 25.
5. \vbox
6. {
7. \hsize=224pt% 24 pt left over!
8. #1\vrule\leaders\copy0\hfill\copy1\par
9. #1\vrule\cleaders\copy0\hfill\copy1\par
10. #1\vrule\xleaders\copy0\hfill\copy1\par
11. }
12. }
13. \sampletocA{\noindent}{100}
14. \sampletocA{Strangers and Brothers}{116}
15. \sampletocA{The Age of Reason}{178}
Produces: See typeset version.
Comments:
- The \vrule on line 8 prevents the \leaders for page 100 from beginning at the left margin.
- If the three vboxes made by the three \sampletocA calls appear too close together, they are! One way to avoid this problem is to use struts [82].
TeXbook References: 224. Also: 224, 225-226, 357, 374.
Related Primitives: leaders, xleaders.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \closein<4-bit number>
Description:
THIS command is used to close a file previously opened by \openin. The number used with \closein should be in the range 0-15 and be the same number used with \openin [217].
Example:
1. \def\tfn{junkjunk.tex}
2. \openin\traux=\tfn\relax
3. \ifeof\traux
4. \closein\traux
5. \else
6. \closein\traux
7. \input\tfn\relax
8. \fi
Produces: See typeset version.
Comments:
- The junkjunk.tex file doesn't hold anything useful, but the lines illustrate one way to read an auxilary file. Note the use of \relax on line 2.
- The junkjunk.tex file is made by the example on the \closeout reference page.
TeXbook References: 217. Also: 217, 280.
Related Primitives: openin, read.
For Additional Examples, see: openin
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \closeout<4-bit number>
Description:
THIS command is used to close a file previously opened by \openout. The number used with \closeout should be in the range 0-15 and be the same number used with \openout [226]. Unless the command is preceeded by \immediate, TeX places the command in a whatsit\mkindex{whatsit`5`file I/O} item in the current list and delays closing the file until a \shipout encounters the list [227].
Example:
\openout\twaux=junkjunk.tex\relax
\write\twaux{{\noexpand\bf byebye}\ World}
\closeout\twaux
Produces: See typeset version.
Comments:
- This example produces no visible output. However, the example on the \closein reference page uses junkjunk.tex. Note, byebye shows up in bold.
- Actually, the \immediate reference page explains how junkjunk.tex is really made.
TeXbook References: 226-228. Also: 226-228, 254, 280, 422.
Related Primitives: openout, write, immediate.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \clubpenalty
Description:
AFTER TeX breaks a paragraph into lines, it moves each line to the containing vertical list. Normally, TeX places a penalty followed by interline glue between each pair of lines. TeX adds \clubpenalty to the penalties inserted immediately after the first line in the paragraph [104].
TeXbook References: 104. Also: 104, 113, 272, 317, 348, 419.
Related Primitives: widowpenalty, brokenpenalty, interlinepenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \copy<8-bit register number>
Description:
THIS command add a copy of the list in the box register to the current list. It behaves just like the \box command except it does not change the contents of the register [120].
Example:
1. \setbox0=\hbox{\selffamily AB ``Hello, World.''}
2. \copy0\par
3. \setbox1=\hbox{``Are you still in a box?''}
4. \copy1\copy0
Produces: See typeset version.
Comments:
- The \copy0 command on line 4 produces the second ``Hello World'' line. See the \box reference page for comparison.
- Even though line 4 makes it look as if \box0 and \box1 will appear on the same line, they don't. That is because in vertical mode boxes are stacked on top of each other.
TeXbook References: 120, 222. Also: 120, 151, 222, 278, 329, 374, 386, 407.
Related Primitives: box, unhcopy, unvcopy.
For Additional Examples, see: cleaders, unhbox
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \count<8-bit register number>=<number>
Description:
THERE are 256 count registers: \count0 to \count255. Each may hold an integer from -2,147,483,647 to 2,147,483,647 (i.e., from -231 to 231). The commands \advance, \multiply, and \divide allow limited arithemetic with the registers [118]. TeX considers \count0 to \count9 to be special and writes the nonzero ones to the terminal and log file each time it writes a page [119]. Plain TeX uses \count0 to hold the page number [119, 362]. The count registers obey TeX's grouping structure. So, changes to a register inside a group will not affect the value of the register outside the group unless \global is used with the register [119]. The command \showthe\countn writes the value for \countn to the terminal and to the log file [121]. The register \count255 is available for temporary storage [122].
Example:
1. \count1 = 100
2. \count2=\count1
3. \multiply\count2 by 3
4. \divide\count2 by 2
5. %\count2=1.5\count1% This does not work with count registers.
6. The counts are: \the\count1, \the\count2.
Produces: See typeset version.
Comments:
- Compare this example which tries to multiply a count register by 1.5 with the example on the \dimen reference page. On that page the technique shown on line 5 works.
TeXbook References: 118-122. Also: 118-122, 207-208, 271, 276, 346-347, 379.
Related Primitives: countdef, ifodd, ifnum, advance, multiply, divide.
For Additional Examples, see: advance, day, divide, ifnum, time, year
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \countdef<name>=<8-bit register number>
Description:
A count register may be used directly (e.g., \count21=1) [118] or indirectly in one of two ways. Each indirect way involves setting up a symbolic name for a register (e.g., \sectno for section number). The first indirect way uses the primitive \countdef (e.g., `\countdef\sectno=21'); this makes \sectno equivalent to \count21. So, the command `\sectno=1' sets the section number to 1 [119]. The second indirect way uses the Plain TeX command \newcount (e.g., `\newcount\sectno'). This time the control sequence \sectno is a count register, but it is not at all apparent which one (the log file should contain a line `\sectno=\countn' for some n) [121]. The direct method is fine for registers used locally in a macro or in a group. The \newcount method (or something equivalent if Plain TeX is not used) is the preferable indirect method. If macros from several sources are used, and two different \countdef's use the same register number, the macros may interfere with each other. This type of problem is difficult to track down [nr]. TeX suppresses expansion when it is reading a control sequence that will be defined by a \countdef [215].
Example:
% count registers
\newcount\headnum\headnum=0 % 0-2: see \def\makeheadline{}.
\newcount\linenumber\linenumber=0 % puts lines # on :exam and :logf data.
\newcount\notenumber\notenumber=0 % numbers \trC{} items.
Produces: See typeset version.
Comments:
- These lines are from the start of the macro file used to prepare these pages and setup needed \count registers. Note, each register is initialized after it is created.
TeXbook References: 119. Also: 119, 121, 210, 215, 271, 277, 346-347.
Related Primitives: count.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \cr
Description:
THIS command is placed at the end of the preamble of an \halign and at the end of each row of data in the \halign [235]. If a particular row in a table requires fewer columns than was specified in the preamble, a \cr after the last one tells TeX: ``there are no more columns on this line'' [245]. When used with a \valign, \cr marks the bottom of a column [249]. Tokens specified by \everycr are inserted after every \cr [275].
Example:
1. \def\tf#1{\omit\hfil #1\hfil}
2. \vbox{\halign
3. {#\hfil\quad&\quad\hfil#\quad&\quad\hfil#\quad&\quad\hfil#\cr
4. \multispan4\hfil 1970 Federal Budget Transfers\hfil\cr
5. \multispan4\hfil (in billions of dollars)\hfil\cr
6. \tf{State}&\tf{Taxes}&\tf{Money}&\tf{Net}\cr
7. &\tf{collected}&\tf{Spent}\cr
8. New York& 22.91& 21.35& -1.56\cr
9. New Jersey& 8.33& 6.96& -1.37\cr
10. Connecticut& 4.12& 3.10& -1.02\cr
11. Maine& 0.74& 0.67& -0.07\cr
12. California& 22.29& 22.42& +0.13\cr
13. New Mexico& 0.70& 1.49& +0.79\cr
14. Georgia& 3.30& 4.28& +0.98\cr
15. Mississippi& 1.15& 2.32& +1.17\cr
16. Texas& 9.33& 11.13& +1.80\cr
17. }}
Produces: See typeset version.
Comments:
- This example begins a multi-reference page example of a table.
- The first version is quite simple. All it does is enter the text of the table. Subsequent versions will add vertical and horizontal rules and polish.
- Note \tf which is defined on line 1 and used on lines 6-7.
- The final version of the table is on the \halign reference page, and the next version is on the \omit reference page.
TeXbook References: 231, 235-236. Also: 175-177, 190-197, 231-238, 245, 248, 275, 282, 351-352, 385-386, 412, 418, 421.
Related Primitives: crcr, everycr, halign, valign.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \crcr
Description:
THIS commands acts like \cr unless it immediately follows a \cr or a \noalign in which case it does nothing [249]. The command often appears in a macro used to format a table (e.g., Plain TeX's \matrix or \cases) [361-362]. Tokens specified by \everycr are inserted after every nonredundant \crcr [275].
Example:
1. \def\er{\crcr\noalign{\hrule}}% \cr\cr makes a blank line
2. \def\strutA#1#2{\vrule height#1 depth#2 width0pt}%\cr\crcr DOES NOT !
3. \def\tm{\hskip0.5em}
4. \halign
5. {\strutA{8.5pt}{3.5pt}\vrule#&\tm#\hfil\tm&\tm#\hfil\tm&\tm#\hfil\tm&
6. #\vrule\cr\er
7. \strutA{9.5pt}{3.5pt}&january&february&march&\cr
8. &april&may&\multispan2\vrule height3.5pt depth 3.5pt
9. \leaders\hrule height3.5pt depth-3.1pt\hfill\vrule\cr
10. &june&july&\omit\vrule\tm\bf Months\hfil&\cr
11. &august&september&\multispan2\vrule height8.5pt depth-3.0pt
12. \leaders\hrule height3.4pt depth-3.0pt\hfill\vrule\cr
13. &october&november&december&\er
14. }
Produces: See typeset version.
Comments:
- The \er macro (defined on line 1) is used instead of \cr when a horizontal rule the width of the table is needed.
- The Months table only requires \er twice: before the first data row (i.e., at the end of the preamble) and after the last data row.
- The preamble has to end with a \cr, and the use of \crcr (instead of just \cr) in \er prevents the table from starting with a blank line.
- Also, notice the trick used on lines 8-9 and 11-12 to position the horizontal and vertical rules around `Months'. That trick and a similar one used on the \span reference page should make it possible to put rules at any position in a table.
- The table is from ``Tbl-A Program to Format Tables'' by M. E. Lesk, which in turn begins on page 157 of Unix Programmer's Manual, Volume 2, 1983.
TeXbook References: 249. Also: 249, 275, 282, 361-362, 385, 412, 421.
Related Primitives: cr, everycr.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \csname<tokens>\endcsname
Description:
A \csname token must be followed by a matching \endcsname token. TeX expands each of the intervening <tokens>. If only character tokens are made, TeX forms a control sequence using all the characters, but, if the expansion produces a primitive, TeX reports an error [40]. If the newly formed control sequence is currently undefined, it is defined to be like \relax [213]. The commands (\csname and \endcsname) allow a document or formatting routine to build a control sequence token on the fly [nr].
Example:
1. \def\tmakedef#1#2{\expandafter\xdef\csname #1\endcsname{#2}}%
2. \count1=0
3. \def\mkr#1#2%
4. {%
5. \global\advance\count1 by 1
6. \tmakedef{ref#1count}{\the\count1}%
7. \tmakedef{ref#1desc}{#2}%
8. }
9. \mkr{A}{The Big Picture}
10. \mkr{B}{Tons of Details}
11. \mkr{C}{The Final Hour}
12. \global\count1=0
13. B---\refBcount---\refBdesc
Produces: See typeset version.
Comments:
- This example has three parts: lines 1-8 which would normally be in a formatting file; lines 9-11 which would normally appear at random places in a document; and lines 12-13 which perform cleanup and check things work.
- Line 1 holds a general purpose macro which builds a control sequence using parameter 1 and defines a macro for the new control sequence which returns parameter 2. The macro uses \xdef to define each new macro instead of the more familar \def. This means each new macro is global and the replacement text (i.e., the value of \count1 on line 6) is expanded when the macro is made (e.g., on line 10) instead of when it is used (e.g., on line 13). The new macro needs to be global because each Example actually takes place inside a group which normally prevents changes made in the example from interfering with the rest of the document.
- Lines 3-8 form a link between \tmakedef and a document. The macro \mkr advances a counter and makes two new control sequences: the first holds the counter and the second holds descriptive text.
- Lines 9-11 make three calls to \mkr. This results in six new control sequences.
- Line 12 is needed to reset \count1. In actual practice a dedicated counter (obtained via \newcount) would be used instead of count1.
- Finally, line 13 checks things work. However, a much better check is shown on the \endcsname reference page.
TeXbook References: 40, 213. Also: 40-41, 213, 348, 375.
Related Primitives: endcsname.
For Additional Examples, see: noexpand, the
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \day
Description:
AT the beginning of each job TeX sets this parameter to the current day (1-31) in the month [349].
Example:
1. \def\mkordinal#1% convert 2 digit integer (1-99) to ordinal: 1st, 2nd, ...
2. {%
3. {%
4. \count1=#1
5. % \the\count1-
6. \divide\count1 by 10 % makes most significant digit.
7. % \the\count1-
8. \count3=\count1
9. \multiply\count3 by 10
10. \count2=#1
11. \advance\count2 by -\count3 % makes least significant digit.
12. \ifcase\count2\def\tss{th}% 10th, 20th, 30th.
13. \or \def\tss{st}% 1st
14. \or \def\tss{nd}% 2nd
15. \or \def\tss{rd}% 3rd
16. \else \def\tss{th}% xth
17. \fi
18. \ifnum\count1=1 % adjust for 11, 12, 13.
19. \def\tss{th}%
20. \fi
21. % \the\count2--
22. #1\superscript{\tss}%
23. }%
24. }
25. \mkordinal{1}, \mkordinal{2}, \mkordinal{3}, \mkordinal{4},
26. \mkordinal{11}, \mkordinal{12}, \mkordinal{13}, \mkordinal{14},
27. \mkordinal{21}, \mkordinal{22}, \mkordinal{23}, \mkordinal{24}, and
28. \mkordinal{31}.\par
29. Today is the \mkordinal{\the\day} day of the month.
Produces: See typeset version.
Comments:
- The purpose of the macro is to produce something similar to what line 29 makes.
- The first version of this macro did not work. Lines 5, 7, and 21 were added to try and see where things were going wrong. It turned out that line 6 did not have the space after 10 and before the comment (i.e., it was `10%'). The moral is: ``a number often needs a space or \relax after it.''
TeXbook References: 349. Also: 273, 349, 406.
Related Primitives: month, year, time.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \deadcycles
Description:
THIS holds the number of times the output routine was performed since the last \shipout. It is set to zero after every \shipout, and it is increased by 1 just before every \output [255].
TeXbook References: 255. Also: 214, 255, 264, 271, 283, 401.
Related Primitives: maxdeadcycles, output, shipout, end.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \def<control sequence><parameter text>{<replacement text>}
Description:
THIS command is used to define a macro. TeX stores the definition (replacement text) and expands the macro when it encounters the macro's control sequence in a document [199-203]. If \par occurs in one of the parameters of a macro, TeX stops processing and reports a runaway argument unless the macro was declared \long [205]. A macro defined inside a group is local to that group unless the macro was declared \global. A macro may be declared \outer if the macro should not be allowed in: a) the argument, the parameter text, or the replacement of another macro; b) the preamble of an alignment; or c) conditional text. The three prefixes (\long, \global, and \outer) can be applied to \def in any order, and they can appear more than once [206].
Example:
1. \def\ta{Bye}
2. \def\tb{Bye}
3. 1. \ta\tb.\par
4. \begingroup
5. \def\ta{Hello}
6. \def\tb{ World}
7. 2. \ta\tb.\par
8. \endgroup
9. 3. \ta\tb.\par
Produces: See typeset version.
Comments:
- This example illustrates the local nature of a macro's definition.
- Lines 1-3 define two macros and typeset each of them.
- Lines 4-8 hold a new group and contain new definitions for the two macros.
- Line 9 typesets the macros a third time. The results are the same as the first time since lines 3 and 9 are in the same group, and no redefinitions occurred in that group.
TeXbook References: 203-206. Also: 44, 136, 199-208, 215, 275-276.
Related Primitives: gdef, edef, xdef, global, long, outer, chardef, mathchardef, countdef, dimendef, muskipdef, skipdef, toksdef.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \defaulthyphenchar=<number>
Description:
WHEN TeX loads a new font, it sets the \hyphenchar of the font to this value [273]. The Plain TeX value is 45 which is the ASCII value of a hyphen `-' [348]. Once a font is loaded, a new assignment may be made. For example, the manmac format sets `\hyphenchar \tentt=-1' [414]. This prevents hyphenation of the control sequence names and keywords which appear in The TeXbook [454]. Setting `\defaulthyphenchar=-1' at the top of a document disables hyphenation for the document [nr].
TeXbook References: 273. Also: 273, 348, 414, 454.
Related Primitives: hyphenchar.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \defaultskewchar
Description:
EACH time TeX loads a new font, it sets the \skewchar of the font to this parameter. Since most fonts do not have or need a working skew char, there is little need to change this parameter from its Plain TeX value [273].
TeXbook References: 273. Also: 273, 348.
Related Primitives: skewchar.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \delcode<8-bit number>=<24-bit number>
Description:
EACH of the 256 characters TeX works with has a \delcode. INITEX sets all delcodes to -1 except the one for a `.' which it makes 0 [345]. Only characters which can act as delimiters in math formulas require a positive delcode. A delcode assignment looks like: `\delcode`a="uvwxyz '. It means a small form of the delimiter for the character a has position "vw in family "u, and a large form has position "yz in family "x. If either form is in position 0 of family 0, the form is ignored. TeX only looks at the delcode of a character when the character follows \left, \right, or one of the `..withdelims' commands. If the delcode of the character is negative, TeX reports an error. Otherwise, it uses the value to decide on the size delimiter to use. The above rules explain why `\right.' does not make a delimiter [156]. Plain TeX makes nine assignments similar to `\delcode`\[="05B302 '. This one makes [ an acceptable delimiter. Also, it says a small form of the delimiter is in position "5B of family 0 and a large version is in position "02 of family 3 [345, 427, and 432].
TeXbook References: 156, 345. Also: 156, 214, 271, 290, 345.
Related Primitives: mathcode, delimiter, fam.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \delimiter<number>
Description:
THIS command provides a way to specify a delimiter directly. The number should be seven hexadecimal digits. Its leading digit must be in the range 0-7. That digit functions as a class number, and the remaining six digits function as a \delcode value [156]. Plain TeX has over twenty definitions similar to: `\def\rceil{\delimiter"5265307 }' [359]. This definition means \rceil is in family 5 (closing), its small form is in family 2 position "65, and its large form is in family 3 position "07. A \delimiter specifies a math symbol and works in two ways. When TeX is looking for a delimiter (e.g., after \left), it ignores the class digit and uses the remaining six digits as a \delcode. But, when the delimiter appears in other contexts, the right three digits are dropped, and the remaining four digits become the symbol's \mathcode. For \rceil that means the \delcode is "265307 and the \mathcode is "5265 [156].
Example:
1. \def\tdela{\delimiter"462833A }% a space or \relax is mandatory!
2. \def\tdelb{\delimiter"562933B }
3. \setbox0=\vbox{\hsize=2in$\tdela x-y\tdelb(x+y)=x^2-y^2$}
4. \def\tbox#1#2#3%
5. {%
6. \setbox#1=\vbox{\hsize=1.5in$$#2\sum_{n=0}^\infty {1\over2^n}#3^2 = 4$$}
7. }
8. \tbox1{\tdela}{\tdelb}
9. \tbox2{\left\tdela}{\right\tdelb}
10. \hbox to \hsize{\quad\raise24pt\box0\hfil\raise4pt\box1\hfil\box2\quad}
Produces: See typeset version.
Comments:
- Lines 1-2 define two control sequences: \tdela and \tdelb. Plain TeX calls them: \lgroup and \rgroup [359].
- On lines 3 and 8 TeX treats the new items as ordinary math symbols whose mathcodes are: "4628 and "5629. Plain TeX's family 6 is cmbx [157], and the characters in positions "28 and "29 of it are bold forms of the left and right parenthesis.
- On line 9 TeX treats the new items as delimiters. The display requires the large form of each delimiter, so "33A and "33B are used. Those characters are in family 3, the math extension font.
TeXbook References: 156. Also: 156, 289-290, 359.
Related Primitives: mathcode, delcode, fam, radical.
For Additional Examples, see: nulldelimiterspace
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \delimiterfactor
Description:
WHEN TeX computes the size of delimiters for a `\left<subformula>\right' construction, it begins by calculating the distances the subformula extends above and below the axis. Next, it makes y equal to twice the maximum of the distances just computed. Then, it computes `y·f/1000' and `y-d'. Finally, it makes the actual delimiters larger than each of the last two calculations. In the calculations f is the \delimiterfactor and d is the \delimitershortfall [152].
Example:
1. \def\tf#1#2%
2. {%
3. $$\delimiterfactor=#1
4. \delimitershortfall=#2
5. f(x) = \left\{\vcenter{%
6. \halign
7. {$##\hfil$&\quad ##\hfil\cr
8. x^2 + 2x - 1 & if $x < 0$,\cr
9. x^3 - 1 & if $0 \le x < 1$,\cr
10. x^2 + x - 1 & if $1 \le x < 2$,\cr
11. x^3 - x^2 + 1 & if $2 \le x$.\cr
12. }}%
13. \right.% NO right delimiter!
14. $$%
15. }
16. \setbox0 = \vbox{\hsize=2.25in\tf{901}{5pt}}
17. \setbox1 = \vbox{\hsize=2.25in\tf{500}{\maxdimen}}
18. \hbox to 5.0in{\quad\box0\hfill\box1}
Produces: See typeset version.
Comments:
- Lines 1-15 define a macro with two parameters. Line 3 sets \delimiterfactor to the first parameter, and line 4 sets \delimitershortfall to the second parameter. The remaining lines construct a multi-line function and use \left to make the left brace in that construction.
- Line 16 calls the macro using Plain TeX's values for the two parameters.
- Line 17 uses values that cause TeX to ignore \delimitershortfall and to use a scaling factor of ½.
- Line 18 typesets each of the boxes made by lines 16-17.
TeXbook References: 152. Also: 152, 273, 348, 446.
Related Primitives: delimitershortfall, left, right.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \delimitershortfall
Description:
WHEN TeX computes the size of delimiters for a `\left<subformula>\right' construction, it begins by calculating the distances the subformula extends above and below the axis. Next, it makes y equal to twice the maximum of the distances just computed. Then, it computes `y·f/1000' and `y-d'. Finally, it makes the actual delimiters larger than each of the last two calculations. In the calculations f is the \delimiterfactor and d is the \delimitershortfall [152].
Example:
1. \setbox0 = \vbox{\hsize=2.25in\tf{901}{5pt}}
2. \setbox1 = \vbox{\hsize=2.25in\tf{10}{12pt}}
3. \hbox to 5.0in{\quad\box0\hfill\box1}
Produces: See typeset version.
Comments:
- This example should be compared to the one on the \delimiterfactor reference page. In particular, that page contains the definition of the macro \tf.
- Line 1 calls the macro using Plain TeX's values for \delimiterfactor and \delimitershortfall.
- Line 2 uses values that cause TeX to ignore \delimiterfactor and to make the brace about one line smaller than it should be.
TeXbook References: 152. Also: 152, 274, 348, 446.
Related Primitives: delimiterfactor, left, right.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \dimen<8-bit register number>=<dimen>
Description:
THERE are 256 dimen registers: \dimen0 to \dimen255. Each may hold a dimension. The commands \advance, \multiply, and \divide allow limited arithemetic with the registers. A dimen register may be placed in a count register. TeX converts a dimension to a number by assuming units of sp (scaled points) [118]. The dimen registers obey TeX's grouping structure. So, changes to a register inside a group will not affect the value of the register outside the group unless \global is used with the register [119]. The command `\showthe\dimenn' writes the value for `\dimenn' to the terminal and to the log file [121]. The register \dimen255 is available for temporary storage [122].
Example:
1. \dimen1=10pt
2. \dimen2=1.5\dimen1
3. \dimen3=-\dimen2
4. \dimen4=0.66667\dimen3
5. The dimens are: \the\dimen1, \the\dimen2, \the\dimen3, \the\dimen4.\par
6. \dimen1=1pt
7. \dimen2=1sp
8. \count1=\dimen1
9. \count2=\dimen2
10. The counts are: \the\count1, \the\count2.\par
Produces: See typeset version.
Comments:
- Lines 1-4 show how easy it is to set one \dimen register equal to a fractional multiple of another register.
- Lines 6-9 show how \dimen registers are converted to \count registers.
TeXbook References: 118-119. Also: 118-122, 271, 276, 346-347, 349, 360, 363, 395.
Related Primitives: dimendef, ifdim, advance, multiply, divide, count.
For Additional Examples, see: divide, prevdepth
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \dimendef<name>=<8-bit register number>
Description:
A dimen register may be used directly (e.g., \dimen17=\hsize) [118] or indirectly in one of two ways. Each indirect way involves setting up a symbolic name for a register (e.g., \pagewidthA). The first indirect way uses the primitive \dimendef (e.g., `\dimendef\pagewidthA=17'); this makes \pagewidthA equivalent to \dimen17. So, the command `\pagewidthA=\hsize' stores a copy of \hsize [119]. The second indirect way uses the Plain TeX command \newdimen (e.g., `\newdimen\pagewidthA'). This time the control sequence \pagewidthA is a dimen register, but it is not at all apparent which one. The log file should contain a line `\pagewidthA=\dimenn' for some n [121]. The direct method is fine for registers used locally in a macro or in a group. The \newdimen method or something equivalent if Plain TeX is not used is the preferable indirect method. If macros from several sources are used, and two different \dimendef's use the same register number, the macros may interfere with each other. This type of problem is difficult to track down [nr]. TeX suppresses expansion when it is reading a control sequence that will be defined by a \dimendef [215].
Example:
% dimen registers
\newdimen\pagewidthB % width of regular output, don't change.
\newdimen\pagewidthA % page width, may change.
\newdimen\pageheightB % permanent page height, vsize changes in doublecolumn
\newdimen\parindentA % alternate parindent.
\pagewidthB=\hsize
\pagewidthA=\hsize
\pageheightB=\vsize
\parindentA=1.5pc
\parindent=0pt
Produces: See typeset version.
Comments:
- These lines are from the start of the macro file used to prepare these pages and setup needed \dimen registers. Note, each register is initialized after it is created.
TeXbook References: 119. Also: 119, 215, 277, 346-347.
Related Primitives: dimen.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \discretionary{<pre-break text>}{<post-break text>}{<no-break text>}
Description:
A discretionary break consists of three sequences of characters: the pre-break, post-break, and no-break text. This command makes it possible to insert a discretionary break at any point in a paragraph [95]. Discretionary breaks are important because they are one of the five places where TeX breaks lines when it is making paragraphs [96]. If this command occurs in one of the vertical modes, it starts a new paragraph [283]. In math mode the no-break text must produce an empty list [292]. The text should contain only characters, ligatures, kerns, boxes, and rules. It should not have penalties or glue. The space factor is not changed after a discretionary [287]. In unrestricted horizontal mode a \discretionary{}{}{} is added after a character whose code is the \hyphenchar of its font (e.g., `-') and after a ligature formed from a sequence which ends with such a character (e.g., an endash or emdash) [286].
Example:
1. \def\tstoryA{There are cries, sobs, confusion among the people, and at
2. that moment the cardinal himself, the Grand Inquisitor, passes by the
3. cathedral. He is an old man . . .}
4. \def\tstoryB{There are cries, sobs, confusion among the people, and at
5. that m\discretionary{om-}{e}{ome}nt the cardinal himself, the Grand
6. Inquisitor, passes by the cathedral. He is an old man . . .}
7. \setbox0=\vbox{\hsize=2.25in \tstoryA}
8. \setbox1=\vbox{\hsize=2.25in \tstoryB}
9. \hbox to \hsize{\box0\hfill\box1}
Produces: See typeset version.
Comments:
- Line 5 uses \discretionary to hyphenate `moment' as: `mom-ent'.
TeXbook References: 95-96. Also: 95-96, 283, 286, 287, 292.
Related Primitives: -, hyphenchar, hyphenation.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \displayindent
Description:
WHEN TeX reads the opening $$ of a math display, it sets \displayindent to the amount of indentation for the current line. Normally, that value is 0 pt, but it depends on the paragraph shape specified by \parshape and on hanging indentation. In the latter two cases TeX figures the indentation using line 1 if the display begins the paragraph or line `\prevgraf+2' if the display occurs after \prevgraf lines. TeX uses \displayindent in deciding how much glue to put before and after the display and where to position the display on its line. The parameter may be changed inside a display, and TeX uses the last value it encounters in the display [189]. Each row in an alignment display is shifted right by this parameter [190].
Example:
1. \def\tfn#1#2#3%
2. {%
3. \hangafter=-6 % lines 1-6 are shortened.
4. \hangindent=#1
5. The Fibonacci numbers are defined by: $F_0=1$, $F_1=1$, and
6. $$
7. F_n = F_{n-1} + F_{n-2} \hbox{, for } n \ge 2.\eqno(#2.)
8. \global\setbox#2=\hbox{(#2.) is \the\displayindent}
9. $$
10. A related sequence $\{v_n\}$ is: 2, 1, 3, 4, 7, 11, 18, \char144\ It
11. satisfies $v_n$ = $x^n + y^n$, where $x = (1 + \sqrt 5)/ 2$
12. and $y = (1 - \sqrt 5)/ 2$.
13. \vskip#3
14. }
15. \tfn{-144pt}{1}{1\baselineskip}
16. \tfn{144pt}{2}{0.25\baselineskip}
17. \hbox{The indent for \box1\ and for \box2.}
Produces: See typeset version.
Comments:
- This example typesets a paragraph containing a math display and hanging indentation. The material is typeset first with the indent on the right and then with it on the left. In each case the value for \displayindent (typeset by lines 8 and 17) is the amount the line needs to be shifted.
- TeX assumes each display and alignment display takes three lines: a blank line, the actual expression, and a blank line [188, 190]. That explains why the value of \hangafter given on line 3 only shortens three lines of text plus the display.
TeXbook References: 188. Also: 188, 190, 274, 291, 349.
Related Primitives: displaywidth, predisplaysize, abovedisplayskip, prevgraf.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \displaylimits
Description:
SEVERAL math symbols such as summation and integration often appear with subformulas as subscripts and superscripts. The subformulas may be typeset either above and below or to the right of the symbol. Normal mathematical conventions use the first method for most displayed expressions and the second for most in-line expressions. TeX's conventions use the first method in display style and the second method in text style. TeX has three commands which change these conventions: \limits always uses the first method; \nolimits always uses the second method; and \displaylimits uses TeX's normal conventions. If two or more of these commands follow each other, the last one controls how the expression is typeset [144]. Each of these commands must follow a large operator (class 1). Otherwise, TeX generates an error [292].
Example:
1. \mathchardef\Intop="1352
2. \mathchardef\Sum="1350
3. \def\tint{\Intop\nolimits}
4. \def\tsum{\Sum}
5. \def\tf#1#2#3%
6. {%
7. $$\hbox{$#2_0^1 3x^2 = x^3]_0^1 = 1$}%
8. \hbox{ and $#3^\infty_{n=0}{1\over2^n} = 2$}%
9. \kern2pc
10. #2_0^1 3x^2 = x^3\Bigr]_0^1 = 1
11. \kern2pc
12. #3^\infty_{n=0}{1\over2^n} = 2
13. \kern2pc
14. \leqno{#1.}
15. $$
16. }
17. \tf 1{\tint}{\tsum}
18. \tf 2{\tint\displaylimits}{\tsum\displaylimits}
Produces: See typeset version.
Comments:
- Lines 1-4 are adapted from Plain TeX [358]. They setup symbols for summation and integration. The integral symbol includes \nolimits because that is how integrals normally appear.
- Lines 5-16 define a macro which mixes in-line math with display math.
- Line 17 calls \tf using \tint and \tsum. This typesets each expression as it was intended to be typeset.
- Line 18 makes a similar call only each symbol is followed by \displaylimits. This changes the form of the third expression.
- I tried the `]' on line 10 in two ways (see the \nolimits reference page for the second way) but prefer the way shown here.
TeXbook References: 144. Also: 144, 159, 292, 443.
Related Primitives: limits, nolimits, textstyle, displaystyle.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \displaystyle
Description:
THIS command is used to specify display style. TeX uses four main styles to typeset formulas and subformulas: display, text, script, and scriptscript. Each main style has a corresponding cramped style. The eight styles are referred to as: D, D', T, T', S, S', SS, and SS' where the primed letter means the cramped style. TeX uses the text font (\textfont) for the current family (\fam) when it typesets material in display and text styles (both regular and cramped) [140]. The body of the following table lists the style of the major components in a formula whose style is known:
component in formula | current style of formula |
| D | D' | T | T' | S, SS | S', SS' |
| superscript | S | S' | S | S' | SS | SS' |
| subscript | S' | S' | S' | S' | SS' | SS' |
| numerator | T | T' | S | S' | SS | SS' |
| denominator | T' | T' | S' | S' | SS' | SS' |
Finally, most math commands including \underline do not change the current style, but \overline, \sqrt, and math accents change regular styles to cramped ones [141].
Example:
1. \def\mkcstyle#1#2%
2. {%
3. \vbox to 0pt
4. {%
5. \vss
6. \hbox{$#1{\atop #2^2}$}%
7. \kern0pt
8. }%
9. }
10. \halign{#\hfil&&\quad#\hfil\cr
11. \it D&\it T&\it D\ftB, T\ftB&\it S&\it S\ftB&\it SS&\it SS\ftB\cr
12. \noalign{\vskip2pt\hrule\vskip3pt}
13. $\displaystyle x^2$&$x^2$&\mkcstyle{\displaystyle}{x}&
14. $\scriptstyle x^2$&\mkcstyle{\textstyle}{x}&
15. $\scriptscriptstyle x^2$&\mkcstyle{\scriptstyle}{x}\cr
16. $\displaystyle X^2$&$X^2$&\mkcstyle{\displaystyle}{X}&
17. $\scriptstyle X^2$&\mkcstyle{\textstyle}{X}&
18. $\scriptscriptstyle X^2$&\mkcstyle{\scriptstyle}{X}\cr}
Produces: See typeset version.
Comments:
- This example makes a table showing each of the styles. The table only has seven columns because cramped display style is the same as cramped text style [141].
- Lines 1-9 define a macro which coerces an expression into one of the cramped styles. The macro is a variation of ideas on page 141 of the actual `.tex' file for The TeXbook.
- The height of the superscript is different in each column. This is particularly apparent on the second line which uses an uppercase `X'.
TeXbook References: 140-141. Also: 140-142, 292, 362.
Related Primitives: textstyle, scriptstyle, scriptscriptstyle, textfont, fam.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \displaywidowpenalty
Description:
IF a display interrupts a paragraph, TeX typesets the paragraph lines before the display, the line (or lines) in the display, and the paragraph lines after the display. This penalty is added immediately after the penultimate line before the display. It tells TeX to try to avoid starting a new page with a widow\mkindex{widow line} line immediately followed by a display [104]. If the Plain TeX value of \predisplaypenalty is used, TeX also tries to avoid starting a new page with a display [189].
TeXbook References: 104. Also: 104, 272, 348.
Related Primitives: predisplaypenalty, widowpenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \displaywidth
Description:
WHEN TeX reads the opening $$ of a math display, it sets \displaywidth to the current line width. Normally, that value is \hsize, but it depends on the paragraph shape specified by \parshape and on hanging indentation. In the latter two cases TeX figures the width using line 1 if the display begins the paragraph or line `\prevgraf+2' if the display occurs after \prevgraf lines. TeX uses \displaywidth in deciding how much glue to put before and after the display and where to position the display on its line. The parameter may be changed inside a display, and TeX uses the last value it encounters in the display [189]. Alignment displays do not use this parameter [190].
Example:
\def\tfn#1#2%
{%
The Fibonacci numbers are defined by: $F_0=1$, $F_1=1$, and
$$
\displaywidth=#1
F_n = F_{n-1} + F_{n-2} \hbox{, for } n \ge 2.
$$
A related sequence $\{v_n\}$ is: 2, 1, 3, 4, 7, 11, 18, \char144\ It
satisfies $v_n$ = $x^n + y^n$, where $x = (1 + \sqrt 5)/ 2$
and $y = (1 - \sqrt 5)/ 2$.
\vskip#2
}
\tfn{\hsize}{1\baselineskip}
\tfn{0.5\hsize}{0pt}
Produces: See typeset version.
Comments:
- This example typesets the same paragraph with two different values for \displaywidth. The first using \hsize results in an expression centered between the margins. The second using ½ \hsize results in a display shifted left. Of course, the second makes an overfull box if the display is wider than the new display width.
TeXbook References: 188. Also: 188, 190, 274, 349.
Related Primitives: displayindent, predisplaysize, abovedisplayskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \divide<numeric variable> by <number>
Description:
THIS command divides the <numeric variable> by <number>. The number must be a nonzero integer [118]. A numeric variable is: a) a parameter of type: integer, dimen, glue, or muglue; b) a token specified by \countdef, \dimendef, \skipdef, or \muskipdef; or c) a \count, \dimen, \skip, or \muskip register. The by is optional [276].
Example:
1. \def\fixdimens#1#2% Want #1*#2/1000 and (#1*#2/1000)*1.2
2. {%
3. \bgroup
4. \dimen1=#1pt
5. \count2=#2
6. \count1=\dimen1
7. \multiply\count1 by \count2
8. \divide\count1 by 1000
9. \dimen1=\count1 sp
10. \dimen2=1.2\dimen1% Note, `\multiply\dimen1 by 1.2' generates an error!
11. Original point size = #1pt with multiplier = #2 makes:
12. \the\dimen1/\the\dimen2.\par
13. \egroup
14. }
15. \count1=1
16. Before fixdimens, count1 = \the\count1.\par
17. \fixdimens{10}{1000}
18. \fixdimens{10}{968}
19. \fixdimens{24}{1044}
20. After fixdimens, count1 = \the\count1.
Produces: See typeset version.
Comments:
- The comment on line 1 shows what \fixdimens is supposed to compute.
- If the product #1*#2 is computed in a \dimen register, the result can easily overflow the register (i.e., be larger than 16384pt). So, line 6 moves \dimen1 to \count1, and the calculations on lines 7-8 are done using \count registers. The result is moved back to \dimen1 by line 9. The trailing sp means use the dimension scaled points with the value in \count1.
- Line 10 shows how a fractional multiplier may be used in an assignment statement. Compare this statement with the four lines used to do the same thing on the \multiply reference page.
- Lines 16 and 20 show that \fixdimens did not change the value of \count1. If comments are placed at the start of lines 3 and 13, the register does change.
TeXbook References: 118. Also: 118-119, 218-219, 276, 391, 397, 398, 417.
Related Primitives: advance, multiply, count, dimen, skip, muskip.
For Additional Examples, see: day, ifnum, time, year
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \doublehyphendemerits=<number>
Description:
WHEN TeX is breaking a paragraph into lines, this value is added to the demerits calculated for a line if the line and the previous one end with discretionary breaks [98].
Example:
\hsize=2.5in% The \adjdemerits reference page
\setbox0=\vbox{\tstory\par}% holds the definition of \tstory
\setbox1=\vbox{\adjdemerits=0
\doublehyphendemerits=100000
\tstory\par}
\hbox{\box0\kern0.25in\box1}
Produces: See typeset version.
Comments:
- The paragraph on the left has two potential hyphenation problems: two consecutive lines are hyphenated, and the penultimate line is hyphenated.
- The paragraph on the right sets \doublehyphendemerits to a large value, and the first problem goes away.
- This example continues on the \finalhyphendemerits reference page.
TeXbook References: 98. Also: 98, 273, 348, 451.
Related Primitives: adjdemerits, finalhyphendemerits.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \dp<8-bit register number>
Description:
EVERY box has a depth which is a <dimen> quantity. When material is placed in a box, the depth of the box is automatically recomputed. The depth may be accessed or changed using \dp<number> [120].
Example:
1. \setbox0=\hbox{Every box has }
2. \setbox1=\hbox{a }
3. The depth of box 0 is \the\dp0.\par
4. The depth of box 1 is \the\dp1.\par
5. \hbox{\box0\copy1 depth}
6. The depth of box 0 is \the\dp0.\par
7. The depth of box 1 is \the\dp1.\par
Produces: See typeset version.
Comments:
- Initially, both boxes have a positive depth. Line 5 empties \box0, and its depth becomes 0.
TeXbook References: 120. Also: 120, 271, 316, 388-389, 417.
Related Primitives: ht, wd, setbox.
For Additional Examples, see: afterassignment, boxmaxdepth, prevdepth
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \dump
Description:
IN INITEX this outputs a format file that can be loaded at high speed to restore the current status. In production versions of TeX, \dump acts like \end [283].
TeXbook References: 283. Also: 283, 286, 336, 344.
Related Primitives: end, everyjob.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \edef<control sequence><parameter text>{<replacement text>}
Description:
THIS command defines a macro whose replacement text is expanded when TeX encounters the definition, not each time TeX encounters the macro's control sequence [215]. However, not quite everything in the replacement text is expanded at definition time. For example, token lists produced by \the and a token following \noexpand are not expanded [216]. The three prefixes (\global, \long, and \outer) can be applied to \edef in any order, and they can appear more than once [275].
Example:
1. \def\tc{\hskip10pt}
2. \def\ta{Bye\tc Bye}
3. \edef\tb{Bye\tc Bye}
4. 1. \ta\tb.\par
5. \begingroup
6. \def\tc{\hskip20pt}
7. 2. \ta\tb.\par
8. \endgroup
9. 3. \ta\tb.\par
Produces: See typeset version.
Comments:
- This example illustrates when the expansion of a macro's definition occurs.
- Lines 2-3 define two macros which use a third macro defined on line 1.
- Line 4 typesets each of the two macros.
- Lines 5-8 hold a new group and contain a new definition for the common macro. The macro defined using \def uses the new definition, but the macro defined using \edef does not.
- Line 9 typesets the macros a third time. The results are the same as the first time since lines 4 and 9 are in the same group, and no redefinitions occurred in that group.
TeXbook References: 215-216. Also: 215-216, 275, 328, 348, 373-374.
Related Primitives: def, xdef, global, long, outer.
For Additional Examples, see: advance, xdef
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \else
Description:
THIS separates the true part of a conditional command from the false part. If there is no false part, the \else may be omitted [207]. It is used with \ifcase to specify the all other cases part of that construction [210].
Example:
1. \def\trefont#1#2% font size & face.
2. {%
3. \ifcase#1 % select font size
4. \or\selffamily AA
5. \or\selffamily AB
6. \or\selffamily AC
7. \or\selffamily AD
8. \or\selffamily AE
9. \or\selffamily AF
10. \or\selffamily AG
11. \or\selffamily BA
12. \else\selffamily AC
13. \fi
14. \ifcase#2 % select font face
15. \or\rm
16. \or\it
17. \or\bf
18. \or\bi
19. \else\rm
20. \fi
21. }
22. \trefont{1}{2}Now, \trefont{3}{1}is the time for {\it all}
23. {\trefont{4}{1}men} to come to the aid of \trefont{2}{3}their
24. \trefont{10}{3}country.
Produces: See typeset version.
Comments:
- This example uses \else with two \ifcase statements.
- Lines 3-13 select a font size and an expected value is 1-8. If 0 is passed, no change in size is made, but if another invalid number is passed, the size changes to AC which is the normal size.
- Lines 14-20 select a font face and an expected value is 1-4. This works similarly to the font size.
TeXbook References: 207, 210. Also: 207, 210, 213.
Related Primitives: fi, ifcase, or.
For Additional Examples, see: day, fi, futurelet, ifdim, ifhbox, ifhmode, time
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \emergencystretch=<dimen>
Description:
TEX will make up to three attempts to break a paragraph into lines. The first two use \pretolerance and \tolerance [97]. TeX only makes the third attempt if \emergencystretch is positive. In that case TeX adds \emergencystretch to the stretch in the line when the text must stretch to fill an hbox of the correct width. This decreases \badness [107].
Example:
\hsize=2.0in\parindent=0pt
\pretolerance=100
\tolerance=200
\emergencystretch=0pt
\setbox0=\vtop{\tstory\par}% The \adjdemerits reference page holds the
\setbox1=\vtop{\emergencystretch=1em\tstory\par}% definition of \tstory
\hbox to 4.5in{\box0\hfil\box1}
Produces: See typeset version.
Comments:
- The paragraph on the left is typeset using default values for: \pretolerance, \tolerance, and \emergencystretch. It contains one overfull line. The paragraph on the right sets \emergencystretch=1em, and the overfull line goes away.
- If \hsize is changed to 1.5in, the left paragraph has 6 overfull lines, and each goes away when \emergencystretch=1em.
- The \tolerance reference page contains an example when \hsize=1.25in.
TeXbook References: 107. Also: 107, 274.
Related Primitives: pretolerance, tolerance, badness.
For Additional Examples, see: pretolerance
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \end
Description:
NORMALLY, the last command in a document is \end [87]. It ends the current job only if the main vertical list is empty and \deadcycles=0. If either condition is not true, TeX inserts `\hbox to \hsize{} \vfill \penalty -'10000000000' into the main vertical list and then prepares to reread the \end (the penalty is in octal and is -230). Generally, this is sufficient to flush out all remaining output [264]. The command is not allowed in internal vertical mode [283] or restricted horizontal mode. In horizontal mode TeX ends the current paragraph and then rereads \end [286].
Example:
\vfill\eject
\end
Produces: See typeset version.
Comments:
- The example shows the preferred way to end a document. It will work fine for most simple things. However, a book might require one or more blank pages to be generated to fill out a signature and so might require a more complicated end routine.
TeXbook References: 26-27, 264. Also: 23, 26-27, 87, 264, 283, 286, 299, 336, 403.
Related Primitives: deadcycles, dump.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \endcsname
Description:
THIS command must terminate a list of tokens begun with \csname. If it does, and if each of the intermediate tokens expands into characters, TeX forms a control sequence token from the characters. If there is no preceeding \csname or a primitive occurs in one of the intermediate tokens, TeX reports an error [40]. If the newly formed control sequence is currently undefined, it is defined to be like \relax [213]. The pair of commands (\csname and \endcsname) allows a document or formatting routine to build a control sequence token on the fly [nr].
Example:
1. \def\getrcount#1{\csname ref#1count\endcsname}
2. \def\getrdesc#1{\csname ref#1desc\endcsname}
3. \halign
4. {\qquad\hfil#\hfil&\quad\hfil#\hfil&\quad#\hfil\cr
5. \bf Name&\bf Count&\bf Description\cr
6. B&\getrcount B&\getrdesc B\cr
7. A&\getrcount A&\getrdesc A\cr
8. C&\getrcount C&\getrdesc C\cr
9. }
Produces: See typeset version.
Comments:
- These lines continue an example begun on the \csname reference page.
- Lines 1-2 would normally be in a formatting file immediately after the \mkr macro shown in the \csname example. The lines form the link between the document and the count and description macros setup there.
- Lines 3-9 typeset a table holding the material prepared in the earlier example.
TeXbook References: 40, 213. Also: 40-41, 213, 283, 348, 375.
Related Primitives: csname.
For Additional Examples, see: csname, endcsname, noexpand, the
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \endgroup
Description:
THIS command creates an error unless TeX is in a group begun by \begingroup. If it is, each item changed by a non-global assignment in the group has its pre-group value restored. Also, the group is ended, but the mode is not changed [279]. Groups begun by `{' and \begingroup must be properly nested; `{\begingroup}\endgroup' generates an error [21].
Example:
\def\tfixcomments
{%
\begingroup
\parindent=\parindentA
\everypar={\llap{\hbox to \parindent{\char149\hss}}%
\hangindent=\parindent\hangafter=1 }% Don't change this to =1}!
}%
So, to summarize:\par
\tfixcomments
The point is . . . \par
We don't really know . . . \par
Who will be held responsible?\par
\endgroup
Are there any questions?\par
No. Good!
Produces: See typeset version.
Comments:
- The \begingroup reference page shows one typical use of `\begingroup ... \endgroup'. This example shows a second use.
- The \tfixcomments macro begins a new group and gives \everypar a value appropriate for a bullet list.
- Later in the document \tfixcomments appears. It turns each of the subsequent paragraphs into an item in a bullet list.
- Finally, when an \endgroup appears, the group is terminated, and \everypar returns to its previous value.
TeXbook References: 21, 279. Also: 21, 249, 262, 279, 380, 407, 419.
Related Primitives: begingroup.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \endinput
Description:
THIS command causes TeX to stop processing an \input file at the end of the current line [214]. This provides a way for a macro file to keep from being loaded twice by a document [383].
Example:
1. \input a % a.tex holds the line: \input c
2. \input b % b.tex holds the line: \input c
3. % c.tex holds the following lines: (see page 383 of The TeXbook).
4. \ifx\xxcyy\relax % use \xxfile_nameyy or anything unique.
5. \endinput
6. \else
7. \let\xxcyy=\relax
8. \fi
9. % This is where c.tex really starts.
10. \newread\tr% We don't want to allocate \tr twice !
Produces: See typeset version.
Comments:
- The above lines provide one solution to a problem described on the \input reference page.
- Lines 1-2 cause c.tex to be loaded. On the \input page that causes \tr to be allocated twice.
- This time c.tex begins by comparing a made up control sequence (which should be unique) to \relax.
- When c.tex is loaded for the first time, the test made on line 4 fails. So, line 7 is performed, and the rest of c is loaded.
- If c is loaded a second time, the test on line 4 passes, and \endinput is done.
TeXbook References: 214, 383. Also: 47, 214, 383.
Related Primitives: input.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \endlinechar
Description:
TEX reads an input file a line at a time and converts the material to a sequence of tokens [38]. At the end of each line it deletes any spaces it finds and inserts a character token holding the current value of \endlinechar [46]. If \endlinechar is less than 0 or greater than 255, nothing is added [48]. The Plain TeX \path macros use \endlinechar=-1 [390-391].
TeXbook References: 48, 273. Also: 48, 273, 331, 348, 390-391.
Related Primitives: escapechar, newlinechar.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \eqno<formula>
Description:
THIS command puts an equation number at the right-hand margin [186]. It may only be used in display math mode. TeX processes the material for the number as follows: a) it enters a new level of grouping and begins non-display math mode; b) it adds the \everymath tokens to the new math list; c) it adds everything between the \eqno command and the $$ which ends the display to the math list; d) it converts the math list to a horizontal list which it puts in an hbox. The resulting hbox becomes the equation number [293]. TeX tries the following strategies as it positions the equation number and the display on a line: a) center the display and then place the equation number at the right margin; b) place the equation number at the right margin and then position the display in the remaining space; [187] c) if the display and the equation number are wider than \displaywidth or if the equation number has zero width, center the display; add an infinite penalty; and place the equation number at the right margin on the following line. The infinite penalty prevents TeX from typesetting the display on one page and the equation number on the following page [188-189].
Example:
1. \def\tfn#1#2% equation number, space.
2. {%
3. $$ u_{-n} = -(xy)^{-n}u_n = (-1)^{n-1}u_n{,}#2 v_{-n} =
4. (-1)^nv_n.#1% even left equation numbers go at the end !
5. $$%
6. }
7. \tfn{\eqno(10.14.5)}{\qquad}
8. \tfn{\leqno(10.14.6)}{\qquad}
9. \tfn{\eqno(10.14.7)}{\qquad\qquad}
10. \tfn{\leqno(10.14.8)}{\qquad\qquad}
Produces: See typeset version.
Comments:
- This example uses the macro defined on lines 1-6 to typeset four displays.
- Lines 7-8 use strategy a) described above.
- The displays made by lines 9-10 are wider, and strategy b) is used.
- Note line 4. Both left and right equation numbers are typed at the end of the display.
TeXbook References: 187, 293. Also: 186-187, 189-191, 193, 293, 375-376.
Related Primitives: leqno.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \errhelp<general text>
Description:
THIS token parameter holds a message that is displayed when a user asks for help after encountering an error made by \errormessage [280]. Plain TeX has a \newhelp macro which facilitates the construction of help messages [347].
Example:
1. \def\checkit#1#2#3% See \errmessage page for another version of \checkit
2. {{%
3. \setbox0=\hbox{#1}%
4. \ifdim\wd0 > #2
5. \errhelp=\helpcheckitA
6. \errmessage{The text #1 has width = \the\wd0, which is wider than #2}%
7. \else
8. #3. \box0
9. \fi
10. }}
11. \newhelp\helpcheckitA{Try increasing the dimen used to check the text.}
12. \checkit{Hello World}{60pt}1
13. \checkit{Hello World}{20pt}2
Produces: See typeset version.
Comments:
- Lines 1-10 define a macro which is used on lines 12 and 13.
- Line 11 uses Plain TeX's \newhelp command to define a custom help message for the error message on line 6. This makes line 14 in the log file.
- Line 12 does not generate an error and typesets its material via line 8.
- Line 13 does generate an error which makes lines 16-21 in the log file. In response to the `?' on line 21, I entered `h' and TeX displayed the message on line 22. That message came from lines 5 and 11.
- The extra level of grouping made by lines 2 and 10 keeps the assignment to \errhelp made on line 5 local to \checkit.
TeXbook References: 280. Also: 275, 280, 347.
Related Primitives: errmessage.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \errmessage<general text>
Description:
THIS command defines a custom error message written on the terminal and to the log file [279-280]. Tokens in the message are expanded when the message is written [216]. If TeX encounters the command, it interrupts processing; displays the message on the terminal and writes it to the log file; and waits for further instructions [nr].
Example:
1. \def\checkit#1#2#3% See \errhelp page for another version of \checkit
2. {%
3. \setbox0=\hbox{#1}%
4. \ifdim\wd0 > #2
5. \errmessage{The text #1 has width = \the\wd0, which is wider than #2}%
6. \else
7. #3. \box0
8. \fi
9. }
10. \checkit{Hello World}{60pt}1
11. \checkit{Hello World}{20pt}2
Produces: See typeset version.
Comments:
- Lines 1-9 define a macro which is used on lines 10 and 11.
- Line 10 does not generate an error and typesets its material via line 7.
- Line 11 does generate an error which makes lines 12-17 in the log file. In response to the `?' on line 17, I entered `h' and TeX displayed lines 18-23. This is the default message TeX displays if there is not an active \errhelp.
TeXbook References: 279-280. Also: 216, 279-280, 347, 418.
Related Primitives: errhelp.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \errorcontextlines
Description:
THIS parameter controls the number of extra 2-line messages displayed on the terminal and written to the log file when TeX encounters an error. If \zzz is an undefined control sequence, the number may be increased by entering `I\errorcontextlines= 100\zzz' when TeX interrupts processing, displays error information, and waits for a response [34].
Example:
1. \def\linkA#1%
2. {A \linkB{\linkC{\linkD{\linkE{\linkF{\linkG{\linkH{\linkI{#1}}}}}}}}Z}
3. \def\linkB#1{B {#1}}
4. \def\linkC#1{C {#1}}
5. \def\linkD#1{D {#1}}
6. \def\linkE#1{E {#1}}
7. \def\linkF#1{F {#1}}
8. \def\linkG#1{G {#1}}
9. \def\linkH#1{H {#1}}
10. \def\linkI#1{I \hskip2#1 B}% This makes an error unless #1 is a valid dimension
11. \linkA{inyz}% This becomes: \hskip2inyz and is OK
12. \errorcontextlines=-1
13. \linkA{axyz}% This becomes: \hskip2axyz and is an error.
14. \errorcontextlines=0
15. \linkA{bxyz}
16. \errorcontextlines=5
17. \linkA{cxyz}
18. \errorcontextlines=100
19. \linkA{dxyz}
Produces: See typeset version.
Comments:
- Lines 1-10 illustrate a set of deeply nested macros. The parameter `inyz' to \linkA on line 11 is eventually placed after \hskip2 on line 10 and it causes TeX to move right 2 inches and then typeset `yz B'.
- On lines 13-19 each of the parameters to \linkA does not begin with a valid TeX dimension, so it creates an error. The value assigned to \errorcontextlines on lines 12-18 determines how many pairs of messages TeX displays when it encounters an error.
- The four errors made by lines 13-19 write four sets of lines to the log file: 20-24, 25-30, 31-46, and 47-71. The first line of each set begins with an `!' and a message. The penultimate line of each set gives the location of the error in the source file, and the last line contains a `?'. It is the clue that TeX is waiting to be told what to do next. If `h' is entered, TeX provides additional help information if any is available. If `?' is entered, TeX displays a list of valid responses and the action it takes for each one.
- Only lines 38 and 52 in the log file give a helpful clue about the underlying problem.
TeXbook References: 34. Also: 34, 273, 348.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \errorstopmode
Description:
IF TeX is running in \batchmode, \nonstopmode, or \scrollmode, this command ends that mode and causes TeX to return to its normal level of interaction when errors are encountered. Otherwise, the command has no effect [32].
Example:
1. \batchmode
2. .
3. .
4. .
5. \errorstopmode
Produces: See typeset version.
Comments:
- If TeX encounters errors on lines 2-4, it writes an error message to the log file, but it won't display a message on the terminal or stop for user input.
- After line 5 TeX resumes normal error processing.
TeXbook References: 32. Also: 32, 33, 277, 299.
Related Primitives: batchmode, nonstopmode, scrollmode.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \escapechar
Description:
THIS specifies the character that should be used when a control sequence is written as text [40] or expanded by \string [213]. Nothing is written if \escapechar is less than 0 or greater than 255 [308].
Example:
1. \escapechar=-1\string\TeX --- % It doesn't matter how OR if \TeX is defined
2. \escapechar=63\string\TeX --- % a ? is 63 and \ is 92.
3. \escapechar=92\string\TeX --- wrong!\par
4. \escapechar=-1 \string\TeX --- % put a space after the number,
5. \escapechar=`?\string\TeX ---
6. \escapechar=`\\\string\TeX --- wrong!\par
7. \escapechar=-1 \string\TeX ---
8. \escapechar=63 \string\TeX ---
9. \escapechar=92 \string\TeX \par
10. \escapechar=-1 \string\TeX ---
11. \escapechar=`?\relax\string\TeX --- % or use \relax,
12. \escapechar=`\\{}\string\TeX\par% or use {}.
Produces: See typeset version.
Comments:
- Lines 1-3 and 5-6 produce unexpected results. In each case the \string command is processed (using the current value of \escapechar) before the new value is determined.
- Lines 4 and 7-12 show various ways to avoid the above problem.
TeXbook References: 40. Also: 40, 213, 228, 273, 308, 348, 377.
Related Primitives: string, endlinechar, newlinechar.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everycr{<token list>}
Description:
This parameter holds a list of tokens that gets inserted after every \cr or nonredundant \crcr [275].
Example:
\everycr{\noalign{\hrule}}
\def\strutA#1#2{\vrule height#1 depth#2 width0pt}
\halign
{\vrule\strutA{10pt}{4pt}#\tabskip=0.5em\hfil\vrule\hfil&
#\vrule&\hfil#\hfil&\tabskip=0pt#\vrule\cr
&\multispan5\it\hfil New York Area Rocks\hfil&\cr
&\omit\hfil Era\hfil&&\omit\hfil Formation\hfil&&\omit\hfil Age (years)\hfil&\cr
&Precambrian&& Reading Prong&& > 1 billion&\cr
&Paleozoic&& Manhattan Prong&& 400 million&\cr
&Mesozoic&& Newark Basin&& 200 million&\cr
&Cenozoic&& Coastal Plain&& 30,000 years&\cr
}
Produces: See typeset version.
Comments:
- This example uses \everycr to add the horizontal rules to the table.
- The table is from ``Tbl-A Program to Format Tables,'' by M. E. Lesk which in turn begins on page 157 of Unix Programmer's Manual, Volume 2, 1983.
TeXbook References: 275. Also: 275, 362.
Related Primitives: cr, crcr.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everydisplay{<token list>}
Description:
This parameter holds a list of tokens that get inserted at the beginning of every display math list [179].
TeXbook References: 179. Also: 179, 275, 287, 326.
Related Primitives: everymath, toks.
For Additional Examples, see: nulldelimiterspace
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everyhbox{<token list>}
Description:
THIS parameter holds a list of tokens that gets inserted at the start of every \hbox [275]. However, if there is an \afterassignment active, and the \hbox appears in a \setbox assignment, then the \everyhbox token list is placed in the \hbox immediately after the \afterassignment token [279].
Example:
\begingroup
\everyhbox{\selffamily AD\it}
\def\badboxes#1#2%
{%
\overfullrule=0.25pt
\setbox0=\hbox spread#2{#1}%
\setbox1=\hbox{\rm\the\badness}% \rm comes after the \it from \everyhbox
\setbox2=\hbox to 2.5in{\box0\hfil\box1}%
\box2
}
\badboxes{The badness of this line is: }{-1em}
\badboxes{The badness of this line is: }{-0.54em}
\badboxes{The badness of this line is: }{-0.4em}
\badboxes{The badness of this line is: }{0em}
\badboxes{The badness of this line is: }{1em}
\badboxes{The badness of this line is: }{2em}
\badboxes{The badness of this line is: }{3em}
\endgroup
Produces: See typeset version.
Comments:
- The \begingroup and \endgroup commands limit the scope of \everyhbox. Otherwise, a mess can rapidly result.
TeXbook References: 275. Also: 275, 279.
Related Primitives: everyvbox, toks.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everyjob{<token list>}
Description:
THIS parameter holds a list of tokens which is inserted at the start of every job [275]. The only example of \everyjob in The Texbook uses it with \dump and hense with INITEX [336].
TeXbook References: 275. Also: 275, 336.
Related Primitives: dump.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everymath{<token list>}
Description:
THIS parameter holds a list of tokens that get inserted at the beginning of every non-display math list [179]. Since TeX processes equation numbers in non-display math mode, the \everymath tokens are inserted following \eqno and \leqno [293].
TeXbook References: 179. Also: 179, 275, 287, 293, 326.
Related Primitives: everydisplay, toks, eqno, leqno.
For Additional Examples, see: mathsurround, nulldelimiterspace
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everypar{<token list>}
Description:
THIS parameter holds a list of tokens added at the start of a new paragraph. The sequence is: a) begin a new horizontal list; b) add an empty box with width \parindent (unless the paragraph was begun with \noindent); c) add the tokens in \everypar; d) continue with the rest of the paragraph [105]. Token expansion is suppressed while the token list in \everypar is read [215]. The effects of an \everypar statement may be limited with groups or canceled by saying `\everypar{}' [nr].
Example:
1. \linenumber=0 % This comes from: \newcount\linenumber
2. \everypar
3. {%
4. \advance\linenumber by 1%
5. \setbox0=\hbox{\the\linenumber.\kern0.75em}%
6. \llap{\box0}%
7. }%
8. This example contains several short paragraphs as examples.\par
9. The only real point is to give an example of |\everypar| and to show
10. that it is easy to number paragraphs.\par
11. Unfortunately, it is more difficult to number every line in a paragraph.\par
Produces: See typeset version.
Comments:
- The formatting file used with these pages has a macro called \autolinenumber. Its definition is lines 1-7. It is placed at the start of each Example whose lines should be numbered.
- Also, the Comments section on these pages uses \everypar to start each paragraph with a bullet and to use hanging indentation.
- Note, that line numbers are placed out in the left margin, but bullets appear at the start of the left margin.
TeXbook References: 105. Also: 105, 215, 253, 262, 275, 282, 283, 333, 381, 407, 421.
Related Primitives: toks.
For Additional Examples, see: endgroup, pagedepth
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \everyvbox{<token list>}
Description:
THIS parameter holds a list of tokens that gets inserted at the start of every \vbox or \vtop [275]. However, if there is an \afterassignment active, and the \vbox appears in a \setbox assignment, then the \everyvbox token list is placed in the \vbox immediately after the \afterassignment token [279].
Example:
1. \begingroup% Without this group, there are tons of problems!
2. \everyvbox{\hsize=2in\noindent}
3. \global\setbox1=\vbox{This is a paragraph without an initial indent. It is
4. set justified left and right with \the\hsize\ long lines.}
5. \global\setbox2=\vtop{\copy1}
6. \endgroup
7. \hbox{\box1\kern20pt\raise\dp2\box2}
Produces: See typeset version.
Comments:
- The \begingroup and \endgroup commands limit the scope ot \everyvbox. Otherwise, a mess can rapidly result.
- Lines 3 and 5 show \everyvbox works with vboxes and vtops.
- Line 7 shows a way to force material into two columns.
- I left extra space on line 4 to make the example easier to read.
TeXbook References: 275. Also: 275, 279.
Related Primitives: everyhbox, toks.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \exhyphenpenalty
Description:
WHEN TeX breaks a paragraph into lines, it adds \exhyphenpenalty to the penalties on each line, in its calculation of a line's demerits, if the line ends with a discretionary whose pre-break text is empty (i.e., a word contains a hyphen, and the break is after the hyphen) [96]. The value used for \exhyphenpenalty is the one that is current at the end of the paragraph [101].
Example:
\def\tstoryB{Several words that include a discretionary are: math-on, math-off and non-discardable.}
\hsize4.0in
\exhyphenpenalty=0\tstoryB\par
\exhyphenpenalty=-400\tstoryB\par
Produces: See typeset version.
Comments:
- This example is not as dramatic as the one on the \hyphenpenalty reference page, but it shows that \exhyphenpenalty can influence line breaking.
TeXbook References: 96. Also: 96, 262, 272, 348.
Related Primitives: hyphenpenalty, brokenpenalty, discretionary.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \expandafter<token1><token2>
Description:
THE construction `\expandafter<t1><t2>' is equivalent to `<t1> expansion of <t2>' [213]. TeX does not expand <t1> until after it expands <t2> [215].
Example:
1. a. \romannumeral\year\par
2. b. \uppercase{\romannumeral\year}\par
3. c. \uppercase{a---\romannumeral\year---z}\par
4. d. \uppercase\expandafter{\romannumeral\year}\par
Produces: See typeset version.
Comments:
- Line 1 shows that \romannumeral works as expected with \year in producing a lowercase version of the year in roman numerals.
- However, line 2 shows \uppercase can't be used directly to convert the result from line 1 to uppercase.
- Line 3 shows \uppercase is not broken. It does convert some things. The problem is one of timing; \uppercase converts the balanced text it finds between `{' and `}', but it does not expand tokens in that text [215]. Later, when TeX does process those tokens, it has no memory of the \uppercase command.
- Line 4 uses \expandafter to change the order TeX does things. On line 4 <token1> is `{' and <token2> is \romannumeral. TeX saves the `{' and expands \romannumeral. This causes it to expand \year. Once it has the correct lowercase letters, it puts the `{' in front of them, and then \uppercase does its work.
TeXbook References: 213. Also: 40, 213, 215, 260, 308, 330, 348, 374-380.
Related Primitives: afterassignment, aftergroup, futurelet, noexpand.
For Additional Examples, see: csname, iffalse, noexpand, uccode
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \fam<number>
Description:
WHEN TeX is in math mode, it typesets material using one of 16 families of fonts. Each family has three fonts: text, script, and scriptscript [153]. In horizontal mode a character is uniquely identified by the two hex digits which give the character's position in the current font. In contrast, a math symbol has an identifying code consisting of three hex digits. The first digit identifies the family, and the next two digits identify the character in the corresponding font. In addition, a fourth digit, the class digit, is often used. It runs from 0-7. The four hex digits are used in various combination to specify \mathcode's [154], \delcode's and \delimiter's [156]. TeX makes only two requirements on the use of family numbers. Families 2 and 3 are reserved for math symbols. Fonts used with these families are required to have additional \fontdimen parameters [157]. Although the preceeding describes several uses of family numbers, it does not describe \fam. TeX sets \fam to -1 every time math mode starts. At any point in a math expression, \fam can be changed. For example, Plain TeX defines \rm to be `\fam=0 \tenrm'. When TeX typesets a math symbol, it checks the symbol's class. If the class is 7, it is changed to 0; and in this case if \fam is between 0 and 15, the family of the symbol is changed from the family specified by \mathcode to the family specified by \fam. This switch plus the assignments made by Plain TeX are what makes `${\rm text }$' typeset `text' in roman instead of in italics [154]. Plain TeX also has \newfam. It is similar to \newcount and allocates family numbers [347].
Example:
1. \def\tfam
2. {%
3. $ \prtfam1 x^2 \rm\
4. \prtfam2 means\ multiply\ \fam=23 x {\rm\ by\ } x \
5. \prtfam3
6. $ \prtfam4
7. }
8. \def\prtfam#1{(#1.\ fam=\the\fam)\ }
9. \def\rm{\tenrm}\tfam\par
10. \def\rm{\fam=0 \tenrm}\tfam\par
Produces: See typeset version.
Comments:
- The macro on lines 1-7 typesets a simple mathematical statement. At several places in the statement, the family number is typeset. Control spaces are required because all text appears in math mode, not in an \hbox.
- Line 9 defines \rm without changing \fam, and all of the text is typeset in italics.
- Line 10 defines \rm as Plain TeX does. The text which should be in roman is.
TeXbook References: 154. Also: 154-159, 273, 289-290, 346-347, 351, 358, 414-415, 433.
Related Primitives: textfont, scriptfont, scriptscriptfont, mathcode, delcode, delimiter.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \fi
Description:
THIS command ends a conditional command begun by one of the `\if..' commands [207]. Each `\if..' command must have a matching \fi. However, the nesting of `\if ... \fi' is independent of the nesting of `{ ... }' [210].
Example:
1. \dimen0=20pt
2. \bgroup
3. \dimen0=101pt
4. \ifdim\dimen0 > 100pt
5. \egroup
6. TRUE---dimen0 = \the\dimen0
7. \else
8. FALSE---dimen0 = \the\dimen0
9. \fi
Produces: See typeset version.
Comments:
- This shows a mixed nesting of \if with \bgroup. When the group ends on line 5, the value of \dimen0 reverts to its pre-group value, and that is what lines 6 and 8 print.
TeXbook References: 207, 210. Also: 207, 210, 213.
Related Primitives: else.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \finalhyphendemerits=<number>
Description:
WHEN TeX breaks a paragraph into lines, it adds \finalhyphendemerits to the demerits for the penultimate line in the paragraph if the line ends with a discretionary break [98].
Example:
\hsize=2.5in
\setbox0=\vbox{\adjdemerits=0
\doublehyphendemerits=100000
\tstory\par}% The \adjdemerits reference page holds the definition of \tstory
\setbox1=\vbox{\adjdemerits=0
\doublehyphendemerits=100000
\finalhyphendemerits=900000
\tstory\par}
\hbox{\box0\kern0.25in\box1}
Produces: See typeset version.
Comments:
- This example continues the example begun on the \doublehyphendemerits page.
- Originally, the paragraph had two consecutive lines hyphenated in addition to the hyphen on the penultimate line.
- The addition of the large \doublehyphendemerits removed the two consecutive hyphenated lines. The result is the left paragraph.
- Several values of \finalhyphendemerits were tried before one large enough to remove the hyphen on the penultimate line was found. The result is the right paragraph.
- This example is concluded on the \adjdemerits reference page.
TeXbook References: 98. Also: 98, 106, 273, 348, 451.
Related Primitives: adjdemerits, doublehyphendemerits.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \firstmark
Description:
THIS command holds the mark text that was first encountered on the page that was just boxed. It is null (i.e., empty) before the first page. It is equal to the previous \botmark, when a page contains no marks [258]. The value of \firstmark is global (i.e., it is not affected by grouping) [259].
TeXbook References: 258-260. Also: 213, 258, 259-260, 280.
Related Primitives: mark, botmark, topmark.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \floatingpenalty
Description:
THIS holds the penalty which is added to \insertpenalties for each unsplit insertion which will not fit on the current page (i.e., the insertion floats to the next page) [123]. Generally, each class of insertions has its own value for \floatingpenalty which is set at some point in the routine used to make the insertion [124 and 363]. The actual value of \floatingpenalty used with a particular class of insertions is the value of the parameter just before the ending `}' of the corresponding \insert [281].
TeXbook References: 123-124. Also: 123-125, 272, 281, 363.
Related Primitives: insertpenalties, insert.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \font<control sequence>=<file name><at clause>
Description:
THIS command has three forms: a) `\font\cs=filename'; b) `\font\cs=filename at <dimen>'; and c) `\font\cs=filename scaled <number>'. The at form supplies the desired size. TeX divides the number provided with the scaled form by 1000 and uses the result as a scaling factor (e.g., 1200 results in 1.2 and 2000 results in 2). The exact form of filename depends on the operating system used with TeX [16]. If \font is used with \fontname, it denotes the current font [213]. Expansion of tokens is suppressed when TeX is reading a control sequence defined by \font [215]. If TeX runs out of font memory, it prints a message and quits prematurely [300]. TeX allows a document to load at most 256 fonts. Once a font is loaded there appears to be no way to unload the font and reuse the space [nr].
Example:
1. \def\tmkfont#1#2#3% filename; point size; scale factor;
2. {%
3. \def\emptyB{#2}%
4. \def\emptyC{#3}%
5. \ifx\emptyB\empty
6. \ifx\emptyC\empty
7. \global\font\tff=#1 % The space in `#1 %' is required!
8. \else
9. \global\font\tff=#1 scaled #3 %
10. \fi
11. \else
12. \global\font\tff=#1 at #2 %
13. \fi
14. . \tff\fontname\tff&
15. \tff The quick red fox jumped over the log.\cr
16. }
17. \baselineskip=14pt
18. \halign{&\qquad#\hfil\cr
19. 1\tmkfont{cmr10}{}{}
20. 2\tmkfont{cmr10}{12pt}{}
21. 3\tmkfont{cmr10}{}{1120}% Note, this results in 11.2pt.
22. 4\tmkfont{pc2k9y}{}{}
23. 5\tmkfont{pc2k9y}{10pt}{}
24. 6\tmkfont{pc2k9y}{12pt}{}
25. 7\tmkfont{pc2k9y}{11.2pt}{}
26. 8\tmkfont{pc2k9y}{}{1120}
27. 9\tmkfont{pc2bi9y}{10pt}{}
28. A\tmkfont{\fontname\font}{11.3pt}{}
29. }
Produces: See typeset version.
Comments:
- Lines 7, 9, and 12 illustrate the three forms of \font.
- Lines 19-21 use each form to typeset a line using ``cmr10'' at 10, 12, and 11.2 points.
- Lines 22-27 illustrate several ways to load PostScript fonts.
- Line 28 illustrates one way to change the point size of the current font.
TeXbook References: 16-17. Also: 16-17, 60, 210, 213-215, 271, 276-278.
Related Primitives: fontname, fontdimen, textfont, scriptfont, scriptscriptfont, tracingstats.
For Additional Examples, see: / (italic correction), mathchar
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \fontdimen<parameter number><font>=<dimen>
Description:
EVERY font which TeX uses is required to have at least seven \fontdimen parameters [433]. In addition, a math symbol font must have at least 22 parameters and math extension fonts must have at least 13 [433 and 447]. Computer Modern fonts have all necessary parameters defined. PostScript fonts have the necessary seven [nr].
Example:
\def\trow#1#2%
{% the above Synopsis shows how to SET one of the
#1 #2& % fontdimen parameters for a font
\the\fontdimen#1\rm& % these lines show how to READ the values for a font
\the\fontdimen#1\it&
\the\fontdimen#1\bf&
\the\fontdimen#1\bi\cr
}
\halign
{\qquad#\hfil&&\quad\hfil#\cr
\multispan5\qquad\hfil\bf The |\fontdimen| parameters for Caslon 224 at 10pt.\hfil\cr
\noalign{\vskip 0.25\baselineskip}
\# Meaning&\omit\hfil\rm\fontname\rm&\omit\hfil\it\fontname\it&
\omit\hfil\bf\fontname\bf&\omit\hfil\bi\fontname\bi\cr
\trow{1}{slant per pt}
\trow{2}{interword space}
\trow{3}{interword stretch}
\trow{4}{interword shrink}
\trow{5}{x-height}
\trow{6}{quad width}
\trow{7}{extra space}
}
Produces: See typeset version.
Comments:
- This example shows the seven \fontdimen parameters for the four basic Caslon fonts at 10pt.
- Compare this table to the one in the TeXbook prepared for several CM fonts [433]. There, the values in the table are hard coded.
TeXbook References: 443, 447. Also: 76, 157, 179, 214, 271, 277, 355-356, 375, 390, 433, 441, 447.
Related Primitives: font.
For Additional Examples, see: textfont
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \fontname<font>
Description:
THIS command returns the system file name for <font> which should be: an identifier defined by \font; \textfont<number>, \scriptfont<number>, or \scriptscriptfont <number>; or \font which denotes the current font [213].
Example:
1. {\selffamily AB\bf Caslon 224 and Helvetica codes and file names}
2. \halign{\qquad\rm#&\quad\selffamily # \fontname\rm\hfil&\quad\rm#\cr
3. A&AA&1\cr
4. B&AB&2\cr
5. C&AC&3\cr
6. D&AD&4\cr
7. E&AE&5\cr
8. F&AF&6\cr
9. G&AG&7\cr
10. A&BA&8\cr
11. }
Produces: See typeset version.
Comments:
- This example shows several different roman fonts used in these pages.
- The preamble on line 2 deserves attention. Each template contains \rm.
- The first and third templates use the definition of \rm when \halign began. Basically, that definition is: ``Use Caslon roman type at 10 points.''
- The second template prints the text provided by \fontname\rm. Not only are the words different on each row, but the type size is also different. That means \selffamily must: a) require two parameters (e.g., `AA' on line 3); b) define \rm to be the font written and used on the row; and c) set the current font to the new \rm.
- Grouping provided automatically by TeX allows the two uses of \rm in the preamble to coexist with each other.
TeXbook References: 213. Also: 213-214.
Related Primitives: font.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \futurelet<control sequence><token1><token2>
Description:
THE construction `\futurelet\cs=<t1><t2>' has the effect of `\let\cs=<t2><t1><t2>' [207]. TeX doesn't expand tokens when it is reading the argument tokens for \futurelet [215].
Example:
1. \def\tfl{\futurelet\tchar\tflA}
2. \def\tflA#1%
3. {%
4. \if \tchar.%
5. \let\next=\relax
6. #1%
7. \else
8. \let\next=\tfl
9. \if\tchar!%
10. --BINGO--%
11. \else
12. -#1-%
13. \fi
14. \fi
15. \next
16. }
17. The next characters are: \tfl aBcDeFg.\par
18. The next characters are: \tfl AbCdEfG.\par
19. The next characters are: \tfl (X:!;z).\par
20. \vskip0.5\baselineskip
21. \def\tflB#1%
22. {%
23. \if #1.%
24. \let\next=\relax
25. #1%
26. \else
27. \let\next=\tflB
28. \if #1!%
29. --BINGO--%
30. \else
31. -#1-%
32. \fi
33. \fi
34. \next
35. }
36. The next characters are: \tflB aBcDeFg.\par
37. The next characters are: \tflB AbCdEfG.\par
38. The next characters are: \tflB (X:!;z).\par
Produces: See typeset version.
Comments:
- This example illustrates two things.
- First, lines 1-19 appear to show how \futurelet may be used to aid in processing material one character (or token) at a time.
- Second, lines 21-38 show \futurelet is completely unnecessary for this task.
TeXbook References: 207. Also: 207, 215, 262, 277, 363, 375-377, 423.
Related Primitives: let, afterassignment, aftergroup, expandafter, noexpand.
For Additional Examples, see: mathchardef
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \gdef<control sequence><parameter text>{<replacement text>}
Description:
THIS command is equivalent to \global\def [206]. The three prefixes (\global, \long, and \outer) can be applied to \gdef in any order, and they can appear more than once [275].
Example:
1. \def\ta{Bye}
2. \def\tb{Bye}
3. 1. \ta\tb.\par
4. \begingroup
5. \def\ta{Hello}
6. \gdef\tb{ World}
7. 2. \ta\tb.\par
8. \endgroup
9. 3. \ta\tb.\par
Produces: See typeset version.
Comments:
- This example illustrates how \global can change the local nature of a macro's definition.
- Lines 1-3 define two macros and typeset each of them.
- Lines 4-8 hold a new group and contain new definitions for the two macros. The definition on line 6 is global.
- Line 9 typesets the macros a third time. The \ta macro is the same on lines 3 and 9, but the global change made to \tb (inside the group) on line 6 continues after the group ends.
TeXbook References: 206. Also: 206, 215, 275, 352, 407.
Related Primitives: def, global, long, outer.
For Additional Examples, see: mathchardef
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \global<assignment>
Description:
THIS command makes the immediately following assignment apply to all groups instead of just the current one [21]. The assignment may be a macro assignment (e.g., `\def\ta{text}') or a non-macro assignment (e.g., `\count1=0' or `\advance\count1 by 1') [275]. Non-macro assignments for a particular variable should be always global or always local. Otherwise, it is possible to run out of save stack space [301 and 346].
Example:
1. \def\tm{}
2. \begingroup
3. \def\tm{lost }
4. \global\def\gtm{will be }
5. \count2 = 2
6. \global\count3=3
7. \advance\count2by5
8. \global\multiply\count3 by \count2
9. A. Non-global items \gtm\tm when a group ends.\par
10. B. The counts are: \the\count2\ and \the\count3.\par
11. \endgroup
12. C. Non-global items \gtm\tm when a group ends.\par
13. D. The counts are: \the\count2\ and \the\count3.\par
14. \global\count3=0
Produces: See typeset version.
Comments:
- Lines 9-10 are identical to lines 13-14 except for the letter at the start of each line. However, the non-global changes made in the group on lines 2-11, which are present on lines A and B, are not present on lines C and D.
- Without line 1, line 12 generates a run-time error (TeX complains that \tm is not defined).
- Note the presence and absence of spaces on lines 5-8.
TeXbook References: 206, 275. Also: 21, 119, 206, 218, 232, 256, 275, 301, 307, 320, 346.
Related Primitives: begingroup, globaldefs, gdef, xdef, tracingstats.
For Additional Examples, see: afterassignment, setbox
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \globaldefs
Description:
NORMALLY, this parameter is 0, and assignments are only global if \global immediately preceeds the assignment. But, if \globaldefs is positive, TeX makes all assignments global. And, if \globaldefs is negative, TeX ignores a \global prefix [275].
Example:
1. \begingroup
2. \globaldefs=1
3. \def\tm{lost }
4. \def\gtm{will be }
5. \count2 = 2
6. \count3=3
7. \advance\count2 by 5
8. \multiply\count3 by \count2
9. A. Non-global items \gtm\tm when a group ends.\par
10. B. The counts are: \the\count2\ and \the\count3.\par
11. \endgroup
12. C. Non-global items \gtm\tm when a group ends.\par
13. D. The counts are: \the\count2\ and \the\count3.\par
14. Globaldefs is now: \the\globaldefs.
15. \global\count2=0\global\count3=0
Produces: See typeset version.
Comments:
- This example is nearly identical to the one on the \global reference page.
- The primary difference is line 2. It makes all subsequent assignments global.
- Line 14 shows the actual assignment made to \globaldefs on line 2 is local.
TeXbook References: 275. Also: 238, 273, 275.
Related Primitives: global.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \halign<box specification>{<alignment material>}
Description:
THERE are three forms of \halign: `\halign {material}' [235]; `\halign to <dimen> {material}'; and `\halign spread <dimen> {material}' [238]. The alignment material consists of two parts: a) the preamble which consists of a number of templates describing each column in the table, and b) the rows of the table. A `&' (category code 4) is used to separate templates in the preamble and columns in each row of the table [231 and 235]. Spaces are ignored after a `&' [236]. Exactly one `#' (category 6) must appear in each template in the preamble. It means: ``Put the text for this column here.'' The preamble and each row must end with either \cr or \crcr [235]. Vertical rules are placed in a table by: a) using the Plain TeX macro \offinterlineskip or an equivalent to stop TeX from putting glue between the lines of the table; b) putting a strut with the correct height and depth on each line in the table; and c) creating a template containing \vrule every place a vertical line is needed in the table [245-246]. Horizontal rules are placed in a table by saying `\noalign{\hrule}' after a \cr or \crcr [246]. An \halign command is not allowed in restricted horizontal mode or in math mode. In horizontal mode it causes the current paragraph to end. It is allowed in display math mode only if the current math list is empty [286 and 291].
Example:
1. \offinterlineskip
2. \def\tf#1{\omit\hfil #1\hfil}
3. \def\tfc#1{\omit\hfil\smash{\lower5pt\hbox{#1}}\hfil}
4. \def\strutA#1#2{\vrule height#1 depth#2 width0pt}
5. \def\er{\crcr\noalign{\hrule}}
6. \setbox0=\vbox{\halign
7. {\strutA{8.5pt}{3.5pt}\vrule#&\kern0.5em#\hfil\quad&\vrule#&\quad\hfil#\quad&
8. \vrule#&\quad\hfil#\quad&\vrule#&\quad\hfil#\kern0.5em\vrule\cr\er
9. \omit\strutA{10.5pt}{3.5pt}\vrule&\multispan7\hfil\bf 1970 Federal Budget
10. Transfers\hfil&\cr
11. \omit\strutA{8.5pt}{4.5pt}\vrule&\multispan7\hfil\selffamily AG (in billions
12. of dollars)\hfil&\er
13. \omit\strutA{3pt}{0pt}\vrule&\multispan7&\er
14. \omit\strutA{10.5pt}{3.5pt}\vrule&\tfc{State}&&\tf{Taxes}&&\tf{Money}&&
15. \tfc{Net}&\cr
16. \omit\strutA{8.5pt}{5.0pt}\vrule&&&\tf{collected}&&\tf{Spent}&&&\er
17. \omit\strutA{10.5pt}{3.5pt}\vrule&New York&& 22.91&& 21.35&& -1.56&\cr
18. &New Jersey&& 8.33&& 6.96&& -1.37&\cr
19. &Connecticut&& 4.12&& 3.10&& -1.02&\cr
20. &Maine&& 0.74&& 0.67&& -0.07&\cr
21. &California&& 22.29&& 22.42&& +0.13&\cr
22. &New Mexico&& 0.70&& 1.49&& +0.79&\cr
23. &Georgia&& 3.30&& 4.28&& +0.98&\cr
24. &Mississippi&& 1.15&& 2.32&& +1.17&\cr
25. \omit\strutA{8.5pt}{5.5pt}\vrule&Texas&& 9.33&& 11.13&& +1.80&\er
26. }}
27. \hbox to \pagewidthB{\hfil\box0\hfil}
Produces: See typeset version.
Comments:
- This example continues a multi-reference page example of a table. The previous version is on the \noalign reference page, and the example began on the \cr reference page.
- This version adds final polish to the table. It puts part of the header in bold (line 9) and repositions the words State and Net (lines 3 and 14). Finally, it centers the table on the page (lines 6 and 27).
- The table appeared on the first page of ``Tbl-A Program to Format Tables,'' by M. E. Lesk which in turn begins on page 157 of Unix Programmer's Manual, Volume 2, 1983.
TeXbook References: 235-249. Also: 117, 190, 193-194, 235-249, 282, 286, 291, 302, 326, 352, 361-362, 386, 392.
Related Primitives: cr, noalign, omit, span, tabskip, crcr, everycr, valign.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hangafter=<number>
Description:
TEX provides two alternatives to the normal paragraph shape. One is hanging indentation. It removes a rectangular region from one of the four corners of a normal paragraph. Two parameters control the size of the rectangle which is removed: \hangafter and \hangindent. Let n be the value for \hangafter. Then if n >= 0, hanging indentation occurs on lines n+1, n+2, ... of the paragraph, but, if n < 0, it occurs on lines 1, 2, ..., |n| [102]. A normal paragraph is made if \hangafter=1 and \hangindent=0pt. TeX resets \hangafter to its default value at the end of every paragraph [103] and when it enters internal vertical mode [349].
Example:
\setbox2=\hbox{\dcrm T}%
\hangafter=-2
\hangindent=\wd2
\hsize=4.75in
\noindent
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
Produces: See typeset version.
Comments:
- The small box in the upper-left corner was designed to hold a large Capital `T'. This illustrates the first step in making a dropcap.
TeXbook References: 102-103. Also: 102, 103-104, 273, 348-349, 419.
Related Primitives: hangindent, parshape, prevgraf.
For Additional Examples, see: displayindent, endgroup, prevgraf
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hangindent=<dimen>
Description:
TEX provides two alternatives to the normal paragraph shape. One is hanging indentation. It removes a rectangular region from one of the four corners of a normal paragraph. Two parameters control the size of the rectangle which is removed: \hangafter and \hangindent. Let x be value for \hangindent. The lines with hanging indentaion have width `\hsize - x'. If x > 0, the indentation appears at the left margin, otherwise it appears at the right margin [102]. A normal paragraph is made if \hangafter=1 and \hangindent=0pt. TeX resets \hangindent to its default value at the end of every paragraph [103] and when it enters internal vertical mode [349].
Example:
\hsize=4.75in
\hangafter=3
\hangindent=-2pc
\noindent
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
Produces: See typeset version.
Comments:
- Since \hangindent is negative, and \hangafter is 3, the rectangle appears at the bottom-right corner of the paragraph.
TeXbook References: 102-103. Also: 102, 262, 274, 349, 407.
Related Primitives: hangafter, parshape.
For Additional Examples, see: displayindent, endgroup, prevgraf
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hbadness
Description:
WHEN an \hbox is made, the \badness of the box is compared to \hbadness. If \badness is less than or equal to \hbadness, the box is acceptable [272]. Otherwise, a message is written to the log file, and the box is considered: overfull, tight, loose, or underfull. The distinction between the four types of bad boxes depends on whether the glue in the box shrinks or stretches and on the parameters: \hbadness and \hfuzz. The following table [302] summarizes the possibilities:
| bad box type | glue | additional conditions |
| overfull | shrink | \hbadness < 100 or excess width > \hfuzz. |
| tight | shrink | (all other shrink cases) |
| loose | stretch | \hbadness < \badness <= 100. |
| underfull | stretch | (all other stretch cases) |
TeXbook References: 272, 302. Also: 29, 272, 302, 348, 387-388, 401.
Related Primitives: hfuzz, badness, vbadness.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hbox<box specification>{<horizontal material>}
Description:
THERE are three forms of \hbox: `\hbox {material}'; `\hbox to <dimen> {material}'; and `\hbox spread <dimen> {material}'. The to version makes a box <dimen> wide, and the spread version increases the natural width of the box by <dimen>. The baseline of a constructed \hbox is the baseline of the boxes inside it before they were raised or lowered. The height and depth of the box are the maximum distances the interior boxes are above and below the baseline. The width of the box can be negative if the box contains a negative \kern or \hskip [77]. When \hbox is used in horizontal mode, it adds material to the current paragraph. When it is used in vertical mode, it adds material to the current page [86]. An \hbox is indivisible. TeX will not split it over two lines [93].
Example:
1. This is \hbox{an interrupted} line.\par
2. This is \hbox spread 1em{also an interrupted} line.\par
3. \hbox to 3in{\vrule\hfil This is a centered line.\hfil\vrule}\par
Produces: See typeset version.
Comments:
- The extra glue introduced by the spread version of hbox is left in line 2.
TeXbook References: 77, 278. Also: 64-67, 77, 86, 93, 151, 159, 163, 175, 179, 185-186, 221, 222, 278, 282, 388-389.
Related Primitives: setbox, vbox, vtop.
For Additional Examples, see: cleaders, ifodd, leaders, mathchoice, vskip, vss
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hfil
Description:
THIS command is essentially equivalent to: `\hskip 0pt plus 1fil' [72]. If \hfil appears in vertical mode, a new paragraph is started [283]. It appends horizontal glue to horizontal [285] and math [290] lists. It is used behind the scenes with \over [142] and \matrix [177] to center material. Also, the Plain TeX macro \displaylines uses \hfil to center each line in the display [194].
Example:
{\bf Commands used for Glue or Kern}
\halign
{\qquad#\hfil&\quad\hfil#&\quad\hfil#\hfil\cr
hskip&vskip&kern\cr
hfil&vfil&lower\cr
hfill&vfill&raise\cr
hfilneg&vfilneg&moveleft\cr
hss&vss&moveright\cr
}
Produces: See typeset version.
Comments:
- This example shows that in an alignment: `#\hfil' left justifies text; `\hfil#' right justifies text; and `\hfil#\hfil' centers text.
TeXbook References: 71-72. Also: 71-72, 194, 235-237, 283, 285, 290, 397.
Related Primitives: hskip, hfill, hfilneg, hss.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hfill
Description:
THIS command is essentially equivalent to: `\hskip 0pt plus 1fill' [72]. If \hfill appears in vertical mode, a new paragraph is started [283]. It appends horizontal glue to horizontal [285] and math [290] lists. It may be used with \over [142], \matrix [177], and \displaylines [194] to place material flush left or right.
Example:
1. \hbox to 3.5in{\vrule\hskip0pt plus2fill Here is an oddly
2. placed line.\hfill\vrule}
3. \hbox to 3.5in{\vrule\hskip0pt plus1.75fill Here is another
4. one.\hfill\vrule}
5. \hbox to 3.5in{\vrule\hskip0pt plus16383.9fil Here is a left
6. justified line.\hfill\vrule}
7. \vskip1\baselineskip
8. $ x\over(x+1)$, $ x\hfil\over(x+1)$, $ x\hfill\over(x+1)$
Produces: See typeset version.
Comments:
- The white space at the start of the first line is exactly twice the space at the end of the line.
- Lines 3-4 show a fractional quantity may be used with \hskip and one of the fils to produce more complicated results.
- Lines 5-6 show that 1 fill is larger than 16383.9 fil. Quantities appearing before one of the fils must be less than 16384 [72].
- Line 8 shows that spacing similar to that from lines 1-4 results if \hfil is used with \over. However, \hfill works as it does in lines 5-6.
TeXbook References: 71-72. Also: 71-72, 142, 177, 194, 233, 283, 285, 290.
Related Primitives: hskip, hfil.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hfilneg
Description:
THIS command is essentially equivalent to: `\hskip 0pt plus -1fil'. It cancels the stretchability of \hfil [72]. If \hfilneg appears in vertical mode, a new paragraph is started [283]. It appends horizontal glue to horizontal [285] and math [290] lists.
Example:
1. \def\cline #1{\hbox to 3in{\vrule\hfil #1\hfil\vrule}}
2. \cline{This line is centered.}
3. \cline{This line is NOT centered.\hfilneg}
4. \cline{\hfilneg This line is NOT centered.}
5. \vskip1\baselineskip
6. $ x\over(x+1)$, $ \hfilneg x\over(x+1)$, $ x\hfilneg\over(x+1)$
Produces: See typeset version.
Comments:
- Line 1 defines a variation of Plain TeX's centerline macro. It creates a 3-inch wide work area and puts vertical lines at each end of the area.
- Line 2 shows a normal use of \cline.
- Lines 3-4 show how \hfilneg can be used to undo part of what \cline does.
- Line 6 is similar to lines 2-4 and shows how \hfilneg acts with \over.
TeXbook References: 72. Also: 72, 100, 233, 283, 285, 290, 397.
Related Primitives: hskip, hfil.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hfuzz
Description:
THIS is a dimen parameter used with \hbadness in classifying an \hbox which contains more material than will fit even after the glue in the box has shrunk all it can. TeX considers the box overfull if the excess width of the box is larger than \hfuzz or \hbadness is less than 100 [302].
TeXbook References: 274, 302. Also: 30, 274, 302, 348, 387-388.
Related Primitives: hbadness, vfuzz.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hoffset=<dimen>
Description:
THIS parameter controls the location of each typeset page's left margin. The default value of \hoffset is 0pt, and TeX makes a 1-inch left margin. That margin is moved to the right if \hoffset is given a positive dimension and to the left if it is given a negative dimension [251].
Example:
1. \def\theadline
2. {%
3. \ifodd\pageno
4. \global\hoffset = 0.8125in% 13/16
5. \hcropmark(-1.7125,00.7)% upper left - ODD page
6. \vcropmark(-1.3125,00.2)
7. % make other ``odd'' page assignments, e.g., cropmarks.
8. \else
9. \global\hoffset = 0.5625in% 9/16
10. \hcropmark(-1.4625,00.7)% upper left - EVEN page
11. \vcropmark(-1.0625,00.2)
12. % make other ``even'' page assignments, e.g., cropmarks.
13. \fi
14. % Put material which will NOT appear on the cropped pages.
15. \ifcase\headnum\vskip 71pt% 0. no header
16. \or\firstheadline % 1. 2 lines only
17. \or\regheadline % 2. 2 lines + text - normal.
18. \fi
19. }
Produces: See typeset version.
Comments:
- This example shows part of a macro which is called by the output routine and makes the header line on these reference pages.
- The quarter of an inch difference in \hoffset (lines 4 and 9) shows up on the left side of each odd page. It provides the extra space required for the binding.
- The macro prints identification data above the top of the page (line 14).
- The macro uses \headnum to print one of three possible headers (lines 15-18).
TeXbook References: 251. Also: 251, 274, 342.
Related Primitives: voffset, hsize, vsize.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \holdinginserts=<number>
Description:
IF this parameter is positive, when the current page is placed in \box255 and sent to the output routine, all insertions are held in their places (i.e., the \box for each class of insertions is left empty) [125].
TeXbook References: 125. Also: 125, 273, 400.
Related Primitives: insert.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hrule[height<dimen> depth<dimen> width<dimen>]
Description:
A rule box is a solid black rectangular box with a height, depth, and width. Such a box may look like a horizontal or vertical line. The \hrule command makes a rule box, and it usually is used in vertical mode. If none of the box dimensions are specified, the box has height 0.4pt and depth 0pt. Its width is the width of the smallest box that encloses it. No interline glue is placed before or after an \hrule [221]. Normally, when \hrule is used in horizontal mode, the paragraph is ended, and the rule box is typeset [222]. However, \hrule may be used with \leaders in horizontal mode with no unexpected effects [224-225].
Example:
1. \vtop{\hsize=3in
2. Here is a square hrule: \hrule width 0.25in height0.125in depth 0.125in\par
3. Here is an hrule \hrule width 1in in a line.\par
4. Here is the first line of text.\par
5. \hrule
6. Here is the second line of text.\par
7. \vskip .5\baselineskip
8. \hrule height 0.25pt% this makes a `thinner' line.
9. \vskip .5\baselineskip
10. Here is the third line of text.\par
11. }
Produces: See typeset version.
Comments:
- Line 2 makes it look as if the square should appear at the end of the first typeset line, but it does not. It is typeset by itself on the next line.
- Line 3 illustrates a variation of the previous comment.
- Each example illustrates that TeX does not automatically put extra space before or after an \hrule command.
TeXbook References: 221-225. Also: 24, 64, 85, 221-225, 246, 281-282, 286, 357, 420, 421.
Related Primitives: vrule, leaders.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hsize=<dimen>
Description:
THIS dimension determines the width of normal lines in a paragraph [27]. However, the first and last lines in a paragraph are special. The first line is affected by \parindent [101], and the last line is affected by \parfillskip [100]. If a paragraph contains several \hsize commands, TeX uses the last one to typeset the paragraph [101].
Example:
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
{\parindent=1.5pc\hsize=4.75in
\tstory\par}
Produces: See typeset version.
Comments:
- The first paragraph is typeset using the value for \hsize used by the reference pages. That value is less than the total width of typeset material on the page (e.g., the header line). TeX makes it easy to place material outside the margins determined by hoffset, voffset, hsize, and vsize.
TeXbook References: 26-27, 251. Also: 26-27, 60, 101-102, 188, 237, 251, 257, 274, 340-341, 348, 387, 406, 407, 413, 415, 417.
Related Primitives: parindent, parfillskip, hangafter, hangindent, parshape, vsize, hoffset, voffset.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hskip<glue>
Description:
THIS command inserts glue in horizontal [285] or math [290] mode. It is used with fil and fill to make \hfil and \hfill. It should not be used with math glue [168]. If \hskip appears in vertical mode, a new paragraph is started [283]. Although filll exists, \hfilll is not a primitive [72].
Example:
1. Here is a line of text\par
2. \hskip0.25in Here is a second line of text.\par
3. \kern0.25in Here is a third line of text.\par
4. \noindent\kern0.25in Here is a final line of text.\par
Produces: See typeset version.
Comments:
- Lines 1-2 work as expected.
- Line 3 produces a surprise. If \hskip appears in vertical mode, a new paragraph is started. However, \kern adds vertical or horizontal space depending on the current mode which is vertical at the start of line 3.
- The \noindent on line 4 begins a new paragraph, so \kern makes horizontal space.
TeXbook References: 71. Also: 71, 86, 168, 283, 285, 290, 314.
Related Primitives: hfil, hfill, hfilneg, hss, mskip, vskip, kern.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hss
Description:
THIS command is essentially equivalent to: `\hskip 0pt plus 1fil minus 1fil' [72]. If it appears in vertical mode, a new paragraph is started [283]. It appends horizontal glue to horizontal [285] and math [290] lists. It is used in the Plain TeX macro \rlap [82].
Example:
1. \def\trlap#1{\hbox to 0pt{#1\hss}}
2. {font {\tt\fontname\font}\ makes: \tt 4 \trlap/= 5. Also 5 \trlap=/ 6.
3. \hbox{\kern.25in\boxitA{/}{}\kern0.25in \boxitA{=}{}}}\par
4. font \fontname\font\ makes: 4 \trlap/= 5. Also 5 \trlap=/ 6.
5. \hbox{\kern.6in\boxitA{/}{}\kern0.25in \boxitA{=}{}}
Produces: See typeset version.
Comments:
- Line 1 defines \trlap. It is the same as Plain TeX's \rlap.
- Lines 2-3 use \trlap and a fixed-width font to print a not equal symbol.
- Lines 4-5 are the same except for the font. However, the results from these lines is not usable.
- The boxes at the end of each line help explain the results.
TeXbook References: 71-72. Also: 71-72, 82-83, 233, 283, 285, 290, 442.
Related Primitives: hskip, hfil.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ht<8-bit register number>
Description:
EVERY box has a height which is a <dimen> quantity. When material is placed in a box, the height of the box is automatically recomputed. The height may be accessed or changed using \ht<number> [120].
Example:
1. \setbox0=\hbox{Every box has }
2. \setbox1=\hbox{a }
3. The height of box 0 is \the\ht0.\par
4. The height of box 1 is \the\ht1.\par
5. \hbox{\box0\copy1 height}
6. The height of box 0 is \the\ht0.\par
7. The height of box 1 is \the\ht1.\par
Produces: See typeset version.
Comments:
- Initially, both boxes have a positive height. Line 5 empties \box0, and its height becomes 0.
TeXbook References: 120. Also: 120, 271, 388-389, 417.
Related Primitives: dp, wd, setbox.
For Additional Examples, see: accent, boxmaxdepth
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hyphenation{<hyphenated words>}
Description:
THIS command adds a set of hyphenated words to the exception
dictionary for the current language. For example, the manmac format
says: `\hyphenation {man-u-script man-u-scripts ap-pen-dix}'
[452]. The exception dictionary is global. If a word is placed
in the dictionary more than once, the last addition is the one used
[453].
Example:
1. \def\tstoryA{There are cries, sobs, confusion among the people, and at
2. that moment the cardinal himself, the Grand Inquisitor, passes by the
3. cathedral. He is an old man . . .}
4. {\language255\hyphenation{mom-ent}}
5. \setbox0=\vbox{\hsize=2.25in \tstoryA}
6. \setbox1=\vbox{\hsize=2.25in\language255 \tstoryA}
7. \hbox to \hsize{\box0\hfill\box1}
Produces: See typeset version.
Comments:
- Line 4 adds a non-standard hyphenation of moment to \language255's execption dictionary.
- Line 6 uses \language255 to typeset the right-hand copy of \tstoryA.
TeXbook References: 452. Also: 277, 419, 452-453, 455.
Related Primitives: patterns, language.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hyphenchar<font>=<number>
Description:
WHEN TeX loads a new font, it sets the \hyphenchar of the font to the value of \defaulthyphenchar [273]. After a font is loaded, its \hyphenchar may, if necessary, be changed. For example, the manmac format sets \hyphenchar to -1 for each typewriter font it uses. This prevents hyphenation of control sequence names and keywords in The TeXbook [414], because hyphenation of a word is not attempted unless the font used for the first letter of the word has a hyphenchar between 0 and 255 [454]. Most fonts set \hyphenchar to a hyphen `-' [351]. In unrestricted horizontal mode a \discretionary{}{}{} is added after a character whose code is the \hyphenchar of its font (e.g., the `-' in pre-break) and after a ligature formed from a sequence which ends with such a character (e.g., an endash or emdash) [286]. Changes to \hyphenchar are global [nr].
Example:
1. \def\tstoryA{There are cries, sobs, confusion among the people, and at
2. that moment the cardinal himself, the Grand Inquisitor, passes by the
3. cathedral. He is an old man . . .}
4. \count0=\hyphenchar\font
5. \setbox0=\vbox{\hsize=2.25in \tstoryA}
6. \setbox1=\vbox{\hsize=2.25in\hyphenchar\font=166 \tstoryA}% 166 is an emdash
7. \hbox to \hsize{\box0\hfill\box1}% in the encoding
8. The values are: \the\count0\ and \the\hyphenchar\font.% used here.
9. \hyphenchar\font=45 % 45 is a hyphen.
Produces: See typeset version.
Comments:
- Line 6 changes the \hyphenchar of the current font to an emdash.
- Lines 4 and 8 show the change is global even though the change was made inside a box.
TeXbook References: 95. Also: 95, 214, 271, 273, 277, 286, 351, 395, 414, 454, 455.
Related Primitives: defaulthyphenchar, discretionary.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \hyphenpenalty
Description:
WHEN TeX breaks a paragraph into lines, it adds \hyphenpenalty to the penalties on each line, in its calculation of a line's demerits, if the line ends with a discretionary whose pre-break text is nonempty (i.e., TeX has hyphenated a word, and the break is after the hyphen) [96]. The value used for \hyphenpenalty is the one that is current at the end of the paragraph [101].
Example:
\hsize4.15in
\def\testhyphenpenalty#1%
{%
\hyphenpenalty=#1 %
\tstory% The \adjdemerits reference page holds the definition of \tstory
\par
\vskip1\baselineskip
}
\testhyphenpenalty{50}% 0 & 50 make identical paragraphs for this material.
\testhyphenpenalty{200}
\testhyphenpenalty{-200}\unskip% remove the last \baselineskip!
Produces: See typeset version.
Comments:
- This example typesets a paragraph with three different values of \hyphenpenalty.
- There is no difference in using the Plain TeX value of 50 and using 0.
- Increasing \hyphenpenalty to 200 eliminates all hyphenated words in the paragraph.
- Decreaseing \hyphenpenalty to -200 results in two addition hyphenated words.
TeXbook References: 96. Also: 96, 101, 272, 348, 451.
Related Primitives: exhyphenpenalty, brokenpenalty, discretionary.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \if<token1><token2>
Description:
TEX evaluates an \if command by expanding the tokens following the \if until it finds two unexpandable tokens [209]. Each of those tokens is either: a character (with a character code value 0-255 and a category code value 0-15) or a control sequence [38]. The control sequence is assigned character code 256 and category code 16. The \if condition is true if the character codes of the two tokens are the same. Part of the above expansion involves replacing a token which has in turn been `let=' to another token by the other token [209].
Example:
1. \def\tmacro#1% a `-' means use default value instead of parameter 1.
2. {%
3. \if -#1
4. DV% default value.
5. \else
6. #1%
7. \fi
8. ---\par
9. }
10. \tmacro{Just a test}% Want to use passed value of paramter.
11. \tmacro{-}% Want to use default value.
12. \tmacro{- Whoops!}% Want to use passed value of paramter.
Produces: See typeset version.
Comments:
- It is common to write a TeX macro with several parameters and then design the macro so it works one way if a particular parameter is present and a second way if the parameter is absent.
- This example shows one way to check for a missing or unused parameter. The \ifx reference page shows another way.
- Lines 3-7 use an \if statement to see if a special character is present in a parameter. Line 12 shows this technique should only be used if the special character will never occur as the first character of the parameter. The result for line 12 makes sense if lines 3-5 are visualized after TeX replaces parameter 1 on line 3: `\if -- Whoops! DV\else'. The test is true, but the result is probably not what was intended.
TeXbook References: 209. Also: 209-211, 307, 377, 379.
Related Primitives: ifcat, ifx.
For Additional Examples, see: afterassignment, futurelet
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifcase<number>
Description:
THIS command begins a conditional which allows for more than two options. Its general form is: `\ifcase<number><text for case 0>\or<text for case 1>\or...\or<text for case n>\else<text for all other cases>\fi'. Here n is an integer greater than or equal to 0; there are n \or statements and an optional final \else which will be used only if the number is negative or larger than n [210].
Example:
1. \def\mydate
2. {%
3. \number\day \ %
4. \ifcase\month
5. \or Jan\or Feb\or Mar%
6. \or Apr\or May\or June%
7. \or July\or Aug\or Sep%
8. \or Oct\or Nov\or Dec%
9. \fi
10. \ \number\year
11. }
12. \mydate
Produces: See typeset version.
Comments:
- The above \ifcase does not have a `0' case or an \else case because \month is an integer between 1 and 12.
- Without the `%' on lines 5-8, an extra space creaps in for four months of the year.
TeXbook References: 210. Also: 210, 349, 373, 390, 406.
Related Primitives: or, else, fi.
For Additional Examples, see: day, else, mathord
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifcat<token1><token2>
Description:
TEX evaluates an \ifcat command by expanding the tokens following the \ifcat until it finds two unexpandable tokens [209]. Each of those tokens is either: a character (with a character code value 0-255 and a category code value 0-15) or a control sequence [38]. The control sequence is assigned character code 256 and category code 16. The \ifcat condition is true if the category codes of the two tokens are the same. Part of the above expansion involves replacing a token which has in turn been `let=' to another token by the other token [209].
Comments:
- Useful examples of \ifcat are rare (but see page 377 of The TeXbook).
TeXbook References: 209. Also: 209, 210, 307, 377.
Related Primitives: if, ifx.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifdim<dimen1><relation><dimen2>
Description:
THIS command compares two <dimen> values. The only relations are `<', `>', and `=' which mean less than, greater than, and equal [209]. Each <dimen> should be one of the following: a) a dimen or skip register (e.g., \dimen0 or \skip1); b) an internal quantity or parameter which holds a dimension or glue (e.g., \hsize or \ht0); or c) an actual dimension (e.g., 2.5in or 100pt) [nr]. Glue is converted to a dimension by dropping the stretch and shrink components [118].
Example:
1. . . .
2. \ifdim\pagegoal < \maxdimen
3. \ifonepage
4. \vfill\eject
5. \else
6. \ifdim\dimen0 < \pagegoal
7. \unvbox1
8. \penalty200
9. \else
10. \ifdim\dimen1 < \pagegoal
11. \vfill
12. \fi
13. \eject
14. \fi
15. \fi
16. \fi
17. \unvbox0
18. . . .
Produces: See typeset version.
Comments:
- The above lines are from the macro used to typeset draft versions of these reference pages.
- They solve a basic problem faced at the start of each new control sequence. Namely, ``is there enough space to get the new cs started on the current page or should the page be ejected and a new page started?''
- Earlier in the macro box0 is made to hold the cs material through the Synopsis line. Also, box1 is made to hold the material placed between two css which appear on the same page. Finally, \dimen0 and \dimen1 are calculated using the current position on the page, the shrink and stretch in the page, and the space required for boxes 0 and 1.
- TeX maintains \pagegoal, and it is less than \maxdimen except at the start of a page. In working with early drafts of the pages, I wanted each cs to start on its own page, and so I set \onepagetrue. Later in the project I set \onepagefalse.
- With the above background it should be straightforward to trace through the lines. TeX only reaches line 3 if the current page has something on it. It only reaches line 6 if two control sequences can appear on the same page. If the material on the current page can shrink enough for both the separation and new material (boxes 1 and 0), the test made on line 6 passes and the separation material is added together with a small penalty which says ``this is not a good place to break the page.'' Otherwise, the page must be ejected (line 13) and the question is whether it has enough on it to stretch and fill out the page. That is the test made on line 10. If there is not, a \vfill is added before the \eject. Finally, the new material is added on line 17.
TeXbook References: 209. Also: 209, 353, 387, 417.
Related Primitives: ifnum.
For Additional Examples, see: accent, fi
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifeof<4-bit number>
Description:
THIS command is true unless the input stream for <number> is open and not fully read. The number must be in the range 0-15 [210].
Example:
1. %File I/O
2. %\newread\traux % This appears uncommented in my main formatting routines
3. %\newwrite\twaux% This appears uncommented in my main formatting routines
4. %
5. \def\tfilesetup#1% pass file name. One could also pass: \traux & \twaux.
6. {%
7. \openin\traux=#1 %
8. \ifeof\traux
9. \closein\traux
10. \else
11. \closein\traux
12. \input #1%
13. \fi
14. \immediate\openout\twaux=#1 %
15. }
Produces: See typeset version.
Comments:
- Some documents require one or more auxilary files (e.g., holding data for the table of contents or index). Normally, TeX is run twice (or more) on such documents. The first run prepares an up-to-date version of the auxilary file, and the second run loads the file and uses it to prepare the final typeset copy.
- The previous point describes the theory of using TeX. The reality is more complicated because each time TeX processes a document it will load or try to load all the auxilary files required by the document. If an auxilary file is missing (as it may well be) and \input is used to load the file, processing will stop and TeX will complain of a missing file.
- So, a macro similar to \tfilesetup is used to load each auxilary file. First, the file is opened for reading (line 7). That does not create an error if the file is missing. But, if it is missing or if it is empty, the test on line 8 will fail and the file is simply closed. Otherwise, the file exists and is not empty. So, it is closed and then read using \input. Finally, the file is opened for writing (line 14), and a new version is prepared during the current processing of the main document.
TeXbook References: 210. Also: 210, 217.
Related Primitives: openin.
For Additional Examples, see: openin
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \iffalse
Description:
THIS is a conditional which is always false. Thus, any text preceeding an accompanying \else will never be used [210]. The command is often used with \mark to set up running headers for the pages of a book or an index [260].
Example:
1. . . .
2. % the next line goes in a verso (even) page header.
3. \setbox1=\hbox{{\selffamily AC\it\expandafter\iffalse\topmark\fi}}%
4. . . .
5. %The next lines are from the macro that makes the reference page for a CS.
6. %We have: \def\CScs{ControlSequence}, e.g., \def\CScs{iffalse}
7. %\box0 holds everything through the Synopsis line.
8. %
9. \mark{\currentcs\noexpand\else\CScs}
10. . . . % do \eject unless following \box0 will fit on current page.
11. % The \ifdim reference page shows this test.
12. \unvbox0%
13. \mark{\CScs\noexpand\else\CScs}
14. . . . %typeset the rest of the page.
15. \let\currentcs=\CScs%
16. . . .
Produces: See typeset version.
Comments:
- It is tricky to get the correct control sequence on the header line of these reference pages. Two things are required [260-261].
- First, a special mark is made before and after the start of each control sequence (lines 9 and 13). Each mark contains two options separated by `\noexpand\else'.
- Second, each header routine uses either \iftrue or \iffalse and the appropriate mark (\botmark, \firstmark, or \topmark).
- Some thought and possibly a review of the mark commands should show that line 3 will select the appropriate control sequence for even pages. Keep in mind that the \expandafter on line 3 means: 1) save the \iffalse token; 2) expand \topmark (this makes \cs1\else\cs2 for appropriate values of \cs1 and \cs2); 3) place the token from step 1 before the tokens from step 2 and continue processing.
TeXbook References: 210-211. Also: 210, 211, 260-261, 348, 385-386.
Related Primitives: iftrue.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifhbox<8-bit number>
Description:
THIS command is true if \box<number> contains an hbox. The number must be a valid box register (i.e., from 0 to 255) [210].
Example:
1. \def\checkbox#1%
2. {%
3. \ifhbox#1
4. \def\tbox{HBox}%
5. \else
6. \ifvbox#1
7. \def\tbox{VBox}%
8. \else
9. \ifvoid#1
10. \def\tbox{VOid}%
11. \else
12. \def\tbox{BigTrouble}%
13. \fi
14. \fi
15. \fi
16. {\it box#1: \tbox}%
17. }
18. \setbox0=\hbox{Hello World}
19. \setbox1=\vbox{Going, Going, Gone}
20. \setbox2=\hbox{Time Out}
21. \setbox3=\vbox{}
22. \checkbox0---\checkbox1---\checkbox2---\checkbox3\par
23. \copy0\box1\box2\copy3
24. \checkbox0---\checkbox1---\checkbox2---\checkbox3\par
Produces: See typeset version.
Comments:
- TeX distinguishes between empty\mkindex{box`5`empty vs void} and void boxes. Line 21 creates an empty vbox and assignes it to \box3. Line 23 displays the boxes created on lines 18-21. After line 23 boxes 1 and 2 are void.
- The \ifhmode reference page shows another way to nest if statements.
- Each of the percent signs in \checkbox is required to keep out spurious\mkindex{space`5`spurious} spaces.
TeXbook References: 210. Also: 210, 392, 399.
Related Primitives: ifvbox, ifvoid.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifhmode
Description:
This command is true if TeX is in horizontal or restricted horizontal mode [209].
Example:
\gdef\checkmode
{%
\ifhmode
\ifinner
\def\tmode{RH}% restricted horizontal.
\else
\def\tmode{H}% horizontal.
\fi
\fi
\ifvmode
\ifinner
\def\tmode{IV}% internal vertical.
\else
\def\tmode{V}% vertical.
\fi
\fi
\ifmmode
\ifinner
\def\tmode{M}% math
\else
\def\tmode{DM}% display math
\fi
\fi
{\it mode: \tmode}%
}
\checkmode\par% Each example is put in a vbox before it is typeset!
\vbox{Hello \checkmode\ \hbox{World \checkmode}}
Produces: See typeset version.
Comments:
- The \checkmode macro identifies each of the six modes.
- The \ifhbox reference page shows another way to nest if statements.
- Each of the percent signs in \checkmode is required to keep out spurious\mkindex{space`5`spurious} spaces.
TeXbook References: 209. Also: 209, 363.
Related Primitives: ifmmode, ifvmode, ifinner.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifinner
Description:
This command is true if TeX is in restricted horizontal, internal vertical, or nondisplay math mode [209].
Example:
1. \def\checkinner
2. {%
3. \ifinner
4. \o T% the accent reference page defines \o
5. \else
6. \o F
7. \fi
8. }
9. \checkinner\checkinner\checkmode\par% the ifhmode page defines \checkmode
10. \vbox{\checkinner Hello\checkinner\hbox{\checkinner World \checkmode}}
11. $ 1+2+3+\ldots+n = {{n(n+1)}\over2}\ \checkinner $\checkinner\checkmode
Produces: See typeset version.
Comments:
- The first two checks made on line 9 match the first two made on line 10 because, each Example actually takes place inside a vbox. So, lines 9 and 10 start in internal vertical mode, but the first character on each line begins a paragraph which TeX processes in horizontal mode.
- The \ifhmode reference page shows another example using \ifinner.
TeXbook References: 209. Also: 209.
Related Primitives: ifhmode, ifmmode, ifvmode.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifmmode
Description:
This command is true if TeX is in math or display math mode [209].
Example:
\def\L#1%
{%
\ifmmode
\mkern-#1mu\relax
\else
\dimen0=0.05em
\multiply\dimen0 by #1
\kern-\dimen0\relax
\fi
}
Compare: 1941--1945 with {\it 1941--1945} with {\it 1941--\L11945}\par
$x^2/2$ vs $x^2\L1/2$ vs $X^2\L2/2$ vs $X^2\L3/2$ vs $X^2\L9/2$
Produces: See typeset version.
Comments:
- The macro \L may be used in all modes. In math mode, it adds math glue, but in other modes it adds regular glue.
- I've added many kerns between digits and a hyphen, endash, and emdash for Caslon's roman font. However, I've not adjusted Caslon's italics font. It does look better with a small adjustment.
- In math mode the \L macro (and a corresponding \R) offer an alternative to Plain TeX's \, and \!.
TeXbook References: 209. Also: 209, 215, 240, 353, 356, 360, 423.
Related Primitives: ifhmode, ifvmode, ifinner.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifnum<number1><relation><number2>
Description:
THIS command compares two integers. The only relations are `<', `>', and `=' which mean less than, greater than, and equal [209]. A <dimen> value may be used as a number. It is converted to scaled points. Also, a <glue> value may be used as a <dimen>. TeX ignores the stretch and shrink components [118]. Each <number> should be one of the following: a) a count register (e.g., \count0); b) a dimen or skip register (each is converted to a number as described above); c) an internal quantity which holds an integer, dimension, or glue (e.g., \year or \vsize); or d) an integer constant (e.g., 1000) [nr].
Example:
1. \def\mytime%format the time as hh:mm. Always use 2 digits for hh & mm.
2. {%
3. {%
4. \count20=\time
5. \count22=\count20
6. \divide \count20 by 60
7. \count21=\count20
8. \multiply\count21 by -60
9. \advance\count22 by \count21
10. \ifnum\count20<10 0\fi% put leading `0' if necessary.
11. \the\count20:%
12. \ifnum\count22<10 0\fi% put leading `0' if necessary.
13. \the\count22
14. }%
15. }
16. \count20=-100
17. Time is: \the\time, and count20 = \the\count20.\par
18. Better time is: \mytime, and count20 = \the\count20.
Produces: See typeset version.
Comments:
- This shows one way to convert \time, which is the number of minutes after midnight, to military (twenty-four hour) time. The hours are calculated in register 20 and the minutes in register 22. Each register is checked (lines 10 and 12), and an extra 0 is added if necessary so the hours and minutes always have two digits.
- The grouping done by lines 3 and 14 ensure that the registers used on lines 4-13 will not interfere with other uses of the registers outside of \mytime.
- Line 16 sets \count20 to -100. It is a value which can never be a valid time. Then line 17 prints \count20 before the call to \mytime, and line 18 prints \count20 after the call. Both values are -100.
- The \time reference page contains a macro which makes civilian time.
TeXbook References: 209. Also: 208, 209, 218-219.
Related Primitives: ifodd, ifdim.
For Additional Examples, see: advance, day, time, year
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifodd<number>
Description:
THIS command is true if <number> is an odd integer and false if it is an even integer [209]. Since \ifeven is not a primitive control sequence, using it will generate an error unless a macro package which defines it is included [nr].
Example:
1. . . .
2. \ifodd\pageno
3. \else
4. \fixpage{}{1}% Do header and footer cleanup 1.
5. \fi
6. \vfill
7. \eject
8. \ifodd\pageno
9. \else
10. \fixpage{0}{1}% Do header and footer cleanup 2.
11. \hbox to 0pt{}% \eject won't work unless `something' is on the page.
12. \vfil
13. \eject
14. \fi
15. . . .
Produces: See typeset version.
Comments:
- These lines are from a macro used to end an article in an academic journal. Lines 8-14 ensure the next article starts on a recto page.
- The header and footer on the last page of the article may be non-standard. Lines 4 and 10 set switches so the correct header and footer is used.
- If TeX had an \ifeven command, each test would be more readable.
TeXbook References: 209. Also: 207, 209, 416, 418-419.
Related Primitives: ifnum.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \iftrue
Description:
THIS is a conditional which is always true. Thus, any text following an accompanying \else will never be used [210]. The command is often used with \mark to set up running headers for the pages of a book or an index [260].
Example:
1. . . .
2. % the next line goes in a recto (odd) page header.
3. \setbox1=\hbox{{\selffamily AC\it\iftrue\botmark\fi}}%
4. . . .
5. %The next lines are from the macro that makes the reference page for a CS.
6. %We have: \def\CScs{ControlSequence}, e.g., \def\CScs{iftrue}
7. %\box0 holds everything through the Synopsis line.
8. %
9. \mark{\currentcs\noexpand\else\CScs}
10. . . . % do \eject unless following \box0 will fit on current page.
11. % The \ifdim reference page shows this test.
12. \unvbox0%
13. \mark{\CScs\noexpand\else\CScs}
14. . . . %typeset the rest of the page.
15. \let\currentcs=\CScs%
16. . . .
Produces: See typeset version.
Comments:
- It is tricky to get the correct control sequence on the header line of these reference pages. Two things are required [260-261].
- First, a special mark is made before and after the start of each control sequence (lines 9 and 13). Each mark contains two options separated by `\noexpand\else'.
- Second, each header routine uses either \iftrue or \iffalse and the appropriate mark (\botmark, \firstmark, or \topmark).
- Some thought and possibly a review of the mark commands should show that line 3 will select the appropriate control sequence for odd pages.
TeXbook References: 210-211. Also: 210, 211, 260-261, 348.
Related Primitives: iffalse.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifvbox<8-bit number>
Description:
THIS command is true if \box<number> contains a vbox. The number must be a valid box register (i.e., from 0 to 255) [210].
Example:
1. \def\checkvbox#1%
2. {%
3. \ifvbox#1
4. \o T%
5. \else
6. \o F%
7. \fi
8. }
9. \setbox1=\vbox{Twenty One}
10. \setbox2=\vbox{Twenty Two}
11. \checkvbox1---\checkvbox2\par
12. \copy1\box2
13. \checkvbox1---\checkvbox2
Produces: See typeset version.
Comments:
- Line 11 shows that each box is in fact a vbox.
- After line 12, box2 will be void, and line 13 shows that box2 is not a vbox.
- The \ifhbox reference page shows another example of \ifvbox.
TeXbook References: 210. Also: 210.
Related Primitives: ifhbox, ifvoid.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifvmode
Description:
This command is true if TeX is in vertical or internal vertical mode [209].
Example:
1. \checkmode\par% the ifhmode reference page defines \checkmode
2. \vbox{\checkmode\ Hello \checkmode\ \hbox{World \checkmode}}
Produces: See typeset version.
Comments:
- The \checkmode on line 1 is in IV mode because each example is put in a vbox before it is typeset.
TeXbook References: 209. Also: 209.
Related Primitives: ifhmode, ifmmode, ifinner.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifvoid<8-bit number>
Description:
THIS command is true if \box<number> is void. The number must be a valid box register (i.e., from 0 to 255) [210].
Example:
1. \def\checkvoid#1%
2. {%
3. \ifvoid#1
4. V%
5. \else
6. N%
7. \fi
8. }
9. \setbox1=\hbox{}
10. \setbox2=\hbox{Twenty Two}
11. \checkvoid1---\checkvoid2\par
12. Where is box 1? \copy1---\box2\par
13. \checkvoid1---\checkvoid2
Produces: See typeset version.
Comments:
- Line 11 shows that initially neither box is void even though box1 is empty.
- After line 12 box2 will be void, and line 13 shows that is the case. However, box1 is still not void.
- The \ifhbox reference page has another example of \ifvoid.
TeXbook References: 210. Also: 210, 256.
Related Primitives: ifhbox, ifvbox.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ifx<token1><token2>
Description:
WHEN evaluating \ifx, TeX does not expand the tokens which follow the \ifx. Instead, the comparison is true if a) both tokens are characters with the same character and category codes; or b) both tokens represent the same TeX primitive, \font, \chardef, \countdef, or other internal quantity; or c) both tokens are macros which have: the same status with respect to \long and \outer; the same parameters; and the same top-level expansion [210].
Example:
1. \def\tmacro#1%
2. {%
3. \def\temptyA{#1}% I use temptyB, C, ... for parameters 2, 3, ...
4. \ifx\temptyA\empty
5. DV% default value.
6. \else
7. #1%
8. \fi
9. --\par
10. }
11. \tmacro{Just a test}
12. \tmacro{- Whoops!}
13. \tmacro{}
Produces: See typeset version.
Comments:
- It is common to write a TeX macro with several parameters and then design the macro so it works one way if a particular parameter is present and a second way if the parameter is absent.
- This example shows one way to check for a missing or unused parameter. The \if reference page shows another way, but that way does not always work. This one does!
- Line 3 defines a special control sequence which holds the parameter. When the parameter is needed, \ifx compares the special cs to \empty which Plain TeX defines as: `\def\empty{}'.
TeXbook References: 210. Also: 210, 215, 307, 384, 375-377, 418.
Related Primitives: if, ifcat.
For Additional Examples, see: endinput
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \ignorespaces<optional spaces>
Description:
AFTER \ignorespaces TeX reads and expands tokens and does nothing until it reaches a token which is not a space [279].
TeXbook References: 279. Also: 279, 333, 355, 424.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \immediate<write or openout or closeout>
Description:
NORMALLY, the output commands \write, \openout, and \closeout are placed in a whatsit item on the current list. When the list shows up in a box during a \shipout operation, the whatsit item is expanded and the actual write, open, or close takes place. There are times when execution of an output command should not be deferred. It should occur at the time TeX encounters it in a document. If \immediate comes just before one of the output commands, the command occurs without delay (i.e., immediately) [227].
Example:
\immediate\openout\twaux=junkjunk.tex\relax
\immediate\write\twaux{{\noexpand\bf byebye}\ World}
\immediate\closeout\twaux
Produces: See typeset version.
Comments:
- This example is the same as the example on the \closeout reference page except each of the three lines begins with \immediate.
- The macros used to format these pages put the output of each example in a box. Then, if the box has a positive height, the box is typeset. In the \closeout example the box contains the three whatsits\mkindex{whatsit`5`file I/O}, but its height is zero. So, it is never added to the current page and hense the three commands are lost.
- This example works completely differently. When TeX is building the box and encounters one of the \immediate commands, it does not make a whatsit. Instead it just does the following open, write, or close. The resulting box is empty, but the commands get done.
TeXbook References: 227. Also: 226-228, 280, 422, 423.
Related Primitives: write, openout, closeout.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \indent
Description:
NORMALLY, TeX needs no help in starting a new paragraph, but occasionally it does. The \indent command causes TeX to switch from vertical or internal vertical mode to horizontal mode. Also, it adds an empty box to the new horizontal list [86]. The width of the box is the value of \parindent at the time the box is added to the list [101]. If TeX is already in horizontal or math mode, \indent adds an empty box whose width is \parindent to the current list [86] and sets the spacefactor to 1000 [286].
Example:
\parindent=2pc
\indent |\indent| provides one way to start a new paragraph.\par
\indent Also, it can \indent add space anywhere in the paragraph.\par
\noindent |\noindent| also starts a paragraph, but it does not do the indent.\par
Finally, |\par| provides a way to end a paragraph that is not followed by a blank line.
Produces: See typeset version.
Comments:
- The example, together with what it produces, illustrates: \indent, \noindent, and \par.
TeXbook References: 86, 101. Also: 86, 94, 101, 263, 282, 286, 291, 355.
Related Primitives: parindent, noindent.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \input<file name>
Description:
WHEN TeX encounters this command, it prepares to read from the specified file before continuing with the current source file [214]. Most TeX implementations add the extension .tex to the file name if the name does not have an extension [217]. If TeX can't locate the file, it writes a message to the log file and on the terminal and interrupts processing so a new name can be entered [nr].
Example:
\input a % a.tex holds the line: \input c
\input b % b.tex holds the line: \input c
% c.tex holds the line: \newread\tr
Produces: See typeset version.
Comments:
- The above lines illustrate a problem that will be familiar to programmers.
- A complex document may require many formatting files, and some of those files may in turn require others. If a file is loaded twice, it may allocate resources more than once.
- In the example c.tex is loaded twice, and each time a new \tr is allocated. Since there are only 16 input streams, it would be easy to allocate all of them even though only 2 or 3 are actually needed.
- The \endinput reference page shows how to avoid the above problem.
TeXbook References: 199, 214. Also: 7, 9, 25-27, 47, 199, 214, 217, 380, 382-383, 403, 422.
Related Primitives: endinput, inputlineno.
For Additional Examples, see: endinput, openin
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \inputlineno
Description:
This quantity holds the line number of the current line in the current source file[*304 TeX: The Program].
Example:
The current line number is: \the\inputlineno.
Produces: See typeset version.
TeXbook References: 214. Also: 214, 271.
Related Primitives: input.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \insert<8-bit number>{<vertical mode material>}
Description:
MOST of the time TeX works sequentially typesetting material across lines and down the page. However, there are times when material needs to be repositioned. For example, footnotes appear at the bottom of a page; endnotes appear at the end of an article or chapter; and a figure may float to the top of the current or the next page. Insertions provide such flexibility. There are 255 classes of insertions: \insert0 to \insert254. Plain TeX provides a \newinsert command. It or something similar should be used to define a new class because each class requires a \box, \count, \dimen, and \skip register and all the registers must use the same number used by the class. TeX keeps all insertions of the same class together in the order they were made. For a particular class, say \insert100, \box100 is made available to the output routine and holds the insertions made to \insert100; \dimen100 holds the maximum height plus depth allowed for \box100 on any single page; \skip100 is the amount of extra space the output routine adds when it positions \box100 on the page; and \count100 holds the magnification factor used with insertions in \insert100. For example, let x be the height plus depth of some \insert100 and let y be the actual change in \pagetotal of the insertions. Then, \count100 = 1000(y/x). For footnotes y is usually x, and \count100 = 1000. But for endnotes or material destined for the margin, y = 0 as does \count100. The actual steps used to prepare \box100 are described on pages 123-124 of The TeXbook. If there is more material in \insert100 than will fit on the current page, part of the material is split (using \vsplit, \splittopskip, and \splitmaxdepth) and placed in \box100. The rest of the material is saved for the next page [122-123]. An insertion will appear on a page only if it appears on TeX's main vertical list [281]. Since \box255 is reserved for use by TeX and the output routine, \insert255 is not allowed [280].
Example:
1. % Footnotes
2. \newinsert\footins % create Footnotes insertions class.
3. \count\footins=1000 % footnote magnification factor (1 to 1)
4. \dimen\footins=\vsize % maximum footnotes per page
5. \skip\footins=12pt plus 24pt% space added when footnote is present
6. % End Notes
7. \newinsert\notes %create Endnotes insertions class.
8. \count\notes=0 % endnotes don't appear on current page.
9. \dimen\notes=\maxdimen
10. \skip\notes=0pt % no extra space on current page for endnotes.
Produces: See typeset version.
Comments:
- Insertions appear complicated because they require three separate steps to work:
- First, the insertion class is created and the associated count, dimen, and skip registers are initialized. Lines 1-5 do this for footins, and lines 6-10 do it for notes.
- Second, one or more special macros are written which prepare the actual insertion. This is where the \insert command is used (e.g., \insert\footins or \insert\notes).
- Third, the output routine is modified so it queries the appropriate box register (e.g., \box\footins or \box\notes) and positions the box on the current page.
TeXbook References: 122-125. Also: 95, 122-125, 259, 280-281, 363, 416, 424, 454.
Related Primitives: holdinginserts, floatingpenalty, insertpenalties, vsplit.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \insertpenalties
Description:
THIS quantity holds two different values. In the ouput routine \insertpenalties holds the total number of held-over insertions. For each class of insertions this includes the unused part of a split insertion and all other insertions which don't appear on the current page [125 and 254]. In the page-making routine \insertpenalties holds the total of the \floatingpenalty for each unsplit insertion which is carried over to the next page [111 and 123].
TeXbook References: 123-125, 254. Also: 111, 114, 123-125, 214, 254, 256, 271.
Related Primitives: floatingpenalty, insert.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \interlinepenalty
Description:
AFTER TeX breaks a paragraph into lines, it moves each line to the containing vertical list. TeX adds \interlinepenalty to the penalties inserted immediately after every line for each line except the last one [104].
TeXbook References: 104. Also: 104, 272, 363, 406, 419.
Related Primitives: clubpenalty, widowpenalty, brokenpenalty, linepenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \jobname
Description:
IF TeX is processing a document whose name is fname.tex, then \jobname expands to fname [213]. Each character in the expansion receives category code 12 (other), except for spaces which receive code 10 (space) [214].
Example:
1. \def\basedir{\string~/doc/trm/}% Unfortunately, my version of TeX
2. \def\myfilenameA% doesn't provide the directory.
3. {%
4. \bgroup
5. \selffamily AG
6. \setbox0=\hbox
7. {%
8. \ifx\basedir\empty% Traps potential bug if \basedir is not defined
9. \string~/.../
10. \else
11. \basedir
12. \fi
13. \jobname.tex%
14. }%
15. \setbox1=\hbox
16. {
17. \mydatetime% see reference pages for: \month & \ifnum.
18. }%
19. \hbox to \pagewidthB
20. {%
21. \box0
22. \hfil
23. -- \number\pageno\ --%
24. \hfil
25. \box1
26. }%
27. \egroup
28. }
29. The document name is: \jobname\par
30. \myfilenameA
Produces: See typeset version.
Comments:
- Line 29 shows a simple use of \jobname.
- The macro in lines 2-28 prepares a line which might be placed in a header or footer routine. The line lists the TeX file name and directory, the page, and the date and time the file was typeset.
- Line 1 shows an example of \basedir which provides the directory name.
- The test on lines 8-12 allows \myfilenameA to work even if \basedir is not defined.
TeXbook References: 213. Also: 213, 214, 336.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \kern<dimen>
Description:
THIS command adds a kern item with the specified dimension to the current list [280]. A \kern specifies vertical spacing in vertical mode and horizontal spacing in horizontal [87] or math [168] mode. Also, a kern is similar to glue except it cannot stretch or shrink. TeX will not break a line at a kern, unless the kern is immediately followed by glue [75]. The hyphenation algorithm distinguishes between implicit kern items (i.e., kerns inserted by TeX because of information stored with the current font) [454] and explicit kern items (i.e., ones added with \kern) [306].
Example:
1. A kern may be used \kern0.25in anywhere.\par
2. \kern0.25in However, the results may be unexpected if the mode is wrong.\par
3. \noindent\kern0.25in See what I mean?
Produces: See typeset version.
Comments:
- The \kern on line 1 is in the middle of a paragraph and so adds horizontal space.
- The \par at the end of line 1 ends the paragraph. Thus, the kern at the start of line 2 is in vertical mode and so adds vertical space.
- The \noindent at the start of line 3 begins a new paragraph so the following \kern adds horizontal space.
TeXbook References: 280. Also: 10, 40, 66, 75, 87, 168, 256, 263, 280, 306, 389, 394-395, 416, 424, 454-455.
Related Primitives: hskip, vskip, mkern.
For Additional Examples, see: ifmmode
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \language=<number>
Description:
TEX can store hyphenation patterns and exceptions for up to 256 different languages. Then, it can apply an appropriate set of hyphenation rules for each paragraph or part of a paragraph in a ms. When TeX begins a new paragraph, it sets the current language to \language. Just before it adds each new character to the paragraph in unrestricted horizontal mode, it compares the current language to \language. If they are different, TeX : a) changes the current language to \language; b) inserts a whatsit\mkindex{whatsit`5`language} containing the new language and the values of \lefthyphenmin and \righthyphenmin; and c) inserts the character. The \setlanguage command should be used to change languages in restricted horizontal mode (i.e., inside an \hbox). If <number> is less than 0 or greater than 255, 0 is used [455]. Plain TeX has a \newlanguage command which may be used to allocate numbers for languages [347]. Changes made to \language are local to the group containing the change [nr].
Example:
1. {\language254\hyphenation{am-ong}}
2. {\language255\hyphenation{I-nquisitor}}
3. \def\tlangX{\lefthyphenmin=2\righthyphenmin=1\language254}
4. \def\tlangY{\lefthyphenmin=1\righthyphenmin=1\language255}
5. \def\tstoryA{\tlangX There are cries, sobs, confusion among the
6. people, and at that moment the cardinal himself, the Grand Inquisitor,
7. passes by the cathedral. He is an old man . . .}
8. \def\tstoryB{\tlangX There are cries, sobs, confusion among the
9. people, and at that moment the cardinal himself, the Grand \tlangY
10. Inquisitor, passes by the cathedral. He is an old man . . .}
11. \count0=\the\language
12. \setbox0=\vbox{\hsize=2.25in \tstoryA}
13. \setbox1=\vbox{\hsize=2.25in\language255 \tstoryB}
14. \hbox to \hsize{\box0\hfill\box1}
15. The values are: \the\count0\ and \the\language.
Produces: See typeset version.
Comments:
- Lines 1-2 of this example add hyphenated words to the exception dictionaries for languages 254 and 255.
- Lines 3-4 define a control sequence for each language which sets \lefthyphenmin and \righthyphenmin and switches to the language.
- Line 11 typesets \tstoryA using \language254, and line 12 typesets \tstoryB using both languages.
- Lines 11 and 15 show the change made to \language on line 13 are local.
TeXbook References: 455. Also: 273, 346-347, 455.
Related Primitives: setlanguage, hyphenation, patterns, lefthyphenmin, righthyphenmin.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lastbox
Description:
THIS command is used with the other last commands to step through the items in a list. If the last item on the current horizontal or internal vertical list is an \hbox, \vbox, or \vtop, \lastbox becomes the box and removes it from the list; otherwise \lastbox is void. The command may not be used on the main vertical list or in math mode [222].
Example:
1. \setbox0=\hbox{Box 0}
2. \setbox1=\hbox{Box 1}
3. \setbox2=\hbox{Box 2}
4. \setbox3=\hbox{Box 3}
5. \setbox4=\hbox{Box 4}
6. \setbox5=\vtop
7. {
8. \copy0
9. \copy1
10. \copy2
11. \copy3
12. \copy4
13. \vskip 2pt
14. \global\setbox6=\lastbox
15. }
16. \setbox7=\vtop
17. {
18. \copy0
19. \copy1
20. \copy2
21. \copy3
22. \copy4
23. \global\setbox8=\lastbox
24. \vskip 2pt
25. }
26. \hbox{\box5\hskip 20pt\box7}
27. \halign{%
28. &\quad#\hfil\cr
29. &\bf Box&&\bf Width&&\bf Contents\cr
30. &6&&\the\wd6&&\copy6\cr
31. &8&&\the\wd8&&\copy8\cr
32. }
Produces: See typeset version.
Comments:
- The \lastbox command in \box5 is void because the previous item in the box is glue (lines 13-14).
- The \lastbox command in \box7 is a copy of \box4. Also, the copy of \box4 in \box7 is removed by line 23.
- The results of the \halign on lines 27-32 verify the previous two statements.
TeXbook References: 222. Also: 222, 278, 354, 392, 398, 399.
Related Primitives: lastkern, lastpenalty, lastskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lastkern
Description:
IF the last item on the current list is a kern, \lastkern is the amount of that kern; otherwise \lastkern is 0.0pt. The kern item itself is not removed from the list by \lastkern [214]. The \unkern command does that [280].
Example:
\def\kernbreakup
{%
\ifdim\lastkern=0pt
lastkern is: 0pt.
\else
\dimen0=\lastkern
lastkern is: \the\dimen0
\fi
}
\def\mkbox#1%
{%
\setbox0=\vbox{\kern 6pt\hbox{Hello}\kern #1}%
\setbox1=\vbox{\unvcopy0\kernbreakup}%
\box1
}
\mkbox{4pt}
Produces: See typeset version.
Comments:
- The \kernbreakup macro is similar to lines used to remove a kern from a box in a breakup macro.
- The \mkbox macro makes a simple vbox whose last component is a kern.
- The call to \mkbox correctly identifies the kern.
TeXbook References: 214. Also: 214, 271.
Related Primitives: unkern, lastbox, lastpenalty, lastskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lastpenalty
Description:
IF the final item on the current list is a penalty, \lastpenalty has that value; otherwise \lastpenalty is 0. The penalty item itself is not removed from the list by \lastpenalty [214]. The \unpenalty command does that [280].
Example:
1. \def\penaltybreakup
2. {%
3. \setbox1=\hbox{\unhcopy0\global\count1=\lastpenalty}%
4. \setbox2=\hbox
5. {%
6. \unhbox2
7. \ifnum\count1=0
8. WHOOPS: %
9. \else
10. lastpenalty is: \the\count1 \ %
11. \fi
12. }%
13. }
14. \def\mkbox#1#2%
15. {%
16. \setbox0=\hbox{#2\penalty #1}%
17. \penaltybreakup
18. \box0 \ %
19. }
20. \box2
21. \noindent\mkbox{100}{Hello}%
22. \mkbox{10\kern12pt}{Brave New}%
23. \mkbox{0}{World}\par
24. \box2
Produces: See typeset version.
Comments:
- The \penaltybreakup macro is similar to lines used to remove a penalty from a box in a breakup macro.
- The \mkbox macro makes a simple hbox whose last component is a penalty.
- The first call to \mkbox correctly identifies the penalty (line 21). The second call does not, but that is not a surprise since a kern follows the penalty (line 22). The third call makes a penalty that is 0 (\showbox verifies this), but \lastpenalty is unable to distinguish this real but zero penalty from the kern on line 22.
TeXbook References: 214. Also: 214, 271.
Related Primitives: unpenalty, lastbox, lastkern, lastskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lastskip
Description:
IF the last item on the current list is glue or muglue, \lastskip is the amount of that glue; otherwise \lastskip is 0.0pt. The glue item itself is not removed from the list by \lastskip [214]. The \unskip command does that [280]. Unfortunately, there is not an `if...' test which compares two glue values. That makes it difficult to breakup boxes containing glue with stretchable or shrinkable compontents [nr].
Example:
\def\skipbreakup
{%
\skip0=\lastskip
\ifdim\skip0=0pt
WHOOPS: lastskip is: \the\skip0
\else
lastskip is: \the\skip0
\fi
}
\def\mkbox#1%
{%
\setbox0=\vbox{\kern 6pt\hbox{Hello}\vskip #1}%
\setbox1=\vbox{\unvcopy0\skipbreakup}%
\box1
}
\mkbox{4pt plus 3pt minus 2pt}
\mkbox{0pt plus 3pt minus 2pt}
Produces: See typeset version.
Comments:
- The \skipbreakup macro is similar to lines used to remove glue from a box in a breakup macro.
- The \mkbox macro makes a simple vbox whose last component is glue.
- The first call to \mkbox correctly identifies the glue. The second call does not. That is because the \ifdim test does not consider the stretchable and shrinkable components of glue.
TeXbook References: 214. Also: 214, 223, 271, 392.
Related Primitives: unskip, lastbox, lastkern, lastpenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lccode<8-bit number>
Description:
THIS quantity is used by \lowercase to convert a character to its lowercase equivalent [41]. INITEX sets `\lccode`A=`a' and `\lccode`a=`a'. It makes similar assignments for all other letters. Finally, it makes the \lccode of all nonletters zero [345]. Words added to the hyphenation dictionary are converted to lowercase. So, each nonhyphen character in the word must have a nonzero \lccode [452].
TeXbook References: 41. Also: 41, 214, 271, 345, 452-454.
Related Primitives: uccode, catcode, sfcode, lowercase, hyphenation.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \leaders<box or rule><glue>
Description:
LEADERS consist of a box and some glue. Copies of the box are used to fill the space specified by the glue [223]. Leaders made with \leaders are aligned [224]. A rule may be used in place of a box. This allows \hrule to make a horizontal line in horizontal mode [224-225].
Example:
\def\sampletocB#1#2%
{%
\hbox to 3in
{%
#1% 0.0625 makes 16 dots per inch.
\leaders
\hbox to 0.0625in{\hfil.\hfil}
\hfill
\hbox to 0.25in{\hfil #2}%
}
}
\def\sampleheader#1%
{%
\hbox to 3in
{%
{\it #1}%
\kern3pt
\leaders
\hrule height 0.25pt
\hfill
}
}
\sampletocB{}{100}% Count the dots. There are 44.
\sampletocB{Strangers and Brothers}{116}
\sampletocB{The Age of Reason}{178}
\sampleheader{Strangers And Brothers}
\sampleheader{The Age of Reason}
Produces: See typeset version.
Comments:
- This illustrates two common uses of leaders: the table of contents and page headers.
TeXbook References: 223-225, 281, 285. Also: 95, 110, 223, 224, 225, 357, 392-394.
Related Primitives: cleaders, xleaders, hrule.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \left<delim1><subformula>\right<delim2>
Description:
THIS command begins a construction which has a delimiter on either side of a subformula. TeX computes how large the delimiter should be based on what is in the subformula. There are three main rules for using \left: a) there must be a matching \right command; b) the `\left ... \right' pair must occur in the same group; and c) the resulting subformula must be typeset on 1 line. However, the delimiters need not match (e.g., `(...]' is fine). Also, if a `.' is used for either delimiter, it will be omitted. TeX makes the delimiter just big enough to cover the subformula. While that is what is needed most of the time, there are instances when TeX makes an outer delimiter that is too small [148-149]. Also, there are times when `\left ... \right' puts more space around the subformula than one of Plain TeX's \big commands puts [171].
Example:
1. ${\bigl||x| - |y|\bigr|} = {\left||x| - |y|\right|}$\par
2. Let $p$ be any odd prime which does not divide $a(a^2 - 1)$. We take
3. $$m = {a^{2p} - 1 \over a^2 - 1} =
4. \left({a^p - 1 \over a - 1}\right)
5. \left({a^p + 1 \over a + 1}\right),\leqno(6.9.2)$$
6. so that $m$ is clearly composite. Now \dots
Produces: See typeset version.
Comments:
- Line 1 shows an example where the hand selection of \bigl looks better than what is constructed by \left.
- Lines 4-5 show a more typical use of \left, and everything looks fine.
TeXbook References: 148-149. Also: 148-150, 155-157, 171, 196, 292, 437.
Related Primitives: right, delcode, delimiter.
For Additional Examples, see: delimiterfactor, nulldelimiterspace, vcenter
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lefthyphenmin=<number>
Description:
THIS parameter holds the minimum number of characters that must appear at the beginning of a hyphenated word (i.e., before the `-'). In particular, TeX will not hyphenate words with fewer than \lefthyphenmin + \righthyphenmin characters [454]. The whatsit\mkindex{whatsit`5`language} made by a change to \language includes the current value of \lefthyphenmin [455]. Changes made to \lefthyphenmin are local to the group containing the change [nr].
Example:
1. \def\tstoryA{There are cries, sobs, confusion among the people, and at
2. that moment the cardinal himself, the Grand Inquisitor, passes by the
3. cathedral. He is an old man . . .}
4. {\language255\hyphenation{m-oment}}
5. \count0=\lefthyphenmin
6. \setbox0=\vbox{\hsize=2.25in\language255 \tstoryA}
7. \setbox1=\vbox{\hsize=2.25in\language255\lefthyphenmin=1 \tstoryA}
8. \hbox to \hsize{\box0\hfill\box1}
9. The values are: \the\count0\ and \the\lefthyphenmin.
Produces: See typeset version.
Comments:
- This example adds a non-standard hyphenation of moment to language 255's exception dictionary.
- Line 6 typesets \tstoryA using the default value of \lefthyphenmin.
- Line 7 typesets the same material with the same language but with a smaller value of \lefthyphenmin.
- Lines 5, 8, and 9 show the change made to \lefthyphenmin on line 7 is local.
TeXbook References: 273, 454. Also: 273, 364, 454, 455.
Related Primitives: righthyphenmin, language.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \leftskip=<glue>
Description:
THIS parameter holds glue which TeX inserts on the left of every line in a paragraph [100]. The value used is the one current when the paragraph ends [101].
Example:
\parindent=1.5pc
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
\vskip3pt
{\leftskip=2pc
\rightskip=\leftskip
\noindent\tstory\par}
Produces: See typeset version.
Comments:
- The first paragraph is indented and uses the \hsize used on these pages.
- The second paragraph is not indented and has 2 picas placed on the left and right of each line.
TeXbook References: 100-101. Also: 100-101, 274, 317, 407, 419.
Related Primitives: rightskip, parindent, parfillskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \leqno<formula>
Description:
THIS command puts an equation number at the left-hand margin [186]. It may only be used in display math mode. TeX processes the material for the number as follows: a) it enters a new level of grouping and begins non-display math mode; b) it adds the \everymath tokens to the new math list; c) it adds everything between the \leqno command and the $$ which ends the display to the math list; d) it converts the math list to a horizontal list which it puts in an hbox. The resulting hbox becomes the equation number [293]. TeX tries the following strategies as it positions the equation number and the display on a line: a) center the display and then place the equation number at the left margin; b) place the equation number at the left margin and then position the display in the remaining space; [187] c) if the display and the equation number are wider than \displaywidth or if the equation number has zero width, place the equation number at the left margin on a line by itself; add an infinite penalty; and center the display on the following line. The infinite penalty prevents TeX from typesetting the equation number on one page and the display on the following page [188-189].
Example:
1. \def\tfn#1%
2. {%
3. $$ u_{-n} = -(xy)^{-n}u_n = (-1)^{n-1}u_n{,}\qquad v_{-n} =
4. (-1)^nv_n.#1
5. $$%
6. }
7. \tfn{\eqno\llap{(10.14.5)}}
8. \tfn{\leqno\rlap{(10.14.6)}}
Produces: See typeset version.
Comments:
- This example uses Plain TeX's \llap and \rlap to make the width of the box holding the equation number be zero. That causes TeX to typeset the equation number on a line by itself and to put an infinite penalty in the vertical list between the equation number and the display [189]. The penalty prevents the two items from appearing on different pages.
- Note line 4. Both left and right equation numbers are typed at the end of the display.
TeXbook References: 187, 293. Also: 187, 189, 293, 375-376.
Related Primitives: eqno.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \let<control sequence>=<token>
Description:
THIS command provides a second way (the various \def's provide the first) for a control sequence to acquire a new meaning. The command may be used to interchange the meaning of two control sequences [206]. The statement `\let\a=\b' gives \a the current meaning of \b. If \b changes after the assignment is made, \a does not change. Also, \a is not a macro. So, TeX does not expand it in situations where macros are expanded [207]. Expansion of tokens is suppressed when TeX is reading the argument token for \let [215].
Example:
1. \def\th{-\hskip10pt-}
2. \def\ta{Hello\th}
3. \def\tb{\th World }
4. 1. \ta\tb\par
5. \begingroup
6. \let\tc=\ta
7. \let\ta=\tb
8. \let\tb=\tc
9. 2. \ta\tb\par
10. \endgroup
11. 3. \ta\tb\par
Produces: See typeset version.
Comments:
- Lines 6-8 interchange the meaning of \ta and \tb.
- Line 11 shows that, when the group ends, everything reverts to its pre-group state.
TeXbook References: 206. Also: 206-207, 215, 277, 307, 309, 329, 352, 376.
Related Primitives: def, futurelet.
For Additional Examples, see: endinput, futurelet, iffalse, mathchardef
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \limits
Description:
SEVERAL math symbols such as summation and integration often appear with subformulas as subscripts and superscripts. The subformulas may be typeset either above and below or to the right of the symbol. Normal mathematical conventions use the first method for most displayed expressions and the second for most in-line expressions. TeX's conventions use the first method in display style and the second method in text style. TeX has three commands which change these conventions: \limits always uses the first method; \nolimits always uses the second method; and \displaylimits uses TeX's normal conventions. If two or more of these commands follow each other, the last one controls how the expression is typeset [144]. Each of these commands must follow a large operator (class 1). Otherwise, TeX generates an error [292].
Example:
1. \mathchardef\Intop="1352
2. \mathchardef\Sum="1350
3. \def\tint{\Intop\nolimits}
4. \def\tsum{\Sum}
5. \def\tf#1#2#3%
6. {%
7. $$\hbox{$#2_0^1 3x^2 = x^3]_0^1 = 1$}%
8. \hbox{ and $#3^\infty_{n=0}{1\over2^n} = 2$}%
9. \kern2pc
10. #2_0^1 3x^2 = x^3\Bigr]_0^1 = 1
11. \kern2pc
12. #3^\infty_{n=0}{1\over2^n} = 2
13. \kern2pc
14. \leqno{#1.}
15. $$
16. }
17. \tf 1{\tint}{\tsum}
18. \tf 2{\tint\limits}{\tsum\limits}
Produces: See typeset version.
Comments:
- Lines 1-4 are adapted from Plain TeX [358]. They setup symbols for summation and integration. The integral symbol includes \nolimits because that is how integrals normally appear.
- Lines 5-16 define a macro which mixes in-line math with display math.
- Line 17 calls \tf using \tint and \tsum. This typesets each expression as it was intended to be typeset.
- Line 18 makes a similar call only each symbol is followed by \limits. This changes the form of the first three expressions.
- I tried the `]' on line 10 in two ways (see the \nolimits reference page for the second way) but prefer the way shown here.
TeXbook References: 144. Also: 144, 159, 292, 358, 443.
Related Primitives: nolimits, displaylimits, textstyle, displaystyle.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \linepenalty
Description:
WHEN TeX is working to break a paragraph into lines, it adds \linepenalty to each potential line's badness in its calculation of the line's demerits. Increasing this parameter causes TeX to try and use fewer lines for the paragraph [98].
Example:
\def\tstoryA{There are cries, sobs, confusion among the people, and at that moment the cardinal himself, the Grand Inquisitor, passes by the cathedral. He is an old man}
\hsize=1.9in
\setbox0=\vtop{\linepenalty=-1000\tstoryA\par\vskip0.5\baselineskip
\linepenalty=-5000\tstoryA\par}
\setbox1=\vtop{\linepenalty=5000\tstoryA\par\vskip0.5\baselineskip
\linepenalty=10000\tstoryA\par}
\hbox{\box0\hskip1in\box1}
Produces: See typeset version.
Comments:
- This example is typical of the author's experiments with \linepenalty.
- The top two paragraphs are typeset using -1000 and 5000 for \linepenalty. Identical results are obtined for 0, 10, and other values between -1000 and 5000.
- The bottom left paragraph uses -5000 for \linepenalty. This value allows lines with large badness to have a small number of demerits; the result is a horrible first line.
- The bottom right paragraph uses 10,000 for \linepenalty. Such a large value means badness has little influence on the selection of line breaks; this also results in a horrible line.
- The primitive command \looseness is intended to typeset a paragraph with fewer or more than the optimum number of lines.
TeXbook References: 98. Also: 98, 272, 314, 316, 348.
Related Primitives: badness, looseness, interlinepenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lineskip=<glue>
Description:
IF the glue specified by \baselineskip brings two adjacent boxes in a vertical list closer together than \lineskiplimit, then \lineskip glue is placed between the boxes [78].
Example:
\parindent=1.5pc\hsize=4.75in
\baselineskip=9pt
\lineskip=0pt
\lineskiplimit=0pt
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
\lineskip=2pt
\lineskiplimit=0pt
\tstory\par
Produces: See typeset version.
Comments:
- The first paragraph is set 10/9 (10pt type on 9pts of space). The lines of type touch each other and in places are further that 9 points apart.
- The second paragraph is also set 10/9. Careful measurement shows the baselines are not uniformally spaced but vary from 11 to 12 points.
TeXbook References: 78-80. Also: 78-80, 104, 194, 274, 281, 349, 351-352.
Related Primitives: baselineskip, lineskiplimit.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lineskiplimit=<dimen>
Description:
IF the glue specified by \baselineskip brings two adjacent boxes in a vertical list closer together than \lineskiplimit, then \lineskip glue is placed between the boxes [78].
Example:
\parindent=1.5pc\hsize=4.75in
\baselineskip=12pt
\lineskip=0pt
\lineskiplimit=0pt
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
\baselineskip=9pt
\lineskip=3pt
\lineskiplimit=1pt
\tstory\par
Produces: See typeset version.
Comments:
- The first paragraph is set 10/12 (10 point type on 12 points of space). The distance between the first and last baseline in the paragraph is exactly 60 points.
- The second paragraph is set 10/9. While the interline spacing of the two paragraphs appears to be quite similar, careful measurement shows the first and last baselines are about 63 points apart.
TeXbook References: 78-80. Also: 78-80, 104, 194, 274, 281, 349, 351-352, 362.
Related Primitives: baselineskip, lineskip.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \long<macro-definition assignment>
Description:
A macro is not allowed to have an argument which contains \par, unless the macro is declared \long [205]. A macro may also be declared \global or \outer. All three prefixes may be used in any order. Also, a prefix can occur more than once (e.g., `\long\global\long\gdef{. . .}') [206]. If two tokens compared by \ifx are macros, TeX includes each token's status with respect to \long in deciding if the two are the same or not [210].
Example:
1. \long\def\tempabiod#1#2% {author}{text}
2. {%
3. \bgroup
4. \selffamily AF
5. \parindent=1.5pc
6. {\bf\noindent AUTHOR BIOGRAPHICAL DATA:}\par
7. \def\temptyA{#1}%
8. \ifx\temptyA\empty
9. \else
10. {\bf\noindent #1 }%
11. \fi
12. #2\par
13. \egroup
14. }
15. \tempabiod{Fyodor Dostoyevsky}{was born in Moscow in 1821. At the age
16. of twenty-seven he was arrested for promoting socialism and was
17. sentenced to be executed. On the day of the execution the Tsar changed
18. the sentence to a prison term in Siberia \char144
19.
20. After four years in Siberia and a mandetory term in the army he
21. received a full pardon and was allowed to return to St. Petersburg.
22. His many books include: \char144}
Produces: See typeset version.
Comments:
- This shows a typical use of \long. Since the text for an author may run several paragraphs, the macro must be \long if the text is passed as a parameter.
- However, the text doesn't have to be treated as a paramter. The macro \tempabiod could be broken into two pieces. The first would have the author as its singe parameter and would contain lines 1-11. The second would have no parameters and would hold: \par\egroup.
- Line 15 would be changed to use the first macro, and `{was' would be changed to just `was'. Finally, the `}' on line 22 would be changed to the second macro.
- The example on the \endgroup reference page is similar to this two-macro method.
TeXbook References: 205-206. Also: 205-206, 210, 275, 331, 375, 378, 382.
Related Primitives: def, edef, gdef, xdef, global, outer.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \looseness=<number>
Description:
THE command `\looseness=l' tells TeX to try and make the current paragraph l lines longer (if l is > 0) or l lines shorter (if l < 0) while maintaining the general tolerances used to typeset the ms. IF l is > 0, a tie `~' is often placed between the last two words in the paragraph to prevent a short last line [103-104]. The parameter is reset to zero at the end of every paragraph or when internal vertical mode is started [349].
Example:
\hsize=4.5in
\tstory\par% The \adjdemerits reference page holds the definition of \tstory
\vskip6pt
{\looseness=-1
\tstory\par}
Produces: See typeset version.
Comments:
- The above paragraph does not work well with \looseness=1, but it does tighten.
- This command is often used to fine-tune the pages in an article or book (e.g., to remove widow\mkindex{widow line} lines). It works best with longer paragraphs.
TeXbook References: 103-104. Also: 103-104, 109, 273, 342, 349.
Related Primitives: linepenalty.
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lower<dimen><box>
Description:
THIS command lowers (or raises with a negative <dimen>) a box on the current list. It may only be used in horizontal mode [285] or math mode [290].
Example:
\selffamily AA
\hskip 1in
\hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125em X}
Produces: See typeset version.
Comments:
- This combines two kerns with \lower to make the TeX logo [66].
TeXbook References: 285. Also: 66, 80, 151, 179, 285, 290.
Related Primitives: raise, moveleft, moveright.
For Additional Examples, see: halign, mathchoice
This is the HTML version of TeX Reference Manual by David Bausum. © Copyright 2002, Kluwer Academic Publishers. All Rights Reserved.
Synopsis: \lowercase{<token list>}
Description:
THIS command converts every character in the token list to its \lccode value unless that value is zero in which case no change is made. The conversion is made in TeX's stomach [41]. Expansion is suppressed during the conversion [215]. Active characters (category 13) behave like character tokens and may be converted [307].
TeXbook R