updated
[latex2e.git] / base / syntonly.dtx
blob9c0c96766732bf95d5b9430580d06078eb244981
1 % \iffalse meta-comment
3 % Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
4 % The LaTeX3 Project and any individual authors listed elsewhere
5 % in this file. 
6
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 %    http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX 
16 % version 2005/12/01 or later.
17
18 % This file has the LPPL maintenance status "maintained".
19
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
22 % information.
23
24 % The list of derived (unpacked) files belonging to the distribution 
25 % and covered by LPPL is defined by the unpacking scripts (with 
26 % extension .ins) which are part of the distribution.
27
28 % \fi
29 %% \CheckSum{110}
30 %% \CharacterTable
31 %%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
32 %%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
33 %%   Digits        \0\1\2\3\4\5\6\7\8\9
34 %%   Exclamation   \!     Double quote  \"     Hash (number) \#
35 %%   Dollar        \$     Percent       \%     Ampersand     \&
36 %%   Acute accent  \'     Left paren    \(     Right paren   \)
37 %%   Asterisk      \*     Plus          \+     Comma         \,
38 %%   Minus         \-     Point         \.     Solidus       \/
39 %%   Colon         \:     Semicolon     \;     Less than     \<
40 %%   Equals        \=     Greater than  \>     Question mark \?
41 %%   Commercial at \@     Left bracket  \[     Backslash     \\
42 %%   Right bracket \]     Circumflex    \^     Underscore    \_
43 %%   Grave accent  \`     Left brace    \{     Vertical bar  \|
44 %%   Right brace   \}     Tilde         \~}
48 % \changes{v2.1a}{1994/03/10}{Update for \LaTeXe}
50 % \DoNotIndex{\@cclvi,\@cclv,\@gobble,\@gobbletwo,\@ifnextchar}
51 % \DoNotIndex{\@M,\@tempboxa,\advance,\alloc,\begingroup,\bgroup}
52 % \DoNotIndex{\box,\count@,\def,\do,\docdate,\egroup,\endgroup}
53 % \DoNotIndex{\fi,\filedate,\fileversion,\font,\fontdimen,\global}
54 % \DoNotIndex{\ifinner,\ifnum,\immediate,\let,\long,\loop,\m@ne}
55 % \DoNotIndex{\noexpand,\relax,\repeat,\scriptfont}
56 % \DoNotIndex{\scriptscriptfont,\setbox,\sixt@@n,\space,\textfont}
57 % \DoNotIndex{\toks,\toksdef,\write,\xdef,\z@}%
60 %\title{The file \texttt{syntonly.dtx} for use with 
61 %      \LaTeXe.\thanks{This file has version
62 %           number \fileversion, dated \filedate.}\\[2pt]
63 %      It contains the code for \texttt{syntonly.sty}}
64 % \author{Frank Mittelbach \and Rainer Sch\"opf}
67 % \maketitle
69 % This package implements the |\syntaxonly| declaration for \LaTeXe.
70 % This command can be used in the preamble for running a document
71 % through \LaTeX{} without actually getting any output.
73 % \StopEventually{}
76 % \section{Identification}
78 %  We identify the package and its current version.
79 % \changes{v2.1b}{1995/04/22}{Removed surplus \cs{typeout} lines}
80 % \changes{v2.1c}{1996/06/14}{Rearange \cs{GetFileInfo} useage.}
81 % \changes{v2.1d}{1998/08/17}{(RmS) Minor documentation fixes.}
83 %    \begin{macrocode}
84 %<package>\ProvidesPackage{syntonly}
85 %<*dtx>
86           \ProvidesFile{syntonly.dtx}
87 %</dtx>
88 %<*package|dtx>
89               [1999/09/17 v2.1e Standard LaTeX2e package]
90 %</package|dtx>
91 %    \end{macrocode}
93 %\iffalse
95 % \section{The documentation driver file}
97 % The next bit of code contains the documentation driver file for
98 % \TeX{}, i.e., the file that will produce the documentation you are
99 % currently reading. It will be extracted from this file by the \dst{}
100 % program.
101 %    \begin{macrocode}
102 %<*driver>
103 \documentclass{ltxdoc}
104 \GetFileInfo{syntonly.dtx}
105 \providecommand\dst{\expandafter{\normalfont\scshape docstrip}}
106 \begin{document}
107    \DocInput{syntonly.dtx}
108 \end{document}
109 %</driver>
110 %    \end{macrocode}
111 %\fi
114 % \section{Implementation}
116 %    \begin{macrocode}
117 %<*package>
118 %    \end{macrocode}
120 % \begin{macro}{\dummyft@}
121 %    First of all we need to define the `dummy' font.
122 %    \begin{macrocode}
123 \font\dummyft@=dummy \relax
124 %    \end{macrocode}
125 % \end{macro}
126 % \changes{v2.1b}{1995/05/25}{Removed unneeded fontdimen settings for
127 %   dummyft@}
129 % \begin{macro}{\ifsyntax@}
130 % Now we can define the `syntax only' feature.  We define a switch
131 % |\if@syntax| so that any macro can always find out if it
132 % is really supposed to typeset text.  Its default is to run in
133 % normal mode.
134 %    \begin{macrocode}
135 \newif\ifsyntax@
136 \syntax@false
137 %    \end{macrocode}
138 % \end{macro}
140 % \begin{macro}{\syntaxonly}
141 %    The |\syntaxonly| macro sets up everything for syntax
142 %    checking.
143 %    \begin{macrocode}
144 \def\syntaxonly{%
145 %    \end{macrocode}
146 %    First of all it sets the |syntax@| switch to \texttt{true}.
147 %    \begin{macrocode}
148    \syntax@true
149 %    \end{macrocode}
150 %    Then it globally sets all fonts to the dummy font.  These are:
151 %    the current font outside math mode,
152 %    \begin{macrocode}
153    \global\dummyft@
154 %    \end{macrocode}
155 %    and the $3\times16$ math fonts for the $16$ math \emph{groups}.
156 %    We use a loop to set these.
157 %    \begin{macrocode}
158    \count@\sixt@@n
159    \loop
160     \ifnum\count@ >\z@
161      \advance\count@\m@ne
162      \global\textfont\count@\dummyft@
163      \global\scriptfont\count@\dummyft@
164      \global\scriptscriptfont\count@\dummyft@
165     \repeat
166 %    \end{macrocode}
167 %    Since all font changes occur either via |\selectfont| (in
168 %    text or |\mathversion| (for math mode) it is sufficient
169 %    to change these to no-ops.  In addition we must prevent
170 %    the loading of math fonts, this is done by making
171 %    |\getanddefine@fonts| a no-op.
172 %    \begin{macrocode}
173    \global\let\selectfont\relax
174    \global\let\mathversion\@gobble
175    \global\let\getanddefine@fonts\@gobbletwo
176 %    \end{macrocode}
177 %    We prevent \TeX{} from complaining about the dummy font
178 %    having no characters.
179 %    \begin{macrocode}
180    \tracinglostchars\z@
181 %    \end{macrocode}
182 %    Then we disable the output routine, and set |\frenchspacing|
183 %    (which is slightly faster than |\nonfrenchspacing|).
184 %    Finally we set |\hbadness| to $10000$ to avoid overfull box
185 %    messages.
186 %    \begin{macrocode}
187    \nopages@
188    \frenchspacing
189    \hbadness\@M}
190 %    \end{macrocode}
191 % \end{macro}
193 % \changes{v2.1b}{1995/05/25}{Removed non-outer newtoks@: newtoks is no
194 %   longer outer}
195 %    
196 % \begin{macro}{\nopages@}
197 % \changes{v1.0b}{1990/01/14}{Rewrite of the \cs{nopages@} macro to
198 %       correctly handle footnote insertions, floats and marginpars.}
199 %    The |\nopages@| macro disables the \LaTeX{} output routine.
200 %    To this end we define a very simple output routine that empties
201 %    the output \emph{and} footnote boxes (remember that the latter
202 %    are insertions.
203 %    \begin{macrocode}
204 \def\nopages@{%
205   \output {\setbox\z@\box\@cclv
206            \setbox\z@\box\footins
207            \deadcycles\z@}%
208 %    \end{macrocode}
209 %    Then we protect it against definition by a style file.
210 % \changes{v2.1b}{1995/05/25}{newtoks is no longer outer}
211 %    \begin{macrocode}
212   \newtoks\output
213 %    \end{macrocode}
214 %    But this is not enough: normally the \LaTeX{} output routine
215 %    is responsible for dealing with floating objects.
216 %    We therefore also redefine the internal macros for handling
217 %    floats and marginpars.
218 %    \begin{macrocode}
219   \def\@xfloat##1[##2]{%
220 %    \end{macrocode}
221 %    There are a few things that have to be retained:
222 %    the definition of |\@captype| since it is used by the
223 %    |\caption| command,
224 % \changes{v1.0c}{1990/01/16}{Definition of \cs{@captype} added.}
225 %    \begin{macrocode}
226     \def\@captype{##1}%
227 %    \end{macrocode}
228 %    the error message issued when not in outer paragraph mode,
229 %    \begin{macrocode}
230     \ifinner\@parmoderr\fi
231 %    \end{macrocode}
232 %    and the |\@parboxrestore| command for the body of the
233 %    float.  This is necessary since it restores the original
234 %    definitions of important commands like |\par| or |\\|.
235 %    \begin{macrocode}
236     \setbox\@tempboxa\vbox\bgroup\@parboxrestore}%
237 %    \end{macrocode}
238 %    |\end@float| must now only close the brace:
239 %    \begin{macrocode}
240   \let\end@float\egroup
241 %    \end{macrocode}
242 %    The redefinition of the |\marginpar| command is a bit more
243 %    complicated since we have to check for the optional argument.
244 %    First we redefine the command itself:
245 %    \begin{macrocode}
246   \def\marginpar{\ifinner\@parmoderr\fi
247 %    \end{macrocode}
248 %    We open a group so that everything gathered in a temporary box
249 %    can easily be thrown away by closing it again (see below).
250 %    \begin{macrocode}
251     \begingroup \@ifnextchar [\@xmpar\@ympar}
252 %    \end{macrocode}
253 %    |\@xmpar| and |\@ympar| are now defined similar to
254 %    |\@xfloat| above.
255 %    If an optional argument is present |\@xmpar| typesets
256 %    it in a temporary box that is thrown away later.
257 %    Then it calls up |\@ympar| to process |\marginpar|'s
258 %    argument.
259 % \changes{v1.0d}{1990/01/21}{Added forgotten \cs{vbox}.}
260 %    \begin{macrocode}
261   \long\def\@xmpar[##1]{%
262     \setbox\@tempboxa\vbox{\@parboxrestore ##1}\@ympar}%
263 %    \end{macrocode}
264 %    |\@ympar| gathers its argument in the same temporary box
265 %    and throws away its contents by closing the group opened up in
266 %    |\marginpar| above.
267 % \changes{v1.0d}{1990/01/21}{Added forgotten \cs{vbox}.}
268 %    \begin{macrocode}
269   \long\def\@ympar##1{%
270     \setbox\@tempboxa\vbox{\@parboxrestore ##1}\endgroup}%
271 %    \end{macrocode}
272 %    And that's all we had to do.
273 %    \begin{macrocode}
275 %    \end{macrocode}
276 % \end{macro}
278 % \begin{macro}{\@preamblecmds}
279 %    We disable the use of the |\syntaxonly| command after
280 %    |\begin{document}|
281 %    \begin{macrocode}
282 \@onlypreamble\syntaxonly
283 %</package>
284 %    \end{macrocode}
285 % \end{macro}
287 % \Finale
289 \endinput