The StarTEX source code

Dag Langmyhr Department of Informatics University of Oslo

dag@ifi.uio.no

Version 1.0, 7th October 1996

Contents

1 The StarTEX format 2 1.1 States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Command handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2.1 Internal form of command names . . . . . . . . . . . . . . . 4 1.2.2 User-defined commands . . . . . . . . . . . . . . . . . . . . 4 1.2.3 Catcode modifications . . . . . . . . . . . . . . . . . . . . . 5 1.2.4 Environments . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3 Document styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4 Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

1.4.1 Font definitions . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.2 Predefined fonts . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4.3 Font selection . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.4 Font size selection . . . . . . . . . . . . . . . . . . . . . . . 10 1.4.5 StarTEX commands for font changes . . . . . . . . . . . . . 10

1.5 Body text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.5.1 Paragraph breaking . . . . . . . . . . . . . . . . . . . . . . 12 1.5.2 Paragraph indentation . . . . . . . . . . . . . . . . . . . . . 12 1.5.3 Paragraph separation . . . . . . . . . . . . . . . . . . . . . 13 1.5.4 The document head . . . . . . . . . . . . . . . . . . . . . . 13 1.5.5 Sectioning commands . . . . . . . . . . . . . . . . . . . . . 14 1.5.6 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.5.7 Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.5.8 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.5.9 Footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.5.10 Page headers and footers . . . . . . . . . . . . . . . . . . . 18

1.6 Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6.1 Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6.2 Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6.3 Character set . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.6.4 Language-specific definitions . . . . . . . . . . . . . . . . . 19

1.7 Math mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.7.1 Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.7.2 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.7.3 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.7.4 Delimitiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.7.5 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 1.7.6 Big symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 1.7.7 Function names . . . . . . . . . . . . . . . . . . . . . . . . . 22 1.7.8 Greek letters . . . . . . . . . . . . . . . . . . . . . . . . . . 22 1.7.9 Calligraphic letters . . . . . . . . . . . . . . . . . . . . . . . 23 1.7.10 Other symbols . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.7.11 Subscripts and superscripts . . . . . . . . . . . . . . . . . . 23 1.7.12 Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1.7.13 Roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

1.8 PostScript figures . . . . . . . . . . . . . . . . . . . . . . . . . . 24 1.9 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

1.9.1 Table rows . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.9.2 Table columns . . . . . . . . . . . . . . . . . . . . . . . . . 26

1.10 Cross-references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 1.10.1 Defining labels . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.10.2 Reading the cross-reference label file . . . . . . . . . . . . . 28 1.10.3 Checking the .aux file . . . . . . . . . . . . . . . . . . . . . 28 1.10.4 Referencing labels . . . . . . . . . . . . . . . . . . . . . . . 29

1.11 Miscellaneous other commands . . . . . . . . . . . . . . . . . . . . 29 1.12 Symbols and logos . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

1.12.1 Error handling . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.12.2 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.12.3 Text handling . . . . . . . . . . . . . . . . . . . . . . . . . . 30 1.12.4 Numerical operations . . . . . . . . . . . . . . . . . . . . . 31 1.12.5 File operations . . . . . . . . . . . . . . . . . . . . . . . . . 31 1.12.6 Format creation . . . . . . . . . . . . . . . . . . . . . . . . 32

1.13 Final initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

2 Language definitions 32

3 Sample document styles 33 3.1 Paper size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.2 Language adaption . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.3 Text font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

1 The StarTEX format

1 ⟨∗code⟩

This document contains the documented source code of StarTEX, a simplified and more robust TEX format intended for students writing their first report or essay. For more information on StarTEX, see the other files accompanying this.

The main guidelines for this implementation are:

• StarTEX is implemented on top of plain TEX.

Value State
x  Ordinary body text
p  Inside a <psfig> caption
t  Inside a <table> caption
r  Inside a <table> row

Table 1: The possible values of \State

• All names defined in the StarTEX implementation contain at least one uppercase letter, like \Cdef or \NewEnvir. This makes it easier to distinguish them from TEX’s internal names and the names defined in plain TEX, nearly all of which consist of lowercase letters only.

• Most TEX macro packages tend to use a rather terse programming style, like

         \advance\var\@ne

This improves processing speed and reduces storage, but make the code more difficult to read. Since this is a package which aims to be easily understandable and adaptable, I will use a more verbose style:

         \advance␣\var␣by␣1

To avoid possible confusion, StarTEX commands will be called commands in this document, while TEX commands will be called macros.

1.1 States

To avoid improper nesting, such as use of <psfig> within a <table>, we introduce a global state variable. Its values are given in table 1. The initial state is body text:

 2 \let \State = x

1.2 Command handling

\Command StarTEX uses the syntax <x> for its commands rather than the usual \x . This is easily implemented by making < an active character calling the macro \Command. The command name is the text between the < and a later >.

