The file syntonly.dtx for use with L^{A}TEX 2ε.^{∗} It contains the code for syntonly.sty

Frank Mittelbach  Rainer Schöpf

October 20, 1997

This package implements the \syntaxonly declaration for L^{A}TEX 2ε. This command can be used in the preamble for running a document through L^{A}TEX without actually getting any output.

1 Identification

We identify the package and its current version.

 1 ⟨package⟩\ProvidesPackage{syntonly}

2 ⟨∗dtx⟩

 3  \ProvidesFile{syntonly.dtx}

4 ⟨/dtx⟩ 5 ⟨∗package | dtx⟩

 6  [1996/06/14 v2.1c Standard LaTeX2e package]

7 ⟨/package | dtx⟩

2 Implementation

8 ⟨∗package⟩

\dummyft@ First of all we need to define the ‘dummy’ font.

 9 \font\dummyft@=dummy \relax

\ifsyntax@ Now we can define the ‘syntax only’ feature. We define a switch \if@syntax so that any macro can always find out if it is really supposed to typeset text. Its default is to run in normal mode.

10 \newif\ifsyntax@
11 \syntax@false

\syntaxonly The \syntaxonly macro sets up everything for syntax checking.

12 \def\syntaxonly{%

∗This file has version number v2.1c, dated 1996/06/14.

First of all it sets the syntax@ switch to true.

13 \syntax@true

Then it globally sets all fonts to the dummy font. These are: the current font outside math mode,

14 \global\dummyft@

and the 3 × 16 math fonts for the 16 math groups. We use a loop to set these.

15 \count@\sixt@@n
16 \loop
17  \ifnum\count@ >\z@
18  \advance\count@\m@ne
19  \global\textfont\count@\dummyft@
20  \global\scriptfont\count@\dummyft@
21  \global\scriptscriptfont\count@\dummyft@
22  \repeat

Since all font changes occur either via \selectfont (in text or \mathversion (for math mode) it is sufficient to change these to no-ops. In addition we must prevent the loading of math fonts, this is done by making \getanddefine@fonts a no-op.

23 \global\let\selectfont\relax
24 \global\let\mathversion\@gobble
25 \global\let\getanddefine@fonts\@gobbletwo

We prevent TEX from complaining about the dummy font having no characters.

26 \tracinglostchars\z@

Then we disable the output routine, and set \frenchspacing (which is slightly faster than \nonfrenchspacing). Finally we set \hbadness to 10000 to avoid overfull box messages.

27 \nopages@
28 \frenchspacing
29 \hbadness\@M}

\nopages@ The \nopages@ macro disables the L^{A}TEX output routine. To this end we define a very simple output routine that empties the output and footnote boxes (remember that the latter are insertions.

30 \def\nopages@{%
31 \output {\setbox\z@\box\@cclv
32  \setbox\z@\box\footins
33  \deadcycles\z@}%

Then we protect it against definition by a style file.

34 \newtoks\output

But this is not enough: normally the L^{A}TEX output routine is responsible for dealing with floating objects. We therefore also redefine the internal macros for handling floats and marginpars.

35 \def\@xfloat##1[##2]{%

There are a few things that have to be retained: the definition of \@captype since it is used by the \caption command,

36  \def\@captype{##1}%

the error message issued when not in outer paragraph mode,

37  \ifinner\@parmoderr\fi

and the \@parboxrestore command for the body of the float. This is necessary since it restores the original definitions of important commands like \par or \\.

38  \setbox\@tempboxa\vbox\bgroup\@parboxrestore}%

\end@float must now only close the brace:

39 \let\end@float\egroup

The redefinition of the \marginpar command is a bit more complicated since we have to check for the optional argument. First we redefine the command itself:

40 \def\marginpar{\ifinner\@parmoderr\fi

We open a group so that everything gathered in a temporary box can easily be thrown away by closing it again (see below).

41  \begingroup \@ifnextchar [\@xmpar\@ympar}

\@xmpar and \@ympar are now defined similar to \@xfloat above. If an optional argument is present \@xmpar typesets it in a temporary box that is thrown away later. Then it calls up \@ympar to process \marginpar’s argument.

42 \long\def\@xmpar[##1]{%
43  \setbox\@tempboxa\vbox{\@parboxrestore ##1}\@ympar}%

\@ympar gathers its argument in the same temporary box and throws away its contents by closing the group opened up in \marginpar above.

44 \long\def\@ympar##1{%
45  \setbox\@tempboxa\vbox{\@parboxrestore ##1}\endgroup}%

And that’s all we had to do.

46 }

\@preamblecmds We disable the use of the \syntaxonly command after \begin{document}
47 \@onlypreamble\syntaxonly

48 ⟨/package⟩

Change History

v1.0b

\nopages@: Rewrite of the ‘nopages@ macro to correctly handle footnote insertions, floats and marginpars. . . . . . . . 2 v1.0c

\nopages@: Definition of ‘@captype

added. . . . . . . . . . . . . . . . . . . 3 v1.0d

\nopages@: Added forgotten ‘vbox. 3 v2.1a

General: Update for L^{A}TEX 2ε …. 1 v2.1b

General: Removed non-outer newtoks@: newtoks is no longer outer . . . . . . . . . . . . . . . . . . . 2 Removed surplus \typeout lines 1 Removed unneeded fontdimen settings for dummyft@ . . . . . . 1 \nopages@: newtoks is no longer

outer . . . . . . . . . . . . . . . . . . . 2 v2.1c

General: Rearange \GetFileInfo useage. . . . . . . . . . . . . . . . . . . 1

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.

Symbols

\@captype . . . . . . . . 36

\@onlypreamble . . . . 47
\@parboxrestore . . .

. . . . . . . 38, 43, 45

\@parmoderr . . . . . 37, 40
\@preamblecmds . . . . \underline{47}

\@xfloat . . . . . . . . . 35 \@xmpar . . . . . . . . 41, 42 \@ympar . . . . . 41, 43, 44

D

\deadcycles . . . . . . . 33

\dummyft@ . \underline{9}, 14, 19–21

E

\end@float . . . . . . . 39

F

\footins . . . . . . . . . 32

                          \frenchspacing . . . . 28

G

                          \getanddefine@fonts 25

H \hbadness . . . . . . . . 29

I

                          \ifsyntax@ . . . . . . . \underline{10}

M

                          \marginpar . . . . . . . 40
                          \mathversion . . . . . . 24

N \newif . . . . . . . . . . . 10 \newtoks . . . . . . . . . 34 \nopages@ . . . . . . 27, \underline{30}

O \output . . . . . . . . 31, 34

P

                                                   \ProvidesFile . . . . . . 3
                                                   \ProvidesPackage . . . 1

S

                                                   \selectfont . . . . . . . 23
                                                   \syntax@false . . . . . 11
                                                   \syntax@true . . . . . . 13
                                                   \syntaxonly . . . . . \underline{12}, 47

T

                                                   \tracinglostchars . 26

V \vbox . . . . . . . 38, 43, 45