Debian Codegraph @

texmf-dist/source/latex/base/syntonly.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX 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 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 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 %%
30 %
31 %
32 % \changes{v2.1a}{1994/03/10}{Update for \LaTeXe}
33 %
34 % \DoNotIndex{\@cclvi,\@cclv,\@gobble,\@gobbletwo,\@ifnextchar}
35 % \DoNotIndex{\@M,\@tempboxa,\advance,\alloc,\begingroup,\bgroup}
36 % \DoNotIndex{\box,\count@,\def,\do,\docdate,\egroup,\endgroup}
37 % \DoNotIndex{\fi,\filedate,\fileversion,\font,\fontdimen,\global}
38 % \DoNotIndex{\ifinner,\ifnum,\immediate,\let,\long,\loop,\m@ne}
39 % \DoNotIndex{\noexpand,\relax,\repeat,\scriptfont}
40 % \DoNotIndex{\scriptscriptfont,\setbox,\sixt@@n,\space,\textfont}
41 % \DoNotIndex{\toks,\toksdef,\write,\xdef,\z@}%
42 %
43 %
44 %\title{The file \texttt{syntonly.dtx} for use with
45 % \LaTeXe.\thanks{This file has version
46 % number \fileversion, dated \filedate.}\\[2pt]
47 % It contains the code for \texttt{syntonly.sty}}
48 % \author{Frank Mittelbach \and Rainer Sch\"opf}
49 %
50 %
51 % \MaintainedByLaTeXTeam{latex}
52 % \maketitle
53 %
54 % This package implements the |\syntaxonly| declaration for \LaTeXe.
55 % This command can be used in the preamble for running a document
56 % through \LaTeX{} without actually getting any output.
57 %
58 % \MaybeStop{}
59 %
60 %
61 % \section{Identification}
62 %
63 % We identify the package and its current version.
64 % \changes{v2.1b}{1995/04/22}{Removed surplus \cs{typeout} lines}
65 % \changes{v2.1c}{1996/06/14}{Rearrange \cs{GetFileInfo} usage.}
66 % \changes{v2.1d}{1998/08/17}{(RmS) Minor documentation fixes.}
67 %
68 % \begin{macrocode}
69 %<package>\ProvidesPackage{syntonly}
70 %<*dtx>
71 \ProvidesFile{syntonly.dtx}
72 %</dtx>
73 %<*package|dtx>
74 [2024/02/08 v2.1e Standard LaTeX2e package]
75 %</package|dtx>
76 % \end{macrocode}
77 %
78 %\iffalse
79 %
80 % \section{The documentation driver file}
81 %
82 % The next bit of code contains the documentation driver file for
83 % \TeX{}, i.e., the file that will produce the documentation you are
84 % currently reading. It will be extracted from this file by the \dst{}
85 % program.
86 % \begin{macrocode}
87 %<*driver>
88 \documentclass{ltxdoc}
89 \GetFileInfo{syntonly.dtx}
90 \providecommand\dst{\expandafter{\normalfont\scshape docstrip}}
91 \begin{document}
92 \DocInput{syntonly.dtx}
93 \end{document}
94 %</driver>
95 % \end{macrocode}
96 %\fi
97 %
98 %
99 % \section{Implementation}
100 %
101 % \begin{macrocode}
102 %<*package>
103 % \end{macrocode}
104 %
105 % \begin{macro}{\dummyft@}
106 % First of all we need to define the `dummy' font.
107 % \begin{macrocode}
108 \font\dummyft@=dummy \relax
109 % \end{macrocode}
110 % \end{macro}
111 % \changes{v2.1b}{1995/05/25}{Removed unneeded fontdimen settings for
112 % dummyft@}
113 %
114 % \begin{macro}{\ifsyntax@}
115 % Now we can define the `syntax only' feature. We define a switch
116 % |\if@syntax| so that any macro can always find out if it
117 % is really supposed to typeset text. Its default is to run in
118 % normal mode.
119 % \begin{macrocode}
120 \newif\ifsyntax@
121 \syntax@false
122 % \end{macrocode}
123 % \end{macro}
124 %
125 % \begin{macro}{\syntaxonly}
126 % The |\syntaxonly| macro sets up everything for syntax
127 % checking.
128 % \begin{macrocode}
129 \def\syntaxonly{%
130 % \end{macrocode}
131 % First of all it sets the |syntax@| switch to \texttt{true}.
132 % \begin{macrocode}
133 \syntax@true
134 % \end{macrocode}
135 % Then it globally sets all fonts to the dummy font. These are:
136 % the current font outside math mode,
137 % \begin{macrocode}
138 \global\dummyft@
139 % \end{macrocode}
140 % and the $3\times16$ math fonts for the $16$ math \emph{groups}.
141 % We use a loop to set these.
142 % \begin{macrocode}
143 \count@\sixt@@n
144 \loop
145 \ifnum\count@ >\z@
146 \advance\count@\m@ne
147 \global\textfont\count@\dummyft@
148 \global\scriptfont\count@\dummyft@
149 \global\scriptscriptfont\count@\dummyft@
150 \repeat
151 % \end{macrocode}
152 % Since all font changes occur either via |\selectfont| (in
153 % text) or |\mathversion| (for math mode), it is sufficient
154 % to change these to no-ops. In addition we must prevent
155 % the loading of math fonts, this is done by making
156 % |\getanddefine@fonts| a no-op.
157 % \begin{macrocode}
158 \global\let\selectfont\relax
159 \global\let\mathversion\@gobble
160 \global\let\getanddefine@fonts\@gobbletwo
161 % \end{macrocode}
162 % We prevent \TeX{} from complaining about the dummy font
163 % having no characters.
164 % \begin{macrocode}
165 \tracinglostchars\z@
166 % \end{macrocode}
167 % Then we disable the output routine, and set |\frenchspacing|
168 % (which is slightly faster than |\nonfrenchspacing|).
169 % Finally we set |\hbadness| to $10000$ to avoid overfull box
170 % messages.
171 % \begin{macrocode}
172 \nopages@
173 \frenchspacing
174 \hbadness\@M}
175 % \end{macrocode}
176 % \end{macro}
177 %
178 % \changes{v2.1b}{1995/05/25}{Removed non-outer newtoks@: newtoks is no
179 % longer outer}
180 %
181 % \begin{macro}{\nopages@}
182 % \changes{v1.0b}{1990/01/14}{Rewrite of the \cs{nopages@} macro to
183 % correctly handle footnote insertions, floats and marginpars.}
184 % The |\nopages@| macro disables the \LaTeX{} output routine.
185 % To this end we define a very simple output routine that empties
186 % the output \emph{and} footnote boxes (remember that the latter
187 % are insertions).
188 % \begin{macrocode}
189 \def\nopages@{%
190 \output {\setbox\z@\box\@cclv
191 \setbox\z@\box\footins
192 \deadcycles\z@}%
193 % \end{macrocode}
194 % Then we protect it against definition by a style file.
195 % \changes{v2.1b}{1995/05/25}{newtoks is no longer outer}
196 % \begin{macrocode}
197 \newtoks\output
198 % \end{macrocode}
199 % But this is not enough: normally the \LaTeX{} output routine
200 % is responsible for dealing with floating objects.
201 % We therefore also redefine the internal macros for handling
202 % floats and marginpars.
203 % \begin{macrocode}
204 \def\@xfloat##1[##2]{%
205 % \end{macrocode}
206 % There are a few things that have to be retained:
207 % the definition of |\@captype| since it is used by the
208 % |\caption| command,
209 % \changes{v1.0c}{1990/01/16}{Definition of \cs{@captype} added.}
210 % \begin{macrocode}
211 \def\@captype{##1}%
212 % \end{macrocode}
213 % the error message issued when not in outer paragraph mode,
214 % \begin{macrocode}
215 \ifinner\@parmoderr\fi
216 % \end{macrocode}
217 % and the |\@parboxrestore| command for the body of the
218 % float. This is necessary since it restores the original
219 % definitions of important commands like |\par| or |\\|.
220 % \begin{macrocode}
221 \setbox\@tempboxa\vbox\bgroup\@parboxrestore}%
222 % \end{macrocode}
223 % |\end@float| must now only close the brace:
224 % \begin{macrocode}
225 \let\end@float\egroup
226 % \end{macrocode}
227 % The above would be enough also for two-column floats with the
228 % kernel algorithm. However with the refined algorithm inside
229 % \texttt{fixlxt2e} this doesn't any longer work, so there we also
230 % need to explicitly overwrite the end macro for two-column floats
231 % (the begin is still okay as it resolves to |\@xfloat| eventually).
232 % \begin{macrocode}
233 \let\end@dblfloat\egroup
234 % \end{macrocode}
235 % The redefinition of the |\marginpar| command is a bit more
236 % complicated since we have to check for the optional argument.
237 % First we redefine the command itself:
238 % \begin{macrocode}
239 \def\marginpar{\ifinner\@parmoderr\fi
240 % \end{macrocode}
241 % We open a group so that everything gathered in a temporary box
242 % can easily be thrown away by closing it again (see below).
243 % \begin{macrocode}
244 \begingroup \@ifnextchar [\@xmpar\@ympar}
245 % \end{macrocode}
246 % |\@xmpar| and |\@ympar| are now defined similar to
247 % |\@xfloat| above.
248 % If an optional argument is present |\@xmpar| typesets
249 % it in a temporary box that is thrown away later.
250 % Then it calls up |\@ympar| to process |\marginpar|'s
251 % argument.
252 % \changes{v1.0d}{1990/01/21}{Added forgotten \cs{vbox}.}
253 % \begin{macrocode}
254 \long\def\@xmpar[##1]{%
255 \setbox\@tempboxa\vbox{\@parboxrestore ##1}\@ympar}%
256 % \end{macrocode}
257 % |\@ympar| gathers its argument in the same temporary box
258 % and throws away its contents by closing the group opened up in
259 % |\marginpar| above.
260 % \changes{v1.0d}{1990/01/21}{Added forgotten \cs{vbox}.}
261 % \begin{macrocode}
262 \long\def\@ympar##1{%
263 \setbox\@tempboxa\vbox{\@parboxrestore ##1}\endgroup}%
264 % \end{macrocode}
265 % And that's all we had to do.
266 % \begin{macrocode}
267 }
268 % \end{macrocode}
269 % \end{macro}
270 %
271 % \begin{macro}{\@preamblecmds}
272 % We disable the use of the |\syntaxonly| command after
273 % |\begin{document}|
274 % \begin{macrocode}
275 \@onlypreamble\syntaxonly
276 %</package>
277 % \end{macrocode}
278 % \end{macro}
279 %
280 % \Finale
281
282 \endinput