\Command first checks whether the command immediately follows a <define> in which case it is being defined. If so, \DefineCmd handles that. Otherwise, \Command converts the command name into lowercase and checks whether it has been defined. If so, it is called; otherwise an error message is produced and the command is ignored.

 3 \def \Command #1>{\ifDefining
 4  \def \Next {\lowercase{\DefineCmd{#1}}}%
 5 \else
 6  \lowercase{\expandafter\ifx \csname >#1\endcsname}\relax
 7  \Error{Unknown command <#1> ignored.}{}%
 8  \let \Next = \relax
 9  \else
10  \def \Next {\lowercase{\csname >#1\endcsname}}%

11  \fi
12 \fi \Next }

The < character must be bound to \Command:

13 {\catcode `\< = \active  \global\let < = \Command }

1.2.1 Internal form of command names

All StarTEX commands are represented by a TEX macro constructed by \csname. To avoid confusion with predefined TEX macros, an initial >^{1} is inserted; for

example, <h1> is represented by \csname >h1\endcsname.

\Cdef To simplify the declaration of StarTEX commands, the macro \Cdef is defined. It takes two parameters: #1 is the command name (using no uppercase letters and no angle brackets), and #2 is the command definition.

14 \def \Cdef #1#2{\expandafter\gdef \csname >#1\endcsname{#2}}

\Ccall In case we need to call StarTEX commands from this TEX code, a \Ccall macro is introduced.

15 \def \Ccall #1{\csname >#1\endcsname}

1.2.2 User-defined commands

<define> The implementation of <define> is a little sneaky; it just sets a flag \ifDefining. When the following command name is found, the \Command routine checks the state of the flag and calls \DefineCmd when the flag is raised.^{2}

16 \newif \ifDefining
17 \Cdef {define}{\Definingtrue}

\DefineCmd The command \DefineCmd is used to define a new user command; #1 is the new command name (already translated into lowercase) and #2 is the definition. The main job of \DefineCmd is to check whether the definition is legal. There are two reasons why it may not be legal:

• The definition may be nested, as in

         <define><comm-1>...<define><comm-2>...

This is checked using a counter \CallLevel which is incremented whenever a user-defined command is called, and decremented on return; see the definition of \Call and \Return below.

• The command may already be defined.

If the definition is legal, \FetchDef is called to perform the actual defining.

18 \def \DefineCmd #1{\Definingfalse
19 \ifnum \CallLevel>0
20  \Error{Nested definitions are not allowed;}%
21  {the definition of <#1> is ignored.}\let \Next = \relax

1The character > was chosen as it cannot possibly occur in a command name.

2This means that the user can insert text between the <define> and the command name, and this text will be typeset as normal text. There is a slight chance that this will confuse some users, but I prefer this to using much more complicated code.

22 \else
23  \expandafter\ifx \csname>#1\endcsname\relax
24  \def \Next {\begingroup \catcode`\^^M = 12 \FetchDef{#1}}%
25  \else
26  \Error{Command <#1> already defined;}{this definition ignored.}%
27  \def \Next {\begingroup \catcode`\^^M = 12 \IgnoreDef{#1}}%
28  \fi
29 \fi \Next }

\FetchDef \FetchDef defines the macro by using everything up to the end-of-line mark as the definition. This implies modifying the \catcode of the end-of-line character (^^M). Also note that calls on \Call and \Return are inserted into the definition.

30 \begingroup \catcode`\^^M = 12
31 \gdef \FetchDef #1#2^^M{\expandafter%
32  \gdef\csname>#1\endcsname {\Call #2\Return }\endgroup }%

\IgnoreDef I also define \IgnoreDef which is quite similar to \FetchDef, but no command is defined. It is used to ignore the rest of the line in case the user tries an illegal definition.

33 \gdef \IgnoreDef #1#2^^M{\endgroup }%
34 \endgroup

Finally, we must declare the user command level counter \CallLevel:

35 \newcount \CallLevel

\Call \Return We must also define the two commands used for incrementing and decrementing the counter:

36 \def \Call   {\global\advance \CallLevel by  1 }
37 \def \Return {\global\advance \CallLevel by -1 }

1.2.3 Catcode modifications

StarTEX uses only one special character: <, which must be active. All the other special characters of TEX and L^{A}TEX are assigned suitable \catcodes turning them into ordinary characters.

\SpecialCatCodes  \SpecialCatCodes sets the \catcodes to the StarTEX values:
38 \def \SpecialCatCodes {%
39 \catcode `\# = 12  \catcode `\$ = 12  \catcode `\% = 12
40 \catcode `\& = 12  \catcode `\{ = 12  \catcode `\} = 12
41 \catcode `\~ = 12  \catcode `\^= 12  \catcode `\_= 12
42 \catcode `\\ = 12  \catcode `\< = \active }
\StandardCatCodes  \StandardCatCodes restores the \catcodes to their normal values. This is nec-

essary when reading for instance style files.

43 \def \StandardCatCodes {%
44 \catcode `\\ = 0  \catcode `\{ = 1  \catcode `\} = 2
45 \catcode `\$ = 3  \catcode `\& = 4  \catcode `\# = 6
46 \catcode `\^= 7  \catcode `\_= 8  \catcode `\~ = \active
47 \catcode `\% = 14 \catcode `\< = 12 }

1.2.4 Environments

An environment is a piece of text enclosed in a <x>… </x> pair.

\NewEnvir \NewEnvir is used to start a new environment. It has three parameters: #1 is the name of the environment, #2 is the TEX commands used to start the new environment (usually just a \begingroup), and #2 is the TEX commands used to terminate the environment (usually just a \endgroup).

\NewEnvir saves information about the current environment’s name (in \CurEnv), the line on which it starts (in \CurEnvLine) and which command is used to exit it (in \CurEnvExit). It also keeps tracks of the outer environment’s name (in \PrevEnv) and start line (in \PrevEnvLine) for better error reporting and error recovery.

48 \def \NewEnvir #1#2#3{#2\relax
49 \let \PrevEnv = \CurEnv  \PrevEnvLine = \CurEnvLine
50 \def \CurEnv {#1}\def \CurEnvExit {#3}\CurEnvLine = \inputlineno }

We need default definitions of \CurEnvand \CurEnvExit:

51 \def \CurEnv {}\def \CurEnvExit {\relax}

We also need to declare the two line counters:

52 \newcount \CurEnvLine  \newcount \PrevEnvLine

\EndEnvir \EndEnvir is used to terminate an environment. It check that the correct environment is terminated, and tries to correct user mistakes. It checks for the following situations:

• If the name of the environment to be terminated is the same as that of the current environment, everything is OK, and we can safely leave the current environment.

• If the name of the terminated environment is not the name of the current one, but matches the name of the outer environment, we assume that the user has forgotten a </x> command. An error message is given, and both the current environment and the outer one are terminated.

• If the name of the terminated environment matches neither the current nor the outer environment, we assume that the user has just misspelled the command. The best thing we can do in this case, is to give an error message and ignore the command. If the user had intended to terminate the current environment, we get erroneous processing of the following text, but the situation will normalize when the outer environment is terminated.

53 \def \EndEnvir #1{%
54 \ifTextEqual{#1}{\CurEnv}\let \Next = \CurEnvExit
55 \else \EnvirError{#1}\fi
56 \Next }

\EnvirError \EnvirError is an auxiliary command giving a proper error message and placing— in \Next—the best command to recover from the error.

57 \def \EnvirError #1{\ifTextEqual{#1}{\PrevEnv}%
58  \Error{<\CurEnv> on line \the\CurEnvLine\space terminated by
59  </#1>.}{An extra </\CurEnv> has been inserted.}%
60  \def \Next {\CurEnvExit \CurEnvExit }%

Kind  Alternate  Bold  Italic  Size
R (Roman) S (Standard) M (Medium) U (Upright) X (Extra large)
T (Teletype) A (Alternate) B (Bold) I (Italic) L (Large)

N (Normal) S (Small)

Table 2: The five parts of the internal StarTEX text font name

61 \else
62  \Error{<\CurEnv> on line \the\CurEnvLine\space terminated by
63  </#1>.}{The </#1> will be ignored.}%
64  \let \Next = \relax
65 \fi }

1.3 Document styles

<style> The command <style> is called to read a document style. It calls \ReadStyle to do the actual work.

66 \Cdef {style}{\IfNextChar{[}{\ReadStyle}%
67 {\Error{No style name given;}{the syntax is: <style>[style name].}}}

\ReadStyle \ReadStyle reads the style file (with extension .stx) using the standard TEX \catcodes. Afterwards, the <style> command is redefined, since <style> should be called once only.

68 \def \ReadStyle [#1]{\IfFileExists{#1.stx}%
69  {\edef \StyleLine {\the\inputlineno}%
70  \Cdef {style}{\Error{Command <style> already used on line
71  \StyleLine;}{this use of <style> is ignored.}}%
72  \StandardCatCodes \input #1.stx
73  \SpecialCatCodes }%
74  {\Error{Style file `#1.stx' could not be found;}%
75  {style definition ignored.}}}

1.4 Fonts

StarTEX allows the user a limited amount of font selection:

• use of bold text using <b>… </b>,

• use of italic text using <i>… </i>, and

   • use of typewriter text using <tt>. . . </tt>.

All other font changes, including font size changes, are done by the document style.

Since the font change commands mentioned above may be combined, StarTEX uses an internal font naming scheme in which a font name consists of five parts, as shown in table 2. For example, the font “Standard bold roman italic normal-size” is represented internally as F-RSBIN.

Size  Position  Family
X (Extra large) N (Normal)  0 (Roman math)
L (Large) S (Script) 1 (Italic math)
N (Normal)  X (Scriptscript) 2 (Math symbols)
S (Small)  3 (Large math symbols)

4 (Bold math)

5 (Extended italic math)

Table 3: The three parts of the internal StarTEX math font name

1.4.1 Font definitions

\FontDef The macro \FontDef is used to define a StarTEX font pair. To be more precise, it defines which TEX font specifications to use for each internal StarTEX font name. Two fonts are defined for each internal StarTEX name: the standard Cork encoded font and the additional companion font.

76 \def \FontDef #1#2#3#4#5#6{%
77 \expandafter\def \csname F-#1S#2#3#4\endcsname {#5}%
78 \expandafter\def \csname F-#1A#2#3#4\endcsname {#6}}
79 \def \MathFontDef #1#2#3#4#5{%
80 \expandafter\def \csname M-#1N#2\endcsname {#3}%
81 \expandafter\def \csname M-#1S#2\endcsname {#4}%
82 \expandafter\def \csname M-#1X#2\endcsname {#5}}

1.4.2 Predefined fonts

The following fonts are predefined, which means that they are the fonts the user will get unless the document style dictates otherwise, or unless the user specifies a legal font changing style.

The fonts used are the so-called DC fonts version 1.2 (or later). Since there are no bold typewriter characters in this set, ordinary typewriter characters are used instead.

Also defined are various size dependant values, such as \LineSkipx (line skip).

Normal size fonts An 11 point (actually 10.95 pt) font is the standard text font.

83 \def \XIpt { at 10.95pt}
84 \FontDef{R}{M}{U}{N}{dcr1095}{tcr1095}
85 \FontDef{R}{M}{I}{N}{dcti1095}{tcti1095}
86 \FontDef{R}{B}{U}{N}{dcbx1095}{tcbx1095}
87 \FontDef{R}{B}{I}{N}{dcbi1095}{tcbi1095}
88 \FontDef{T}{M}{U}{N}{dctt1095}{tctt1095}
89 \FontDef{T}{M}{I}{N}{dcit1095}{tcit1095}
90 \FontDef{T}{B}{U}{N}{dctt1095}{tctt1095}
91 \FontDef{T}{B}{I}{N}{dcit1095}{tcit1095}
92 \MathFontDef{N}{0}{cmr10\XIpt}{cmr8}{cmr6}
93 \MathFontDef{N}{1}{cmmi10\XIpt}{cmmi8}{cmmi6}
94 \MathFontDef{N}{2}{cmsy10\XIpt}{cmsy8}{cmsy6}
95 \MathFontDef{N}{3}{cmex10\XIpt}{cmex10\XIpt}{cmex10\XIpt}
96 \MathFontDef{N}{4}{cmbx10\XIpt}{cmbx8}{cmbx6}

 97 \MathFontDef{N}{5}{dcti1095}{dcti0800}{dcti0600}
 98 \def \LineSkipN {12pt}  \def \CodeSkipN {11pt plus 0.0pt minus 0.1pt}

Large fonts The slightly larger characters are 14.4 pt.

 99 \def \XIVpt { at 14.4pt}
100 \FontDef{R}{M}{U}{L}{dcr1440}{tcr1440}
101 \FontDef{R}{M}{I}{L}{dcti1440}{tcti1440}
102 \FontDef{R}{B}{U}{L}{dcbx1440}{tcbx1440}
103 \FontDef{R}{B}{I}{L}{dcbi1440}{tcbi1440}
104 \FontDef{T}{M}{U}{L}{dctt1440}{tctt1440}
105 \FontDef{T}{M}{I}{L}{dcit1440}{tcit1440}
106 \FontDef{T}{B}{U}{L}{dctt1440}{tctt1440}
107 \FontDef{T}{B}{I}{L}{dcit1440}{tcit1440}
108 \MathFontDef{L}{0}{cmr12\XIVpt}{cmr10}{cmr8}
109 \MathFontDef{L}{1}{cmmi12\XIVpt}{cmmi10}{cmmi8}
110 \MathFontDef{L}{2}{cmsy10\XIVpt}{cmsy10}{cmsy8}
111 \MathFontDef{L}{3}{cmex10\XIVpt}{cmex10\XIVpt}{cmex10\XIVpt}
112 \MathFontDef{L}{4}{cmbx12\XIVpt}{cmbx10}{cmbx8}
113 \MathFontDef{L}{5}{dcti1440}{dcti1000}{dcti0800}
114 \def \LineSkipL {15pt}

The extra large fonts The largest fonts are 17.28 pt.

115 \def \XVIIpt { at 17.28pt}
116 \FontDef{R}{M}{U}{X}{dcr1728}{tcr1728}
117 \FontDef{R}{M}{I}{X}{dcti1728}{tcti1728}
118 \FontDef{R}{B}{U}{X}{dcbx1728}{tcbx1728}
119 \FontDef{R}{B}{I}{X}{dcbi1728}{tcbi1728}
120 \FontDef{T}{M}{U}{X}{dctt1728}{tctt1728}
121 \FontDef{T}{M}{I}{X}{dcit1728}{tcit1728}
122 \FontDef{T}{B}{U}{X}{dctt1728}{tctt1728}
123 \FontDef{T}{B}{I}{X}{dcit1728}{tcit1728}
124 \MathFontDef{X}{0}{cmr17}{cmr12\XIVpt}{cmr9}
125 \MathFontDef{X}{1}{cmmi12\XVIIpt}{cmmi12}{cmmi9}
126 \MathFontDef{X}{2}{cmsy10\XVIIpt}{cmsy10 at 12pt}{cmsy9}
127 \MathFontDef{X}{3}{cmex10\XVIIpt}{cmex10\XVIIpt}{cmex10\XVIIpt}
128 \MathFontDef{X}{4}{cmbx12\XVIIpt}{cmbx12}{cmbx9}
129 \MathFontDef{X}{5}{dcti1728}{dcti1200}{dcti0900}
130 \def \LineSkipX {17pt}

Small fonts A smaller font for footnotes and other special text is 10 pt.

131 \FontDef{R}{M}{U}{S}{dcr1000}{tcr1000}
132 \FontDef{R}{M}{I}{S}{dcti1000}{tcti1000}
133 \FontDef{R}{B}{U}{S}{dcbx1000}{tcbx1000}
134 \FontDef{R}{B}{I}{S}{dcbi1000}{tcbi1000}
135 \FontDef{T}{M}{U}{S}{dctt1000}{tctt1000}
136 \FontDef{T}{M}{I}{S}{dcit1000}{tcit1000}
137 \FontDef{T}{B}{U}{S}{dctt1000}{tctt1000}
138 \FontDef{T}{B}{I}{S}{dcit1000}{tcit1000}
139 \MathFontDef{S}{0}{cmr10}{cmr7}{cmr5}
140 \MathFontDef{S}{1}{cmmi10}{cmmi7}{cmmi5}
141 \MathFontDef{S}{2}{cmsy10}{cmsy7}{cmsy5}
142 \MathFontDef{S}{3}{cmex10}{cmex10}{cmex10}

143 \MathFontDef{S}{4}{cmbx10}{cmbx7}{cmbx5}
144 \MathFontDef{S}{5}{dcti1000}{dcti0700}{dcti0500}
145 \def \LineSkipS {11pt}

1.4.3 Font selection

Selecting a StarTEX font is a two-step procedure:

   1. Define \FontKind, \FontAlt, \FontBold, \FontItal and \FontSize to con-

tain the correct letters, as shown in table 2 on page 7.

   2. Call \SelectFont.

(The reason for this procedure is to avoid loading unused fonts.)

\SelectFont As mentioned, \SelectFont selects a font according to the specifications given.

146 \def \SelectFont {%
147 \edef \ThisFont {F-\FontKind\FontAlt\FontBold\FontItal\FontSize}%
148 \font \CurFont = \csname\ThisFont\endcsname \CurFont }

\ResetFont \ResetFont provides standard settings for the various StarTEX font parameters.

149 \def \ResetFont {%
150 \def \FontKind{R}\def \FontAlt{S}\def \FontBold{M}%
151 \def \FontItal{U}\def \FontSize{N}}

\CheckItCorr \CheckItCorr is called after every group of italic text. Unless the following character is a low character like ‘.’ or ‘,’, an italic correction command \/ is inserted.

152 \def \CheckItCorr {%
153 \IfNextCharTwo{.}{,}{}{\/}}

1.4.4 Font size selection

\SetSize \SetSize is used to set various parameters connected with a size change. It also contains a call on \SelectFont.

154 \def \SetSize #1{\def \FontSize{#1}\SelectFont
155 \baselineskip = \csname LineSkip#1\endcsname
156 \ParIndent = \StdParIndent }

1.4.5 StarTEX commands for font changes

<b> </b> <i> </i> <tt> </tt> The following commands are used to indicate bold, italic, or typewriter text.

157 \Cdef {b}{\NewEnvir{b}{\begingroup}{\endgroup}%
158 \def\FontBold{B}\SelectFont}
159 \Cdef {/b}{\EndEnvir{b}}
160 \Cdef {i}{\NewEnvir{i}{\begingroup}{\endgroup\CheckItCorr}%
161 \def\FontItal{I}\SelectFont}
162 \Cdef {/i}{\EndEnvir{i}}
163 \Cdef {tt}{\NewEnvir{tt}{\begingroup}{\endgroup}%
164 \def\FontKind{T}\SelectFont}
165 \Cdef {/tt}{\EndEnvir{tt}}

1.5 Body text

A StarTEX file is enclosed in a <body>… </body> environment. The main reason for this is to be able to detect the end of the document and terminate properly.^{3} It is also used to print an introductory message.

<body> <body> just redefines itself to produce an error message if used a second time; this is to ensure that it is only used once.

166 \Cdef {body}{\NewEnvir{body}{\begingroup}{\endgroup}%
167 \message{^^JThis is StarTeX, version \CodeVersion^^J}%
168 \global\everypar = {\NewPar }%
169 \xdef \BodyLine {\the\inputlineno}%
170 \Cdef {body}{\Error{Command <body> already used on line \BodyLine;}%
171  {this use of <body> was ignored.}}}

\BodyError If the user has forgotten the <body>… </body> environment, the first text paragraph will trigger the \BodyError macro.

172 \def \BodyError {\message{^^JThis is StarTeX, version \CodeVersion^^J}%
173 \Error{A <body>...</body> environment should surround
174  the whole document.}{A missing <body> was inserted.}%
175 \global\everypar = {\NewPar }}

</body> </body> is used to terminate the document. This involves two things:

1. the current page must be terminated, and

2. the .aux file must be check to determine whether any references have changed. The .aux file must be checked if both

• an .aux file has been read (\ifAuxRead is true), and

• a new .aux file has been created (\ifAuxOpen is true).

If we already know that a rerun is necessary (because \ifRerun is true), there is no need to check the .aux file.

176 \Cdef {/body}{\EndEnvir{body}\endgraf\vfill\supereject
177 \let \Next = \CheckAux
178 \ifRerun \let \Next = \relax \fi
179 \ifAuxRead \else \let \Next = \relax \fi
180 \ifAuxOpen \else \let \Next = \relax \fi
181 \Next

Give a warning if rerunning StarTEX is necessary.

182 \ifRerun \Warning{Cross-references are not correct;}%
183  {please run StarTeX again.}\fi
184 \end}

3An \everyeof command—had it existed—would have made the <body>… </body> environment superfluous, thus removing yet another possible error source. (ε-TEX[Tay95] does provide such a primitive, but I have chosen not to apply it as use of ε-TEX is not yet very widespread.)

1.5.1 Paragraph breaking

<p> The StarTEX command <p> is used to separate paragraphs:

185 \Cdef {p}{\endgraf}

Blank lines are just ignored:

186 \def \par {}

StarTEX uses parameters which allow rather sloppy paragraph setting:

187 \pretolerance = 2500 \tolerance = 9999  \hbadness = \tolerance
188 \emergencystretch = 3cm

The reasons for this are:

• If a good set of breaks is possible, TEX will still choose that.

• If no good breaks are possible, it is better to have a sloppily set paragraph than problem lines sticking into the margin. The potential users of StarTEX tend to just ignore messages about overfull boxes.

Note, however, that \hfuzz has not been increased, as such a change is immediately visible and gives a poor impression.

1.5.2 Paragraph indentation

The paragraph handling mechanism must be able to let some paragraphs be indented and others not; for instance, the first paragraph following a title should not be indented, while the subsequent ones should be.

In StarTEX this is solved by disabling the original \parindent and instead insert a call on \NewPar at the start of every paragraph. However, \everypar is initialized to \BodyError to detect a missing <body>… </body> environment; the <body> command will set \everypar correctly.

189 \parindent = 0pt \everypar = {\BodyError }

\NewPar This \NewPar inserts an indentation \ParIndent wide if \ifIndent is true.^{4} It also sets \ifIndent to true, ensuring the indentation of subsequent paragraphs. \NewPar sets \parskip to its standard current value \CurParSkip.

190 \def \NewPar {\ifIndent \kern \ParIndent \fi  \Indenttrue
191 \global\parskip = \CurParSkip }

(In some environments, like <list>… </list>, no paragraphs are indented. By setting \ParIndent to 0 pt, the whole paragraph indentation mechanism is disabled.)

\ParIndent \ifIndent \StdParIndent We must declare \ParIndent and \ifIndent, and also \StdParIndent which

holds the value to which \ParIndent is set when it is not 0:

192 \newskip \ParIndent  \def \StdParIndent {1em}
193 \newif \ifIndent

4We cannot use the standard \parindent to this, as that is inserted when the paragraph is started, in other words before \NewPar is called.

1.5.3 Paragraph separation

Sometimes it is necessary to omit the paragraph separation (the vertical space inserted between every paragraph), for instance after having inserted some special vertical space. This is done by setting \parskip to 0 pt. The following paragraph will reset this to \CurParSkip so that subsequent paragraphs will have the standard separation; see the definition of \NewPar above.

\CurParSkip  \CurParSkip must be defined:
194 \newskip \CurParSkip

\AddVspace Several insertions of vertical space (with \vskip) should not just accumulate; this will lead to excessive vertical spacing. Instead, \AddVspace should be used; it inserts the maximum of the last space (if any) and the current one, and it also sets \parskip to 0 pt so that the automatic paragraph separation will not interfere.

195 \def \AddVspace #1{\ifvmode \else \endgraf \fi
196 \skip1 = #1\relax
197 \ifdim \lastskip < \skip1 \relax
198  \ifdim \lastskip > 0pt \vskip -\lastskip \fi
199  \vskip \skip1
200 \fi \parskip = 0pt \relax }

1.5.4 The document head

This section implements the various commands used at the start of the document.

<title> </title> <title>… </title> is used to set the document title. It is centered, and uses the biggest fonts available.

201 \Cdef {title}{\AddVspace{30pt plus 10pt}
202 \NewEnvir{title}{\begingroup}{\endgraf\endgroup}
203 \leftskip = 2cm plus 1fill  \rightskip = \leftskip
204 \ParIndent = 0pt  \CurParSkip = 0pt
205 \ResetFont \SetSize{X}}
206 \Cdef {/title}{\EndEnvir{title}%
207 \AddVspace{20pt plus 4pt}}

<author> </author> <author>… </author> is used for the author’s name. It is set like <title>… </title>, but uses a smaller font.

208 \Cdef {author}{\AddVspace{10pt plus 3pt}
209 \NewEnvir{author}{\begingroup}{\endgraf\endgroup}
210 \leftskip = 2cm plus 1fill  \rightskip = \leftskip
211 \ParIndent = 0pt  \CurParSkip = 0pt
212 \ResetFont \SetSize{L}}
213 \Cdef {/author}{\EndEnvir{author}%
214 \AddVspace{20pt plus 4pt}}

<info> </info> <info>… </info> is used for additional information, like the date. It is centered, but uses the normal text font.

215 \Cdef {info}{\AddVspace{10pt plus 3pt}
216 \NewEnvir{info}{\begingroup}{\endgraf\endgroup}
217 \leftskip = 2cm plus 1fill  \rightskip = \leftskip
218 \ParIndent = 0pt  \CurParSkip = 0pt
219 \ResetFont \SetSize{N}}

220 \Cdef {/info}{\EndEnvir{info}%
221 \AddVspace{20pt plus 4pt}}

<abstract> </abstract> <abstract>… </abstract> is used for the short abstract usually given with each document. It is set with indented margins, and the type is smaller than the text type. The word ‘Abstract’ is set in boldface.

222 \Cdef {abstract}{\AddVspace{10pt plus 3pt}
223 \NewEnvir{abstract}{\begingroup}{\endgraf\endgroup}
224 \ResetFont \def \FontBold{B} \SetSize{S}  \CurParSkip = 0pt
225 \leftskip = 2cm  \rightskip = \leftskip  \Indentfalse
226 \centerline{\AbstractName}
227 \ResetFont \SetSize{S}\Indentfalse }
228 \Cdef {/abstract}{\EndEnvir{abstract}%
229 \AddVspace{10pt plus 2pt}}

1.5.5 Sectioning commands

To keep track of the section numbers, we need four counters:

230 \newcount \SectI    \newcount \SectII
231 \newcount \SectIII  \newcount \SectIV

\Heading Since most of the work of a sectioning command is the same irrespective of its level, the common code has been place in \Heading which has four parameters: #1 is the vertical space before the section, #2 is the font size (N, L or X), #3 tells whether to use bold type or not (B or M), and #4 is the TEX command to produce the section number.

232 \def \Heading #1#2#3#4{\AddVspace{#1}
233 \def \FontBold {#3} \SetSize{#2}
234 \setbox0 = \hbox{#4\kern 0.5\baselineskip}
235 \hangindent = \wd0  \hangafter = 1  \raggedright
236 \ParIndent = 0pt  \CurParSkip = 0pt  \leavevmode  \box0 }

<h1> <H1> must update the counters and add vertical space. The rest of the work is

 done by \Heading.
237 \Cdef {h1}{\endgraf
238 \global\advance \SectI by 1
239 \global\SectII = 0  \global\SectIII = 0  \global\SectIV = 0
240 \edef \CurDef {\SectIim}
241 \NewEnvir{h1}{\begingroup}{\endgroup}
242 \Heading{24pt plus 12pt minus 3pt}{X}{B}{\SectIim}}

</h1> </H1> terminates the heading. It adds some vertical space (protcted with a top \penalty so that a page break will never occur) and sets \Indentfalse to prevent indentation of the following line.

243 \Cdef {/h1}{\endgraf
244 \penalty10000\vskip 6pt plus 1.5pt
245 \EndEnvir{h1}  \Indentfalse }
{<h2> \atop </h2>}  <H2> and </h2> work more or less like <h1> and </h1>:
246 \Cdef {h2}{\endgraf
247 \global\advance \SectII by 1
248 \global\SectIII = 0  \global\SectIV = 0

249 \edef \CurDef {\SectIIim}
250 \NewEnvir{h2}{\begingroup}{\endgroup}
251 \Heading{14pt plus 7pt minus 2pt}{L}{B}{\SectIIim}}
252 \Cdef {/h2}{\endgraf
253 \penalty10000\vskip 4pt plus 1pt
254 \EndEnvir{h2}\Indentfalse }

{<h3> \atop </h3>} <H3> and </h3> work more or less like the two preceding ones:

255 \Cdef {h3}{\endgraf
256 \global\advance \SectIII by 1  \global\SectIV = 0
257 \edef \CurDef {\SectIIIim}
258 \NewEnvir{h3}{\begingroup}{\endgroup}
259 \Heading{10pt plus 5pt minus 1pt}{N}{B}{\SectIIIim}}
260 \Cdef {/h3}{\endgraf
261 \penalty10000\vskip 2pt plus 1pt
262 \EndEnvir{h3}\Indentfalse }

{<h4> \atop </h4>} <H4> and </h4> are slightly different from the previous ones in that they use a run-in title (the text continues on the same line as the title):

263 \Cdef {h4}{\AddVspace{8pt plus 4pt minus 1pt}
264 \global\advance \SectIV by 1
265 \edef \CurDef {\SectIVim}
266 \NewEnvir{h4}{\begingroup}{\endgroup}
267 \def \FontBold{B}\SelectFont \Indentfalse \SectIVim }
268 \Cdef {/h4}{\kern 0.5\baselineskip
269 \EndEnvir{h4}}

1.5.6 Lists

<list> </list> The <list>… </list> environment increases the left margin and sets the item counter to 0; everything else is handled by the various kinds of \item.

270 \Cdef {list}{\AddVspace{\ListSkip}
271 \NewEnvir{list}{\begingroup}{\endgroup}
272 \advance \leftskip by \ListIndent
273 \Indentfalse  \CurParSkip = \ListSkip  \ParIndent = 0pt
274 \ItemCount = 0 }
275 \Cdef {/list}{\endgraf
276 \EndEnvir{list}  \Indentfalse }

<item> <item> inserts a bulleted item.

277 \Cdef {item}{\endgraf  \Indentfalse
278 \leavevmode\llap{\BulletItemFormat}\ignorespaces }
<numitem>
279 \Cdef {numitem}{\endgraf
280 \advance \ItemCount by 1  \edef \CurDef {\the\ItemCount}
281 \Indentfalse
282 \leavevmode\llap{\NumItemFormat{\ItemCount}}\ignorespaces }

\ItemCount The item counter \ItemCount must also be declared:

283 \newcount \ItemCount

<textitem> </textitem> The <textitem>… </textitem> environment starts another item with a bold text.

284 \Cdef {textitem}{\endgraf
285 \NewEnvir{textitem}{\begingroup}{\endgroup}
286 \def \FontBold {B}\SelectFont \leavevmode \kern -\ListIndent
287 \ignorespaces }
288 \Cdef {/textitem}{\unskip
289 \EndEnvir{textitem}%
290 \hskip 0.5\baselineskip  \ignorespaces }

1.5.7 Displays

<display> </display> A <display>… </display> environment is implemented by increasing both margins.

291 \Cdef {display}{\AddVspace{\DisplayPreSkip}
292 \NewEnvir{display}{\begingroup}{\endgroup}%
293 \advance \leftskip  by \DisplayIndent
294 \advance \rightskip by \DisplayIndent
295 \CurParSkip = \DisplayParSkip \ParIndent = 0pt \relax }
296 \Cdef {/display}{\AddVspace{\DisplayPostSkip}
297 \EndEnvir{display}}

1.5.8 Code

Handling code like computer programs is quite easy. It involves

• changing <’s \catcode into that of an ordinary character,

• making space and end-of-lines into active characters with a suitable definition, and

• selecting a fixed-width font and a suitable leading.

It is necessary to remember whether the code followed a <p>. If so, some vertical space will be added before and after the code.

298 \newif \ifCodePar

\CodeSetup All the initialization is handled by the \CodeSetup macro:

299 \def \CodeSetup {\ifvmode \CodePartrue \AddVspace{\DisplayPreSkip}
300  \else \CodeParfalse \fi
301 \def\FontKind{T}\SelectFont
302 \baselineskip = \CodeSkipN  \CurParSkip = 0pt  \ParIndent = 0pt
303 \catcode`\< = 12  \frenchspacing   \obeylines  \obeyspaces }

\obeylines Plain TEX’s definition of \obeylines must be redefined since \par has been changed:

304 \begingroup
305 \catcode`\^^M = \active %
306 \gdef\obeylines{\catcode`\^^M=\active \def^^M{\endgraf\leavevmode}}%
307 \endgroup

\obeyspaces The appearance of a space when \obeyspaces is in effect must also be modified. By inserting a \leavevmode, we will not lose spaces at the beginning of a line.

308 \begingroup
309 \obeyspaces\gdef {\leavevmode\space}%
310 \endgroup

\CodeFinish After the code, \CodeFinish is called to terminate the mode. It adds the needed vertical space.

311 \def \CodeFinish {\ifCodePar
312  \def \Next {\endgraf  \vskip -\baselineskip  \vskip \DisplayPostSkip
313  \global\Indentfalse }%
314 \else
315  \let \Next = \relax
316 \fi \Next }

<code> Time has come to write the user interface. The <code>… </code> environment reads the code as parameter to the command \ReadCode.

317 \Cdef {code}{\NewEnvir{code}{\begingroup}{\endgroup}%
318 \CodeSetup \ReadCode }

\ReadCode \ReadCode just inserts the code (which is parameter #1) and terminates the environment.

319 \begingroup
320 \catcode `\< = 12
321 \gdef \ReadCode #1</code>{#1\CodeFinish\EndEnvir{code}}%
322 \endgroup

<codefile> <codefile> checks for correct syntax. If the file name is given properly, \ReadCodeFile is called to perform the actual reading.

323 \Cdef {codefile}{\IfNextChar{[}%
324  {\ReadCodeFile}%
325  {\Error{No code file name given;}%
326  {the syntax is <codefile>[file name].}}}
\ReadCodeFile  \ReadCodeFile just reads the specified file
327 \def \ReadCodeFile [#1]{\endgraf \begingroup
328 \CodeSetup
329 \IfFileExists{#1}{\input #1}%
330  {\Error{Code file `#1' cound not be found.}{}}
331 \CodeFinish \endgroup }

1.5.9 Footnotes

<footnote> </footnote> Implementing footnotes is easy, as the mechanism is ready in plain TEX.

332 \Cdef {footnote}{\NewEnvir{footnote}%
333  {\global\advance \FootnoteCnt by 1
334  \footnote{\FootnoteIm{\FootnoteCnt}}\bgroup
335  \edef \CurDef {\the\FootnoteCnt}}%
336  {\egroup}%
337 \ResetFont \SetSize{S}}
338 \Cdef {/footnote}{\EndEnvir{footnote}}

\FootnoteCnt We must remember to declare the footnote counter:

339 \newcount \FootnoteCnt

1.5.10 Page headers and footers

By default, StarTEX has the same headers and footer as TEX. The footer must, however, be redefined so that it always uses the same font as the body text.

340 \footline = {\ResetFont\SelectFont \hfil \folio \hfil}

1.6 Customization

1.6.1 Sizes

341 \def \DisplayIndent    {\ListIndent}
342 \def \DisplayParSkip   {\ListParSkip}
343 \def \DisplayPostSkip  {5pt plus 2pt minus 1pt\relax}
344 \def \DisplayPreSkip   {5pt plus 2pt minus 1pt\relax}

345

346 \def \ListIndent       {25pt\relax}
347 \def \ListParSkip      {\ListSkip}
348 \def \ListSkip         {10pt plus 2pt minus 1pt\relax}

1.6.2 Formats

\SectIim \SectIIim \SectIIIim \SectIVim  \SetcIim, \SectIIim, \SectIIIim and \SectIVim define what the section num-

ber at various levels should look like.

349 \def \SectIim {\the\SectI}
350 \def \SectIIim {\SectIim.\the\SectII}
351 \def \SectIIIim {\SectIIim.\the\SectIII}
352 \def \SectIVim {\SectIIIim.\the\SectIV}

\FootnoteIm \FootnoteIm defines the appearance of the footnote mark; #1 is the footnote number.

353 \def \FootnoteIm #1{$^{\the #1}$}

\FigIm \TabIm \FigIm and \TabIm define the appearance of the figure and table counters, respectively.

354 \def \FigIm {\the\FigCnt}
355 \def \TabIm {\the\TabCnt}
356 \def \BulletItemFormat {$\bullet$\kern 6pt\relax}
357 \def \NumItemFormat  #1{\the#1.\kern 4pt\relax}

1.6.3 Character set

This version of StarTEX uses iso 8859-1 as its standard character set. (Users of other character sets will have to modify this.)

\E \E is used to redefine the encoding of a character; this is done by making the character active. #1 is the character’s number, and #2 is the TEX code to which it is to be defined. The implementation of \E uses the standard technique of defining a \uccode and then calling \uppercase to insert the correct character where it is defined.)

358 \def \E #1#2{\catcode#1 = \active
359 \begingroup \uccode`\~ = #1\uppercase{\endgroup \def ~{#2}}}

There are five different kinds of reencoding:

• Some characters are reencoded to a different character in the same font using the \char primitive; examples are 161 (¡) and 163 (£).

360 \E{161}{\char189 } \E{163}{\char191 } \E{167}{\char159 }
361 \E{171}{\char19 }  \E{184}{\char11 }  \E{187}{\char20 }
362 \E{191}{\char190 } \E{223}{\char255 } \E{255}{\char184 }

\CC • Other characters can be found in the Companion font, known to StarTEX as the Alternate font. The macro \CC is used for this; its parameter #1 is the character’s position in the companion font. Examples are 162 (¢) and 164 (¤).

363 \def \CC #1{{\def\FontAlt{A}\SelectFont \char#1}}
364 \E{162}{\CC{162}} \E{164}{\CC{164}} \E{165}{\CC{165}}
365 \E{166}{\CC{166}} \E{168}{\CC{168}} \E{169}{\CC{169}}
366 \E{170}{\CC{170}} \E{172}{\CC{172}} \E{174}{\CC{174}}
367 \E{175}{\CC{175}} \E{176}{\CC{176}} \E{180}{\CC{180}}
368 \E{182}{\CC{182}} \E{186}{\CC{186}}

\MC • A few characters are math characters, like 185 (¹) and 246 (÷). They are defined using the macro \MC which has two parameters: #1 is the character’s position in the companion font to be used in text mode, and #2 is some TEX code to be used in math mode.

369 \def \MC #1#2{\ifmmode #2 \else \CC{#1}\fi }
370 \E{177}{\MC{177}{\pm}}       \E{178}{\MC{178}{^2{}}}
371 \E{179}{\MC{179}{^3{}}}      \E{181}{\MC{181}{\mu}}
372 \E{183}{\MC{183}{\cdot}}     \E{185}{\MC{185}{^1{}}}
373 \E{188}{\MC{188}{{1\over4}}} \E{189}{\MC{189}{{1\over2}}}
374 \E{190}{\MC{190}{{3\over4}}} \E{215}{\MC{214}{\times}}
375 \E{247}{\MC{246}{\div}}

• Character 160 is a “non-break space” which is treated just like a ~ in TEX.

376 \E{160}{\penalty10000\ }

• Character 173 is a “soft hyphen” which is treated like \- in TEX.

377 \E{173}{\-}

1.6.4 Language-specific definitions

378 \def \AbstractName {Abstract}
379 \def \FigureName   {Figure}
380 \def \TableName    {Table}
381 \def \TimeSep      {:}

382

383 \Cdef {today}{\the\day\Th{\day} \Month\space\the\year}

384

385 \def \Month {\ifcase \month \or January\or February\or March\or
386 April\or May\or June\or July\or August\or September\or
387 October\or November\or December\fi }

388

389 \def \Th #1{% %% English date suffices:

390 \ifnum #1=1 st\else\ifnum #1=21 st\else\ifnum #1=31 st\else
391 \ifnum #1=2 nd\else\ifnum #1=22 nd\else
392 \ifnum #1=3 rd\else\ifnum #1=23 rd\else th\fi\fi\fi\fi\fi\fi\fi }

393

394 \Cdef {now}{\Minutes = \time  \Hours = \Minutes
395 \divide \Hours by 60  \Htemp = \Hours  \multiply \Htemp by -60
396 \advance \Minutes by \Htemp
397 \the\Hours \TimeSep \ifnum \Minutes > 9 \else 0\fi \the\Minutes }
398 \newcount \Minutes  \newcount \Hours  \newcount \Htemp

1.7 Math mode

399 \mathcode`< = "8000

400

401 \Cdef {math}{\MathFonts \NewEnvir{math}{$}{$}}
402 \Cdef {/math}{\EndEnvir{math}}

403

404 \Cdef {displaymath}{\endgraf \MathFonts \NewEnvir{displaymath}{$$}{$$}}
405 \Cdef {/displaymath}{\EndEnvir{displaymath}}

406

407 \def \MSetFont #1#2{\font \NewMFont = \csname #2\endcsname
408 #1 = \NewMFont }
409 \def \MathFonts {\if \FontSize \LastMathSize \else
410  \MSetFont{\textfont0}{M-\FontSize N0}%
411  \MSetFont{\scriptfont0}{M-\FontSize S0}%
412  \MSetFont{\scriptscriptfont0}{M-\FontSize X0}%
413  \MSetFont{\textfont1}{M-\FontSize N1}%
414  \MSetFont{\scriptfont1}{M-\FontSize S1}%
415  \MSetFont{\scriptscriptfont1}{M-\FontSize X1}%
416  \MSetFont{\textfont2}{M-\FontSize N2}%
417  \MSetFont{\scriptfont2}{M-\FontSize S2}%
418  \MSetFont{\scriptscriptfont2}{M-\FontSize X2}%
419  \MSetFont{\textfont3}{M-\FontSize N3}%
420  \MSetFont{\scriptfont3}{M-\FontSize S3}%
421  \MSetFont{\scriptscriptfont3}{M-\FontSize X3}%
422  \MSetFont{\textfont4}{M-\FontSize N4}%
423  \MSetFont{\scriptfont4}{M-\FontSize S4}%
424  \MSetFont{\scriptscriptfont4}{M-\FontSize X4}%
425  \MSetFont{\textfont5}{M-\FontSize N5}%
426  \MSetFont{\scriptfont5}{M-\FontSize S5}%
427  \MSetFont{\scriptscriptfont5}{M-\FontSize X5}%
428  \let \LastMathSize = \FontSize
429 \fi }
430 \def \LastMathSize {?}

1.7.1 Letters

The standard 26 letters are already defined, but we must define the others, like ‘é’ and ‘Å’. These are taken from the dcti font (number 5 in StarTEX).

431 \def \MCo #1{\mathcode"#1 = "05#1 \relax }
432 \MCo{C0}\MCo{C1}\MCo{C2}\MCo{C3}\MCo{C4}\MCo{C5}\MCo{C6}\MCo{C7}
433 \MCo{C8}\MCo{C9}\MCo{CA}\MCo{CB}\MCo{CC}\MCo{CD}\MCo{CE}\MCo{CF}
434 \MCo{D0}\MCo{D1}\MCo{D2}\MCo{D3}\MCo{D4}\MCo{D5}\MCo{D6}
435 \MCo{D8}\MCo{D9}\MCo{DA}\MCo{DB}\MCo{DC}\MCo{DD}\MCo{DE}\MCo{DF}

436 \MCo{E0}\MCo{E1}\MCo{E2}\MCo{E3}\MCo{E4}\MCo{E5}\MCo{E6}\MCo{E7}
437 \MCo{E8}\MCo{E9}\MCo{EA}\MCo{EB}\MCo{EC}\MCo{ED}\MCo{EE}\MCo{EF}
438 \MCo{F0}\MCo{F1}\MCo{F2}\MCo{F3}\MCo{F4}\MCo{F5}\MCo{F6}
439 \MCo{F8}\MCo{F9}\MCo{FA}\MCo{FB}\MCo{FC}\MCo{FD}\MCo{FE}\MCo{FF}

1.7.2 Operators

\MSy \MSy is used to insert a mathematical symbol. It will expand to #1, and insert a math mode environment ($… $) if required.

440 \def \MSy #1{\ifmmode #1\else $#1$\fi }

\MOp \MOp is also used to insert the mathematical symbol #2, but gives an error message if not in a math environment. Parameter #1 is the StarTEX command name, which is used in the error message.

441 \def \MOp #1#2{\ifmmode \def \MNext {#2}\else
442 \Error{Command <#1> is only allowed in math mode;}%
443  {command ignored.}\let \MNext = \relax \fi
444 \MNext }

\Mdef \Mdef is used to define a StarTEX mathematical symbol command based on \MSy whenever the StarTEX command is identical to the name of the corresponding TEX macro; parameter #1 is the name of both.

445 \def \Mdef #1{\Cdef{#1}{\MSy{\csname #1\endcsname}}}

\Odef \Odef is similar to \Mdef but is for definitions based on \MOp rather than \MSy.

446 \def \Odef #1{\Cdef{#1}{\MOp{#1}{\csname #1\endcsname}}}

These commands are now used to define all the standard unary and binary operators.

447 \Mdef{amalg} \Mdef{bigcirc} \Mdef{bigtriangleup}
448 \Mdef{bigtriangledown} \Mdef{bullet} \Mdef{cap} \Mdef{circ}
449 \Mdef{cup} \Mdef{dagger} \Mdef{ddagger} \Mdef{diamond} \Mdef{mp}
450 \Mdef{odot} \Mdef{ominus} \Mdef{oplus} \Mdef{oslash} \Mdef{otimes}
451 \Mdef{setminus} \Mdef{sqcap} \Mdef{sqcup} \Mdef{star}
452 \Mdef{triangleleft} \Mdef{triangleright} \Mdef{uplus} \Mdef{vee}
453 \Mdef{wedge} \Mdef{wr}

1.7.3 Relations

These are the various relations available.

454 \Cdef{gt}{>} \Cdef{lt}{\ifmmode \mathchar"313C \else <\fi}
455 \Mdef{approx} \Mdef{asymp} \Mdef{bowtie} \Mdef{cong} \Mdef{doteq}
456 \Mdef{dashv} \Mdef{equiv} \Mdef{frown} \Mdef{geq} \Mdef{gg} \Mdef{in}
457 \Mdef{leq} \Mdef{ll} \Mdef{mid} \Mdef{models} \Mdef{neq} \Mdef{ni}
458 \Mdef{notin} \Mdef{parallel} \Mdef{perp} \Mdef{prec} \Mdef{preceq}
459 \Mdef{sim} \Mdef{simeq} \Mdef{smile} \Mdef{sqsubseteq} \Mdef{sqsupseteq}
460 \Mdef{subset} \Mdef{subseteq} \Mdef{supset} \Mdef{supseteq}
461 \Mdef{succ} \Mdef{succeq} \Mdef{vdash}

1.7.4 Delimitiers

In addition to (), [], {} and |, the following delimiters are defined:

462 \Mdef{langle} \Mdef{lceil} \Mdef{lfloor} \Mdef{rangle}
463 \Mdef{rceil} \Mdef{rfloor}

1.7.5 Arrows

All the standard arrows are included.

464 \Mdef{leftarrow} \Mdef{rightarrow} \Mdef{leftrightarrow}
465 \Mdef{longleftarrow} \Mdef{longrightarrow} \Mdef{longleftrightarrow}
466 \Mdef{uparrow} \Mdef{downarrow}
467 \Mdef{updownarrow} \Mdef{nearrow} \Mdef{nwarrow} \Mdef{searrow}
468 \Mdef{swarrow} \Mdef{mapsto} \Mdef{longmapsto} \Mdef{hookleftarrow}
469 \Mdef{hookrightarrow} \Mdef{leftharpoonup} \Mdef{rightharpoonup}
470 \Mdef{leftharpoondown} \Mdef{rightharpoondown} \Mdef{rightleftharpoons}

Some arrow use uppercase letters to indicate double arrows. I use the prefix double instead.

471 \Cdef{doubleleftarrow}{\MSy{\Leftarrow}}
472 \Cdef{doublerightarrow}{\MSy{\Rightarrow}}
473 \Cdef{doubleleftrightarrow}{\MSy{\Leftrightarrow}}
474 \Cdef{doublelongleftarrow}{\MSy{\Longleftarrow}}
475 \Cdef{doublelongrightarrow}{\MSy{\Longrightarrow}}
476 \Cdef{doublelongleftrightarrow}{\MSy{\Longleftrightarrow}}
477 \Cdef{doubleuparrow}{\MSy{\Uparrow}}
478 \Cdef{doubledownarrow}{\MSy{\Downarrow}}
479 \Cdef{doubleupdownarrow}{\MSy{\Updownarrow}}

1.7.6 Big symbols

480 \Odef{bigcap} \Odef{bigcup} \Odef{bigodot} \Odef{bigoplus}
481 \Odef{bigotimes} \Odef{bigsqcup} \Odef{biguplus} \Odef{bigvee}
482 \Odef{bigwedge} \Odef{coprod} \Odef{int} \Odef{oint}
483 \Odef{prod} \Odef{sum}

1.7.7 Function names

Some names are defined as commands to ensure that they will be printed in the correct font.

484 \Cdef{pr}{\MSy{\Pr}}
485 \Mdef{arccos} \Mdef{arcsin} \Mdef{arctan} \Mdef{arg} \Mdef{cos}
486 \Mdef{cosh} \Mdef{cot} \Mdef{coth} \Mdef{csc} \Mdef{deg} \Mdef{det}
487 \Mdef{dim} \Mdef{exp} \Mdef{gcd} \Mdef{hom} \Mdef{inf} \Mdef{ker}
488 \Mdef{lg} \Mdef{lim} \Mdef{liminf} \Mdef{limsup} \Mdef{ln}
489 \Mdef{log} \Mdef{max} \Mdef{min} \Mdef{sec} \Mdef{sin} \Mdef{sinh}
490 \Mdef{sup} \Mdef{tan} \Mdef{tanh}

1.7.8 Greek letters

491 \Mdef{alpha} \Mdef{beta} \Mdef{gamma} \Mdef{delta} \Mdef{epsilon}
492 \Mdef{varepsilon} \Mdef{zeta} \Mdef{eta} \Mdef{theta} \Mdef{vartheta}
493 \Mdef{iota} \Mdef{kappa} \Mdef{lambda} \Mdef{mu} \Mdef{nu} \Mdef{xi}
494 \Cdef {omicron}{\MSy{o}} \Mdef{pi} \Mdef{varpi} \Mdef{rho} \Mdef{varrho}
495 \Mdef{sigma} \Mdef{varsigma} \Mdef{tau} \Mdef{upsilon} \Mdef{phi}
496 \Mdef{varphi} \Mdef{chi} \Mdef{psi} \Mdef{omega}

The special uppercase Greek letters can be found in the cmr font, which is font no 0. The letters which also exist in the Latin alphabet, like A and B, are also taken from this font, as we want upright rather than slanted versions.

497 \Cdef{ucgamma}{\MSy{\Gamma}} \Cdef{ucdelta}{\MSy{\Delta}}
498 \Cdef{uctheta}{\MSy{\Theta}} \Cdef{uclambda}{\MSy{\Lambda}}
499 \Cdef{ucxi}{\MSy{\Xi}}       \Cdef{ucpi}{\MSy{\Pi}}
500 \Cdef{ucsigma}{\MSy{\Sigma}} \Cdef{ucupsilon}{\MSy{\Upsilon}}
501 \Cdef{ucphi}{\MSy{\Phi}}     \Cdef{ucpsi}{\MSy{\Psi}}
502 \Cdef{ucomega}{\MSy{\Omega}}

The letters which also exist in the Latin alphabet, like A and B, are also taken from this font, as we want upright rather than slanted versions of the characters.

503 \def \MGr #1#2{\Cdef{#1}{\MSy{\mathchar"#2}}}
504 \MGr{ucalpha}{0041}   \MGr{ucbeta}{0042} \MGr{ucepsilon}{0045}
505 \MGr{uczeta}{005A}    \MGr{uceta}{0048}  \MGr{uciota}{0049}
506 \MGr{uckappa}{004B}   \MGr{ucmu}{004D}   \MGr{ucnu}{004E}
507 \MGr{ucomicron}{004F} \MGr{ucrho}{0050}  \MGr{uctau}{0054}
508 \MGr{ucchi}{0058}

1.7.9 Calligraphic letters

509 \def \MCal #1{\Cdef{cal#1}{\uppercase{\MSy{\cal #1}}}}
510 \MCal{a} \MCal{b} \MCal{c} \MCal{d} \MCal{e} \MCal{f} \MCal{g}
511 \MCal{h} \MCal{i} \MCal{j} \MCal{k} \MCal{l} \MCal{m} \MCal{n}
512 \MCal{o} \MCal{p} \MCal{q} \MCal{r} \MCal{s} \MCal{t} \MCal{u}
513 \MCal{v} \MCal{w} \MCal{x} \MCal{y} \MCal{z}

1.7.10 Other symbols

514 \Mdef{aleph} \Mdef{angle} \Mdef{bot} \Mdef{ell} \Mdef{emptyset}
515 \Mdef{exists} \Mdef{forall} \Mdef{hbar}
516 \Mdef{nabla}\Mdef{neg}\Odef{not} \Mdef{partial} \Mdef{surd}
517 \Mdef{top} \Mdef{wp}
518 \Cdef{,}{{,}}
519 \Cdef{...}{\MSy{\ldots}\hskip 0.001pt \relax }
520 \Cdef{:}{\MSy{\vdots}}\Cdef{:::}{\MSy{\cdots}}
521 \Cdef{infinity}{\MSy{\infty}}\Cdef{im}{\MSy{\Im}}\Cdef{re}{\MSy{\Re}}

1.7.11 Subscripts and superscripts

522 \Cdef {sub}{\MOp{sub}{\NewEnvir{sub}{_\bgroup}{\egroup}}}
523 \Cdef {/sub}{\MOp{/sub}{\EndEnvir{sub}}}
524 \Cdef {sup}{\MOp{sup}{\NewEnvir{sup}{^\bgroup}{\egroup}}}
525 \Cdef {/sup}{\MOp{/sup}{\EndEnvir{sup}}}

1.7.12 Fractions

526 \Cdef {frac}{\MOp{frac}{\NewEnvir{frac}{\bgroup}{\egroup}%
527  \NOver = 0\relax}}
528 \Cdef {over}{\MOp{over}{\FracOver}}
529 \Cdef {/frac}{\MOp{/frac}{\ifnum \NOver = 0
530  \Error{No <over> in the <frac>...<over>...</frac> environment.}{}\fi
531  \EndEnvir{frac}}}
532 \def \FracOver {\ifTextEqual{\CurEnv}{frac}%
533  \ifnum \NOver = 0 \over
534  \else \Error{Only one <over> may occur in each <frac>...</frac>
535  environment.}{}%
536  \fi  \advance \NOver by 1

537 \else \Error{<over> only allowed in a
538  <frac>...<over>...</frac> environment.}{}%
539 \fi }
540 \newcount \NOver

1.7.13 Roots

<sqrt> </sqrt>
541 \Cdef {sqrt}{\MOp{sqrt}{\NewEnvir{sqrt}{\sqrt\bgroup}{\egroup}}}
542 \Cdef {/sqrt}{\MOp{/sqrt}{\EndEnvir{sqrt}}}

1.8 PostScript figures

<psfig> StarTEX allows the inclusion of PostScript figures through the <psfig>… </psfig> environment. It checks if the command is allowed in the current state, and, if it is, \PSfig is called; if not, \PSfigError is called instead.

543 \Cdef {psfig}{\if \State x \let \Next = \PSfig \else
544 \let \Next = \PSfigError \fi
545 \Next }
546 \Cdef {/psfig}{\AddVspace{6pt plus 1pt}
547 \ifx \PSfile \relax \else
548  \centerline{\epsfbox{\PSfile}}%
549  \AddVspace{10pt plus 2pt minus 1pt}
550 \fi
551 \EndEnvir{psfig}}

\PSfig \PSfig checks whether the user has remembered the file name; if so \PSfetch is called to read the PostScript file.

552 \def \PSfig{\NewEnvir{psfig}{\topinsert}{\endinsert}
553 \let \PSfile = \relax \let \State = p
554 \IfNextChar{[}%
555  {\PSfetch}%
556  {\Error{No file name for PostScript figure;}%
557  {the syntax is: <psfig>[file name]caption text</psfig>.}%
558  \PScaption}}

\PSfigError \PSfigError gives an error message and starts a dummy environment.

559 \def \PSfigError {\endgraf
560 \Error{Calls on <psfig> not allowed inside <psfig> or <table>;}%
561  {the command was ignored.}%
562 \NewEnvir{psfig}{\begingroup}{\endgroup}}

\PSfetch The actual figure inclusion is handled by the \PSfetch macro which uses the \epsfbox macro in the epsf package distributed with the dvips program.

563 \input epsf.tex
564 \def \PSfetch [#1]{\IfFileExists{#1}%
565  {\gdef \PSfile {#1}}%
566  {\Error{PostScript file `#1' could not be found.}{}}%
567  \PScaption }

\epsfsize \epsfsize is used by \epsfbox to scale the PostScript figure. We want figures to fill either 80% of the text width or 40% of the text height. This is done by comparing 0.8hsize<0.4vsize×#1/#2, where #1 and #2 are the horizontal and vertical original sizes of the the figure.

568 \def \epsfsize #1#2{0pt \dimen1 = 0.8\hsize  \dimen2 = 0.4\vsize
569 \floatdiv{\dimen2}{#1}{#2}%
570 \ifdim \dimen1 < \divres \epsfxsize = 0.8\hsize
571 \else \epsfysize = 0.4\vsize \fi }

\PScaption The formatting of the caption is done by \PScaption:

572 \def \PScaption {\global\advance \FigCnt by 1
573 \edef \CurDef {\the\FigCnt}
574 \leftskip = 0.1\hsize  \rightskip = \leftskip
575 \ResetFont \SetSize{S}\Indentfalse
576 \FigureName~\FigIm: \ignorespaces }

\PScaption needs a counter to count the figures:

577 \newcount \FigCnt

1.9 Tables

<table> </table> Tables are created with the <table>… </table> environment. It checks if the command is allowed in the current state and calls \Table if it is; otherwise it calls

 \TableError.
578 \Cdef {table}{\if \State x\let \Next = \Table \else
579 \let \Next = \TableError \fi
580 \Next }
581 \Cdef {/table}{\EndEnvir{table}}

The table is temporarily placed in a box so that it may be centered when output.

582 \newbox \TableBox

\Table \Table starts the table environment.

583 \def \Table{\topinsert
584 \NewEnvir{table}{\TableCaption}{\LastRow\endinsert}%
585 \let \State = t}

\TableCaption The formatting of the table caption is done by \TableCaption:

586 \def \TableCaption {\global\advance \TabCnt by 1
587 \edef \CurDef {\the\TabCnt}
588 \leftskip = 0.1\hsize  \rightskip = \leftskip
589 \ResetFont \SetSize{S}\Indentfalse
590 \TableName~\TabIm: \ignorespaces }

\TableCaption needs a counter to count the tables:

591 \newcount \TabCnt

\TableError \TableError gives an error message and starts a dummy environment.

592 \def \TableError {\endgraf
593 \Error{Calls on <table> not allowed inside <psfig>
594  or <table>;}{the command was ignored.}%
595 \NewEnvir{table}{\begingroup}{\endgroup}}

1.9.1 Table rows

{<row> \atop \Row} The command <row> is the interface to \Row which is used to start another table row. Its actions depend on the current state.

596 \Cdef {row}{\Row}
597 \def \Row {\if \State t\FirstRow\NewRow \else
598 \if \State r\EndRow\NewRow   \else
599 \Error{The <row> command is only allowed inside a
600  <table>.}{The command was ignored.}\fi\fi }

\FirstRow \FirstRow is called prior to the first table row.

601 \def \FirstRow {\endgraf \ResetFont \SelectFont \let \State = r%
602 \setbox\TableBox = \hbox\bgroup \vbox\bgroup \offinterlineskip
603  \halign\bgroup \vrule ##\strut&&
604  \kern 6pt \hfil ##\unskip \hfil \kern 6pt \vrule \cr
605  \noalign{\hrule}}

\NewRow \NewRow is used to start another table row.

606 \def \NewRow {&}

\EndRow The command \EndRow is used to terminate the current table row.

607 \def \EndRow {\cr \noalign{\hrule}}

\LastRow The command \LastRow is used to terminate the last table row.

608 \def \LastRow {\if \State r\EndRow\PrintTable\fi}

\PrintTable \PrintTable is the final command used when processing a table. It terminated the table structure and outputs it.

609 \def \PrintTable {\egroup\egroup\egroup
610 \AddVspace{6pt plus 2pt minus 1pt}
611 \centerline{\box\TableBox}%
612 \AddVspace{10pt plus 4pt minus 2pt}}

1.9.2 Table columns

<col> <col> is used to start another table column.

613 \Cdef {col}{\if \State r&\else
614 \Error{The <col> command is only allowed after a <row>
615  inside a <table>.}{The command was ignored.}\fi}

1.10 Cross-references

This section describes the various commands used for cross-referencing.

The basic idea is the same as used in L^{A}TEX: an extra file (with extension .aux) contains all the labels defined in the document. There are two reasons for this:

• Using a separate file makes it possible to have forward references.

• When processing a document, the page number of each label is not known until the page is actually written to the dvi file. The \write command is, consequently, delayed until that stage of the processing, so the use of a file will always give us the correct page number.

\ifAuxOpen The .aux file is only created when there are <label> commands in the document. The first <label> creates the file, and the flag \ifAuxOpen indicates whether this has been done.

616 \newif \ifAuxOpen

1.10.1 Defining labels

<label> <label> is used to define another cross-reference label. The value of the label is

the current value of \CurDef which is set by <h1>, <table>, etc.

<label> first checks the syntax, and then alters the \catcode of < in case there are any <s in the label. Finally, it calls \NewLabel to perform the actual definition.

617 \Cdef {label}{\IfNextChar{[}%
618  {\begingroup \catcode`\< = 12 \NewLabel}%
619  {\Error{No label given;}%
620  {the syntax is <label>[your label].}}}

\NewLabel \NewLabel first reads the old .aux file (unless it has already been read) and opens a new .aux file (unless that has been done).

621 \def \NewLabel [#1]{\endgroup
622 \ifAuxRead \else \ReadAuxFile \fi
623 \ifAuxOpen \else
624  \immediate\openout \NewAuxFile = \jobname.aux
625  \global\AuxOpentrue \fi

Then, it checks whether the label has been previously defined, and prints an error message it it has been. Otherwise, it notes the definition and writes the necessary data to the .aux file.^{5}

626 \expandafter\ifx \csname L]#1\endcsname \relax
627  \expandafter\edef \csname L]#1\endcsname{\the\inputlineno}%
628  {\let \the = 0\relax
629  \edef \WriteCurDef {\write \NewAuxFile
630  {\string\LabelDef
631  ]#1]\the\pageno]\CurDef E-o-LabelDef\string\relax}}%
632  \WriteCurDef }%
633 \else
634  \Error{Label `#1' already defined on line \csname L]#1\endcsname;}%
635  {this definition is ignored.}%
636 \fi }

The new .aux file must be declared.

637 \newwrite \NewAuxFile

We must also defined an initial value for \CurDef in case the user calls <label> prior to the first <hx>.

638 \edef \CurDef {0}

5Note the trick of redefining \the so that \pageno is not expanded until the page is completed.

On the other hand, we want the current value of \CurDef.

1.10.2 Reading the cross-reference label file

\ReadAuxFile \ReadAuxFile reads the .aux file produced by the previous run. It redefines the \catcode of < in case that characters occurs in a label.

639 \def \ReadAuxFile {\IfFileExists{\jobname.aux}%
640  {\begingroup
641  \def \LabelDef {\begingroup
642  \catcode `\\ = 12\relax \FetchLabel }%
643  \catcode `\< = 12 \catcode `\\ = 0\relax
644  \input \jobname.aux
645  \global\AuxReadtrue
646  \endgroup }%
647  {\global\Reruntrue}}

\LabelDef A StarTEX .aux file consists of a sequence of calls on \LabelDef. \LabelDef just alters the \catcode of \ (in case there are \s in the label), and calls \FetchLabel to do the actual definition.

\FetchLabel \FetchLabel has three parameters. The label is parameter #1; it is enclosed by a set of ]s.^{6} Parameter #2 is the referenced page number; it is also terminated by a ]. The label reference is parameter #3; it is terminated by the text “E-o-LabelDef”.

648 \def \FetchLabel ]#1]#2]#3E-o-LabelDef{%
649  \expandafter\gdef \csname R]#1\endcsname {#3}%
650  \expandafter\gdef \csname P]#1\endcsname {#2}%
651 \endgroup }

The flag \ifAuxRead tells whether the .aux file from the previous run has been read.

652 \newif \ifAuxRead

The flag \ifRerun is set whenever it is detected that a new label has been defined or the definition of a label has been modified. This implies that it is necessary to run StarTEX again.^{7}

653 \newif \ifRerun

1.10.3 Checking the .aux file

\CheckAux At the end of each run, the .aux file is checked by \CheckAux to see if any label were modified during the run. If so, the flag \ifRerun is set.

654 \def \CheckAux {\immediate\closeout \NewAuxFile
655 \begingroup
656  \def \LabelDef {\begingroup
657  \catcode `\\ = 12 \relax  \CheckLabel }%
658  \catcode `\< = 12  \catcode `\\ = 0\relax
659  \input \jobname.aux
660 \endgroup }

\CheckLabel \CheckLabel does the actual checking by comparing the new definition with the old one.

6We can be certain that no ] occurs in the label.

7It would be nice to be able to do this automatically, but that is not possible with the present TEX.

661 \def \CheckLabel ]#1]#2]#3E-o-LabelDef{%
662 \ifTextEqual{#2++#3}%
663  {\csname P]#1\endcsname++\csname R]#1\endcsname}%
664 \else
665  \global\Reruntrue
666 \fi \endgroup }

1.10.4 Referencing labels

<ref> <ref> is used to reference a label. It checks the syntax, and calls \GiveRef to produce the actual reference.

667 \Cdef {ref}{\IfNextChar{[}%
668 {\begingroup \catcode `\< = 12 \relax \GiveRef }%
669 {\Error{No label referenced;}{the syntax is <ref>[your label].}}}

\GiveRef \GiveRef checks whether the reference has been defined, and, if it is defined, typesets the reference in the format specified by \RefFormat.

670 \def \GiveRef [#1]{\ifAuxRead \else \ReadAuxFile \fi
671 \expandafter\ifx \csname R]#1\endcsname \relax
672  [label #1]%
673  \Error{Label `#1' not defined.}{}\global\Reruntrue
674 \else
675  \RefFormat{\csname R]#1\endcsname}{\csname P]#1\endcsname}%
676 \fi \endgroup }

\RefFormat The macro \RefFormat gives the appearance of the reference. The default is a (possibly composite) number followed by “on page x” unless the reference is to the same page.^{8}

677 \def \RefFormat #1#2{#1\ifTextEqual{#2}{\the\pageno}\else
678  \space on page~#2\fi }

1.11 Miscellaneous other commands

1.12 Symbols and logos

679 {\catcode`\~ = 12 \Cdef {~}{\penalty10000\ }}
680 \Cdef {}{\null}
681 \Cdef {-}{\-}
682 \Cdef {--}{--}
683 \Cdef {---}{---}
684 \Cdef {``}{``}
685 \Cdef {''}{''}
686 \Cdef {tex}{\TeX}
687 \Cdef {latex}{La\TeX}
688 \Cdef {startex}{Star\TeX}

1.12.1 Error handling

\Error This macro gives an error message with one or two lines of text. (The second line is omitted if it is empty.)

8The page test used will not always give the correct result; if the reference is very near the top or the bottom of a page, \pageno will sometimes be 1 off. This is not a serious problem, as the referenced object in that case will be very close to the reference.

689 \def \Error #1#2{%
690 \message{^^J** StarTeX error detected on line \the\inputlineno:^^J}%
691 \message{\space\space\space #1^^J}%
692 \ifTextEqual{#2}{}\else \message{\space\space\space #2^^J}\fi}

\Warning This macro gives a warning with one or two lines of text. (The second line is omitted if it is empty.)

693 \def \Warning #1#2{%
694 \message{^^J** StarTeX warning:^^J}%
695 \message{\space\space\space #1^^J}%
696 \ifTextEqual{#2}{}\else \message{\space\space\space #2^^J}\fi}

We need to modify the \newlinechar in order to produce a line feed when we want it. The lf character (ascii code 10 = ^^J) seems a good choice.

697 \newlinechar = `^^J

1.12.2 Comments

<comment> </comment> The environment <comment>… </comment> is defined to make it possible for the user to add comments to his or her StarTEX code. It uses \SkipComment to fetch the comment text.

698 \Cdef {comment}{\NewEnvir{comment}{\begingroup}{\endgroup}%
699 \catcode `\< = 12 \SkipComment }
\SkipComment  \SkipComment works just like \ReadCode for a <code>. . . </code> environment,

except that the code is simply ignored.

700 {\catcode `\< = 12
701 \gdef \SkipComment #1</comment>{\EndEnvir{comment}}}

1.12.3 Text handling

There is very little text handling in StarTEX, but a few macroes are necessary.

\ifTextEqual The macro \ifTextEqual^{9} tests if the two texts #1 and #2 are equal. This is achieved by letting the TEX primitive \ifx do the job.

702 \def \ifTextEqual #1#2{\edef \TmpA {#1}\edef \TmpB {#2}%
703 \ifx \TmpA\TmpB }

\IfNextChar Sometimes we need to check the next input character, for instance to see if it is a [. The macro \IfNextChar expands into #2 if the next input character is #1; otherwise it expands into #3.

The TEX primitive \futurelet is used to implement \IfNextChar; it was designed just for this. Note that the call on \IfNextChar must be at the very end of the macro in which it occurs.

704 \def \IfNextChar #1#2#3{\def \TestChar {#1}%
705 \def \AltA {#2}\def \AltB {#3}%
706 \futurelet \NextChar \TestNextChar }

9The name \ifTextEqual starts with a lowercase \if- to show its relationship to the various \if… macros of primitive TEX. \ifTextEqual is used just like these, which means that it must have a corresponding \fi. It may also have an \else part. Note, however, that calls on \ifTextEqual may not occur inside other \ifs.

\TestNextChar
707 \def \TestNextChar {%
708 \if \NextChar \TestChar \let\Next=\AltA \else \let\Next=\AltB \fi
709 \Next }

\IfNextCharTwo A similar macro testing whether the following character is one of two possible alternatives, is also necessary. It takes four parameters: #1 and #2 are the two characters to check for, and the result of \IfNextCharTwo is #3 if the next character is either or the other of the two alternatives, or else #4.

710 \def \IfNextCharTwo #1#2#3#4{\def \TestChar {#1}\def \TestCharX {#2}%
711 \def \AltA {#3}\def \AltB {#4}%
712 \futurelet \NextChar \TestNextCharTwo }
\TestNextCharTwo
713 \def \TestNextCharTwo {%
714 \if \NextChar \TestChar  \let \Next = \AltA \else
715 \if \NextChar \TestCharX \let \Next = \AltA \else
716  \let \Next = \AltB
717 \fi \fi
718 \Next }

1.12.4 Numerical operations

\floatdiv TEX has no floating-point division, so routines like \floatdiv are necessary. It computes \frac{#1×#2}{#3} and places the result in \divres.^{10} All parameters must be \dimen registers.

719 \def \floatdiv #1#2#3{\divtemp = #1\divide \divtemp by #3%
720 \divres = #2\multiply \divres by \divtemp
721 \multiply \divtemp by #3%
722 \divrem = #1\advance \divrem by -\divtemp
723 \divtemp = #2%
724 \loop
725  \multiply \divrem by 2  \divide \divtemp by 2
726 \ifnum \divtemp > 0
727  \ifnum \divrem < #3\else
728  \advance \divrem by -#3\advance \divres by \divtemp
729  \fi
730 \repeat }

\divrem \divres \divtemp The necessary registers must be declared:

731 \newdimen \divrem   \newdimen \divres   \newdimen \divtemp

1.12.5 File operations

\ifFileExists To provide better error messages, StarTEX tests whether files exist before any attempt is made to read them. \ifFileExists first checks if file #1 exists;^{11} if it does, the file is closed and #2 is executed, otherwise #3 is executed.

732 \def \IfFileExists #1#2#3{\openin\TestFile = #1
733 \ifeof\TestFile \def \Next {#3}\else

10The algorithm used is taken from the code in epsf.tex.

11This checking is done by using \ifeof which means that empty files will be regarded as non-existant; this should not really be a problem.

734 \closein\TestFile \def \Next {#2}\fi
735 \Next }

We must also define the input file we use for testing.

\TestFile
736 \newread \TestFile

1.12.6 Format creation

<make-new-format> <make-new-format> is used by the system to make a new format; it is not intended to be called by the user.

737 \Cdef {make-new-format}{\dump}

<trace-on> <trace-off> <trace-on> is used during debugging to trace the expansion of commands, and <trace-off> turns this tracing off. Using tracing requires insight into both the inner mechanisms of StarTEX as well as TEX itself.

738 \Cdef {trace-on}{\tracingcommands = 1 \tracingmacros = 1
739 \tracingrestores = 1 \tracingoutput = 1 \relax }
740 \Cdef {trace-off}{\tracingcommands = 0 \tracingmacros = 0
741 \tracingrestores = 0 \tracingoutput = 0 \relax }

1.13 Final initialization

In the final initialization, we need to load the hyphenation patterns defined at this site:

742 \input startex.lan

We select the default text font:

743 \ResetFont \SetSize{N}

Our very last initialization is to modify the \catcodes:

744 \endinput \SpecialCatCodes

745 ⟨/code⟩

2 Language definitions

This section describes the file startex.lan that defines which hyphenation patterns are known to StarTEX. It should be adapted to the needs of each local installation.

746 ⟨∗languages⟩

\DefLang The macro \DefLang is used to defined a new language. It has three parameters: #1 is the internal number of the language, #2 is the internal name of the language, and #3 is the name of the file from which to read hyphenation patterns for the language.

747 \def \DefLang #1#2#3{\expandafter\def \csname L-#2\endcsname {#1}%
748 \language = #1 \input #3}%

Only one language is predefined here, as this file will have to be adapted to local needs anyhow. american (American English) has already been defined as language 0 by plain TEX.

749 \expandafter\def \csname L-american\endcsname {0}%
750 \DefLang{1}{norsk}{nohyph2.tex}%

We want American English as our default:

751 \language = 0

752 ⟨/languages⟩

3 Sample document styles

Included are also four document styles:

article is used for ordinary articles. As this is the default definition of StarTEX, this style is empty.

a4-article is just an adaption of article to fit A4 paper.

ifi-article is the style used for articles at Ifi (“Institutt for informatikk”, the Department of Informatics at the Univeristy of Oslo). It uses Concorde as the main text font, and A4 paper.

ifi-artikkel is ifi-article adapted to Norwegian text.

Each style file contains the necessary redefinitions.

3.1 Paper size

Every style except article uses A4 paper. The margins are set to 2.5 cm.

753 ⟨∗a4 − article | ifi − article | ifi − artikkel⟩

754 \hoffset = -1in  \advance \hoffset by 2.5cm  \hsize = 16cm
755 \voffset = -1in  \advance \voffset by 2.5cm  \vsize = 24.7cm

756 ⟨/a4 − article | ifi − article | ifi − artikkel⟩

3.2 Language adaption

The ifi-artikkel is for text in Norwegian. We must select the correct language and

adjust \lefthyphenmin and \righthyphenmin.

757 ⟨∗ifi − artikkel⟩

758 \language = \csname L-norsk\endcsname
759 \lefthyphenmin = 1 \righthyphenmin = 2
\AbstractName \FigureName \TableName Some names must also be redefined.
760 \def \AbstractName {Sammendrag}%
761 \def \FigureName   {Figur}%
762 \def \TableName    {Tabell}%
763 \def \TimeSep      {.}%

\RefFormat The format for references must be translated into Norwegian.

764 \def \RefFormat #1#2{#1\ifTextEqual{#2}{\the\pageno}\else
765 \space p\aa{} side~#2\fi }%

<today> \Month Finally, the date command <today> must be redefined.

766 \Cdef {today}{\the\day.\space \Month\space \the\year }%
767 \def \Month {\ifcase \month \or januar\or februar\or mars\or
768 april\or mai\or juni\or juli\or august\or september\or
769 oktober\or november\or desember\fi }%

770 ⟨/ifi − artikkel⟩

3.3 Text font

The two ifi- styles use Concorde^{12} as the main body text font; it is the official font of the University of Oslo. Since Concorde is a wider font than dcr, and because it has a larger x-height, a smaller font size is used. The DC Companion font is kept for the special symbols.

771 ⟨∗ifi − article | ifi − artikkel⟩

772 \FontDef{R}{M}{U}{N}{pocr8t at 9.8pt}{tcr1095}%
773 \FontDef{R}{M}{I}{N}{pocri8t at 9.8pt}{tcti1095}%
774 \FontDef{R}{B}{U}{N}{pocb8t at 9.8pt}{tcbx1095}%
775 \FontDef{R}{B}{I}{N}{pocbi8t at 9.8pt}{tcbi1095}%
776 \FontDef{T}{M}{U}{N}{pcrr8t at 9.8pt}{tctt1095}%
777 \FontDef{T}{M}{I}{N}{pcrro8t at 9.8pt}{tcit1095}%
778 \FontDef{T}{B}{U}{N}{pcrb8t at 9.8pt}{tctt1095}%
779 \FontDef{T}{B}{I}{N}{pcrbo8t at 9.8pt}{tcit1095}%
780 \FontDef{R}{M}{U}{L}{pocr8t at 12.9pt}{tcr1440}%
781 \FontDef{R}{M}{I}{L}{pocri8t at 12.9pt}{tcti1440}%
782 \FontDef{R}{B}{U}{L}{pocb8t at 12.9pt}{tcbx1440}%
783 \FontDef{R}{B}{I}{L}{pocbi8t at 12.9pt}{tcbi1440}%
784 \FontDef{T}{M}{U}{L}{pcrr8t at 12.9pt}{tctt1440}%
785 \FontDef{T}{M}{I}{L}{pcrro8t at 12.9pt}{tcit1440}%
786 \FontDef{T}{B}{U}{L}{pcrb8t at 12.9pt}{tctt1440}%
787 \FontDef{T}{B}{I}{L}{pcrbo8t at 12.9pt}{tcit1440}%
788 \FontDef{R}{M}{U}{X}{pocr8t at 15.5pt}{tcr1728}%
789 \FontDef{R}{M}{I}{X}{pocri8t at 15.5pt}{tcti1728}%
790 \FontDef{R}{B}{U}{X}{pocb8t at 15.5pt}{tcbx1728}%
791 \FontDef{R}{B}{I}{X}{pocbi8t at 15.5pt}{tcbi1728}%
792 \FontDef{T}{M}{U}{X}{pcrr8t at 15.5pt}{tctt1728}%
793 \FontDef{T}{M}{I}{X}{pcrro8t at 15.5pt}{tcit1728}%
794 \FontDef{T}{B}{U}{X}{pcrb8t at 15.5pt}{tctt1728}%
795 \FontDef{T}{B}{I}{X}{pcrro8t at 15.5pt}{tcit1728}%
796 \FontDef{R}{M}{U}{S}{pocr8t at 8.9pt}{tcr1000}%
797 \FontDef{R}{M}{I}{S}{pocri8t at 8.9pt}{tcti1000}%
798 \FontDef{R}{B}{U}{S}{pocb8t at 8.9pt}{tcbx1000}%
799 \FontDef{R}{B}{I}{S}{pocbi8t at 8.9pt}{tcbi1000}%
800 \FontDef{T}{M}{U}{S}{pcrr8t at 8.9pt}{tctt1000}%
801 \FontDef{T}{M}{I}{S}{pcrro8t at 8.9pt}{tcit1000}%
802 \FontDef{T}{B}{U}{S}{pcrb8t at 8.9pt}{tctt1000}%
803 \FontDef{T}{B}{I}{S}{pcrbo8t at 8.9pt}{tcit1000}%
804 \SelectFont

805 ⟨/ifi − article | ifi − artikkel⟩

12In the Karl Berry font name scheme [Ber95], Concorde is known as poc-.

References

[Ber95] Berry, Karl. Fontname. Available from ctan in info/fontname.

[Knu84] Knuth, Donald E. The TEXbook. Addison-Wesley, 1984.

[Tay95] Taylor, Philip. ε-TEX: a 100%-compatible successor to TEX. EuroTEX 1995 conference proceedings.

Index

Numbers written in italic refer to the page where the corresponding entry is described, the ones underlined to the code line of the definition, the rest to the code lines where the entry is used.

/abstract¿=  \subitem *+</abstract>+, \main{222}
/author¿=  \subitem *+</author>+, \main{208}
/b¿=  \subitem *+</b>+, \main{157}
/body¿=  \subitem *+</body>+, \main{176}
/comment¿=  \subitem *+</comment>+, \main{698}
/display¿=  \subitem *+</display>+, \main{291}
/footnote¿=  \subitem *+</footnote>+, \main{332}
/h1¿=  \subitem *+</h1>+, \main{243}
/h2¿=  \subitem *+</h2>+, \main{246}
/h3¿=  \subitem *+</h3>+, \main{255}
/h4¿=  \subitem *+</h4>+, \main{263}
/i¿=  \subitem *+</i>+, \main{157}
/info¿=  \subitem *+</info>+, \main{215}
/list¿=  \subitem *+</list>+, \main{270}
/sqrt¿=  \subitem *+</sqrt>+, \main{541}
/table¿=  \subitem *+</table>+, \main{578}
/textitem¿=  \subitem *+</textitem>+, \main{284}
/title¿=  \subitem *+</title>+, \main{201}
/tt¿=  \subitem *+</tt>+, \main{157}
aa=  \subitem *+\aa+, 765
abstract¿=  \subitem *+<abstract>+, \main{222}
AbstractName=  \subitem *+\AbstractName+, 226, 378, \main{760}
AddVspace=  \subitem *+\AddVspace+, \main{195}, 201, 207, 208, 214, 215,221,

222, 229, 232, 263, 270, 291, 296, 299, 546, 549, 610, 612

AltA=  \subitem *+\AltA+, 705, 708, 711, 714, 715
AltB=  \subitem *+\AltB+, 705, 708, 711, 716
author¿=  \subitem *+<author>+, \main{208}
AuxOpentrue=  \subitem *+\AuxOpentrue+, 625
AuxReadtrue=  \subitem *+\AuxReadtrue+, 645
b¿=  \subitem *+<b>+, \main{157}
baselineskip=  \subitem *+\baselineskip+, 155, 234, 268, 290, 302, 312
body¿=  \subitem *+<body>+, \main{166}
BodyError=  \subitem *+\BodyError+, \main{172}, 189
BodyLine=  \subitem *+\BodyLine+, 169, 170
box=  \subitem *+\box+, 236, 611
bullet=  \subitem *+\bullet+, 356
BulletItemFormat=  \subitem *+\BulletItemFormat+, 278, 356
cal=  \subitem *+\cal+, 509
Call=  \subitem *+\Call+, 32, \main{36}
CallLevel=  \subitem *+\CallLevel+, 19, 35--37
CC=  \subitem *+\CC+, \main{363}, 369
Ccall=  \subitem *+\Ccall+, \main{15}

                          Cdef=  \subitem *+\Cdef+, \main{14}, 17, 66, 70, 157, 159, 160, 162, 163,165,

166, 170, 176, 185, 201, 206, 208, 213, 215, 220, 222, 228, 237, 243, 246, 252, 255, 260, 263, 268, 270, 275, 277, 279, 284, 288, 291, 296, 317, 323, 332, 338, 383, 394, 401, 402, 404, 405, 445, 446, 454, 471– 479, 484, 494, 497–503, 509, 518–526, 528, 529, 541– 543, 546, 578, 581, 596, 613, 617, 667, 679– 688, 698, 737, 738, 740, 766

                          cdot=  \subitem *+\cdot+, 372
                          cdots=  \subitem *+\cdots+, 520
                          centerline=  \subitem *+\centerline+, 226, 548, 611
                          char=  \subitem *+\char+, 360--363
                          CheckAux=  \subitem *+\CheckAux+, 177, \main{654}
                          CheckItCorr=  \subitem *+\CheckItCorr+, \main{152}, 160
                          CheckLabel=  \subitem *+\CheckLabel+, 657, \main{661}
                          closein=  \subitem *+\closein+, 734
                          closeout=  \subitem *+\closeout+, 654
                          code¿=  \subitem *+<code>+, \main{317}
                          codefile¿=  \subitem *+<codefile>+, \main{323}
                          CodeFinish=  \subitem *+\CodeFinish+, \main{311}, 321, 331
                          CodeParfalse=  \subitem *+\CodeParfalse+, 300
                          CodePartrue=  \subitem *+\CodePartrue+, 299
                          CodeSetup=  \subitem *+\CodeSetup+, \main{299}, 318, 328
                          CodeSkipN=  \subitem *+\CodeSkipN+, 98, 302
                          CodeVersion=  \subitem *+\CodeVersion+, 167, 172
                          col¿=  \subitem *+<col>+, \main{613}
                          Command=  \subitem *+\Command+, \main{3}, 13
                          comment¿=  \subitem *+<comment>+, \main{698}
                          cr=  \subitem *+\cr+, 604, 607
                          csname=  \subitem *+\csname+, 6, 10, 14, 15, 23, 32, 77, 78, 80--82, 148,155,

407, 445, 446, 626, 627, 634, 649, 650, 663, 671, 675, 747, 749, 758

                                                   CurDef=  \subitem *+\CurDef+, 240, 249, 257, 265, 280, 335, 573, 587, 631,638
                                                   CurEnv=  \subitem *+\CurEnv+, 49--51, 54, 58, 59, 62, 532
                                                   CurEnvExit=  \subitem *+\CurEnvExit+, 50, 51, 54, 60
                                                   CurEnvLine=  \subitem *+\CurEnvLine+, 49, 50, 52, 58, 62
                                                   CurFont=  \subitem *+\CurFont+, 148
                                                   CurParSkip=  \subitem *+\CurParSkip+, 191, \main{194}, 204, 211, 218, 224, 236,273,

295, 302

                                                   define¿=  \subitem *+<define>+, \main{16}
                                                   DefineCmd=  \subitem *+\DefineCmd+, 4, \main{18}
                                                   Definingfalse=  \subitem *+\Definingfalse+, 18
                                                   Definingtrue=  \subitem *+\Definingtrue+, 17
                                                   DefLang=  \subitem *+\DefLang+, \main{747}, 750
                                                   dimen=  \subitem *+\dimen+, 568--570
                                                   display¿=  \subitem *+<display>+, \main{291}
                                                   DisplayIndent=  \subitem *+\DisplayIndent+, 293, 294, 341
                                                   DisplayParSkip=  \subitem *+\DisplayParSkip+, 295, 342
                                                   DisplayPostSkip=  \subitem *+\DisplayPostSkip+, 296, 312, 343
                                                   DisplayPreSkip=  \subitem *+\DisplayPreSkip+, 291, 299, 344
                                                   div=  \subitem *+\div+, 375
                                                   divide=  \subitem *+\divide+, 395, 719, 725
                                                   divrem=  \subitem *+\divrem+, 722, 725, 727, 728, \main{731}
                                                   divres=  \subitem *+\divres+, 570, 720, 728, \main{731}
                                                   divtemp=  \subitem *+\divtemp+, 719--723, 725, 726, 728, \main{731}
                                                   Downarrow=  \subitem *+\Downarrow+, 478
                                                   E=  \subitem *+\E+, \main{358}, 360--362, 364--368, 370--377
                                                   edef=  \subitem *+\edef+, 69, 147, 240, 249, 257, 265, 280, 335, 573, 587,627,

629, 638, 702

                                                   else=  \subitem *+\else+, 5, 9, 22, 25, 55, 61, 179, 180, 195, 300, 314,369,

390–392, 397, 409, 440, 441, 454, 534, 537, 543, 547, 571, 578, 597, 598, 613, 622, 623, 633, 664, 670, 674, 677, 692, 696, 708, 714, 715, 727, 733, 764

                                                   emergencystretch=  \subitem *+\emergencystretch+, 188
                                                   end=  \subitem *+\end+, 184
                                                   endcsname=  \subitem *+\endcsname+, 6, 10, 14, 15, 23, 32, 77, 78, 80--82, 148,155,

407, 445, 446, 626, 627, 634, 649, 650, 663, 671, 675, 747, 749, 758

EndEnvir=  \subitem *+\EndEnvir+, \main{53}, 159, 162, 165, 176, 206, 213, 220,228,

245, 254, 262, 269, 276, 289, 297, 321, 338, 402, 405, 523, 525, 531, 542, 551, 581, 701

endinput=  \subitem *+\endinput+, 744
endinsert=  \subitem *+\endinsert+, 552, 584
EndRow=  \subitem *+\EndRow+, 598, \main{607}, 608
EnvirError=  \subitem *+\EnvirError+, 55, \main{57}
epsfbox=  \subitem *+\epsfbox+, 548
epsfsize=  \subitem *+\epsfsize+, \main{568}
epsfxsize=  \subitem *+\epsfxsize+, 570
epsfysize=  \subitem *+\epsfysize+, 571
Error=  \subitem *+\Error+, 7, 20, 26, 58, 62, 67, 70, 74, 170, 173, 325,330,

442, 530, 534, 537, 556, 560, 566, 593, 599, 614, 619, 634, 669, 673, \underline{689}

everypar=  \subitem *+\everypar+, 168, 175, 189
expandafter=  \subitem *+\expandafter+, 6, 14, 23, 31, 77, 78, 80--82, 626, 627,649,

650, 671, 747, 749

FetchDef=  \subitem *+\FetchDef+, 24, \main{30}
FetchLabel=  \subitem *+\FetchLabel+, 642, \main{648}
fi=  \subitem *+\fi+, 11, 12, 28, 29, 55, 65, 178--180, 183, 190, 195,198,

200, 300, 316, 369, 387, 392, 397, 429, 440, 443, 454, 530, 536, 539, 544, 550, 571, 579, 600, 608, 615, 622, 625, 636, 666, 670, 676, 678, 692, 696, 708, 717, 729, 734, 765, 769

FigCnt=  \subitem *+\FigCnt+, 354, 572, 573, 577
FigIm=  \subitem *+\FigIm+, \main{354}, 576
FigureName=  \subitem *+\FigureName+, 379, 576, \main{760}
FirstRow=  \subitem *+\FirstRow+, 597, \main{601}
floatdiv=  \subitem *+\floatdiv+, 569, \main{719}
folio=  \subitem *+\folio+, 340
font=  \subitem *+\font+, 148, 407
FontAlt=  \subitem *+\FontAlt+, 147, 150, 363
FontBold=  \subitem *+\FontBold+, 147, 150, 158, 224, 233, 267, 286
FontDef=  \subitem *+\FontDef+, \main{76}, 84--91, 100--107, 116--123,131–

138, 772–803

FontItal=  \subitem *+\FontItal+, 147, 151, 161
FontKind=  \subitem *+\FontKind+, 147, 150, 164, 301
FontSize=  \subitem *+\FontSize+, 147, 151, 154, 409--428
footline=  \subitem *+\footline+, 340
footnote=  \subitem *+\footnote+, 334
footnote¿=  \subitem *+<footnote>+, \main{332}
FootnoteCnt=  \subitem *+\FootnoteCnt+, 333--335, \main{339}
FootnoteIm=  \subitem *+\FootnoteIm+, 334, \main{353}
FracOver=  \subitem *+\FracOver+, 528, 532
frenchspacing=  \subitem *+\frenchspacing+, 303
futurelet=  \subitem *+\futurelet+, 706, 712
gdef=  \subitem *+\gdef+, 14, 31--33, 306, 309, 321, 565, 649, 650, 701
GiveRef=  \subitem *+\GiveRef+, 668, \main{670}
global=  \subitem *+\global+, 13, 36, 37, 168, 175, 191, 238, 239, 247, 248,256,

264, 313, 333, 572, 586, 625, 645, 647, 665, 673

h1¿=  \subitem *+<h1>+, \main{237}
h2¿=  \subitem *+<h2>+, \main{246}
h3¿=  \subitem *+<h3>+, \main{255}
h4¿=  \subitem *+<h4>+, \main{263}
Heading=  \subitem *+\Heading+, \main{232}, 242, 251, 259
Hours=  \subitem *+\Hours+, 394, 395, 397, 398
hskip=  \subitem *+\hskip+, 290, 519
Htemp=  \subitem *+\Htemp+, 395, 396, 398
i¿=  \subitem *+<i>+, \main{157}
if=  \subitem *+\if+, 409, 543, 578, 597, 598, 608, 613, 708, 714, 715
ifAuxOpen=  \subitem *+\ifAuxOpen+, 180, \main{616}, 623
ifAuxRead=  \subitem *+\ifAuxRead+, 179, 622, 652, 670
ifcase=  \subitem *+\ifcase+, 385, 767
ifCodePar=  \subitem *+\ifCodePar+, 298, 311
ifDefining=  \subitem *+\ifDefining+, 3, 16
ifdim=  \subitem *+\ifdim+, 197, 198, 570
ifeof=  \subitem *+\ifeof+, 733
IfFileExists=  \subitem *+\IfFileExists+, 68, 329, 564, 639, 732
ifFileExists=  \subitem *+\ifFileExists+, \main{732}
ifIndent=  \subitem *+\ifIndent+, 190, \main{192}
ifmmode=  \subitem *+\ifmmode+, 369, 440, 441, 454
IfNextChar=  \subitem *+\IfNextChar+, 66, 323, 554, 617, 667, \main{704}
IfNextCharTwo=  \subitem *+\IfNextCharTwo+, 153, \main{710}
ifnum=  \subitem *+\ifnum+, 19, 390--392, 397, 529, 533, 726, 727
ifRerun=  \subitem *+\ifRerun+, 178, 182, 653
ifTextEqual=  \subitem *+\ifTextEqual+, 54, 57, 532, 662, 677, 692, 696,\underline{702},

764

ifvmode=  \subitem *+\ifvmode+, 195, 299
ifx=  \subitem *+\ifx+, 6, 23, 547, 626, 671, 703
IgnoreDef=  \subitem *+\IgnoreDef+, 27, \main{33}
ignorespaces=  \subitem *+\ignorespaces+, 278, 282, 287, 290, 576, 590
Im=  \subitem *+\Im+, 521
immediate=  \subitem *+\immediate+, 624, 654

                          Indentfalse=  \subitem *+\Indentfalse+, 225, 227, 245, 254, 262, 267, 273,276,

277, 281, 313, 575, 589

                          Indenttrue=  \subitem *+\Indenttrue+, 190
                          info¿=  \subitem *+<info>+, \main{215}
                          infty=  \subitem *+\infty+, 521
                          item¿=  \subitem *+<item>+, \main{277}
                          ItemCount=  \subitem *+\ItemCount+, 274, 280, 282, \main{283}
                          jobname=  \subitem *+\jobname+, 624, 639, 644, 659
                          label¿=  \subitem *+<label>+, \main{617}
                          LabelDef=  \subitem *+\LabelDef+, 630, 641, \main{648}, 656
                          LastMathSize=  \subitem *+\LastMathSize+, 409, 428, 430
                          LastRow=  \subitem *+\LastRow+, 584, \main{608}
                          lastskip=  \subitem *+\lastskip+, 197, 198
                          ldots=  \subitem *+\ldots+, 519
                          Leftarrow=  \subitem *+\Leftarrow+, 471
                          lefthyphenmin=  \subitem *+\lefthyphenmin+, 759
                          Leftrightarrow=  \subitem *+\Leftrightarrow+, 473
                          let=  \subitem *+\let+, 2, 8, 13, 21, 49, 54, 64, 177--180, 315, 428, 443,543,

544, 553, 578, 579, 585, 601, 628, 708, 714–716

                          LineSkipL=  \subitem *+\LineSkipL+, 114
                          LineSkipN=  \subitem *+\LineSkipN+, 98
                          LineSkipS=  \subitem *+\LineSkipS+, 145
                          LineSkipX=  \subitem *+\LineSkipX+, 130
                          list¿=  \subitem *+<list>+, \main{270}
                          ListIndent=  \subitem *+\ListIndent+, 272, 286, 341, 346
                          ListParSkip=  \subitem *+\ListParSkip+, 342, 347
                          ListSkip=  \subitem *+\ListSkip+, 270, 273, 347, 348
                          Longleftarrow=  \subitem *+\Longleftarrow+, 474
                          Longleftrightarrow=  \subitem *+\Longleftrightarrow+, 476
                          Longrightarrow=  \subitem *+\Longrightarrow+, 475
                          loop=  \subitem *+\loop+, 724
                          lowercase=  \subitem *+\lowercase+, 4, 6, 10
                          make-new-format¿=  \subitem *+<make-new-format>+, \main{737}
                          mathchar=  \subitem *+\mathchar+, 454, 503
                          MathFontDef=  \subitem *+\MathFontDef+, 79, 92--97, 108--113, 124--129, 139--144
                          MathFonts=  \subitem *+\MathFonts+, 401, 404, 409
                          MC=  \subitem *+\MC+, \main{369}
                          MCal=  \subitem *+\MCal+, 509--513
                          MCo=  \subitem *+\MCo+, 431--439
                          Mdef=  \subitem *+\Mdef+, \main{445}, 447--453, 455--470, 485--496,514–

517

                          MGr=  \subitem *+\MGr+, 503--508
                          Minutes=  \subitem *+\Minutes+, 394, 396--398
                          MNext=  \subitem *+\MNext+, 441, 443, 444
                          Month=  \subitem *+\Month+, 383, 385, \main{766}
                          MOp=  \subitem *+\MOp+, \main{441}, 446, 522--526, 528, 529, 541, 542
                          MSetFont=  \subitem *+\MSetFont+, 407, 410--427
                          MSy=  \subitem *+\MSy+, \main{440}, 445, 471--479, 484, 494, 497--503,509,

519–521

multiply=  \subitem *+\multiply+, 395, 720, 721, 725
NewAuxFile=  \subitem *+\NewAuxFile+, 624, 629, 637, 654
NewEnvir=  \subitem *+\NewEnvir+, \main{48}, 157, 160, 163, 166, 202, 209, 216,223,

241, 250, 258, 266, 271, 285, 292, 317, 332, 401, 404, 522, 524, 526, 541, 552, 562, 584, 595, 698

NewLabel=  \subitem *+\NewLabel+, 618, \main{621}
NewMFont=  \subitem *+\NewMFont+, 407, 408
NewPar=  \subitem *+\NewPar+, 168, 175, \main{190}
NewRow=  \subitem *+\NewRow+, 597, 598, \main{606}
Next=  \subitem *+\Next+, 4, 8, 10, 12, 21, 24, 27, 29, 54, 56, 60, 64,177–

181, 312, 315, 316, 543– 545, 578–580, 708, 709, 714– 716, 718, 733–735

NextChar=  \subitem *+\NextChar+, 706, 708, 712, 714, 715
NOver=  \subitem *+\NOver+, 527, 529, 533, 536, 540
null=  \subitem *+\null+, 680
numitem¿=  \subitem *+<numitem>+, \main{279}
NumItemFormat=  \subitem *+\NumItemFormat+, 282, 357
obeylines=  \subitem *+\obeylines+, \main{304}
obeyspaces=  \subitem *+\obeyspaces+, \main{308}
Odef=  \subitem *+\Odef+, \main{446}, 480--483, 516
or=  \subitem *+\or+, 385--387, 767--769
p¿=  \subitem *+<p>+, \main{185}
ParIndent=  \subitem *+\ParIndent+, 156, 190, \main{192}, 204, 211, 218, 236,273,

295, 302

pretolerance=  \subitem *+\pretolerance+, 187
PrevEnv=  \subitem *+\PrevEnv+, 49, 57
PrevEnvLine=  \subitem *+\PrevEnvLine+, 49, 52
PrintTable=  \subitem *+\PrintTable+, 608, \main{609}
PScaption=  \subitem *+\PScaption+, 558, 567, \main{572}

PSfetch=  \subitem *+\PSfetch+, 555, \main{563}
PSfig=  \subitem *+\PSfig+, 543, \main{552}
psfig¿=  \subitem *+<psfig>+, \main{543}
PSfigError=  \subitem *+\PSfigError+, 544, \main{559}
PSfile=  \subitem *+\PSfile+, 547, 548, 553, 565
ReadAuxFile=  \subitem *+\ReadAuxFile+, 622, \main{639}, 670
ReadCode=  \subitem *+\ReadCode+, 318, \main{319}
ReadCodeFile=  \subitem *+\ReadCodeFile+, 324, \main{327}
ReadStyle=  \subitem *+\ReadStyle+, 66, \main{68}
ref¿=  \subitem *+<ref>+, \main{667}
RefFormat=  \subitem *+\RefFormat+, 675, \main{677}, \main{764}
repeat=  \subitem *+\repeat+, 730
Reruntrue=  \subitem *+\Reruntrue+, 647, 665, 673
ResetFont=  \subitem *+\ResetFont+, \main{149}, 205, 212, 219, 224, 227, 337,340,

575, 589, 601, 743

Return=  \subitem *+\Return+, 32, \main{36}
Rightarrow=  \subitem *+\Rightarrow+, 472
righthyphenmin=  \subitem *+\righthyphenmin+, 759
Row=  \subitem *+\Row+, \main{596}
row¿=  \subitem *+<row>+, \main{596}
scriptfont=  \subitem *+\scriptfont+, 411, 414, 417, 420, 423, 426
scriptscriptfont=  \subitem *+\scriptscriptfont+, 412, 415, 418, 421, 424, 427
SectI=  \subitem *+\SectI+, 230, 238, 349
SectII=  \subitem *+\SectII+, 230, 239, 247, 350
SectIII=  \subitem *+\SectIII+, 231, 239, 248, 256, 351
SectIIIim=  \subitem *+\SectIIIim+, 257, 259, \main{349}
SectIIim=  \subitem *+\SectIIim+, 249, 251, \main{349}
SectIim=  \subitem *+\SectIim+, 240, 242, \main{349}
SectIV=  \subitem *+\SectIV+, 231, 239, 248, 256, 264, 352
SectIVim=  \subitem *+\SectIVim+, 265, 267, \main{349}
SelectFont=  \subitem *+\SelectFont+, \main{146}, 154, 158, 161, 164, 267, 286,301,

340, 363, 601, 804

SetSize=  \subitem *+\SetSize+, \main{154}, 205, 212, 219, 224, 227, 233, 337,575,

589, 743

skip=  \subitem *+\skip+, 196, 197, 199
SkipComment=  \subitem *+\SkipComment+, 699, \main{700}
SpecialCatCodes=  \subitem *+\SpecialCatCodes+, \main{38}, 73, 744
sqrt=  \subitem *+\sqrt+, 541

sqrt¿=  \subitem *+<sqrt>+, \main{541}
StandardCatCodes=  \subitem *+\StandardCatCodes+, \main{43}, 72
State=  \subitem *+\State+, 2, 543, 553, 578, 585, 597, 598, 601, 608, 613
StdParIndent=  \subitem *+\StdParIndent+, 156, \main{192}
style¿=  \subitem *+<style>+, \main{66}
StyleLine=  \subitem *+\StyleLine+, 69, 71
TabCnt=  \subitem *+\TabCnt+, 355, 586, 587, 591
TabIm=  \subitem *+\TabIm+, \main{354}, 590
Table=  \subitem *+\Table+, 578, \main{583}
table¿=  \subitem *+<table>+, \main{578}
TableBox=  \subitem *+\TableBox+, 582, 602, 611
TableCaption=  \subitem *+\TableCaption+, 584, \main{586}
TableError=  \subitem *+\TableError+, 579, \main{592}
TableName=  \subitem *+\TableName+, 380, 590, \main{760}
TestChar=  \subitem *+\TestChar+, 704, 708, 710, 714
TestCharX=  \subitem *+\TestCharX+, 710, 715
TestFile=  \subitem *+\TestFile+, 732--734, \main{736}
TestNextChar=  \subitem *+\TestNextChar+, 706, \main{707}
TestNextCharTwo=  \subitem *+\TestNextCharTwo+, 712, \main{713}
textfont=  \subitem *+\textfont+, 410, 413, 416, 419, 422, 425
textitem¿=  \subitem *+<textitem>+, \main{284}
Th=  \subitem *+\Th+, 383, 389
ThisFont=  \subitem *+\ThisFont+, 147, 148
TimeSep=  \subitem *+\TimeSep+, 381, 397, 763
title¿=  \subitem *+<title>+, \main{201}
today¿=  \subitem *+<today>+, \main{766}
trace-off¿=  \subitem *+<trace-off>+, \main{738}
trace-on¿=  \subitem *+<trace-on>+, \main{738}
tt¿=  \subitem *+<tt>+, \main{157}
Warning=  \subitem *+\Warning+, 182, \main{693}
write=  \subitem *+\write+, 629
WriteCurDef=  \subitem *+\WriteCurDef+, 629, 632
xdef=  \subitem *+\xdef+, 169
XIpt=  \subitem *+\XIpt+, 83, 92--96
XIVpt=  \subitem *+\XIVpt+, 99, 108--112, 124
XVIIpt=  \subitem *+\XVIIpt+, 115, 125--128