Commands from ‘TEX by Example’

The commands illustrated below are taken from the book TEX by Example, by Arvind Borde (Academic Press, 1992). Their definitions are printed in that book and are also available in a file called tbemacros.tex . To use the commands you must copy the definitions from the book, or type ‘\input tbemacros’ in your file.

1. Letters

Illustration:

Your name, Your address, Etc. February 19, 1993

Name Street City Postal code Country. Dear Reader,

This shows you how to make a simple letter.

Sincerely, The Author.

The input for this was:

\letterhead
\date{\today}
\address{Name\cr Street\cr City\cr
Postal code\cr Country.\cr}
\smallskip
\sal{Dear Reader,}
This shows you how to make a simple letter.
\endletter{Sincerely,}{The Author.}

For this to be useful, you must edit the definition of \letterhead in the tbemacros file, replacing “Your name” by your name, etc.

2. Framing text

Illustration:

This text is 2.25 inches wide, with 6 points of white space all around. The rules that make the frame around the text are each .5 point thick.

The input for this was:

\centerline{\frame{.5}{6}{2.25in}{\noindent
This text is 2.25 inches wide, with 6 points
of white space all around. The rules that

make the frame around the text are each .5
point thick.}}

Illustration:

This frame hugs its contents.

The input for this was:

\centerline{\fitframe{.3}{.5}{This frame hugs
its contents.}}

Illustration:

\underline{S H A D O W}

The input for this was:

\centerline{\shframe{3}{10}{110pt}{%
\centerline{\s{S}\s{H}\s{A}\s{D}\s{O}\s{W}}}}

3. Memoranda

Illustration:

MEMO!

TO: The reader. FROM: The author. SUBJECT: Writing memoranda. DATE: Today.

This shows you one way to do a memorandum.

⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆

The input for this was:

\memo
TO: The reader.
FROM: The author.
SUBJECT: Writing memoranda.
DATE: Today.
This shows you one way to do a memorandum.
\bigskip
\centerline{\pattern{$\star$}{25}}

The \memo command is somewhat rigid in that it requires you to type ‘TO:’, ‘FROM:’, ‘SUBJECT:’ and ‘DATE:’ exactly as shown, and in that order.

4. Ignoring text

The command shown below allows you to make multi-line comments without using a % sign at the start of each line. It is useful when you want TEX to temporarily ignore parts of a document and to process only a portion of it.

\ignore
All input lines will be ignored from now on
unless they start with an `!'.
`\ignore' is switched off by typing `!E' at
the START of a line, as here:
!E

5. Ruled tables

It is tedious work to make tables with ‘rules’ (i.e., drawn lines) from scratch, each time they are needed. The \table command in this package, along with its associates, gives you one easy way to make ruled tables.

Illustration:

Table A

One Two Three
101  102  103
104  105  10691

The input for this was:

$$\table{\bf Table A}
One ! Two ! Three \rr
101 ! 102 ! 103   \r
104 ! 105 ! 10691
\caption{}$$

The $$ signs center the table and leave space above and below. They can be omitted, if you don’t want this. The table entries are typed between \table{} and \caption{}. Entries that are to go on the same line are separated by !. You signal the end of a line by typing ‘\rr’ if you want a horizontal rule just below, or ‘\r’ if you don’t—for all but the last line.

Illustration:

B

1 2^{A α} Italics. Like it?

Your caption can be many lines long!

The input for this was:

\medskip\hfil  % This combination serves
%to center the table.
\table{\bf B}

  \hfill\bf 1\hfill!\hfill\bf 2\hfill\rr
  \hfill          A! $\alpha$        \r
  \it Italics.     !                 \rr
  \multispan{2}Like it? \hfil
  \caption{Your caption can be many lines
  long\exclaim}
  \medskip

Thus, you can use \multispan to span table entries, as normal, and you can center entries, set them flush right, or change typeface, as shown. The \exclaim at the end of the caption gives ‘!’: a special command is needed because the character is reserved in this application for special duty as a column separator. The ‘special duty’ that ‘!’ performs does not work correctly from within commands like \centerline. To center, you must use $$ on either side, or the method employed above. The next example shows how to specify your own table ‘preambles’.

Illustration:

C

Col. 1  Col. 2
One  44987.01
Two  513.1
Three  316.9

