preliminary draft, July 14, 2003 0:51  preliminary draft, July 14, 2003 0:51 TUGboat, Volume 0 (2001), No. 0  preliminary draft, July 14, 2003 0:51  1

Extending TEX’s mathematical typography

Matthias Clasen

1 Introduction

One of the reasons why TEX is still in use is that its abilities in setting mathematical formulas are still unsurmounted. But there are some nits to pick.

I propose a small set of extensions to TEX to remove some deficiencies in its handling of formulas.

2 Implementation

The implementation is split into a series of change files:

accent.ch implements three new primitives for nestable accents and under accents. To some extent these can be implemented in TEX itself (see AMS-L^{A}TEX), but macro solutions are complicated, slow and error-prone.

\mathaccent⟨15-bit number⟩⟨math field⟩ can now grok an extensible recipe at the end of a charlist. The extensible recipe is used to construct longer variants of an accent (in analogy to growing delimiters).

\nestingmathaccent⟨15-bit number⟩⟨math field⟩ is like \mathaccent, but it follows a chain of

\nestingmathaccent or \nestingmathunder-

accent primitives to determine its accentee and the appropriate skew.

\mathunderaccent⟨15-bit number⟩⟨math field⟩ places an accent under the ⟨math field⟩. It uses the ⟨accent⟩–⟨accent⟩ kerning to determine the vertical space between the ⟨math field⟩ and the ⟨accent⟩ and the ⟨skewchar⟩–⟨accentee⟩ kerning to determine the appropriate skew to the left.

\nestingmathunderaccent⟨15-bit number⟩⟨math

field⟩

is a variant of \mathunderaccent which respects the nesting of accents.

cramp.ch complements the \displaystyle,

…, \scriptscriptstyle style-changing primitives

by \crampeddisplaystyle, . . . , \crampedscript-

scriptstyle which change to the cramped styles.

fraction.ch continues to improve the math style-handling. It adds the following:

\mathstyle is a special readonly integer parameter corresponding to the current math style according to the following table:

                                                 math style \mathstyle

none  < 0
D  0
D’  1
T  2
T’  3
S  4
S’  5
SS  6
SS’  7

\fraction{⟨math field⟩} can be used to surround fractions. Its sole purpose is that \mathstyle reports the correct values in a subformula like

                                              \fraction{...\over...} while it fails to do
                                              so in {...\over...}.

radical.ch implements the following new primitive: \genradical⟨27-bit number⟩⟨27-bit number⟩⟨math

field⟩

creates a radical with delimiters on both sides. By specifiying a nonexisting left delimiter, you can also create a right radical.

3 Installation

The change files are written for TEX 3.1459. But it should need only cosmetic changes to get them to work with other versions of TEX3.

To make the change files for TEX work, you have to apply the change file pre.ch first. I have only tried these files with web2c, and for that you need to surround the web2c change file with pre-web2c.ch

                                          and post-web2c.ch.

All this boils down to the command line

                                          mv tex.ch tex.ch.orig
                                          tie -c tex.ch tex.web pre.ch accent.ch \
                                                 cramp.ch fraction.ch radical.ch \
                                                 pre-web2c.ch tex.ch.orig \
                                                 post-web2c.ch

⋄ Matthias Clasen

                                                                maclas@gmx.de