Four This shows you how you can make entries that are many lines long.

The input for this was:

  $$\preamble{\hfill\it ##\hfill\strut&##&\hfill
  \sl ##&##}
  \table{\bf C}
  \bf Col. 1 &!\bf Col. 2\hfill\rr
  One        &!        44987.01\r
  Two        &!       513.1\dig\rr
  %\dig will make the decimal points align.
  Three      &&       316.9\dig\rr
  Four       &!\large{1.6in}{This shows you
  how you can make entries that are many lines
  long.}
  \caption{} $$

Specifying a customized preamble can get a little tricky, so you may wish not to indulge. The preamble has to have extra slots for the vertical rules, for one thing, and you have to make sure you enclose everything in a group (either explicitly within braces, or between $$ signs) to prevent the new preamble specification from interfering with the default preamble that goes with these commands. Easier to use from the table above, are \dig, which merely leaves a horizontal space of size equal to the width of a digit, and \large{}{}, which can be used to place large-size material in the table. \dig can be used to align columns of digits along decimal points. To use \large you have to specify a width (1.6in above).

You can adjust other attributes to suit your own tastes. Rule thicknesses are governed by \toprule (thickness of the top rule), \othick (thickness of the outer rules; default value .4pt) and \ithick (thickness of the inner rules; default value .4pt). A minimum height is assigned to every line by \spacing (default 9pt); the space above and below horizontal rules is set by the values of \abovehr (default 6pt) and \belowhr (default 8pt); the space next to vertical rules by \nexttovr (default 8pt). All these parameters can be altered, as they have been below.

Illustration:

1 2 3 4 D  E 1  2 3  4  1 2 3 4 F

The input for this was:

\line{{\othick=2pt
\table{} 1!2\rr
3!4\caption{\centerline{\bf D}} }
\hfil
{\ithick=.8pt \othick=0pt \spacing=12pt
\abovehr=18pt \belowhr=20pt \nexttovr=30pt
\table{\bf E} 1!2\rr 3!4\caption{} }
\hfil
{\toprule{2pt}
\table{} 1!\hgap{1pt}! 2\rr 3!\hgap{1pt}! 4
\caption{\centerline{\bf F}} }}

The command \hgap, used for the third table, makes a narrow column of specified size, so it may be used to effectively get double vertical lines.

Illustration:

You can make displays like this, by playing tricks with rule thickness.

1 2

The input for this was:

\centerline{{\othick=0pt \nexttovr=.1in
\abovehr=.1in \belowhr=0in
\table{}
\large{2.25in}{You can make displays like
this, by playing tricks with rule thickness.}
\global\othick=3pt
\caption{}}
\othick=.4pt % MUST reset \othick.
\qquad\qquad
{\othick=1pt \ithick=1pt
\table{}
1\global\othick=0pt\rr 2\global\othick=1pt

  \caption{} }}
  \othick=.4pt % Reset \othick again.

It was all right to use \centerline here, because ! was not used anywhere.

6. Stacking symbols

Plain TEX, a mathematician’s creation, lacks two symbols essential to the emotional well-being of physicists, > ∼ and < ∼. This package provides them.

Illustration:

a < ∼ b α > ∼ β

The input for this was:

  $$a\lapproxeq b \qquad\qquad
  \alpha\gapproxeq\beta $$

These are special cases of a more general command that creates composite symbols like g̃, i.e., it allows you to take

any two symbols and place one above the other. This particular composite symbol was created by

  $\stacksymbols{g}{\tilde{}}{8}{1}$

The first number controls the overall vertical position, the second the spacing within the new symbol. This allows you to fine tune spacing to your satisfaction. Even after ‘fine tuning’, you may have to make further adjustments: e.g., the new symbol shown above has too large a ‘depth’, as you can see from the gap between the line in which it appears and the line below. The required adjustments can be made with standard commands like \smash and \vphantom.

7. Verbatim reproduction

Input lines are reproduced like this (for example):

  \beginliteral
  $$a\lapproxeq b \qquad\qquad
  \alpha\gapproxeq\beta $$
  \endliteral

If you type ‘\vquotingon’ in your file, you can then use ‘"’ to quote commands verbatim within text. For example, the first input line for this paragraph was

  \noindent If you type `"\vquotingon"' in your

Typing ‘\vquotingoff’ switches the feature off.

8. Multi-column output

The two column stuff on these pages is produced by

  \beginart \dividerule \coljump=.25in / {2}

stuff

  \endart

The specifications before the / are optional (\dividerule places a vertical rule between columns and \coljump resets the gap between columns—the default is no rule, with a .2 inch gap); the specification after the / gives the number of columns. This multi-column command has limited uses: it is suitable only for output that will fit on a single page.

9. Character tables

Illustration:

Characters in the cmsy10 font, with decimal codes:

0: −  1: ·  2: ×  3: ∗  4: ÷
5: ⋄  6: ±  7: ∓  8: ⊕  9: ⊖
10: ⊗  11: ⊘  12: ⊙  13: ◯  14: ∘
15: •  16: ≍  17: ≡  18: ⊆  19: ⊇
20: ≤  21: ≥  22: ⪯  23: ⪰  24: ∼
25: ≈  26: ⊂  27: ⊃  28: ≪  29: ≫
30: ≺  31: ≻  32: ←  33: →  34: ↑
35: ↓  36: ↔  37: ↗  38: ↘  39: ≃
40: ⇐  41: ⇒  42: ⇑  43: ⇓  44: ⇔
45: ↖  46: ↙  47: ∝  48: ′  49: ∞
50: ∈  51: ∋  52: △  53: ▽  54:
55:  56: ∀  57: ∃  58: ¬  59: ∅
60: ℜ  61: ℑ  62: ⊤  63: ⊥  64: ℵ
65: A  66: B  67: C  68: D  69: E
70: F  71: G  72: H  73: I  74: J
75: K  76: L  77: M  78: N  79: O
80: P  81: Q  82: R  83: S  84: T
85: U  86: V  87: W  88: X  89: Y
90: Z  91: ∪  92: ∩  93: ⊎  94: ∧
95: ∨  96: ⊢  97: ⊣  98: ⌊  99: ⌋
100: ⌈  101: ⌉  102: {  103: }  104: ⟨
105: ⟩  106: |  107: ∥  108: ↕  109: ⇕
110: \  111: ≀  112: √  113: ⨿  114: ∇
115: ∫  116: ⊔  117: ⊓  118: ⊑  119: ⊒
120: §  121: †  122: ‡  123: ¶  124: ♣
125: ♢  126: ♡  127: ♠

The input for this was:

\chartable{cmsy10}

To use the command, you must know the ‘external name’ of the font (i.e., the name under which information about the font is filed). The one used above, cmsy10, is the standard Computer Modern mathematics symbols font.

10. Scripts

Illustration: Now, at last, you can easily typeset conversations you eavesdrop on in restaurants and on planes.

Really? That’s just what I’ve been waiting for! How do I do it?

Exactly the way this script was done.

Is it easy? Extremely.

The input for this was:

\beginscript
Now, at last, you can easily typeset
conversations you eavesdrop on in
restaurants and on planes.

  Really? That's just what I've been waiting
  for! How do I do it?
  Exactly the way this script was done.
  Is it easy?
  Extremely.
  \endscript

11. Dating

Illustration:

Gosh darn it, it’s February already! Even worse, it is 5:34 P.M. on February 19, 1993.

The input for this was:

  Gosh darn it, it's \monthname\ already!
  Even worse, it is \now\ on \today.

12. Fun with numbers

Illustration:

15^{3} + 16^{3} = 7471. This lies between 19^{3} (= 6859) and 20^{3} (= 8000). 3^{2} + 4^{2} = 25. The sum seems to be exactly 5^{2}. Yawn! Tell me something I don’t know, will you?

The input for this was:

  \fermat{15}{16}{3}
  \smallskip\noindent
  \fermat{3}{4}{2}

13. Trapezoids galore

Illustration:

The input for this was:

  \trap{0}{20}{50}{10}{10}{60}\quad
  \trap{10}{40}{30}{-10}{30}{100}\quad
  \rect{20}{48}{5}{120}\quad
  \trap{1}{1}{30}{50}{5}{60}

The parameters in \trap are, respectively, the top width, the bottom width, the height and the bottom displacement (all in points); the rule thickness and the gap between rules (in 1/64th of a point). For \rect the numbers are the top width, the bottom width, the rule thickness and the gap. (If you use small numbers for the rule specifications, you are likely to cause TEX to ‘overflow’.)