1 1.1 christos % texinfo.tex -- TeX macros to handle Texinfo files. 2 1.1 christos % Id: texinfo.tex,v 1.1.1.1 2000/06/16 07:49:23 drepper Exp 3 1.1 christos % 4 1.1 christos % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98 5 1.1 christos % Free Software Foundation, Inc. 6 1.1 christos % 7 1.1 christos % This texinfo.tex file is free software; you can redistribute it and/or 8 1.1 christos % modify it under the terms of the GNU General Public License as 9 1.1 christos % published by the Free Software Foundation; either version 2, or (at 10 1.1 christos % your option) any later version. 11 1.1 christos % 12 1.1 christos % This texinfo.tex file is distributed in the hope that it will be 13 1.1 christos % useful, but WITHOUT ANY WARRANTY; without even the implied warranty 14 1.1 christos % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 1.1 christos % General Public License for more details. 16 1.1 christos % 17 1.1 christos % You should have received a copy of the GNU General Public License 18 1.1 christos % along with this texinfo.tex file; see the file COPYING. If not, write 19 1.1 christos % to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 1.1 christos % Boston, MA 02110-1301, USA. 21 1.1 christos % 22 1.1 christos % In other words, you are welcome to use, share and improve this program. 23 1.1 christos % You are forbidden to forbid anyone else to use, share and improve 24 1.1 christos % what you give them. Help stamp out software-hoarding! 25 1.1 christos % 26 1.1 christos % Please try the latest version of texinfo.tex before submitting bug 27 1.1 christos % reports; you can get the latest version from: 28 1.1 christos % /home/gd/gnu/doc/texinfo.tex on the GNU machines. 29 1.1 christos % ftp://ftp.gnu.org/pub/gnu/texinfo.tex 30 1.1 christos % (and all GNU mirrors, see ftp://ftp.gnu.org/pub/gnu/README.mirrors) 31 1.1 christos % ftp://tug.org/tex/texinfo.tex 32 1.1 christos % ftp://ctan.org/macros/texinfo/texinfo.tex 33 1.1 christos % (and all CTAN mirrors, finger ctan (a] tug.org for a list). 34 1.1 christos % 35 1.1 christos % Send bug reports to bug-texinfo (a] gnu.org. 36 1.1 christos % Please include a precise test case in each bug report, 37 1.1 christos % including a complete document with which we can reproduce the problem. 38 1.1 christos % 39 1.1 christos % Texinfo macros (with @macro) are *not* supported by texinfo.tex. You 40 1.1 christos % have to run makeinfo -E to expand macros first; the texi2dvi script 41 1.1 christos % does this. 42 1.1 christos % 43 1.1 christos % To process a Texinfo manual with TeX, it's most reliable to use the 44 1.1 christos % texi2dvi shell script that comes with the distribution. For simple 45 1.1 christos % manuals, you can get away with: 46 1.1 christos % tex foo.texi 47 1.1 christos % texindex foo.?? 48 1.1 christos % tex foo.texi 49 1.1 christos % tex foo.texi 50 1.1 christos % dvips foo.dvi -o # or whatever, to process the dvi file. 51 1.1 christos % The extra runs of TeX get the cross-reference information correct. 52 1.1 christos % Sometimes one run after texindex suffices, and sometimes you need more 53 1.1 christos % than two; texi2dvi does it as many times as necessary. 54 1.1 christos 55 1.1 christos 56 1.1 christos % Make it possible to create a .fmt file just by loading this file: 57 1.1 christos % if the underlying format is not loaded, start by loading it now. 58 1.1 christos % Added by gildea November 1993. 59 1.1 christos \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 60 1.1 christos 61 1.1 christos % This automatically updates the version number based on RCS. 62 1.1 christos \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} 63 1.1 christos \deftexinfoversionRevision: 1.1.1.1 64 1.1 christos \message{Loading texinfo package [Version \texinfoversion]:} 65 1.1 christos 66 1.1 christos % If in a .fmt file, print the version number 67 1.1 christos % and turn on active characters that we couldn't do earlier because 68 1.1 christos % they might have appeared in the input file name. 69 1.1 christos \everyjob{\message{[Texinfo version \texinfoversion]}\message{} 70 1.1 christos \catcode`+=\active \catcode`\_=\active} 71 1.1 christos 72 1.1 christos % Save some parts of plain tex whose names we will redefine. 73 1.1 christos 74 1.1 christos \let\ptexb=\b 75 1.1 christos \let\ptexbullet=\bullet 76 1.1 christos \let\ptexc=\c 77 1.1 christos \let\ptexcomma=\, 78 1.1 christos \let\ptexdot=\. 79 1.1 christos \let\ptexdots=\dots 80 1.1 christos \let\ptexend=\end 81 1.1 christos \let\ptexequiv=\equiv 82 1.1 christos \let\ptexexclam=\! 83 1.1 christos \let\ptexi=\i 84 1.1 christos \let\ptexlbrace=\{ 85 1.1 christos \let\ptexrbrace=\} 86 1.1 christos \let\ptexstar=\* 87 1.1 christos \let\ptext=\t 88 1.1 christos 89 1.1 christos % We never want plain's outer \+ definition in Texinfo. 90 1.1 christos % For @tex, we can use \tabalign. 91 1.1 christos \let\+ = \relax 92 1.1 christos 93 1.1 christos 94 1.1 christos \message{Basics,} 95 1.1 christos \chardef\other=12 96 1.1 christos 97 1.1 christos % If this character appears in an error message or help string, it 98 1.1 christos % starts a new line in the output. 99 1.1 christos \newlinechar = `^^J 100 1.1 christos 101 1.1 christos % Set up fixed words for English if not already set. 102 1.1 christos \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi 103 1.1 christos \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi 104 1.1 christos \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi 105 1.1 christos \ifx\putwordInfo\undefined \gdef\putwordfile{Info}\fi 106 1.1 christos \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi 107 1.1 christos \ifx\putwordon\undefined \gdef\putwordon{on}\fi 108 1.1 christos \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi 109 1.1 christos \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi 110 1.1 christos \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi 111 1.1 christos \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi 112 1.1 christos \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi 113 1.1 christos \ifx\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi 114 1.1 christos \ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\fi 115 1.1 christos 116 1.1 christos % Ignore a token. 117 1.1 christos % 118 1.1 christos \def\gobble#1{} 119 1.1 christos 120 1.1 christos \hyphenation{ap-pen-dix} 121 1.1 christos \hyphenation{mini-buf-fer mini-buf-fers} 122 1.1 christos \hyphenation{eshell} 123 1.1 christos \hyphenation{white-space} 124 1.1 christos 125 1.1 christos % Margin to add to right of even pages, to left of odd pages. 126 1.1 christos \newdimen \bindingoffset 127 1.1 christos \newdimen \normaloffset 128 1.1 christos \newdimen\pagewidth \newdimen\pageheight 129 1.1 christos 130 1.1 christos % Sometimes it is convenient to have everything in the transcript file 131 1.1 christos % and nothing on the terminal. We don't just call \tracingall here, 132 1.1 christos % since that produces some useless output on the terminal. 133 1.1 christos % 134 1.1 christos \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% 135 1.1 christos \def\loggingall{\tracingcommands2 \tracingstats2 136 1.1 christos \tracingpages1 \tracingoutput1 \tracinglostchars1 137 1.1 christos \tracingmacros2 \tracingparagraphs1 \tracingrestores1 138 1.1 christos \showboxbreadth\maxdimen\showboxdepth\maxdimen 139 1.1 christos }% 140 1.1 christos 141 1.1 christos % For @cropmarks command. 142 1.1 christos % Do @cropmarks to get crop marks. 143 1.1 christos % 144 1.1 christos \newif\ifcropmarks 145 1.1 christos \let\cropmarks = \cropmarkstrue 146 1.1 christos % 147 1.1 christos % Dimensions to add cropmarks at corners. 148 1.1 christos % Added by P. A. MacKay, 12 Nov. 1986 149 1.1 christos % 150 1.1 christos \newdimen\cornerlong \newdimen\cornerthick 151 1.1 christos \newdimen\topandbottommargin 152 1.1 christos \newdimen\outerhsize \newdimen\outervsize 153 1.1 christos \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks 154 1.1 christos \outerhsize=7in 155 1.1 christos %\outervsize=9.5in 156 1.1 christos % Alternative @smallbook page size is 9.25in 157 1.1 christos \outervsize=9.25in 158 1.1 christos \topandbottommargin=.75in 159 1.1 christos 160 1.1 christos % Main output routine. 161 1.1 christos \chardef\PAGE = 255 162 1.1 christos \output = {\onepageout{\pagecontents\PAGE}} 163 1.1 christos 164 1.1 christos \newbox\headlinebox 165 1.1 christos \newbox\footlinebox 166 1.1 christos 167 1.1 christos % \onepageout takes a vbox as an argument. Note that \pagecontents 168 1.1 christos % does insertions, but you have to call it yourself. 169 1.1 christos \def\onepageout#1{% 170 1.1 christos \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi 171 1.1 christos % 172 1.1 christos \ifodd\pageno \advance\hoffset by \bindingoffset 173 1.1 christos \else \advance\hoffset by -\bindingoffset\fi 174 1.1 christos % 175 1.1 christos % Do this outside of the \shipout so @code etc. will be expanded in 176 1.1 christos % the headline as they should be, not taken literally (outputting ''code). 177 1.1 christos \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% 178 1.1 christos \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% 179 1.1 christos % 180 1.1 christos {% 181 1.1 christos % Have to do this stuff outside the \shipout because we want it to 182 1.1 christos % take effect in \write's, yet the group defined by the \vbox ends 183 1.1 christos % before the \shipout runs. 184 1.1 christos % 185 1.1 christos \escapechar = `\\ % use backslash in output files. 186 1.1 christos \indexdummies % don't expand commands in the output. 187 1.1 christos \normalturnoffactive % \ in index entries must not stay \, e.g., if 188 1.1 christos % the page break happens to be in the middle of an example. 189 1.1 christos \shipout\vbox{% 190 1.1 christos \ifcropmarks \vbox to \outervsize\bgroup 191 1.1 christos \hsize = \outerhsize 192 1.1 christos \line{\ewtop\hfil\ewtop}% 193 1.1 christos \nointerlineskip 194 1.1 christos \line{% 195 1.1 christos \vbox{\moveleft\cornerthick\nstop}% 196 1.1 christos \hfill 197 1.1 christos \vbox{\moveright\cornerthick\nstop}% 198 1.1 christos }% 199 1.1 christos \vskip\topandbottommargin 200 1.1 christos \line\bgroup 201 1.1 christos \hfil % center the page within the outer (page) hsize. 202 1.1 christos \ifodd\pageno\hskip\bindingoffset\fi 203 1.1 christos \vbox\bgroup 204 1.1 christos \fi 205 1.1 christos % 206 1.1 christos \unvbox\headlinebox 207 1.1 christos \pagebody{#1}% 208 1.1 christos \ifdim\ht\footlinebox > 0pt 209 1.1 christos % Only leave this space if the footline is nonempty. 210 1.1 christos % (We lessened \vsize for it in \oddfootingxxx.) 211 1.1 christos % The \baselineskip=24pt in plain's \makefootline has no effect. 212 1.1 christos \vskip 2\baselineskip 213 1.1 christos \unvbox\footlinebox 214 1.1 christos \fi 215 1.1 christos % 216 1.1 christos \ifcropmarks 217 1.1 christos \egroup % end of \vbox\bgroup 218 1.1 christos \hfil\egroup % end of (centering) \line\bgroup 219 1.1 christos \vskip\topandbottommargin plus1fill minus1fill 220 1.1 christos \boxmaxdepth = \cornerthick 221 1.1 christos \line{% 222 1.1 christos \vbox{\moveleft\cornerthick\nsbot}% 223 1.1 christos \hfill 224 1.1 christos \vbox{\moveright\cornerthick\nsbot}% 225 1.1 christos }% 226 1.1 christos \nointerlineskip 227 1.1 christos \line{\ewbot\hfil\ewbot}% 228 1.1 christos \egroup % \vbox from first cropmarks clause 229 1.1 christos \fi 230 1.1 christos }% end of \shipout\vbox 231 1.1 christos }% end of group with \turnoffactive 232 1.1 christos \advancepageno 233 1.1 christos \ifnum\outputpenalty>-20000 \else\dosupereject\fi 234 1.1 christos } 235 1.1 christos 236 1.1 christos \newinsert\margin \dimen\margin=\maxdimen 237 1.1 christos 238 1.1 christos \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} 239 1.1 christos {\catcode`\@ =11 240 1.1 christos \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi 241 1.1 christos % marginal hacks, juha (a] viisa.uucp (Juha Takala) 242 1.1 christos \ifvoid\margin\else % marginal info is present 243 1.1 christos \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi 244 1.1 christos \dimen@=\dp#1 \unvbox#1 245 1.1 christos \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi 246 1.1 christos \ifr@ggedbottom \kern-\dimen@ \vfil \fi} 247 1.1 christos } 248 1.1 christos 249 1.1 christos % Here are the rules for the cropmarks. Note that they are 250 1.1 christos % offset so that the space between them is truly \outerhsize or \outervsize 251 1.1 christos % (P. A. MacKay, 12 November, 1986) 252 1.1 christos % 253 1.1 christos \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} 254 1.1 christos \def\nstop{\vbox 255 1.1 christos {\hrule height\cornerthick depth\cornerlong width\cornerthick}} 256 1.1 christos \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} 257 1.1 christos \def\nsbot{\vbox 258 1.1 christos {\hrule height\cornerlong depth\cornerthick width\cornerthick}} 259 1.1 christos 260 1.1 christos % Parse an argument, then pass it to #1. The argument is the rest of 261 1.1 christos % the input line (except we remove a trailing comment). #1 should be a 262 1.1 christos % macro which expects an ordinary undelimited TeX argument. 263 1.1 christos % 264 1.1 christos \def\parsearg#1{% 265 1.1 christos \let\next = #1% 266 1.1 christos \begingroup 267 1.1 christos \obeylines 268 1.1 christos \futurelet\temp\parseargx 269 1.1 christos } 270 1.1 christos 271 1.1 christos % If the next token is an obeyed space (from an @example environment or 272 1.1 christos % the like), remove it and recurse. Otherwise, we're done. 273 1.1 christos \def\parseargx{% 274 1.1 christos % \obeyedspace is defined far below, after the definition of \sepspaces. 275 1.1 christos \ifx\obeyedspace\temp 276 1.1 christos \expandafter\parseargdiscardspace 277 1.1 christos \else 278 1.1 christos \expandafter\parseargline 279 1.1 christos \fi 280 1.1 christos } 281 1.1 christos 282 1.1 christos % Remove a single space (as the delimiter token to the macro call). 283 1.1 christos {\obeyspaces % 284 1.1 christos \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} 285 1.1 christos 286 1.1 christos {\obeylines % 287 1.1 christos \gdef\parseargline#1^^M{% 288 1.1 christos \endgroup % End of the group started in \parsearg. 289 1.1 christos % 290 1.1 christos % First remove any @c comment, then any @comment. 291 1.1 christos % Result of each macro is put in \toks0. 292 1.1 christos \argremovec #1\c\relax % 293 1.1 christos \expandafter\argremovecomment \the\toks0 \comment\relax % 294 1.1 christos % 295 1.1 christos % Call the caller's macro, saved as \next in \parsearg. 296 1.1 christos \expandafter\next\expandafter{\the\toks0}% 297 1.1 christos }% 298 1.1 christos } 299 1.1 christos 300 1.1 christos % Since all \c{,omment} does is throw away the argument, we can let TeX 301 1.1 christos % do that for us. The \relax here is matched by the \relax in the call 302 1.1 christos % in \parseargline; it could be more or less anything, its purpose is 303 1.1 christos % just to delimit the argument to the \c. 304 1.1 christos \def\argremovec#1\c#2\relax{\toks0 = {#1}} 305 1.1 christos \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} 306 1.1 christos 307 1.1 christos % \argremovec{,omment} might leave us with trailing spaces, though; e.g., 308 1.1 christos % @end itemize @c foo 309 1.1 christos % will have two active spaces as part of the argument with the 310 1.1 christos % `itemize'. Here we remove all active spaces from #1, and assign the 311 1.1 christos % result to \toks0. 312 1.1 christos % 313 1.1 christos % This loses if there are any *other* active characters besides spaces 314 1.1 christos % in the argument -- _ ^ +, for example -- since they get expanded. 315 1.1 christos % Fortunately, Texinfo does not define any such commands. (If it ever 316 1.1 christos % does, the catcode of the characters in questionwill have to be changed 317 1.1 christos % here.) But this means we cannot call \removeactivespaces as part of 318 1.1 christos % \argremovec{,omment}, since @c uses \parsearg, and thus the argument 319 1.1 christos % that \parsearg gets might well have any character at all in it. 320 1.1 christos % 321 1.1 christos \def\removeactivespaces#1{% 322 1.1 christos \begingroup 323 1.1 christos \ignoreactivespaces 324 1.1 christos \edef\temp{#1}% 325 1.1 christos \global\toks0 = \expandafter{\temp}% 326 1.1 christos \endgroup 327 1.1 christos } 328 1.1 christos 329 1.1 christos % Change the active space to expand to nothing. 330 1.1 christos % 331 1.1 christos \begingroup 332 1.1 christos \obeyspaces 333 1.1 christos \gdef\ignoreactivespaces{\obeyspaces\let =\empty} 334 1.1 christos \endgroup 335 1.1 christos 336 1.1 christos 337 1.1 christos \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} 338 1.1 christos 339 1.1 christos %% These are used to keep @begin/@end levels from running away 340 1.1 christos %% Call \inENV within environments (after a \begingroup) 341 1.1 christos \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} 342 1.1 christos \def\ENVcheck{% 343 1.1 christos \ifENV\errmessage{Still within an environment. Type Return to continue.} 344 1.1 christos \endgroup\fi} % This is not perfect, but it should reduce lossage 345 1.1 christos 346 1.1 christos % @begin foo is the same as @foo, for now. 347 1.1 christos \newhelp\EMsimple{Type <Return> to continue.} 348 1.1 christos 349 1.1 christos \outer\def\begin{\parsearg\beginxxx} 350 1.1 christos 351 1.1 christos \def\beginxxx #1{% 352 1.1 christos \expandafter\ifx\csname #1\endcsname\relax 353 1.1 christos {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else 354 1.1 christos \csname #1\endcsname\fi} 355 1.1 christos 356 1.1 christos % @end foo executes the definition of \Efoo. 357 1.1 christos % 358 1.1 christos \def\end{\parsearg\endxxx} 359 1.1 christos \def\endxxx #1{% 360 1.1 christos \removeactivespaces{#1}% 361 1.1 christos \edef\endthing{\the\toks0}% 362 1.1 christos % 363 1.1 christos \expandafter\ifx\csname E\endthing\endcsname\relax 364 1.1 christos \expandafter\ifx\csname \endthing\endcsname\relax 365 1.1 christos % There's no \foo, i.e., no ``environment'' foo. 366 1.1 christos \errhelp = \EMsimple 367 1.1 christos \errmessage{Undefined command `@end \endthing'}% 368 1.1 christos \else 369 1.1 christos \unmatchedenderror\endthing 370 1.1 christos \fi 371 1.1 christos \else 372 1.1 christos % Everything's ok; the right environment has been started. 373 1.1 christos \csname E\endthing\endcsname 374 1.1 christos \fi 375 1.1 christos } 376 1.1 christos 377 1.1 christos % There is an environment #1, but it hasn't been started. Give an error. 378 1.1 christos % 379 1.1 christos \def\unmatchedenderror#1{% 380 1.1 christos \errhelp = \EMsimple 381 1.1 christos \errmessage{This `@end #1' doesn't have a matching `@#1'}% 382 1.1 christos } 383 1.1 christos 384 1.1 christos % Define the control sequence \E#1 to give an unmatched @end error. 385 1.1 christos % 386 1.1 christos \def\defineunmatchedend#1{% 387 1.1 christos \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% 388 1.1 christos } 389 1.1 christos 390 1.1 christos 391 1.1 christos % Single-spacing is done by various environments (specifically, in 392 1.1 christos % \nonfillstart and \quotations). 393 1.1 christos \newskip\singlespaceskip \singlespaceskip = 12.5pt 394 1.1 christos \def\singlespace{% 395 1.1 christos % Why was this kern here? It messes up equalizing space above and below 396 1.1 christos % environments. --karl, 6may93 397 1.1 christos %{\advance \baselineskip by -\singlespaceskip 398 1.1 christos %\kern \baselineskip}% 399 1.1 christos \setleading \singlespaceskip 400 1.1 christos } 401 1.1 christos 402 1.1 christos %% Simple single-character @ commands 403 1.1 christos 404 1.1 christos % @@ prints an @ 405 1.1 christos % Kludge this until the fonts are right (grr). 406 1.1 christos \def\@{{\tt\char64}} 407 1.1 christos 408 1.1 christos % This is turned off because it was never documented 409 1.1 christos % and you can use @w{...} around a quote to suppress ligatures. 410 1.1 christos %% Define @` and @' to be the same as ` and ' 411 1.1 christos %% but suppressing ligatures. 412 1.1 christos %\def\`{{`}} 413 1.1 christos %\def\'{{'}} 414 1.1 christos 415 1.1 christos % Used to generate quoted braces. 416 1.1 christos \def\mylbrace {{\tt\char123}} 417 1.1 christos \def\myrbrace {{\tt\char125}} 418 1.1 christos \let\{=\mylbrace 419 1.1 christos \let\}=\myrbrace 420 1.1 christos \begingroup 421 1.1 christos % Definitions to produce actual \{ & \} command in an index. 422 1.1 christos \catcode`\{ = 12 \catcode`\} = 12 423 1.1 christos \catcode`\[ = 1 \catcode`\] = 2 424 1.1 christos \catcode`\@ = 0 \catcode`\\ = 12 425 1.1 christos @gdef@lbracecmd[\{]% 426 1.1 christos @gdef@rbracecmd[\}]% 427 1.1 christos @endgroup 428 1.1 christos 429 1.1 christos % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent 430 1.1 christos % Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. 431 1.1 christos \let\, = \c 432 1.1 christos \let\dotaccent = \. 433 1.1 christos \def\ringaccent#1{{\accent23 #1}} 434 1.1 christos \let\tieaccent = \t 435 1.1 christos \let\ubaraccent = \b 436 1.1 christos \let\udotaccent = \d 437 1.1 christos 438 1.1 christos % Other special characters: @questiondown @exclamdown 439 1.1 christos % Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. 440 1.1 christos \def\questiondown{?`} 441 1.1 christos \def\exclamdown{!`} 442 1.1 christos 443 1.1 christos % Dotless i and dotless j, used for accents. 444 1.1 christos \def\imacro{i} 445 1.1 christos \def\jmacro{j} 446 1.1 christos \def\dotless#1{% 447 1.1 christos \def\temp{#1}% 448 1.1 christos \ifx\temp\imacro \ptexi 449 1.1 christos \else\ifx\temp\jmacro \j 450 1.1 christos \else \errmessage{@dotless can be used only with i or j}% 451 1.1 christos \fi\fi 452 1.1 christos } 453 1.1 christos 454 1.1 christos % Be sure we're in horizontal mode when doing a tie, since we make space 455 1.1 christos % equivalent to this in @example-like environments. Otherwise, a space 456 1.1 christos % at the beginning of a line will start with \penalty -- and 457 1.1 christos % since \penalty is valid in vertical mode, we'd end up putting the 458 1.1 christos % penalty on the vertical list instead of in the new paragraph. 459 1.1 christos {\catcode`@ = 11 460 1.1 christos % Avoid using \@M directly, because that causes trouble 461 1.1 christos % if the definition is written into an index file. 462 1.1 christos \global\let\tiepenalty = \@M 463 1.1 christos \gdef\tie{\leavevmode\penalty\tiepenalty\ } 464 1.1 christos } 465 1.1 christos 466 1.1 christos % @: forces normal size whitespace following. 467 1.1 christos \def\:{\spacefactor=1000 } 468 1.1 christos 469 1.1 christos % @* forces a line break. 470 1.1 christos \def\*{\hfil\break\hbox{}\ignorespaces} 471 1.1 christos 472 1.1 christos % @. is an end-of-sentence period. 473 1.1 christos \def\.{.\spacefactor=3000 } 474 1.1 christos 475 1.1 christos % @! is an end-of-sentence bang. 476 1.1 christos \def\!{!\spacefactor=3000 } 477 1.1 christos 478 1.1 christos % @? is an end-of-sentence query. 479 1.1 christos \def\?{?\spacefactor=3000 } 480 1.1 christos 481 1.1 christos % @w prevents a word break. Without the \leavevmode, @w at the 482 1.1 christos % beginning of a paragraph, when TeX is still in vertical mode, would 483 1.1 christos % produce a whole line of output instead of starting the paragraph. 484 1.1 christos \def\w#1{\leavevmode\hbox{#1}} 485 1.1 christos 486 1.1 christos % @group ... @end group forces ... to be all on one page, by enclosing 487 1.1 christos % it in a TeX vbox. We use \vtop instead of \vbox to construct the box 488 1.1 christos % to keep its height that of a normal line. According to the rules for 489 1.1 christos % \topskip (p.114 of the TeXbook), the glue inserted is 490 1.1 christos % max (\topskip - \ht (first item), 0). If that height is large, 491 1.1 christos % therefore, no glue is inserted, and the space between the headline and 492 1.1 christos % the text is small, which looks bad. 493 1.1 christos % 494 1.1 christos \def\group{\begingroup 495 1.1 christos \ifnum\catcode13=\active \else 496 1.1 christos \errhelp = \groupinvalidhelp 497 1.1 christos \errmessage{@group invalid in context where filling is enabled}% 498 1.1 christos \fi 499 1.1 christos % 500 1.1 christos % The \vtop we start below produces a box with normal height and large 501 1.1 christos % depth; thus, TeX puts \baselineskip glue before it, and (when the 502 1.1 christos % next line of text is done) \lineskip glue after it. (See p.82 of 503 1.1 christos % the TeXbook.) Thus, space below is not quite equal to space 504 1.1 christos % above. But it's pretty close. 505 1.1 christos \def\Egroup{% 506 1.1 christos \egroup % End the \vtop. 507 1.1 christos \endgroup % End the \group. 508 1.1 christos }% 509 1.1 christos % 510 1.1 christos \vtop\bgroup 511 1.1 christos % We have to put a strut on the last line in case the @group is in 512 1.1 christos % the midst of an example, rather than completely enclosing it. 513 1.1 christos % Otherwise, the interline space between the last line of the group 514 1.1 christos % and the first line afterwards is too small. But we can't put the 515 1.1 christos % strut in \Egroup, since there it would be on a line by itself. 516 1.1 christos % Hence this just inserts a strut at the beginning of each line. 517 1.1 christos \everypar = {\strut}% 518 1.1 christos % 519 1.1 christos % Since we have a strut on every line, we don't need any of TeX's 520 1.1 christos % normal interline spacing. 521 1.1 christos \offinterlineskip 522 1.1 christos % 523 1.1 christos % OK, but now we have to do something about blank 524 1.1 christos % lines in the input in @example-like environments, which normally 525 1.1 christos % just turn into \lisppar, which will insert no space now that we've 526 1.1 christos % turned off the interline space. Simplest is to make them be an 527 1.1 christos % empty paragraph. 528 1.1 christos \ifx\par\lisppar 529 1.1 christos \edef\par{\leavevmode \par}% 530 1.1 christos % 531 1.1 christos % Reset ^^M's definition to new definition of \par. 532 1.1 christos \obeylines 533 1.1 christos \fi 534 1.1 christos % 535 1.1 christos % Do @comment since we are called inside an environment such as 536 1.1 christos % @example, where each end-of-line in the input causes an 537 1.1 christos % end-of-line in the output. We don't want the end-of-line after 538 1.1 christos % the `@group' to put extra space in the output. Since @group 539 1.1 christos % should appear on a line by itself (according to the Texinfo 540 1.1 christos % manual), we don't worry about eating any user text. 541 1.1 christos \comment 542 1.1 christos } 543 1.1 christos % 544 1.1 christos % TeX puts in an \escapechar (i.e., `@') at the beginning of the help 545 1.1 christos % message, so this ends up printing `@group can only ...'. 546 1.1 christos % 547 1.1 christos \newhelp\groupinvalidhelp{% 548 1.1 christos group can only be used in environments such as @example,^^J% 549 1.1 christos where each line of input produces a line of output.} 550 1.1 christos 551 1.1 christos % @need space-in-mils 552 1.1 christos % forces a page break if there is not space-in-mils remaining. 553 1.1 christos 554 1.1 christos \newdimen\mil \mil=0.001in 555 1.1 christos 556 1.1 christos \def\need{\parsearg\needx} 557 1.1 christos 558 1.1 christos % Old definition--didn't work. 559 1.1 christos %\def\needx #1{\par % 560 1.1 christos %% This method tries to make TeX break the page naturally 561 1.1 christos %% if the depth of the box does not fit. 562 1.1 christos %{\baselineskip=0pt% 563 1.1 christos %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000 564 1.1 christos %\prevdepth=-1000pt 565 1.1 christos %}} 566 1.1 christos 567 1.1 christos \def\needx#1{% 568 1.1 christos % Go into vertical mode, so we don't make a big box in the middle of a 569 1.1 christos % paragraph. 570 1.1 christos \par 571 1.1 christos % 572 1.1 christos % Don't add any leading before our big empty box, but allow a page 573 1.1 christos % break, since the best break might be right here. 574 1.1 christos \allowbreak 575 1.1 christos \nointerlineskip 576 1.1 christos \vtop to #1\mil{\vfil}% 577 1.1 christos % 578 1.1 christos % TeX does not even consider page breaks if a penalty added to the 579 1.1 christos % main vertical list is 10000 or more. But in order to see if the 580 1.1 christos % empty box we just added fits on the page, we must make it consider 581 1.1 christos % page breaks. On the other hand, we don't want to actually break the 582 1.1 christos % page after the empty box. So we use a penalty of 9999. 583 1.1 christos % 584 1.1 christos % There is an extremely small chance that TeX will actually break the 585 1.1 christos % page at this \penalty, if there are no other feasible breakpoints in 586 1.1 christos % sight. (If the user is using lots of big @group commands, which 587 1.1 christos % almost-but-not-quite fill up a page, TeX will have a hard time doing 588 1.1 christos % good page breaking, for example.) However, I could not construct an 589 1.1 christos % example where a page broke at this \penalty; if it happens in a real 590 1.1 christos % document, then we can reconsider our strategy. 591 1.1 christos \penalty9999 592 1.1 christos % 593 1.1 christos % Back up by the size of the box, whether we did a page break or not. 594 1.1 christos \kern -#1\mil 595 1.1 christos % 596 1.1 christos % Do not allow a page break right after this kern. 597 1.1 christos \nobreak 598 1.1 christos } 599 1.1 christos 600 1.1 christos % @br forces paragraph break 601 1.1 christos 602 1.1 christos \let\br = \par 603 1.1 christos 604 1.1 christos % @dots{} output an ellipsis using the current font. 605 1.1 christos % We do .5em per period so that it has the same spacing in a typewriter 606 1.1 christos % font as three actual period characters. 607 1.1 christos % 608 1.1 christos \def\dots{\hbox to 1.5em{% 609 1.1 christos \hskip 0pt plus 0.25fil minus 0.25fil 610 1.1 christos .\hss.\hss.% 611 1.1 christos \hskip 0pt plus 0.5fil minus 0.5fil 612 1.1 christos }} 613 1.1 christos 614 1.1 christos % @enddots{} is an end-of-sentence ellipsis. 615 1.1 christos % 616 1.1 christos \def\enddots{% 617 1.1 christos \hbox to 2em{% 618 1.1 christos \hskip 0pt plus 0.25fil minus 0.25fil 619 1.1 christos .\hss.\hss.\hss.% 620 1.1 christos \hskip 0pt plus 0.5fil minus 0.5fil 621 1.1 christos }% 622 1.1 christos \spacefactor=3000 623 1.1 christos } 624 1.1 christos 625 1.1 christos 626 1.1 christos % @page forces the start of a new page 627 1.1 christos 628 1.1 christos \def\page{\par\vfill\supereject} 629 1.1 christos 630 1.1 christos % @exdent text.... 631 1.1 christos % outputs text on separate line in roman font, starting at standard page margin 632 1.1 christos 633 1.1 christos % This records the amount of indent in the innermost environment. 634 1.1 christos % That's how much \exdent should take out. 635 1.1 christos \newskip\exdentamount 636 1.1 christos 637 1.1 christos % This defn is used inside fill environments such as @defun. 638 1.1 christos \def\exdent{\parsearg\exdentyyy} 639 1.1 christos \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} 640 1.1 christos 641 1.1 christos % This defn is used inside nofill environments such as @example. 642 1.1 christos \def\nofillexdent{\parsearg\nofillexdentyyy} 643 1.1 christos \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount 644 1.1 christos \leftline{\hskip\leftskip{\rm#1}}}} 645 1.1 christos 646 1.1 christos % @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. 647 1.1 christos 648 1.1 christos \def\inmargin#1{% 649 1.1 christos \strut\vadjust{\nobreak\kern-\strutdepth 650 1.1 christos \vtop to \strutdepth{\baselineskip\strutdepth\vss 651 1.1 christos \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} 652 1.1 christos \newskip\inmarginspacing \inmarginspacing=1cm 653 1.1 christos \def\strutdepth{\dp\strutbox} 654 1.1 christos 655 1.1 christos %\hbox{{\rm#1}}\hfil\break}} 656 1.1 christos 657 1.1 christos % @include file insert text of that file as input. 658 1.1 christos % Allow normal characters that we make active in the argument (a file name). 659 1.1 christos \def\include{\begingroup 660 1.1 christos \catcode`\\=12 661 1.1 christos \catcode`~=12 662 1.1 christos \catcode`^=12 663 1.1 christos \catcode`_=12 664 1.1 christos \catcode`|=12 665 1.1 christos \catcode`<=12 666 1.1 christos \catcode`>=12 667 1.1 christos \catcode`+=12 668 1.1 christos \parsearg\includezzz} 669 1.1 christos % Restore active chars for included file. 670 1.1 christos \def\includezzz#1{\endgroup\begingroup 671 1.1 christos % Read the included file in a group so nested @include's work. 672 1.1 christos \def\thisfile{#1}% 673 1.1 christos \input\thisfile 674 1.1 christos \endgroup} 675 1.1 christos 676 1.1 christos \def\thisfile{} 677 1.1 christos 678 1.1 christos % @center line outputs that line, centered 679 1.1 christos 680 1.1 christos \def\center{\parsearg\centerzzz} 681 1.1 christos \def\centerzzz #1{{\advance\hsize by -\leftskip 682 1.1 christos \advance\hsize by -\rightskip 683 1.1 christos \centerline{#1}}} 684 1.1 christos 685 1.1 christos % @sp n outputs n lines of vertical space 686 1.1 christos 687 1.1 christos \def\sp{\parsearg\spxxx} 688 1.1 christos \def\spxxx #1{\vskip #1\baselineskip} 689 1.1 christos 690 1.1 christos % @comment ...line which is ignored... 691 1.1 christos % @c is the same as @comment 692 1.1 christos % @ignore ... @end ignore is another way to write a comment 693 1.1 christos 694 1.1 christos \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other% 695 1.1 christos \parsearg \commentxxx} 696 1.1 christos 697 1.1 christos \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 } 698 1.1 christos 699 1.1 christos \let\c=\comment 700 1.1 christos 701 1.1 christos % @paragraphindent is defined for the Info formatting commands only. 702 1.1 christos \let\paragraphindent=\comment 703 1.1 christos 704 1.1 christos % Prevent errors for section commands. 705 1.1 christos % Used in @ignore and in failing conditionals. 706 1.1 christos \def\ignoresections{% 707 1.1 christos \let\chapter=\relax 708 1.1 christos \let\unnumbered=\relax 709 1.1 christos \let\top=\relax 710 1.1 christos \let\unnumberedsec=\relax 711 1.1 christos \let\unnumberedsection=\relax 712 1.1 christos \let\unnumberedsubsec=\relax 713 1.1 christos \let\unnumberedsubsection=\relax 714 1.1 christos \let\unnumberedsubsubsec=\relax 715 1.1 christos \let\unnumberedsubsubsection=\relax 716 1.1 christos \let\section=\relax 717 1.1 christos \let\subsec=\relax 718 1.1 christos \let\subsubsec=\relax 719 1.1 christos \let\subsection=\relax 720 1.1 christos \let\subsubsection=\relax 721 1.1 christos \let\appendix=\relax 722 1.1 christos \let\appendixsec=\relax 723 1.1 christos \let\appendixsection=\relax 724 1.1 christos \let\appendixsubsec=\relax 725 1.1 christos \let\appendixsubsection=\relax 726 1.1 christos \let\appendixsubsubsec=\relax 727 1.1 christos \let\appendixsubsubsection=\relax 728 1.1 christos \let\contents=\relax 729 1.1 christos \let\smallbook=\relax 730 1.1 christos \let\titlepage=\relax 731 1.1 christos } 732 1.1 christos 733 1.1 christos % Used in nested conditionals, where we have to parse the Texinfo source 734 1.1 christos % and so want to turn off most commands, in case they are used 735 1.1 christos % incorrectly. 736 1.1 christos % 737 1.1 christos \def\ignoremorecommands{% 738 1.1 christos \let\defcodeindex = \relax 739 1.1 christos \let\defcv = \relax 740 1.1 christos \let\deffn = \relax 741 1.1 christos \let\deffnx = \relax 742 1.1 christos \let\defindex = \relax 743 1.1 christos \let\defivar = \relax 744 1.1 christos \let\defmac = \relax 745 1.1 christos \let\defmethod = \relax 746 1.1 christos \let\defop = \relax 747 1.1 christos \let\defopt = \relax 748 1.1 christos \let\defspec = \relax 749 1.1 christos \let\deftp = \relax 750 1.1 christos \let\deftypefn = \relax 751 1.1 christos \let\deftypefun = \relax 752 1.1 christos \let\deftypevar = \relax 753 1.1 christos \let\deftypevr = \relax 754 1.1 christos \let\defun = \relax 755 1.1 christos \let\defvar = \relax 756 1.1 christos \let\defvr = \relax 757 1.1 christos \let\ref = \relax 758 1.1 christos \let\xref = \relax 759 1.1 christos \let\printindex = \relax 760 1.1 christos \let\pxref = \relax 761 1.1 christos \let\settitle = \relax 762 1.1 christos \let\setchapternewpage = \relax 763 1.1 christos \let\setchapterstyle = \relax 764 1.1 christos \let\everyheading = \relax 765 1.1 christos \let\evenheading = \relax 766 1.1 christos \let\oddheading = \relax 767 1.1 christos \let\everyfooting = \relax 768 1.1 christos \let\evenfooting = \relax 769 1.1 christos \let\oddfooting = \relax 770 1.1 christos \let\headings = \relax 771 1.1 christos \let\include = \relax 772 1.1 christos \let\lowersections = \relax 773 1.1 christos \let\down = \relax 774 1.1 christos \let\raisesections = \relax 775 1.1 christos \let\up = \relax 776 1.1 christos \let\set = \relax 777 1.1 christos \let\clear = \relax 778 1.1 christos \let\item = \relax 779 1.1 christos } 780 1.1 christos 781 1.1 christos % Ignore @ignore ... @end ignore. 782 1.1 christos % 783 1.1 christos \def\ignore{\doignore{ignore}} 784 1.1 christos 785 1.1 christos % Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. 786 1.1 christos % 787 1.1 christos \def\ifinfo{\doignore{ifinfo}} 788 1.1 christos \def\ifhtml{\doignore{ifhtml}} 789 1.1 christos \def\ifnottex{\doignore{ifnottex}} 790 1.1 christos \def\html{\doignore{html}} 791 1.1 christos \def\menu{\doignore{menu}} 792 1.1 christos \def\direntry{\doignore{direntry}} 793 1.1 christos 794 1.1 christos % Also ignore @macro ... @end macro. The user must run texi2dvi, 795 1.1 christos % which runs makeinfo to do macro expansion. Ignore @unmacro, too. 796 1.1 christos \def\macro{\doignore{macro}} 797 1.1 christos \def\macrocsname{macro} 798 1.1 christos \let\unmacro = \comment 799 1.1 christos 800 1.1 christos 801 1.1 christos % @dircategory CATEGORY -- specify a category of the dir file 802 1.1 christos % which this file should belong to. Ignore this in TeX. 803 1.1 christos \let\dircategory = \comment 804 1.1 christos 805 1.1 christos % Ignore text until a line `@end #1'. 806 1.1 christos % 807 1.1 christos \def\doignore#1{\begingroup 808 1.1 christos % Don't complain about control sequences we have declared \outer. 809 1.1 christos \ignoresections 810 1.1 christos % 811 1.1 christos % Define a command to swallow text until we reach `@end #1'. 812 1.1 christos % This @ is a catcode 12 token (that is the normal catcode of @ in 813 1.1 christos % this texinfo.tex file). We change the catcode of @ below to match. 814 1.1 christos \long\def\doignoretext##1@end #1{\enddoignore}% 815 1.1 christos % 816 1.1 christos % Make sure that spaces turn into tokens that match what \doignoretext wants. 817 1.1 christos \catcode32 = 10 818 1.1 christos % 819 1.1 christos % Ignore braces, too, so mismatched braces don't cause trouble. 820 1.1 christos \catcode`\{ = 9 821 1.1 christos \catcode`\} = 9 822 1.1 christos % 823 1.1 christos % We must not have @c interpreted as a control sequence. 824 1.1 christos \catcode`\@ = 12 825 1.1 christos % 826 1.1 christos % Make the letter c a comment character so that the rest of the line 827 1.1 christos % will be ignored. This way, the document can have (for example) 828 1.1 christos % @c @end ifinfo 829 1.1 christos % and the @end ifinfo will be properly ignored. 830 1.1 christos % (We've just changed @ to catcode 12.) 831 1.1 christos % 832 1.1 christos % But we can't do this if #1 is `macro', since that actually contains a c. 833 1.1 christos % Happily, none of the other conditionals have the letter `c' in their names! 834 1.1 christos \def\temp{#1}% 835 1.1 christos \ifx\temp\macrocsname \else 836 1.1 christos \catcode`\c = 14 837 1.1 christos \fi 838 1.1 christos % 839 1.1 christos % And now expand that command. 840 1.1 christos \doignoretext 841 1.1 christos } 842 1.1 christos 843 1.1 christos % What we do to finish off ignored text. 844 1.1 christos % 845 1.1 christos \def\enddoignore{\endgroup\ignorespaces}% 846 1.1 christos 847 1.1 christos \newif\ifwarnedobs\warnedobsfalse 848 1.1 christos \def\obstexwarn{% 849 1.1 christos \ifwarnedobs\relax\else 850 1.1 christos % We need to warn folks that they may have trouble with TeX 3.0. 851 1.1 christos % This uses \immediate\write16 rather than \message to get newlines. 852 1.1 christos \immediate\write16{} 853 1.1 christos \immediate\write16{***WARNING*** for users of Unix TeX 3.0!} 854 1.1 christos \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} 855 1.1 christos \immediate\write16{If you are running another version of TeX, relax.} 856 1.1 christos \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} 857 1.1 christos \immediate\write16{ Then upgrade your TeX installation if you can.} 858 1.1 christos \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)} 859 1.1 christos \immediate\write16{If you are stuck with version 3.0, run the} 860 1.1 christos \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} 861 1.1 christos \immediate\write16{ to use a workaround.} 862 1.1 christos \immediate\write16{} 863 1.1 christos \global\warnedobstrue 864 1.1 christos \fi 865 1.1 christos } 866 1.1 christos 867 1.1 christos % **In TeX 3.0, setting text in \nullfont hangs tex. For a 868 1.1 christos % workaround (which requires the file ``dummy.tfm'' to be installed), 869 1.1 christos % uncomment the following line: 870 1.1 christos %%%%%\font\nullfont=dummy\let\obstexwarn=\relax 871 1.1 christos 872 1.1 christos % Ignore text, except that we keep track of conditional commands for 873 1.1 christos % purposes of nesting, up to an `@end #1' command. 874 1.1 christos % 875 1.1 christos \def\nestedignore#1{% 876 1.1 christos \obstexwarn 877 1.1 christos % We must actually expand the ignored text to look for the @end 878 1.1 christos % command, so that nested ignore constructs work. Thus, we put the 879 1.1 christos % text into a \vbox and then do nothing with the result. To minimize 880 1.1 christos % the change of memory overflow, we follow the approach outlined on 881 1.1 christos % page 401 of the TeXbook: make the current font be a dummy font. 882 1.1 christos % 883 1.1 christos \setbox0 = \vbox\bgroup 884 1.1 christos % Don't complain about control sequences we have declared \outer. 885 1.1 christos \ignoresections 886 1.1 christos % 887 1.1 christos % Define `@end #1' to end the box, which will in turn undefine the 888 1.1 christos % @end command again. 889 1.1 christos \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% 890 1.1 christos % 891 1.1 christos % We are going to be parsing Texinfo commands. Most cause no 892 1.1 christos % trouble when they are used incorrectly, but some commands do 893 1.1 christos % complicated argument parsing or otherwise get confused, so we 894 1.1 christos % undefine them. 895 1.1 christos % 896 1.1 christos % We can't do anything about stray @-signs, unfortunately; 897 1.1 christos % they'll produce `undefined control sequence' errors. 898 1.1 christos \ignoremorecommands 899 1.1 christos % 900 1.1 christos % Set the current font to be \nullfont, a TeX primitive, and define 901 1.1 christos % all the font commands to also use \nullfont. We don't use 902 1.1 christos % dummy.tfm, as suggested in the TeXbook, because not all sites 903 1.1 christos % might have that installed. Therefore, math mode will still 904 1.1 christos % produce output, but that should be an extremely small amount of 905 1.1 christos % stuff compared to the main input. 906 1.1 christos % 907 1.1 christos \nullfont 908 1.1 christos \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont 909 1.1 christos \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont 910 1.1 christos \let\tensf = \nullfont 911 1.1 christos % Similarly for index fonts (mostly for their use in 912 1.1 christos % smallexample) 913 1.1 christos \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont 914 1.1 christos \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont 915 1.1 christos \let\indsf = \nullfont 916 1.1 christos % 917 1.1 christos % Don't complain when characters are missing from the fonts. 918 1.1 christos \tracinglostchars = 0 919 1.1 christos % 920 1.1 christos % Don't bother to do space factor calculations. 921 1.1 christos \frenchspacing 922 1.1 christos % 923 1.1 christos % Don't report underfull hboxes. 924 1.1 christos \hbadness = 10000 925 1.1 christos % 926 1.1 christos % Do minimal line-breaking. 927 1.1 christos \pretolerance = 10000 928 1.1 christos % 929 1.1 christos % Do not execute instructions in @tex 930 1.1 christos \def\tex{\doignore{tex}}% 931 1.1 christos } 932 1.1 christos 933 1.1 christos % @set VAR sets the variable VAR to an empty value. 934 1.1 christos % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. 935 1.1 christos % 936 1.1 christos % Since we want to separate VAR from REST-OF-LINE (which might be 937 1.1 christos % empty), we can't just use \parsearg; we have to insert a space of our 938 1.1 christos % own to delimit the rest of the line, and then take it out again if we 939 1.1 christos % didn't need it. Make sure the catcode of space is correct to avoid 940 1.1 christos % losing inside @example, for instance. 941 1.1 christos % 942 1.1 christos \def\set{\begingroup\catcode` =10 943 1.1 christos \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. 944 1.1 christos \parsearg\setxxx} 945 1.1 christos \def\setxxx#1{\setyyy#1 \endsetyyy} 946 1.1 christos \def\setyyy#1 #2\endsetyyy{% 947 1.1 christos \def\temp{#2}% 948 1.1 christos \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty 949 1.1 christos \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. 950 1.1 christos \fi 951 1.1 christos \endgroup 952 1.1 christos } 953 1.1 christos % Can't use \xdef to pre-expand #2 and save some time, since \temp or 954 1.1 christos % \next or other control sequences that we've defined might get us into 955 1.1 christos % an infinite loop. Consider `@set foo @cite{bar}'. 956 1.1 christos \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} 957 1.1 christos 958 1.1 christos % @clear VAR clears (i.e., unsets) the variable VAR. 959 1.1 christos % 960 1.1 christos \def\clear{\parsearg\clearxxx} 961 1.1 christos \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} 962 1.1 christos 963 1.1 christos % @value{foo} gets the text saved in variable foo. 964 1.1 christos % 965 1.1 christos \def\value{\begingroup 966 1.1 christos \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. 967 1.1 christos \valuexxx} 968 1.1 christos \def\valuexxx#1{\expandablevalue{#1}\endgroup} 969 1.1 christos 970 1.1 christos % We have this subroutine so that we can handle at least some @value's 971 1.1 christos % properly in indexes (we \let\value to this in \indexdummies). Ones 972 1.1 christos % whose names contain - or _ still won't work, but we can't do anything 973 1.1 christos % about that. The command has to be fully expandable, since the result 974 1.1 christos % winds up in the index file. This means that if the variable's value 975 1.1 christos % contains other Texinfo commands, it's almost certain it will fail 976 1.1 christos % (although perhaps we could fix that with sufficient work to do a 977 1.1 christos % one-level expansion on the result, instead of complete). 978 1.1 christos % 979 1.1 christos \def\expandablevalue#1{% 980 1.1 christos \expandafter\ifx\csname SET#1\endcsname\relax 981 1.1 christos {[No value for ``#1'']v}% 982 1.1 christos \else 983 1.1 christos \csname SET#1\endcsname 984 1.1 christos \fi 985 1.1 christos } 986 1.1 christos 987 1.1 christos % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined 988 1.1 christos % with @set. 989 1.1 christos % 990 1.1 christos \def\ifset{\parsearg\ifsetxxx} 991 1.1 christos \def\ifsetxxx #1{% 992 1.1 christos \expandafter\ifx\csname SET#1\endcsname\relax 993 1.1 christos \expandafter\ifsetfail 994 1.1 christos \else 995 1.1 christos \expandafter\ifsetsucceed 996 1.1 christos \fi 997 1.1 christos } 998 1.1 christos \def\ifsetsucceed{\conditionalsucceed{ifset}} 999 1.1 christos \def\ifsetfail{\nestedignore{ifset}} 1000 1.1 christos \defineunmatchedend{ifset} 1001 1.1 christos 1002 1.1 christos % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been 1003 1.1 christos % defined with @set, or has been undefined with @clear. 1004 1.1 christos % 1005 1.1 christos \def\ifclear{\parsearg\ifclearxxx} 1006 1.1 christos \def\ifclearxxx #1{% 1007 1.1 christos \expandafter\ifx\csname SET#1\endcsname\relax 1008 1.1 christos \expandafter\ifclearsucceed 1009 1.1 christos \else 1010 1.1 christos \expandafter\ifclearfail 1011 1.1 christos \fi 1012 1.1 christos } 1013 1.1 christos \def\ifclearsucceed{\conditionalsucceed{ifclear}} 1014 1.1 christos \def\ifclearfail{\nestedignore{ifclear}} 1015 1.1 christos \defineunmatchedend{ifclear} 1016 1.1 christos 1017 1.1 christos % @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text 1018 1.1 christos % following, through the first @end iftex (etc.). Make `@end iftex' 1019 1.1 christos % (etc.) valid only after an @iftex. 1020 1.1 christos % 1021 1.1 christos \def\iftex{\conditionalsucceed{iftex}} 1022 1.1 christos \def\ifnothtml{\conditionalsucceed{ifnothtml}} 1023 1.1 christos \def\ifnotinfo{\conditionalsucceed{ifnotinfo}} 1024 1.1 christos \defineunmatchedend{iftex} 1025 1.1 christos \defineunmatchedend{ifnothtml} 1026 1.1 christos \defineunmatchedend{ifnotinfo} 1027 1.1 christos 1028 1.1 christos % We can't just want to start a group at @iftex (for example) and end it 1029 1.1 christos % at @end iftex, since then @set commands inside the conditional have no 1030 1.1 christos % effect (they'd get reverted at the end of the group). So we must 1031 1.1 christos % define \Eiftex to redefine itself to be its previous value. (We can't 1032 1.1 christos % just define it to fail again with an ``unmatched end'' error, since 1033 1.1 christos % the @ifset might be nested.) 1034 1.1 christos % 1035 1.1 christos \def\conditionalsucceed#1{% 1036 1.1 christos \edef\temp{% 1037 1.1 christos % Remember the current value of \E#1. 1038 1.1 christos \let\nece{prevE#1} = \nece{E#1}% 1039 1.1 christos % 1040 1.1 christos % At the `@end #1', redefine \E#1 to be its previous value. 1041 1.1 christos \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% 1042 1.1 christos }% 1043 1.1 christos \temp 1044 1.1 christos } 1045 1.1 christos 1046 1.1 christos % We need to expand lots of \csname's, but we don't want to expand the 1047 1.1 christos % control sequences after we've constructed them. 1048 1.1 christos % 1049 1.1 christos \def\nece#1{\expandafter\noexpand\csname#1\endcsname} 1050 1.1 christos 1051 1.1 christos % @asis just yields its argument. Used with @table, for example. 1052 1.1 christos % 1053 1.1 christos \def\asis#1{#1} 1054 1.1 christos 1055 1.1 christos % @math means output in math mode. 1056 1.1 christos % We don't use $'s directly in the definition of \math because control 1057 1.1 christos % sequences like \math are expanded when the toc file is written. Then, 1058 1.1 christos % we read the toc file back, the $'s will be normal characters (as they 1059 1.1 christos % should be, according to the definition of Texinfo). So we must use a 1060 1.1 christos % control sequence to switch into and out of math mode. 1061 1.1 christos % 1062 1.1 christos % This isn't quite enough for @math to work properly in indices, but it 1063 1.1 christos % seems unlikely it will ever be needed there. 1064 1.1 christos % 1065 1.1 christos \let\implicitmath = $ 1066 1.1 christos \def\math#1{\implicitmath #1\implicitmath} 1067 1.1 christos 1068 1.1 christos % @bullet and @minus need the same treatment as @math, just above. 1069 1.1 christos \def\bullet{\implicitmath\ptexbullet\implicitmath} 1070 1.1 christos \def\minus{\implicitmath-\implicitmath} 1071 1.1 christos 1072 1.1 christos \def\node{\ENVcheck\parsearg\nodezzz} 1073 1.1 christos \def\nodezzz#1{\nodexxx [#1,]} 1074 1.1 christos \def\nodexxx[#1,#2]{\gdef\lastnode{#1}} 1075 1.1 christos \let\nwnode=\node 1076 1.1 christos \let\lastnode=\relax 1077 1.1 christos 1078 1.1 christos \def\donoderef{\ifx\lastnode\relax\else 1079 1.1 christos \expandafter\expandafter\expandafter\setref{\lastnode}\fi 1080 1.1 christos \global\let\lastnode=\relax} 1081 1.1 christos 1082 1.1 christos \def\unnumbnoderef{\ifx\lastnode\relax\else 1083 1.1 christos \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi 1084 1.1 christos \global\let\lastnode=\relax} 1085 1.1 christos 1086 1.1 christos \def\appendixnoderef{\ifx\lastnode\relax\else 1087 1.1 christos \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi 1088 1.1 christos \global\let\lastnode=\relax} 1089 1.1 christos 1090 1.1 christos % @refill is a no-op. 1091 1.1 christos \let\refill=\relax 1092 1.1 christos 1093 1.1 christos % If working on a large document in chapters, it is convenient to 1094 1.1 christos % be able to disable indexing, cross-referencing, and contents, for test runs. 1095 1.1 christos % This is done with @novalidate (before @setfilename). 1096 1.1 christos % 1097 1.1 christos \newif\iflinks \linkstrue % by default we want the aux files. 1098 1.1 christos \let\novalidate = \linksfalse 1099 1.1 christos 1100 1.1 christos % @setfilename is done at the beginning of every texinfo file. 1101 1.1 christos % So open here the files we need to have open while reading the input. 1102 1.1 christos % This makes it possible to make a .fmt file for texinfo. 1103 1.1 christos \def\setfilename{% 1104 1.1 christos \iflinks 1105 1.1 christos \readauxfile 1106 1.1 christos \opencontents 1107 1.1 christos \fi % \openindices needs to do some work in any case. 1108 1.1 christos \openindices 1109 1.1 christos \fixbackslash % Turn off hack to swallow `\input texinfo'. 1110 1.1 christos \global\let\setfilename=\comment % Ignore extra @setfilename cmds. 1111 1.1 christos % 1112 1.1 christos % If texinfo.cnf is present on the system, read it. 1113 1.1 christos % Useful for site-wide @afourpaper, etc. 1114 1.1 christos % Just to be on the safe side, close the input stream before the \input. 1115 1.1 christos \openin 1 texinfo.cnf 1116 1.1 christos \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi 1117 1.1 christos \closein1 1118 1.1 christos \temp 1119 1.1 christos % 1120 1.1 christos \comment % Ignore the actual filename. 1121 1.1 christos } 1122 1.1 christos 1123 1.1 christos % @bye. 1124 1.1 christos \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} 1125 1.1 christos 1126 1.1 christos % \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx} 1127 1.1 christos % \def\macroxxx#1#2 \end macro{% 1128 1.1 christos % \expandafter\gdef\macrotemp#1{#2}% 1129 1.1 christos % \endgroup} 1130 1.1 christos 1131 1.1 christos %\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx} 1132 1.1 christos %\def\linemacroxxx#1#2 \end linemacro{% 1133 1.1 christos %\let\parsearg=\relax 1134 1.1 christos %\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}% 1135 1.1 christos %\expandafter\xdef\macrotemp{\parsearg\macrotempx}% 1136 1.1 christos %\expandafter\gdef\macrotempx#1{#2}% 1137 1.1 christos %\endgroup} 1138 1.1 christos 1139 1.1 christos %\def\butfirst#1{} 1140 1.1 christos 1141 1.1 christos 1142 1.1 christos \message{fonts,} 1143 1.1 christos 1144 1.1 christos % Font-change commands. 1145 1.1 christos 1146 1.1 christos % Texinfo supports the sans serif font style, which plain TeX does not. 1147 1.1 christos % So we set up a \sf analogous to plain's \rm, etc. 1148 1.1 christos \newfam\sffam 1149 1.1 christos \def\sf{\fam=\sffam \tensf} 1150 1.1 christos \let\li = \sf % Sometimes we call it \li, not \sf. 1151 1.1 christos 1152 1.1 christos % We don't need math for this one. 1153 1.1 christos \def\ttsl{\tenttsl} 1154 1.1 christos 1155 1.1 christos % Use Computer Modern fonts at \magstephalf (11pt). 1156 1.1 christos \newcount\mainmagstep 1157 1.1 christos \mainmagstep=\magstephalf 1158 1.1 christos 1159 1.1 christos % Set the font macro #1 to the font named #2, adding on the 1160 1.1 christos % specified font prefix (normally `cm'). 1161 1.1 christos % #3 is the font's design size, #4 is a scale factor 1162 1.1 christos \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} 1163 1.1 christos 1164 1.1 christos % Use cm as the default font prefix. 1165 1.1 christos % To specify the font prefix, you must define \fontprefix 1166 1.1 christos % before you read in texinfo.tex. 1167 1.1 christos \ifx\fontprefix\undefined 1168 1.1 christos \def\fontprefix{cm} 1169 1.1 christos \fi 1170 1.1 christos % Support font families that don't use the same naming scheme as CM. 1171 1.1 christos \def\rmshape{r} 1172 1.1 christos \def\rmbshape{bx} %where the normal face is bold 1173 1.1 christos \def\bfshape{b} 1174 1.1 christos \def\bxshape{bx} 1175 1.1 christos \def\ttshape{tt} 1176 1.1 christos \def\ttbshape{tt} 1177 1.1 christos \def\ttslshape{sltt} 1178 1.1 christos \def\itshape{ti} 1179 1.1 christos \def\itbshape{bxti} 1180 1.1 christos \def\slshape{sl} 1181 1.1 christos \def\slbshape{bxsl} 1182 1.1 christos \def\sfshape{ss} 1183 1.1 christos \def\sfbshape{ss} 1184 1.1 christos \def\scshape{csc} 1185 1.1 christos \def\scbshape{csc} 1186 1.1 christos 1187 1.1 christos \ifx\bigger\relax 1188 1.1 christos \let\mainmagstep=\magstep1 1189 1.1 christos \setfont\textrm\rmshape{12}{1000} 1190 1.1 christos \setfont\texttt\ttshape{12}{1000} 1191 1.1 christos \else 1192 1.1 christos \setfont\textrm\rmshape{10}{\mainmagstep} 1193 1.1 christos \setfont\texttt\ttshape{10}{\mainmagstep} 1194 1.1 christos \fi 1195 1.1 christos % Instead of cmb10, you many want to use cmbx10. 1196 1.1 christos % cmbx10 is a prettier font on its own, but cmb10 1197 1.1 christos % looks better when embedded in a line with cmr10. 1198 1.1 christos \setfont\textbf\bfshape{10}{\mainmagstep} 1199 1.1 christos \setfont\textit\itshape{10}{\mainmagstep} 1200 1.1 christos \setfont\textsl\slshape{10}{\mainmagstep} 1201 1.1 christos \setfont\textsf\sfshape{10}{\mainmagstep} 1202 1.1 christos \setfont\textsc\scshape{10}{\mainmagstep} 1203 1.1 christos \setfont\textttsl\ttslshape{10}{\mainmagstep} 1204 1.1 christos \font\texti=cmmi10 scaled \mainmagstep 1205 1.1 christos \font\textsy=cmsy10 scaled \mainmagstep 1206 1.1 christos 1207 1.1 christos % A few fonts for @defun, etc. 1208 1.1 christos \setfont\defbf\bxshape{10}{\magstep1} %was 1314 1209 1.1 christos \setfont\deftt\ttshape{10}{\magstep1} 1210 1.1 christos \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} 1211 1.1 christos 1212 1.1 christos % Fonts for indices and small examples (9pt). 1213 1.1 christos % We actually use the slanted font rather than the italic, 1214 1.1 christos % because texinfo normally uses the slanted fonts for that. 1215 1.1 christos % Do not make many font distinctions in general in the index, since they 1216 1.1 christos % aren't very useful. 1217 1.1 christos \setfont\ninett\ttshape{9}{1000} 1218 1.1 christos \setfont\indrm\rmshape{9}{1000} 1219 1.1 christos \setfont\indit\slshape{9}{1000} 1220 1.1 christos \let\indsl=\indit 1221 1.1 christos \let\indtt=\ninett 1222 1.1 christos \let\indttsl=\ninett 1223 1.1 christos \let\indsf=\indrm 1224 1.1 christos \let\indbf=\indrm 1225 1.1 christos \setfont\indsc\scshape{10}{900} 1226 1.1 christos \font\indi=cmmi9 1227 1.1 christos \font\indsy=cmsy9 1228 1.1 christos 1229 1.1 christos % Fonts for title page: 1230 1.1 christos \setfont\titlerm\rmbshape{12}{\magstep3} 1231 1.1 christos \setfont\titleit\itbshape{10}{\magstep4} 1232 1.1 christos \setfont\titlesl\slbshape{10}{\magstep4} 1233 1.1 christos \setfont\titlett\ttbshape{12}{\magstep3} 1234 1.1 christos \setfont\titlettsl\ttslshape{10}{\magstep4} 1235 1.1 christos \setfont\titlesf\sfbshape{17}{\magstep1} 1236 1.1 christos \let\titlebf=\titlerm 1237 1.1 christos \setfont\titlesc\scbshape{10}{\magstep4} 1238 1.1 christos \font\titlei=cmmi12 scaled \magstep3 1239 1.1 christos \font\titlesy=cmsy10 scaled \magstep4 1240 1.1 christos \def\authorrm{\secrm} 1241 1.1 christos 1242 1.1 christos % Chapter (and unnumbered) fonts (17.28pt). 1243 1.1 christos \setfont\chaprm\rmbshape{12}{\magstep2} 1244 1.1 christos \setfont\chapit\itbshape{10}{\magstep3} 1245 1.1 christos \setfont\chapsl\slbshape{10}{\magstep3} 1246 1.1 christos \setfont\chaptt\ttbshape{12}{\magstep2} 1247 1.1 christos \setfont\chapttsl\ttslshape{10}{\magstep3} 1248 1.1 christos \setfont\chapsf\sfbshape{17}{1000} 1249 1.1 christos \let\chapbf=\chaprm 1250 1.1 christos \setfont\chapsc\scbshape{10}{\magstep3} 1251 1.1 christos \font\chapi=cmmi12 scaled \magstep2 1252 1.1 christos \font\chapsy=cmsy10 scaled \magstep3 1253 1.1 christos 1254 1.1 christos % Section fonts (14.4pt). 1255 1.1 christos \setfont\secrm\rmbshape{12}{\magstep1} 1256 1.1 christos \setfont\secit\itbshape{10}{\magstep2} 1257 1.1 christos \setfont\secsl\slbshape{10}{\magstep2} 1258 1.1 christos \setfont\sectt\ttbshape{12}{\magstep1} 1259 1.1 christos \setfont\secttsl\ttslshape{10}{\magstep2} 1260 1.1 christos \setfont\secsf\sfbshape{12}{\magstep1} 1261 1.1 christos \let\secbf\secrm 1262 1.1 christos \setfont\secsc\scbshape{10}{\magstep2} 1263 1.1 christos \font\seci=cmmi12 scaled \magstep1 1264 1.1 christos \font\secsy=cmsy10 scaled \magstep2 1265 1.1 christos 1266 1.1 christos % \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. 1267 1.1 christos % \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. 1268 1.1 christos % \setfont\ssecsl\slshape{10}{\magstep1} 1269 1.1 christos % \setfont\ssectt\ttshape{10}{\magstep1} 1270 1.1 christos % \setfont\ssecsf\sfshape{10}{\magstep1} 1271 1.1 christos 1272 1.1 christos %\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. 1273 1.1 christos %\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than 1274 1.1 christos %\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. 1275 1.1 christos %\setfont\ssectt\ttshape{10}{1315} 1276 1.1 christos %\setfont\ssecsf\sfshape{10}{1315} 1277 1.1 christos 1278 1.1 christos %\let\ssecbf=\ssecrm 1279 1.1 christos 1280 1.1 christos % Subsection fonts (13.15pt). 1281 1.1 christos \setfont\ssecrm\rmbshape{12}{\magstephalf} 1282 1.1 christos \setfont\ssecit\itbshape{10}{1315} 1283 1.1 christos \setfont\ssecsl\slbshape{10}{1315} 1284 1.1 christos \setfont\ssectt\ttbshape{12}{\magstephalf} 1285 1.1 christos \setfont\ssecttsl\ttslshape{10}{1315} 1286 1.1 christos \setfont\ssecsf\sfbshape{12}{\magstephalf} 1287 1.1 christos \let\ssecbf\ssecrm 1288 1.1 christos \setfont\ssecsc\scbshape{10}{\magstep1} 1289 1.1 christos \font\sseci=cmmi12 scaled \magstephalf 1290 1.1 christos \font\ssecsy=cmsy10 scaled 1315 1291 1.1 christos % The smallcaps and symbol fonts should actually be scaled \magstep1.5, 1292 1.1 christos % but that is not a standard magnification. 1293 1.1 christos 1294 1.1 christos % In order for the font changes to affect most math symbols and letters, 1295 1.1 christos % we have to define the \textfont of the standard families. Since 1296 1.1 christos % texinfo doesn't allow for producing subscripts and superscripts, we 1297 1.1 christos % don't bother to reset \scriptfont and \scriptscriptfont (which would 1298 1.1 christos % also require loading a lot more fonts). 1299 1.1 christos % 1300 1.1 christos \def\resetmathfonts{% 1301 1.1 christos \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy 1302 1.1 christos \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf 1303 1.1 christos \textfont\ttfam = \tentt \textfont\sffam = \tensf 1304 1.1 christos } 1305 1.1 christos 1306 1.1 christos 1307 1.1 christos % The font-changing commands redefine the meanings of \tenSTYLE, instead 1308 1.1 christos % of just \STYLE. We do this so that font changes will continue to work 1309 1.1 christos % in math mode, where it is the current \fam that is relevant in most 1310 1.1 christos % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam 1311 1.1 christos % \tenbf}, for example. By redefining \tenbf, we obviate the need to 1312 1.1 christos % redefine \bf itself. 1313 1.1 christos \def\textfonts{% 1314 1.1 christos \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl 1315 1.1 christos \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc 1316 1.1 christos \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl 1317 1.1 christos \resetmathfonts} 1318 1.1 christos \def\titlefonts{% 1319 1.1 christos \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl 1320 1.1 christos \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc 1321 1.1 christos \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy 1322 1.1 christos \let\tenttsl=\titlettsl 1323 1.1 christos \resetmathfonts \setleading{25pt}} 1324 1.1 christos \def\titlefont#1{{\titlefonts\rm #1}} 1325 1.1 christos \def\chapfonts{% 1326 1.1 christos \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 1327 1.1 christos \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc 1328 1.1 christos \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl 1329 1.1 christos \resetmathfonts \setleading{19pt}} 1330 1.1 christos \def\secfonts{% 1331 1.1 christos \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl 1332 1.1 christos \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc 1333 1.1 christos \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl 1334 1.1 christos \resetmathfonts \setleading{16pt}} 1335 1.1 christos \def\subsecfonts{% 1336 1.1 christos \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl 1337 1.1 christos \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc 1338 1.1 christos \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl 1339 1.1 christos \resetmathfonts \setleading{15pt}} 1340 1.1 christos \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? 1341 1.1 christos \def\indexfonts{% 1342 1.1 christos \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl 1343 1.1 christos \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc 1344 1.1 christos \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl 1345 1.1 christos \resetmathfonts \setleading{12pt}} 1346 1.1 christos 1347 1.1 christos % Set up the default fonts, so we can use them for creating boxes. 1348 1.1 christos % 1349 1.1 christos \textfonts 1350 1.1 christos 1351 1.1 christos % Define these so they can be easily changed for other fonts. 1352 1.1 christos \def\angleleft{$\langle$} 1353 1.1 christos \def\angleright{$\rangle$} 1354 1.1 christos 1355 1.1 christos % Count depth in font-changes, for error checks 1356 1.1 christos \newcount\fontdepth \fontdepth=0 1357 1.1 christos 1358 1.1 christos % Fonts for short table of contents. 1359 1.1 christos \setfont\shortcontrm\rmshape{12}{1000} 1360 1.1 christos \setfont\shortcontbf\bxshape{12}{1000} 1361 1.1 christos \setfont\shortcontsl\slshape{12}{1000} 1362 1.1 christos 1363 1.1 christos %% Add scribe-like font environments, plus @l for inline lisp (usually sans 1364 1.1 christos %% serif) and @ii for TeX italic 1365 1.1 christos 1366 1.1 christos % \smartitalic{ARG} outputs arg in italics, followed by an italic correction 1367 1.1 christos % unless the following character is such as not to need one. 1368 1.1 christos \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} 1369 1.1 christos \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx} 1370 1.1 christos 1371 1.1 christos \let\i=\smartitalic 1372 1.1 christos \let\var=\smartitalic 1373 1.1 christos \let\dfn=\smartitalic 1374 1.1 christos \let\emph=\smartitalic 1375 1.1 christos \let\cite=\smartitalic 1376 1.1 christos 1377 1.1 christos \def\b#1{{\bf #1}} 1378 1.1 christos \let\strong=\b 1379 1.1 christos 1380 1.1 christos % We can't just use \exhyphenpenalty, because that only has effect at 1381 1.1 christos % the end of a paragraph. Restore normal hyphenation at the end of the 1382 1.1 christos % group within which \nohyphenation is presumably called. 1383 1.1 christos % 1384 1.1 christos \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} 1385 1.1 christos \def\restorehyphenation{\hyphenchar\font = `- } 1386 1.1 christos 1387 1.1 christos \def\t#1{% 1388 1.1 christos {\tt \rawbackslash \frenchspacing #1}% 1389 1.1 christos \null 1390 1.1 christos } 1391 1.1 christos \let\ttfont=\t 1392 1.1 christos \def\samp#1{`\tclose{#1}'\null} 1393 1.1 christos \setfont\smallrm\rmshape{8}{1000} 1394 1.1 christos \font\smallsy=cmsy9 1395 1.1 christos \def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{% 1396 1.1 christos \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 1397 1.1 christos \vbox{\hrule\kern-0.4pt 1398 1.1 christos \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 1399 1.1 christos \kern-0.4pt\hrule}% 1400 1.1 christos \kern-.06em\raise0.4pt\hbox{\angleright}}}} 1401 1.1 christos % The old definition, with no lozenge: 1402 1.1 christos %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} 1403 1.1 christos \def\ctrl #1{{\tt \rawbackslash \hat}#1} 1404 1.1 christos 1405 1.1 christos \let\file=\samp 1406 1.1 christos 1407 1.1 christos % @code is a modification of @t, 1408 1.1 christos % which makes spaces the same size as normal in the surrounding text. 1409 1.1 christos \def\tclose#1{% 1410 1.1 christos {% 1411 1.1 christos % Change normal interword space to be same as for the current font. 1412 1.1 christos \spaceskip = \fontdimen2\font 1413 1.1 christos % 1414 1.1 christos % Switch to typewriter. 1415 1.1 christos \tt 1416 1.1 christos % 1417 1.1 christos % But `\ ' produces the large typewriter interword space. 1418 1.1 christos \def\ {{\spaceskip = 0pt{} }}% 1419 1.1 christos % 1420 1.1 christos % Turn off hyphenation. 1421 1.1 christos \nohyphenation 1422 1.1 christos % 1423 1.1 christos \rawbackslash 1424 1.1 christos \frenchspacing 1425 1.1 christos #1% 1426 1.1 christos }% 1427 1.1 christos \null 1428 1.1 christos } 1429 1.1 christos 1430 1.1 christos % We *must* turn on hyphenation at `-' and `_' in \code. 1431 1.1 christos % Otherwise, it is too hard to avoid overfull hboxes 1432 1.1 christos % in the Emacs manual, the Library manual, etc. 1433 1.1 christos 1434 1.1 christos % Unfortunately, TeX uses one parameter (\hyphenchar) to control 1435 1.1 christos % both hyphenation at - and hyphenation within words. 1436 1.1 christos % We must therefore turn them both off (\tclose does that) 1437 1.1 christos % and arrange explicitly to hyphenate at a dash. 1438 1.1 christos % -- rms. 1439 1.1 christos { 1440 1.1 christos \catcode`\-=\active 1441 1.1 christos \catcode`\_=\active 1442 1.1 christos \catcode`\|=\active 1443 1.1 christos \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex} 1444 1.1 christos % The following is used by \doprintindex to insure that long function names 1445 1.1 christos % wrap around. It is necessary for - and _ to be active before the index is 1446 1.1 christos % read from the file, as \entry parses the arguments long before \code is 1447 1.1 christos % ever called. -- mycroft 1448 1.1 christos % _ is always active; and it shouldn't be \let = to an _ that is a 1449 1.1 christos % subscript character anyway. Then, @cindex @samp{_} (for example) 1450 1.1 christos % fails. --karl 1451 1.1 christos \global\def\indexbreaks{% 1452 1.1 christos \catcode`\-=\active \let-\realdash 1453 1.1 christos } 1454 1.1 christos } 1455 1.1 christos 1456 1.1 christos \def\realdash{-} 1457 1.1 christos \def\codedash{-\discretionary{}{}{}} 1458 1.1 christos \def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} 1459 1.1 christos \def\codex #1{\tclose{#1}\endgroup} 1460 1.1 christos 1461 1.1 christos %\let\exp=\tclose %Was temporary 1462 1.1 christos 1463 1.1 christos % @kbd is like @code, except that if the argument is just one @key command, 1464 1.1 christos % then @kbd has no effect. 1465 1.1 christos 1466 1.1 christos % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), 1467 1.1 christos % `example' (@kbd uses ttsl only inside of @example and friends), 1468 1.1 christos % or `code' (@kbd uses normal tty font always). 1469 1.1 christos \def\kbdinputstyle{\parsearg\kbdinputstylexxx} 1470 1.1 christos \def\kbdinputstylexxx#1{% 1471 1.1 christos \def\arg{#1}% 1472 1.1 christos \ifx\arg\worddistinct 1473 1.1 christos \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% 1474 1.1 christos \else\ifx\arg\wordexample 1475 1.1 christos \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% 1476 1.1 christos \else\ifx\arg\wordcode 1477 1.1 christos \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% 1478 1.1 christos \fi\fi\fi 1479 1.1 christos } 1480 1.1 christos \def\worddistinct{distinct} 1481 1.1 christos \def\wordexample{example} 1482 1.1 christos \def\wordcode{code} 1483 1.1 christos 1484 1.1 christos % Default is kbdinputdistinct. (Too much of a hassle to call the macro, 1485 1.1 christos % the catcodes are wrong for parsearg to work.) 1486 1.1 christos \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} 1487 1.1 christos 1488 1.1 christos \def\xkey{\key} 1489 1.1 christos \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% 1490 1.1 christos \ifx\one\xkey\ifx\threex\three \key{#2}% 1491 1.1 christos \else{\tclose{\kbdfont\look}}\fi 1492 1.1 christos \else{\tclose{\kbdfont\look}}\fi} 1493 1.1 christos 1494 1.1 christos % @url. Quotes do not seem necessary, so use \code. 1495 1.1 christos \let\url=\code 1496 1.1 christos 1497 1.1 christos % @uref (abbreviation for `urlref') takes an optional second argument 1498 1.1 christos % specifying the text to display. First (mandatory) arg is the url. 1499 1.1 christos % Perhaps eventually put in a hypertex \special here. 1500 1.1 christos % 1501 1.1 christos \def\uref#1{\urefxxx #1,,\finish} 1502 1.1 christos \def\urefxxx#1,#2,#3\finish{% 1503 1.1 christos \setbox0 = \hbox{\ignorespaces #2}% 1504 1.1 christos \ifdim\wd0 > 0pt 1505 1.1 christos \unhbox0\ (\code{#1})% 1506 1.1 christos \else 1507 1.1 christos \code{#1}% 1508 1.1 christos \fi 1509 1.1 christos } 1510 1.1 christos 1511 1.1 christos % rms does not like the angle brackets --karl, 17may97. 1512 1.1 christos % So now @email is just like @uref. 1513 1.1 christos %\def\email#1{\angleleft{\tt #1}\angleright} 1514 1.1 christos \let\email=\uref 1515 1.1 christos 1516 1.1 christos % Check if we are currently using a typewriter font. Since all the 1517 1.1 christos % Computer Modern typewriter fonts have zero interword stretch (and 1518 1.1 christos % shrink), and it is reasonable to expect all typewriter fonts to have 1519 1.1 christos % this property, we can check that font parameter. 1520 1.1 christos % 1521 1.1 christos \def\ifmonospace{\ifdim\fontdimen3\font=0pt } 1522 1.1 christos 1523 1.1 christos % Typeset a dimension, e.g., `in' or `pt'. The only reason for the 1524 1.1 christos % argument is to make the input look right: @dmn{pt} instead of 1525 1.1 christos % @dmn{}pt. 1526 1.1 christos % 1527 1.1 christos \def\dmn#1{\thinspace #1} 1528 1.1 christos 1529 1.1 christos \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} 1530 1.1 christos 1531 1.1 christos % @l was never documented to mean ``switch to the Lisp font'', 1532 1.1 christos % and it is not used as such in any manual I can find. We need it for 1533 1.1 christos % Polish suppressed-l. --karl, 22sep96. 1534 1.1 christos %\def\l#1{{\li #1}\null} 1535 1.1 christos 1536 1.1 christos \def\r#1{{\rm #1}} % roman font 1537 1.1 christos % Use of \lowercase was suggested. 1538 1.1 christos \def\sc#1{{\smallcaps#1}} % smallcaps font 1539 1.1 christos \def\ii#1{{\it #1}} % italic font 1540 1.1 christos 1541 1.1 christos % @pounds{} is a sterling sign. 1542 1.1 christos \def\pounds{{\it\$}} 1543 1.1 christos 1544 1.1 christos 1545 1.1 christos \message{page headings,} 1546 1.1 christos 1547 1.1 christos \newskip\titlepagetopglue \titlepagetopglue = 1.5in 1548 1.1 christos \newskip\titlepagebottomglue \titlepagebottomglue = 2pc 1549 1.1 christos 1550 1.1 christos % First the title page. Must do @settitle before @titlepage. 1551 1.1 christos \newif\ifseenauthor 1552 1.1 christos \newif\iffinishedtitlepage 1553 1.1 christos 1554 1.1 christos \def\shorttitlepage{\parsearg\shorttitlepagezzz} 1555 1.1 christos \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% 1556 1.1 christos \endgroup\page\hbox{}\page} 1557 1.1 christos 1558 1.1 christos \def\titlepage{\begingroup \parindent=0pt \textfonts 1559 1.1 christos \let\subtitlerm=\tenrm 1560 1.1 christos % I deinstalled the following change because \cmr12 is undefined. 1561 1.1 christos % This change was not in the ChangeLog anyway. --rms. 1562 1.1 christos % \let\subtitlerm=\cmr12 1563 1.1 christos \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% 1564 1.1 christos % 1565 1.1 christos \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% 1566 1.1 christos % 1567 1.1 christos % Leave some space at the very top of the page. 1568 1.1 christos \vglue\titlepagetopglue 1569 1.1 christos % 1570 1.1 christos % Now you can print the title using @title. 1571 1.1 christos \def\title{\parsearg\titlezzz}% 1572 1.1 christos \def\titlezzz##1{\leftline{\titlefonts\rm ##1} 1573 1.1 christos % print a rule at the page bottom also. 1574 1.1 christos \finishedtitlepagefalse 1575 1.1 christos \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% 1576 1.1 christos % No rule at page bottom unless we print one at the top with @title. 1577 1.1 christos \finishedtitlepagetrue 1578 1.1 christos % 1579 1.1 christos % Now you can put text using @subtitle. 1580 1.1 christos \def\subtitle{\parsearg\subtitlezzz}% 1581 1.1 christos \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% 1582 1.1 christos % 1583 1.1 christos % @author should come last, but may come many times. 1584 1.1 christos \def\author{\parsearg\authorzzz}% 1585 1.1 christos \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi 1586 1.1 christos {\authorfont \leftline{##1}}}% 1587 1.1 christos % 1588 1.1 christos % Most title ``pages'' are actually two pages long, with space 1589 1.1 christos % at the top of the second. We don't want the ragged left on the second. 1590 1.1 christos \let\oldpage = \page 1591 1.1 christos \def\page{% 1592 1.1 christos \iffinishedtitlepage\else 1593 1.1 christos \finishtitlepage 1594 1.1 christos \fi 1595 1.1 christos \oldpage 1596 1.1 christos \let\page = \oldpage 1597 1.1 christos \hbox{}}% 1598 1.1 christos % \def\page{\oldpage \hbox{}} 1599 1.1 christos } 1600 1.1 christos 1601 1.1 christos \def\Etitlepage{% 1602 1.1 christos \iffinishedtitlepage\else 1603 1.1 christos \finishtitlepage 1604 1.1 christos \fi 1605 1.1 christos % It is important to do the page break before ending the group, 1606 1.1 christos % because the headline and footline are only empty inside the group. 1607 1.1 christos % If we use the new definition of \page, we always get a blank page 1608 1.1 christos % after the title page, which we certainly don't want. 1609 1.1 christos \oldpage 1610 1.1 christos \endgroup 1611 1.1 christos \HEADINGSon 1612 1.1 christos } 1613 1.1 christos 1614 1.1 christos \def\finishtitlepage{% 1615 1.1 christos \vskip4pt \hrule height 2pt width \hsize 1616 1.1 christos \vskip\titlepagebottomglue 1617 1.1 christos \finishedtitlepagetrue 1618 1.1 christos } 1619 1.1 christos 1620 1.1 christos %%% Set up page headings and footings. 1621 1.1 christos 1622 1.1 christos \let\thispage=\folio 1623 1.1 christos 1624 1.1 christos \newtoks \evenheadline % Token sequence for heading line of even pages 1625 1.1 christos \newtoks \oddheadline % Token sequence for heading line of odd pages 1626 1.1 christos \newtoks \evenfootline % Token sequence for footing line of even pages 1627 1.1 christos \newtoks \oddfootline % Token sequence for footing line of odd pages 1628 1.1 christos 1629 1.1 christos % Now make Tex use those variables 1630 1.1 christos \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline 1631 1.1 christos \else \the\evenheadline \fi}} 1632 1.1 christos \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline 1633 1.1 christos \else \the\evenfootline \fi}\HEADINGShook} 1634 1.1 christos \let\HEADINGShook=\relax 1635 1.1 christos 1636 1.1 christos % Commands to set those variables. 1637 1.1 christos % For example, this is what @headings on does 1638 1.1 christos % @evenheading @thistitle|@thispage|@thischapter 1639 1.1 christos % @oddheading @thischapter|@thispage|@thistitle 1640 1.1 christos % @evenfooting @thisfile|| 1641 1.1 christos % @oddfooting ||@thisfile 1642 1.1 christos 1643 1.1 christos \def\evenheading{\parsearg\evenheadingxxx} 1644 1.1 christos \def\oddheading{\parsearg\oddheadingxxx} 1645 1.1 christos \def\everyheading{\parsearg\everyheadingxxx} 1646 1.1 christos 1647 1.1 christos \def\evenfooting{\parsearg\evenfootingxxx} 1648 1.1 christos \def\oddfooting{\parsearg\oddfootingxxx} 1649 1.1 christos \def\everyfooting{\parsearg\everyfootingxxx} 1650 1.1 christos 1651 1.1 christos {\catcode`\@=0 % 1652 1.1 christos 1653 1.1 christos \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} 1654 1.1 christos \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% 1655 1.1 christos \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 1656 1.1 christos 1657 1.1 christos \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} 1658 1.1 christos \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% 1659 1.1 christos \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 1660 1.1 christos 1661 1.1 christos \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% 1662 1.1 christos 1663 1.1 christos \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} 1664 1.1 christos \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% 1665 1.1 christos \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} 1666 1.1 christos 1667 1.1 christos \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} 1668 1.1 christos \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% 1669 1.1 christos \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% 1670 1.1 christos % 1671 1.1 christos % Leave some space for the footline. Hopefully ok to assume 1672 1.1 christos % @evenfooting will not be used by itself. 1673 1.1 christos \global\advance\pageheight by -\baselineskip 1674 1.1 christos \global\advance\vsize by -\baselineskip 1675 1.1 christos } 1676 1.1 christos 1677 1.1 christos \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} 1678 1.1 christos % 1679 1.1 christos }% unbind the catcode of @. 1680 1.1 christos 1681 1.1 christos % @headings double turns headings on for double-sided printing. 1682 1.1 christos % @headings single turns headings on for single-sided printing. 1683 1.1 christos % @headings off turns them off. 1684 1.1 christos % @headings on same as @headings double, retained for compatibility. 1685 1.1 christos % @headings after turns on double-sided headings after this page. 1686 1.1 christos % @headings doubleafter turns on double-sided headings after this page. 1687 1.1 christos % @headings singleafter turns on single-sided headings after this page. 1688 1.1 christos % By default, they are off at the start of a document, 1689 1.1 christos % and turned `on' after @end titlepage. 1690 1.1 christos 1691 1.1 christos \def\headings #1 {\csname HEADINGS#1\endcsname} 1692 1.1 christos 1693 1.1 christos \def\HEADINGSoff{ 1694 1.1 christos \global\evenheadline={\hfil} \global\evenfootline={\hfil} 1695 1.1 christos \global\oddheadline={\hfil} \global\oddfootline={\hfil}} 1696 1.1 christos \HEADINGSoff 1697 1.1 christos % When we turn headings on, set the page number to 1. 1698 1.1 christos % For double-sided printing, put current file name in lower left corner, 1699 1.1 christos % chapter name on inside top of right hand pages, document 1700 1.1 christos % title on inside top of left hand pages, and page numbers on outside top 1701 1.1 christos % edge of all pages. 1702 1.1 christos \def\HEADINGSdouble{ 1703 1.1 christos \global\pageno=1 1704 1.1 christos \global\evenfootline={\hfil} 1705 1.1 christos \global\oddfootline={\hfil} 1706 1.1 christos \global\evenheadline={\line{\folio\hfil\thistitle}} 1707 1.1 christos \global\oddheadline={\line{\thischapter\hfil\folio}} 1708 1.1 christos \global\let\contentsalignmacro = \chapoddpage 1709 1.1 christos } 1710 1.1 christos \let\contentsalignmacro = \chappager 1711 1.1 christos 1712 1.1 christos % For single-sided printing, chapter title goes across top left of page, 1713 1.1 christos % page number on top right. 1714 1.1 christos \def\HEADINGSsingle{ 1715 1.1 christos \global\pageno=1 1716 1.1 christos \global\evenfootline={\hfil} 1717 1.1 christos \global\oddfootline={\hfil} 1718 1.1 christos \global\evenheadline={\line{\thischapter\hfil\folio}} 1719 1.1 christos \global\oddheadline={\line{\thischapter\hfil\folio}} 1720 1.1 christos \global\let\contentsalignmacro = \chappager 1721 1.1 christos } 1722 1.1 christos \def\HEADINGSon{\HEADINGSdouble} 1723 1.1 christos 1724 1.1 christos \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} 1725 1.1 christos \let\HEADINGSdoubleafter=\HEADINGSafter 1726 1.1 christos \def\HEADINGSdoublex{% 1727 1.1 christos \global\evenfootline={\hfil} 1728 1.1 christos \global\oddfootline={\hfil} 1729 1.1 christos \global\evenheadline={\line{\folio\hfil\thistitle}} 1730 1.1 christos \global\oddheadline={\line{\thischapter\hfil\folio}} 1731 1.1 christos \global\let\contentsalignmacro = \chapoddpage 1732 1.1 christos } 1733 1.1 christos 1734 1.1 christos \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} 1735 1.1 christos \def\HEADINGSsinglex{% 1736 1.1 christos \global\evenfootline={\hfil} 1737 1.1 christos \global\oddfootline={\hfil} 1738 1.1 christos \global\evenheadline={\line{\thischapter\hfil\folio}} 1739 1.1 christos \global\oddheadline={\line{\thischapter\hfil\folio}} 1740 1.1 christos \global\let\contentsalignmacro = \chappager 1741 1.1 christos } 1742 1.1 christos 1743 1.1 christos % Subroutines used in generating headings 1744 1.1 christos % Produces Day Month Year style of output. 1745 1.1 christos \def\today{\number\day\space 1746 1.1 christos \ifcase\month\or 1747 1.1 christos January\or February\or March\or April\or May\or June\or 1748 1.1 christos July\or August\or September\or October\or November\or December\fi 1749 1.1 christos \space\number\year} 1750 1.1 christos 1751 1.1 christos % Use this if you want the Month Day, Year style of output. 1752 1.1 christos %\def\today{\ifcase\month\or 1753 1.1 christos %January\or February\or March\or April\or May\or June\or 1754 1.1 christos %July\or August\or September\or October\or November\or December\fi 1755 1.1 christos %\space\number\day, \number\year} 1756 1.1 christos 1757 1.1 christos % @settitle line... specifies the title of the document, for headings 1758 1.1 christos % It generates no output of its own 1759 1.1 christos 1760 1.1 christos \def\thistitle{No Title} 1761 1.1 christos \def\settitle{\parsearg\settitlezzz} 1762 1.1 christos \def\settitlezzz #1{\gdef\thistitle{#1}} 1763 1.1 christos 1764 1.1 christos 1765 1.1 christos \message{tables,} 1766 1.1 christos % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). 1767 1.1 christos 1768 1.1 christos % default indentation of table text 1769 1.1 christos \newdimen\tableindent \tableindent=.8in 1770 1.1 christos % default indentation of @itemize and @enumerate text 1771 1.1 christos \newdimen\itemindent \itemindent=.3in 1772 1.1 christos % margin between end of table item and start of table text. 1773 1.1 christos \newdimen\itemmargin \itemmargin=.1in 1774 1.1 christos 1775 1.1 christos % used internally for \itemindent minus \itemmargin 1776 1.1 christos \newdimen\itemmax 1777 1.1 christos 1778 1.1 christos % Note @table, @vtable, and @vtable define @item, @itemx, etc., with 1779 1.1 christos % these defs. 1780 1.1 christos % They also define \itemindex 1781 1.1 christos % to index the item name in whatever manner is desired (perhaps none). 1782 1.1 christos 1783 1.1 christos \newif\ifitemxneedsnegativevskip 1784 1.1 christos 1785 1.1 christos \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} 1786 1.1 christos 1787 1.1 christos \def\internalBitem{\smallbreak \parsearg\itemzzz} 1788 1.1 christos \def\internalBitemx{\itemxpar \parsearg\itemzzz} 1789 1.1 christos 1790 1.1 christos \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} 1791 1.1 christos \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} 1792 1.1 christos 1793 1.1 christos \def\internalBkitem{\smallbreak \parsearg\kitemzzz} 1794 1.1 christos \def\internalBkitemx{\itemxpar \parsearg\kitemzzz} 1795 1.1 christos 1796 1.1 christos \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% 1797 1.1 christos \itemzzz {#1}} 1798 1.1 christos 1799 1.1 christos \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% 1800 1.1 christos \itemzzz {#1}} 1801 1.1 christos 1802 1.1 christos \def\itemzzz #1{\begingroup % 1803 1.1 christos \advance\hsize by -\rightskip 1804 1.1 christos \advance\hsize by -\tableindent 1805 1.1 christos \setbox0=\hbox{\itemfont{#1}}% 1806 1.1 christos \itemindex{#1}% 1807 1.1 christos \nobreak % This prevents a break before @itemx. 1808 1.1 christos % 1809 1.1 christos % Be sure we are not still in the middle of a paragraph. 1810 1.1 christos %{\parskip = 0in 1811 1.1 christos %\par 1812 1.1 christos %}% 1813 1.1 christos % 1814 1.1 christos % If the item text does not fit in the space we have, put it on a line 1815 1.1 christos % by itself, and do not allow a page break either before or after that 1816 1.1 christos % line. We do not start a paragraph here because then if the next 1817 1.1 christos % command is, e.g., @kindex, the whatsit would get put into the 1818 1.1 christos % horizontal list on a line by itself, resulting in extra blank space. 1819 1.1 christos \ifdim \wd0>\itemmax 1820 1.1 christos % 1821 1.1 christos % Make this a paragraph so we get the \parskip glue and wrapping, 1822 1.1 christos % but leave it ragged-right. 1823 1.1 christos \begingroup 1824 1.1 christos \advance\leftskip by-\tableindent 1825 1.1 christos \advance\hsize by\tableindent 1826 1.1 christos \advance\rightskip by0pt plus1fil 1827 1.1 christos \leavevmode\unhbox0\par 1828 1.1 christos \endgroup 1829 1.1 christos % 1830 1.1 christos % We're going to be starting a paragraph, but we don't want the 1831 1.1 christos % \parskip glue -- logically it's part of the @item we just started. 1832 1.1 christos \nobreak \vskip-\parskip 1833 1.1 christos % 1834 1.1 christos % Stop a page break at the \parskip glue coming up. Unfortunately 1835 1.1 christos % we can't prevent a possible page break at the following 1836 1.1 christos % \baselineskip glue. 1837 1.1 christos \nobreak 1838 1.1 christos \endgroup 1839 1.1 christos \itemxneedsnegativevskipfalse 1840 1.1 christos \else 1841 1.1 christos % The item text fits into the space. Start a paragraph, so that the 1842 1.1 christos % following text (if any) will end up on the same line. Since that 1843 1.1 christos % text will be indented by \tableindent, we make the item text be in 1844 1.1 christos % a zero-width box. 1845 1.1 christos \noindent 1846 1.1 christos \rlap{\hskip -\tableindent\box0}\ignorespaces% 1847 1.1 christos \endgroup% 1848 1.1 christos \itemxneedsnegativevskiptrue% 1849 1.1 christos \fi 1850 1.1 christos } 1851 1.1 christos 1852 1.1 christos \def\item{\errmessage{@item while not in a table}} 1853 1.1 christos \def\itemx{\errmessage{@itemx while not in a table}} 1854 1.1 christos \def\kitem{\errmessage{@kitem while not in a table}} 1855 1.1 christos \def\kitemx{\errmessage{@kitemx while not in a table}} 1856 1.1 christos \def\xitem{\errmessage{@xitem while not in a table}} 1857 1.1 christos \def\xitemx{\errmessage{@xitemx while not in a table}} 1858 1.1 christos 1859 1.1 christos %% Contains a kludge to get @end[description] to work 1860 1.1 christos \def\description{\tablez{\dontindex}{1}{}{}{}{}} 1861 1.1 christos 1862 1.1 christos \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} 1863 1.1 christos {\obeylines\obeyspaces% 1864 1.1 christos \gdef\tablex #1^^M{% 1865 1.1 christos \tabley\dontindex#1 \endtabley}} 1866 1.1 christos 1867 1.1 christos \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} 1868 1.1 christos {\obeylines\obeyspaces% 1869 1.1 christos \gdef\ftablex #1^^M{% 1870 1.1 christos \tabley\fnitemindex#1 \endtabley 1871 1.1 christos \def\Eftable{\endgraf\afterenvbreak\endgroup}% 1872 1.1 christos \let\Etable=\relax}} 1873 1.1 christos 1874 1.1 christos \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} 1875 1.1 christos {\obeylines\obeyspaces% 1876 1.1 christos \gdef\vtablex #1^^M{% 1877 1.1 christos \tabley\vritemindex#1 \endtabley 1878 1.1 christos \def\Evtable{\endgraf\afterenvbreak\endgroup}% 1879 1.1 christos \let\Etable=\relax}} 1880 1.1 christos 1881 1.1 christos \def\dontindex #1{} 1882 1.1 christos \def\fnitemindex #1{\doind {fn}{\code{#1}}}% 1883 1.1 christos \def\vritemindex #1{\doind {vr}{\code{#1}}}% 1884 1.1 christos 1885 1.1 christos {\obeyspaces % 1886 1.1 christos \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% 1887 1.1 christos \tablez{#1}{#2}{#3}{#4}{#5}{#6}}} 1888 1.1 christos 1889 1.1 christos \def\tablez #1#2#3#4#5#6{% 1890 1.1 christos \aboveenvbreak % 1891 1.1 christos \begingroup % 1892 1.1 christos \def\Edescription{\Etable}% Necessary kludge. 1893 1.1 christos \let\itemindex=#1% 1894 1.1 christos \ifnum 0#3>0 \advance \leftskip by #3\mil \fi % 1895 1.1 christos \ifnum 0#4>0 \tableindent=#4\mil \fi % 1896 1.1 christos \ifnum 0#5>0 \advance \rightskip by #5\mil \fi % 1897 1.1 christos \def\itemfont{#2}% 1898 1.1 christos \itemmax=\tableindent % 1899 1.1 christos \advance \itemmax by -\itemmargin % 1900 1.1 christos \advance \leftskip by \tableindent % 1901 1.1 christos \exdentamount=\tableindent 1902 1.1 christos \parindent = 0pt 1903 1.1 christos \parskip = \smallskipamount 1904 1.1 christos \ifdim \parskip=0pt \parskip=2pt \fi% 1905 1.1 christos \def\Etable{\endgraf\afterenvbreak\endgroup}% 1906 1.1 christos \let\item = \internalBitem % 1907 1.1 christos \let\itemx = \internalBitemx % 1908 1.1 christos \let\kitem = \internalBkitem % 1909 1.1 christos \let\kitemx = \internalBkitemx % 1910 1.1 christos \let\xitem = \internalBxitem % 1911 1.1 christos \let\xitemx = \internalBxitemx % 1912 1.1 christos } 1913 1.1 christos 1914 1.1 christos % This is the counter used by @enumerate, which is really @itemize 1915 1.1 christos 1916 1.1 christos \newcount \itemno 1917 1.1 christos 1918 1.1 christos \def\itemize{\parsearg\itemizezzz} 1919 1.1 christos 1920 1.1 christos \def\itemizezzz #1{% 1921 1.1 christos \begingroup % ended by the @end itemize 1922 1.1 christos \itemizey {#1}{\Eitemize} 1923 1.1 christos } 1924 1.1 christos 1925 1.1 christos \def\itemizey #1#2{% 1926 1.1 christos \aboveenvbreak % 1927 1.1 christos \itemmax=\itemindent % 1928 1.1 christos \advance \itemmax by -\itemmargin % 1929 1.1 christos \advance \leftskip by \itemindent % 1930 1.1 christos \exdentamount=\itemindent 1931 1.1 christos \parindent = 0pt % 1932 1.1 christos \parskip = \smallskipamount % 1933 1.1 christos \ifdim \parskip=0pt \parskip=2pt \fi% 1934 1.1 christos \def#2{\endgraf\afterenvbreak\endgroup}% 1935 1.1 christos \def\itemcontents{#1}% 1936 1.1 christos \let\item=\itemizeitem} 1937 1.1 christos 1938 1.1 christos % Set sfcode to normal for the chars that usually have another value. 1939 1.1 christos % These are `.?!:;,' 1940 1.1 christos \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 1941 1.1 christos \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } 1942 1.1 christos 1943 1.1 christos % \splitoff TOKENS\endmark defines \first to be the first token in 1944 1.1 christos % TOKENS, and \rest to be the remainder. 1945 1.1 christos % 1946 1.1 christos \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% 1947 1.1 christos 1948 1.1 christos % Allow an optional argument of an uppercase letter, lowercase letter, 1949 1.1 christos % or number, to specify the first label in the enumerated list. No 1950 1.1 christos % argument is the same as `1'. 1951 1.1 christos % 1952 1.1 christos \def\enumerate{\parsearg\enumeratezzz} 1953 1.1 christos \def\enumeratezzz #1{\enumeratey #1 \endenumeratey} 1954 1.1 christos \def\enumeratey #1 #2\endenumeratey{% 1955 1.1 christos \begingroup % ended by the @end enumerate 1956 1.1 christos % 1957 1.1 christos % If we were given no argument, pretend we were given `1'. 1958 1.1 christos \def\thearg{#1}% 1959 1.1 christos \ifx\thearg\empty \def\thearg{1}\fi 1960 1.1 christos % 1961 1.1 christos % Detect if the argument is a single token. If so, it might be a 1962 1.1 christos % letter. Otherwise, the only valid thing it can be is a number. 1963 1.1 christos % (We will always have one token, because of the test we just made. 1964 1.1 christos % This is a good thing, since \splitoff doesn't work given nothing at 1965 1.1 christos % all -- the first parameter is undelimited.) 1966 1.1 christos \expandafter\splitoff\thearg\endmark 1967 1.1 christos \ifx\rest\empty 1968 1.1 christos % Only one token in the argument. It could still be anything. 1969 1.1 christos % A ``lowercase letter'' is one whose \lccode is nonzero. 1970 1.1 christos % An ``uppercase letter'' is one whose \lccode is both nonzero, and 1971 1.1 christos % not equal to itself. 1972 1.1 christos % Otherwise, we assume it's a number. 1973 1.1 christos % 1974 1.1 christos % We need the \relax at the end of the \ifnum lines to stop TeX from 1975 1.1 christos % continuing to look for a <number>. 1976 1.1 christos % 1977 1.1 christos \ifnum\lccode\expandafter`\thearg=0\relax 1978 1.1 christos \numericenumerate % a number (we hope) 1979 1.1 christos \else 1980 1.1 christos % It's a letter. 1981 1.1 christos \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax 1982 1.1 christos \lowercaseenumerate % lowercase letter 1983 1.1 christos \else 1984 1.1 christos \uppercaseenumerate % uppercase letter 1985 1.1 christos \fi 1986 1.1 christos \fi 1987 1.1 christos \else 1988 1.1 christos % Multiple tokens in the argument. We hope it's a number. 1989 1.1 christos \numericenumerate 1990 1.1 christos \fi 1991 1.1 christos } 1992 1.1 christos 1993 1.1 christos % An @enumerate whose labels are integers. The starting integer is 1994 1.1 christos % given in \thearg. 1995 1.1 christos % 1996 1.1 christos \def\numericenumerate{% 1997 1.1 christos \itemno = \thearg 1998 1.1 christos \startenumeration{\the\itemno}% 1999 1.1 christos } 2000 1.1 christos 2001 1.1 christos % The starting (lowercase) letter is in \thearg. 2002 1.1 christos \def\lowercaseenumerate{% 2003 1.1 christos \itemno = \expandafter`\thearg 2004 1.1 christos \startenumeration{% 2005 1.1 christos % Be sure we're not beyond the end of the alphabet. 2006 1.1 christos \ifnum\itemno=0 2007 1.1 christos \errmessage{No more lowercase letters in @enumerate; get a bigger 2008 1.1 christos alphabet}% 2009 1.1 christos \fi 2010 1.1 christos \char\lccode\itemno 2011 1.1 christos }% 2012 1.1 christos } 2013 1.1 christos 2014 1.1 christos % The starting (uppercase) letter is in \thearg. 2015 1.1 christos \def\uppercaseenumerate{% 2016 1.1 christos \itemno = \expandafter`\thearg 2017 1.1 christos \startenumeration{% 2018 1.1 christos % Be sure we're not beyond the end of the alphabet. 2019 1.1 christos \ifnum\itemno=0 2020 1.1 christos \errmessage{No more uppercase letters in @enumerate; get a bigger 2021 1.1 christos alphabet} 2022 1.1 christos \fi 2023 1.1 christos \char\uccode\itemno 2024 1.1 christos }% 2025 1.1 christos } 2026 1.1 christos 2027 1.1 christos % Call itemizey, adding a period to the first argument and supplying the 2028 1.1 christos % common last two arguments. Also subtract one from the initial value in 2029 1.1 christos % \itemno, since @item increments \itemno. 2030 1.1 christos % 2031 1.1 christos \def\startenumeration#1{% 2032 1.1 christos \advance\itemno by -1 2033 1.1 christos \itemizey{#1.}\Eenumerate\flushcr 2034 1.1 christos } 2035 1.1 christos 2036 1.1 christos % @alphaenumerate and @capsenumerate are abbreviations for giving an arg 2037 1.1 christos % to @enumerate. 2038 1.1 christos % 2039 1.1 christos \def\alphaenumerate{\enumerate{a}} 2040 1.1 christos \def\capsenumerate{\enumerate{A}} 2041 1.1 christos \def\Ealphaenumerate{\Eenumerate} 2042 1.1 christos \def\Ecapsenumerate{\Eenumerate} 2043 1.1 christos 2044 1.1 christos % Definition of @item while inside @itemize. 2045 1.1 christos 2046 1.1 christos \def\itemizeitem{% 2047 1.1 christos \advance\itemno by 1 2048 1.1 christos {\let\par=\endgraf \smallbreak}% 2049 1.1 christos \ifhmode \errmessage{In hmode at itemizeitem}\fi 2050 1.1 christos {\parskip=0in \hskip 0pt 2051 1.1 christos \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% 2052 1.1 christos \vadjust{\penalty 1200}}% 2053 1.1 christos \flushcr} 2054 1.1 christos 2055 1.1 christos % @multitable macros 2056 1.1 christos % Amy Hendrickson, 8/18/94, 3/6/96 2057 1.1 christos % 2058 1.1 christos % @multitable ... @end multitable will make as many columns as desired. 2059 1.1 christos % Contents of each column will wrap at width given in preamble. Width 2060 1.1 christos % can be specified either with sample text given in a template line, 2061 1.1 christos % or in percent of \hsize, the current width of text on page. 2062 1.1 christos 2063 1.1 christos % Table can continue over pages but will only break between lines. 2064 1.1 christos 2065 1.1 christos % To make preamble: 2066 1.1 christos % 2067 1.1 christos % Either define widths of columns in terms of percent of \hsize: 2068 1.1 christos % @multitable @columnfractions .25 .3 .45 2069 1.1 christos % @item ... 2070 1.1 christos % 2071 1.1 christos % Numbers following @columnfractions are the percent of the total 2072 1.1 christos % current hsize to be used for each column. You may use as many 2073 1.1 christos % columns as desired. 2074 1.1 christos 2075 1.1 christos 2076 1.1 christos % Or use a template: 2077 1.1 christos % @multitable {Column 1 template} {Column 2 template} {Column 3 template} 2078 1.1 christos % @item ... 2079 1.1 christos % using the widest term desired in each column. 2080 1.1 christos % 2081 1.1 christos % For those who want to use more than one line's worth of words in 2082 1.1 christos % the preamble, break the line within one argument and it 2083 1.1 christos % will parse correctly, i.e., 2084 1.1 christos % 2085 1.1 christos % @multitable {Column 1 template} {Column 2 template} {Column 3 2086 1.1 christos % template} 2087 1.1 christos % Not: 2088 1.1 christos % @multitable {Column 1 template} {Column 2 template} 2089 1.1 christos % {Column 3 template} 2090 1.1 christos 2091 1.1 christos % Each new table line starts with @item, each subsequent new column 2092 1.1 christos % starts with @tab. Empty columns may be produced by supplying @tab's 2093 1.1 christos % with nothing between them for as many times as empty columns are needed, 2094 1.1 christos % ie, @tab@tab@tab will produce two empty columns. 2095 1.1 christos 2096 1.1 christos % @item, @tab, @multitable or @end multitable do not need to be on their 2097 1.1 christos % own lines, but it will not hurt if they are. 2098 1.1 christos 2099 1.1 christos % Sample multitable: 2100 1.1 christos 2101 1.1 christos % @multitable {Column 1 template} {Column 2 template} {Column 3 template} 2102 1.1 christos % @item first col stuff @tab second col stuff @tab third col 2103 1.1 christos % @item 2104 1.1 christos % first col stuff 2105 1.1 christos % @tab 2106 1.1 christos % second col stuff 2107 1.1 christos % @tab 2108 1.1 christos % third col 2109 1.1 christos % @item first col stuff @tab second col stuff 2110 1.1 christos % @tab Many paragraphs of text may be used in any column. 2111 1.1 christos % 2112 1.1 christos % They will wrap at the width determined by the template. 2113 1.1 christos % @item@tab@tab This will be in third column. 2114 1.1 christos % @end multitable 2115 1.1 christos 2116 1.1 christos % Default dimensions may be reset by user. 2117 1.1 christos % @multitableparskip is vertical space between paragraphs in table. 2118 1.1 christos % @multitableparindent is paragraph indent in table. 2119 1.1 christos % @multitablecolmargin is horizontal space to be left between columns. 2120 1.1 christos % @multitablelinespace is space to leave between table items, baseline 2121 1.1 christos % to baseline. 2122 1.1 christos % 0pt means it depends on current normal line spacing. 2123 1.1 christos % 2124 1.1 christos \newskip\multitableparskip 2125 1.1 christos \newskip\multitableparindent 2126 1.1 christos \newdimen\multitablecolspace 2127 1.1 christos \newskip\multitablelinespace 2128 1.1 christos \multitableparskip=0pt 2129 1.1 christos \multitableparindent=6pt 2130 1.1 christos \multitablecolspace=12pt 2131 1.1 christos \multitablelinespace=0pt 2132 1.1 christos 2133 1.1 christos % Macros used to set up halign preamble: 2134 1.1 christos % 2135 1.1 christos \let\endsetuptable\relax 2136 1.1 christos \def\xendsetuptable{\endsetuptable} 2137 1.1 christos \let\columnfractions\relax 2138 1.1 christos \def\xcolumnfractions{\columnfractions} 2139 1.1 christos \newif\ifsetpercent 2140 1.1 christos 2141 1.1 christos % 2/1/96, to allow fractions to be given with more than one digit. 2142 1.1 christos \def\pickupwholefraction#1 {\global\advance\colcount by1 % 2143 1.1 christos \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}% 2144 1.1 christos \setuptable} 2145 1.1 christos 2146 1.1 christos \newcount\colcount 2147 1.1 christos \def\setuptable#1{\def\firstarg{#1}% 2148 1.1 christos \ifx\firstarg\xendsetuptable\let\go\relax% 2149 1.1 christos \else 2150 1.1 christos \ifx\firstarg\xcolumnfractions\global\setpercenttrue% 2151 1.1 christos \else 2152 1.1 christos \ifsetpercent 2153 1.1 christos \let\go\pickupwholefraction % In this case arg of setuptable 2154 1.1 christos % is the decimal point before the 2155 1.1 christos % number given in percent of hsize. 2156 1.1 christos % We don't need this so we don't use it. 2157 1.1 christos \else 2158 1.1 christos \global\advance\colcount by1 2159 1.1 christos \setbox0=\hbox{#1 }% Add a normal word space as a separator; 2160 1.1 christos % typically that is always in the input, anyway. 2161 1.1 christos \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% 2162 1.1 christos \fi% 2163 1.1 christos \fi% 2164 1.1 christos \ifx\go\pickupwholefraction\else\let\go\setuptable\fi% 2165 1.1 christos \fi\go} 2166 1.1 christos 2167 1.1 christos % multitable syntax 2168 1.1 christos \def\tab{&\hskip1sp\relax} % 2/2/96 2169 1.1 christos % tiny skip here makes sure this column space is 2170 1.1 christos % maintained, even if it is never used. 2171 1.1 christos 2172 1.1 christos % @multitable ... @end multitable definitions: 2173 1.1 christos 2174 1.1 christos \def\multitable{\parsearg\dotable} 2175 1.1 christos \def\dotable#1{\bgroup 2176 1.1 christos \vskip\parskip 2177 1.1 christos \let\item\crcr 2178 1.1 christos \tolerance=9500 2179 1.1 christos \hbadness=9500 2180 1.1 christos \setmultitablespacing 2181 1.1 christos \parskip=\multitableparskip 2182 1.1 christos \parindent=\multitableparindent 2183 1.1 christos \overfullrule=0pt 2184 1.1 christos \global\colcount=0 2185 1.1 christos \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% 2186 1.1 christos % 2187 1.1 christos % To parse everything between @multitable and @item: 2188 1.1 christos \setuptable#1 \endsetuptable 2189 1.1 christos % 2190 1.1 christos % \everycr will reset column counter, \colcount, at the end of 2191 1.1 christos % each line. Every column entry will cause \colcount to advance by one. 2192 1.1 christos % The table preamble 2193 1.1 christos % looks at the current \colcount to find the correct column width. 2194 1.1 christos \everycr{\noalign{% 2195 1.1 christos % 2196 1.1 christos % \filbreak%% keeps underfull box messages off when table breaks over pages. 2197 1.1 christos % Maybe so, but it also creates really weird page breaks when the table 2198 1.1 christos % breaks over pages. Wouldn't \vfil be better? Wait until the problem 2199 1.1 christos % manifests itself, so it can be fixed for real --karl. 2200 1.1 christos \global\colcount=0\relax}}% 2201 1.1 christos % 2202 1.1 christos % This preamble sets up a generic column definition, which will 2203 1.1 christos % be used as many times as user calls for columns. 2204 1.1 christos % \vtop will set a single line and will also let text wrap and 2205 1.1 christos % continue for many paragraphs if desired. 2206 1.1 christos \halign\bgroup&\global\advance\colcount by 1\relax 2207 1.1 christos \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname 2208 1.1 christos % 2209 1.1 christos % In order to keep entries from bumping into each other 2210 1.1 christos % we will add a \leftskip of \multitablecolspace to all columns after 2211 1.1 christos % the first one. 2212 1.1 christos % 2213 1.1 christos % If a template has been used, we will add \multitablecolspace 2214 1.1 christos % to the width of each template entry. 2215 1.1 christos % 2216 1.1 christos % If the user has set preamble in terms of percent of \hsize we will 2217 1.1 christos % use that dimension as the width of the column, and the \leftskip 2218 1.1 christos % will keep entries from bumping into each other. Table will start at 2219 1.1 christos % left margin and final column will justify at right margin. 2220 1.1 christos % 2221 1.1 christos % Make sure we don't inherit \rightskip from the outer environment. 2222 1.1 christos \rightskip=0pt 2223 1.1 christos \ifnum\colcount=1 2224 1.1 christos % The first column will be indented with the surrounding text. 2225 1.1 christos \advance\hsize by\leftskip 2226 1.1 christos \else 2227 1.1 christos \ifsetpercent \else 2228 1.1 christos % If user has not set preamble in terms of percent of \hsize 2229 1.1 christos % we will advance \hsize by \multitablecolspace. 2230 1.1 christos \advance\hsize by \multitablecolspace 2231 1.1 christos \fi 2232 1.1 christos % In either case we will make \leftskip=\multitablecolspace: 2233 1.1 christos \leftskip=\multitablecolspace 2234 1.1 christos \fi 2235 1.1 christos % Ignoring space at the beginning and end avoids an occasional spurious 2236 1.1 christos % blank line, when TeX decides to break the line at the space before the 2237 1.1 christos % box from the multistrut, so the strut ends up on a line by itself. 2238 1.1 christos % For example: 2239 1.1 christos % @multitable @columnfractions .11 .89 2240 1.1 christos % @item @code{#} 2241 1.1 christos % @tab Legal holiday which is valid in major parts of the whole country. 2242 1.1 christos % Is automatically provided with highlighting sequences respectively marking 2243 1.1 christos % characters. 2244 1.1 christos \noindent\ignorespaces##\unskip\multistrut}\cr 2245 1.1 christos } 2246 1.1 christos 2247 1.1 christos \def\setmultitablespacing{% test to see if user has set \multitablelinespace. 2248 1.1 christos % If so, do nothing. If not, give it an appropriate dimension based on 2249 1.1 christos % current baselineskip. 2250 1.1 christos \ifdim\multitablelinespace=0pt 2251 1.1 christos %% strut to put in table in case some entry doesn't have descenders, 2252 1.1 christos %% to keep lines equally spaced 2253 1.1 christos \let\multistrut = \strut 2254 1.1 christos %% Test to see if parskip is larger than space between lines of 2255 1.1 christos %% table. If not, do nothing. 2256 1.1 christos %% If so, set to same dimension as multitablelinespace. 2257 1.1 christos \else 2258 1.1 christos \gdef\multistrut{\vrule height\multitablelinespace depth\dp0 2259 1.1 christos width0pt\relax} \fi 2260 1.1 christos \ifdim\multitableparskip>\multitablelinespace 2261 1.1 christos \global\multitableparskip=\multitablelinespace 2262 1.1 christos \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 2263 1.1 christos %% than skip between lines in the table. 2264 1.1 christos \fi% 2265 1.1 christos \ifdim\multitableparskip=0pt 2266 1.1 christos \global\multitableparskip=\multitablelinespace 2267 1.1 christos \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 2268 1.1 christos %% than skip between lines in the table. 2269 1.1 christos \fi} 2270 1.1 christos 2271 1.1 christos 2272 1.1 christos \message{indexing,} 2273 1.1 christos % Index generation facilities 2274 1.1 christos 2275 1.1 christos % Define \newwrite to be identical to plain tex's \newwrite 2276 1.1 christos % except not \outer, so it can be used within \newindex. 2277 1.1 christos {\catcode`\@=11 2278 1.1 christos \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} 2279 1.1 christos 2280 1.1 christos % \newindex {foo} defines an index named foo. 2281 1.1 christos % It automatically defines \fooindex such that 2282 1.1 christos % \fooindex ...rest of line... puts an entry in the index foo. 2283 1.1 christos % It also defines \fooindfile to be the number of the output channel for 2284 1.1 christos % the file that accumulates this index. The file's extension is foo. 2285 1.1 christos % The name of an index should be no more than 2 characters long 2286 1.1 christos % for the sake of vms. 2287 1.1 christos % 2288 1.1 christos \def\newindex#1{% 2289 1.1 christos \iflinks 2290 1.1 christos \expandafter\newwrite \csname#1indfile\endcsname 2291 1.1 christos \openout \csname#1indfile\endcsname \jobname.#1 % Open the file 2292 1.1 christos \fi 2293 1.1 christos \expandafter\xdef\csname#1index\endcsname{% % Define @#1index 2294 1.1 christos \noexpand\doindex{#1}} 2295 1.1 christos } 2296 1.1 christos 2297 1.1 christos % @defindex foo == \newindex{foo} 2298 1.1 christos 2299 1.1 christos \def\defindex{\parsearg\newindex} 2300 1.1 christos 2301 1.1 christos % Define @defcodeindex, like @defindex except put all entries in @code. 2302 1.1 christos 2303 1.1 christos \def\newcodeindex#1{% 2304 1.1 christos \iflinks 2305 1.1 christos \expandafter\newwrite \csname#1indfile\endcsname 2306 1.1 christos \openout \csname#1indfile\endcsname \jobname.#1 2307 1.1 christos \fi 2308 1.1 christos \expandafter\xdef\csname#1index\endcsname{% 2309 1.1 christos \noexpand\docodeindex{#1}} 2310 1.1 christos } 2311 1.1 christos 2312 1.1 christos \def\defcodeindex{\parsearg\newcodeindex} 2313 1.1 christos 2314 1.1 christos % @synindex foo bar makes index foo feed into index bar. 2315 1.1 christos % Do this instead of @defindex foo if you don't want it as a separate index. 2316 1.1 christos % The \closeout helps reduce unnecessary open files; the limit on the 2317 1.1 christos % Acorn RISC OS is a mere 16 files. 2318 1.1 christos \def\synindex#1 #2 {% 2319 1.1 christos \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname 2320 1.1 christos \expandafter\closeout\csname#1indfile\endcsname 2321 1.1 christos \expandafter\let\csname#1indfile\endcsname=\synindexfoo 2322 1.1 christos \expandafter\xdef\csname#1index\endcsname{% define \xxxindex 2323 1.1 christos \noexpand\doindex{#2}}% 2324 1.1 christos } 2325 1.1 christos 2326 1.1 christos % @syncodeindex foo bar similar, but put all entries made for index foo 2327 1.1 christos % inside @code. 2328 1.1 christos \def\syncodeindex#1 #2 {% 2329 1.1 christos \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname 2330 1.1 christos \expandafter\closeout\csname#1indfile\endcsname 2331 1.1 christos \expandafter\let\csname#1indfile\endcsname=\synindexfoo 2332 1.1 christos \expandafter\xdef\csname#1index\endcsname{% define \xxxindex 2333 1.1 christos \noexpand\docodeindex{#2}}% 2334 1.1 christos } 2335 1.1 christos 2336 1.1 christos % Define \doindex, the driver for all \fooindex macros. 2337 1.1 christos % Argument #1 is generated by the calling \fooindex macro, 2338 1.1 christos % and it is "foo", the name of the index. 2339 1.1 christos 2340 1.1 christos % \doindex just uses \parsearg; it calls \doind for the actual work. 2341 1.1 christos % This is because \doind is more useful to call from other macros. 2342 1.1 christos 2343 1.1 christos % There is also \dosubind {index}{topic}{subtopic} 2344 1.1 christos % which makes an entry in a two-level index such as the operation index. 2345 1.1 christos 2346 1.1 christos \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} 2347 1.1 christos \def\singleindexer #1{\doind{\indexname}{#1}} 2348 1.1 christos 2349 1.1 christos % like the previous two, but they put @code around the argument. 2350 1.1 christos \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} 2351 1.1 christos \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} 2352 1.1 christos 2353 1.1 christos \def\indexdummies{% 2354 1.1 christos \def\ { }% 2355 1.1 christos % Take care of the plain tex accent commands. 2356 1.1 christos \def\"{\realbackslash "}% 2357 1.1 christos \def\`{\realbackslash `}% 2358 1.1 christos \def\'{\realbackslash '}% 2359 1.1 christos \def\^{\realbackslash ^}% 2360 1.1 christos \def\~{\realbackslash ~}% 2361 1.1 christos \def\={\realbackslash =}% 2362 1.1 christos \def\b{\realbackslash b}% 2363 1.1 christos \def\c{\realbackslash c}% 2364 1.1 christos \def\d{\realbackslash d}% 2365 1.1 christos \def\u{\realbackslash u}% 2366 1.1 christos \def\v{\realbackslash v}% 2367 1.1 christos \def\H{\realbackslash H}% 2368 1.1 christos % Take care of the plain tex special European modified letters. 2369 1.1 christos \def\oe{\realbackslash oe}% 2370 1.1 christos \def\ae{\realbackslash ae}% 2371 1.1 christos \def\aa{\realbackslash aa}% 2372 1.1 christos \def\OE{\realbackslash OE}% 2373 1.1 christos \def\AE{\realbackslash AE}% 2374 1.1 christos \def\AA{\realbackslash AA}% 2375 1.1 christos \def\o{\realbackslash o}% 2376 1.1 christos \def\O{\realbackslash O}% 2377 1.1 christos \def\l{\realbackslash l}% 2378 1.1 christos \def\L{\realbackslash L}% 2379 1.1 christos \def\ss{\realbackslash ss}% 2380 1.1 christos % Take care of texinfo commands likely to appear in an index entry. 2381 1.1 christos % (Must be a way to avoid doing expansion at all, and thus not have to 2382 1.1 christos % laboriously list every single command here.) 2383 1.1 christos \def\@{@}% will be @@ when we switch to @ as escape char. 2384 1.1 christos %\let\{ = \lbracecmd 2385 1.1 christos %\let\} = \rbracecmd 2386 1.1 christos \def\_{{\realbackslash _}}% 2387 1.1 christos \def\w{\realbackslash w }% 2388 1.1 christos \def\bf{\realbackslash bf }% 2389 1.1 christos %\def\rm{\realbackslash rm }% 2390 1.1 christos \def\sl{\realbackslash sl }% 2391 1.1 christos \def\sf{\realbackslash sf}% 2392 1.1 christos \def\tt{\realbackslash tt}% 2393 1.1 christos \def\gtr{\realbackslash gtr}% 2394 1.1 christos \def\less{\realbackslash less}% 2395 1.1 christos \def\hat{\realbackslash hat}% 2396 1.1 christos \def\TeX{\realbackslash TeX}% 2397 1.1 christos \def\dots{\realbackslash dots }% 2398 1.1 christos \def\result{\realbackslash result}% 2399 1.1 christos \def\equiv{\realbackslash equiv}% 2400 1.1 christos \def\expansion{\realbackslash expansion}% 2401 1.1 christos \def\print{\realbackslash print}% 2402 1.1 christos \def\error{\realbackslash error}% 2403 1.1 christos \def\point{\realbackslash point}% 2404 1.1 christos \def\copyright{\realbackslash copyright}% 2405 1.1 christos \def\tclose##1{\realbackslash tclose {##1}}% 2406 1.1 christos \def\code##1{\realbackslash code {##1}}% 2407 1.1 christos \def\dotless##1{\realbackslash dotless {##1}}% 2408 1.1 christos \def\samp##1{\realbackslash samp {##1}}% 2409 1.1 christos \def\,##1{\realbackslash ,{##1}}% 2410 1.1 christos \def\t##1{\realbackslash t {##1}}% 2411 1.1 christos \def\r##1{\realbackslash r {##1}}% 2412 1.1 christos \def\i##1{\realbackslash i {##1}}% 2413 1.1 christos \def\b##1{\realbackslash b {##1}}% 2414 1.1 christos \def\sc##1{\realbackslash sc {##1}}% 2415 1.1 christos \def\cite##1{\realbackslash cite {##1}}% 2416 1.1 christos \def\key##1{\realbackslash key {##1}}% 2417 1.1 christos \def\file##1{\realbackslash file {##1}}% 2418 1.1 christos \def\var##1{\realbackslash var {##1}}% 2419 1.1 christos \def\kbd##1{\realbackslash kbd {##1}}% 2420 1.1 christos \def\dfn##1{\realbackslash dfn {##1}}% 2421 1.1 christos \def\emph##1{\realbackslash emph {##1}}% 2422 1.1 christos % 2423 1.1 christos % Handle some cases of @value -- where the variable name does not 2424 1.1 christos % contain - or _, and the value does not contain any 2425 1.1 christos % (non-fully-expandable) commands. 2426 1.1 christos \let\value = \expandablevalue 2427 1.1 christos % 2428 1.1 christos \unsepspaces 2429 1.1 christos } 2430 1.1 christos 2431 1.1 christos % If an index command is used in an @example environment, any spaces 2432 1.1 christos % therein should become regular spaces in the raw index file, not the 2433 1.1 christos % expansion of \tie (\\leavevmode \penalty \@M \ ). 2434 1.1 christos {\obeyspaces 2435 1.1 christos \gdef\unsepspaces{\obeyspaces\let =\space}} 2436 1.1 christos 2437 1.1 christos % \indexnofonts no-ops all font-change commands. 2438 1.1 christos % This is used when outputting the strings to sort the index by. 2439 1.1 christos \def\indexdummyfont#1{#1} 2440 1.1 christos \def\indexdummytex{TeX} 2441 1.1 christos \def\indexdummydots{...} 2442 1.1 christos 2443 1.1 christos \def\indexnofonts{% 2444 1.1 christos % Just ignore accents. 2445 1.1 christos \let\,=\indexdummyfont 2446 1.1 christos \let\"=\indexdummyfont 2447 1.1 christos \let\`=\indexdummyfont 2448 1.1 christos \let\'=\indexdummyfont 2449 1.1 christos \let\^=\indexdummyfont 2450 1.1 christos \let\~=\indexdummyfont 2451 1.1 christos \let\==\indexdummyfont 2452 1.1 christos \let\b=\indexdummyfont 2453 1.1 christos \let\c=\indexdummyfont 2454 1.1 christos \let\d=\indexdummyfont 2455 1.1 christos \let\u=\indexdummyfont 2456 1.1 christos \let\v=\indexdummyfont 2457 1.1 christos \let\H=\indexdummyfont 2458 1.1 christos \let\dotless=\indexdummyfont 2459 1.1 christos % Take care of the plain tex special European modified letters. 2460 1.1 christos \def\oe{oe}% 2461 1.1 christos \def\ae{ae}% 2462 1.1 christos \def\aa{aa}% 2463 1.1 christos \def\OE{OE}% 2464 1.1 christos \def\AE{AE}% 2465 1.1 christos \def\AA{AA}% 2466 1.1 christos \def\o{o}% 2467 1.1 christos \def\O{O}% 2468 1.1 christos \def\l{l}% 2469 1.1 christos \def\L{L}% 2470 1.1 christos \def\ss{ss}% 2471 1.1 christos \let\w=\indexdummyfont 2472 1.1 christos \let\t=\indexdummyfont 2473 1.1 christos \let\r=\indexdummyfont 2474 1.1 christos \let\i=\indexdummyfont 2475 1.1 christos \let\b=\indexdummyfont 2476 1.1 christos \let\emph=\indexdummyfont 2477 1.1 christos \let\strong=\indexdummyfont 2478 1.1 christos \let\cite=\indexdummyfont 2479 1.1 christos \let\sc=\indexdummyfont 2480 1.1 christos %Don't no-op \tt, since it isn't a user-level command 2481 1.1 christos % and is used in the definitions of the active chars like <, >, |... 2482 1.1 christos %\let\tt=\indexdummyfont 2483 1.1 christos \let\tclose=\indexdummyfont 2484 1.1 christos \let\code=\indexdummyfont 2485 1.1 christos \let\file=\indexdummyfont 2486 1.1 christos \let\samp=\indexdummyfont 2487 1.1 christos \let\kbd=\indexdummyfont 2488 1.1 christos \let\key=\indexdummyfont 2489 1.1 christos \let\var=\indexdummyfont 2490 1.1 christos \let\TeX=\indexdummytex 2491 1.1 christos \let\dots=\indexdummydots 2492 1.1 christos \def\@{@}% 2493 1.1 christos } 2494 1.1 christos 2495 1.1 christos % To define \realbackslash, we must make \ not be an escape. 2496 1.1 christos % We must first make another character (@) an escape 2497 1.1 christos % so we do not become unable to do a definition. 2498 1.1 christos 2499 1.1 christos {\catcode`\@=0 \catcode`\\=\other 2500 1.1 christos @gdef@realbackslash{\}} 2501 1.1 christos 2502 1.1 christos \let\indexbackslash=0 %overridden during \printindex. 2503 1.1 christos \let\SETmarginindex=\relax % put index entries in margin (undocumented)? 2504 1.1 christos 2505 1.1 christos % For \ifx comparisons. 2506 1.1 christos \def\emptymacro{\empty} 2507 1.1 christos 2508 1.1 christos % Most index entries go through here, but \dosubind is the general case. 2509 1.1 christos % 2510 1.1 christos \def\doind#1#2{\dosubind{#1}{#2}\empty} 2511 1.1 christos 2512 1.1 christos % Workhorse for all \fooindexes. 2513 1.1 christos % #1 is name of index, #2 is stuff to put there, #3 is subentry -- 2514 1.1 christos % \empty if called from \doind, as we usually are. The main exception 2515 1.1 christos % is with defuns, which call us directly. 2516 1.1 christos % 2517 1.1 christos \def\dosubind#1#2#3{% 2518 1.1 christos % Put the index entry in the margin if desired. 2519 1.1 christos \ifx\SETmarginindex\relax\else 2520 1.1 christos \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% 2521 1.1 christos \fi 2522 1.1 christos {% 2523 1.1 christos \count255=\lastpenalty 2524 1.1 christos {% 2525 1.1 christos \indexdummies % Must do this here, since \bf, etc expand at this stage 2526 1.1 christos \escapechar=`\\ 2527 1.1 christos {% 2528 1.1 christos \let\folio = 0% We will expand all macros now EXCEPT \folio. 2529 1.1 christos \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now 2530 1.1 christos % so it will be output as is; and it will print as backslash. 2531 1.1 christos % 2532 1.1 christos \def\thirdarg{#3}% 2533 1.1 christos % 2534 1.1 christos % If third arg is present, precede it with space in sort key. 2535 1.1 christos \ifx\thirdarg\emptymacro 2536 1.1 christos \let\subentry = \empty 2537 1.1 christos \else 2538 1.1 christos \def\subentry{ #3}% 2539 1.1 christos \fi 2540 1.1 christos % 2541 1.1 christos % First process the index-string with all font commands turned off 2542 1.1 christos % to get the string to sort by. 2543 1.1 christos {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% 2544 1.1 christos % 2545 1.1 christos % Now produce the complete index entry, with both the sort key and the 2546 1.1 christos % original text, including any font commands. 2547 1.1 christos \toks0 = {#2}% 2548 1.1 christos \edef\temp{% 2549 1.1 christos \write\csname#1indfile\endcsname{% 2550 1.1 christos \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% 2551 1.1 christos }% 2552 1.1 christos % 2553 1.1 christos % If third (subentry) arg is present, add it to the index string. 2554 1.1 christos \ifx\thirdarg\emptymacro \else 2555 1.1 christos \toks0 = {#3}% 2556 1.1 christos \edef\temp{\temp{\the\toks0}}% 2557 1.1 christos \fi 2558 1.1 christos % 2559 1.1 christos % If a skip is the last thing on the list now, preserve it 2560 1.1 christos % by backing up by \lastskip, doing the \write, then inserting 2561 1.1 christos % the skip again. Otherwise, the whatsit generated by the 2562 1.1 christos % \write will make \lastskip zero. The result is that sequences 2563 1.1 christos % like this: 2564 1.1 christos % @end defun 2565 1.1 christos % @tindex whatever 2566 1.1 christos % @defun ... 2567 1.1 christos % will have extra space inserted, because the \medbreak in the 2568 1.1 christos % start of the @defun won't see the skip inserted by the @end of 2569 1.1 christos % the previous defun. 2570 1.1 christos \iflinks 2571 1.1 christos \skip0 = \lastskip \ifdim\lastskip = 0pt \else \vskip-\lastskip \fi 2572 1.1 christos \temp 2573 1.1 christos \ifdim\skip0 = 0pt \else \vskip\skip0 \fi 2574 1.1 christos \fi 2575 1.1 christos }% 2576 1.1 christos }% 2577 1.1 christos \penalty\count255 2578 1.1 christos }% 2579 1.1 christos } 2580 1.1 christos 2581 1.1 christos % The index entry written in the file actually looks like 2582 1.1 christos % \entry {sortstring}{page}{topic} 2583 1.1 christos % or 2584 1.1 christos % \entry {sortstring}{page}{topic}{subtopic} 2585 1.1 christos % The texindex program reads in these files and writes files 2586 1.1 christos % containing these kinds of lines: 2587 1.1 christos % \initial {c} 2588 1.1 christos % before the first topic whose initial is c 2589 1.1 christos % \entry {topic}{pagelist} 2590 1.1 christos % for a topic that is used without subtopics 2591 1.1 christos % \primary {topic} 2592 1.1 christos % for the beginning of a topic that is used with subtopics 2593 1.1 christos % \secondary {subtopic}{pagelist} 2594 1.1 christos % for each subtopic. 2595 1.1 christos 2596 1.1 christos % Define the user-accessible indexing commands 2597 1.1 christos % @findex, @vindex, @kindex, @cindex. 2598 1.1 christos 2599 1.1 christos \def\findex {\fnindex} 2600 1.1 christos \def\kindex {\kyindex} 2601 1.1 christos \def\cindex {\cpindex} 2602 1.1 christos \def\vindex {\vrindex} 2603 1.1 christos \def\tindex {\tpindex} 2604 1.1 christos \def\pindex {\pgindex} 2605 1.1 christos 2606 1.1 christos \def\cindexsub {\begingroup\obeylines\cindexsub} 2607 1.1 christos {\obeylines % 2608 1.1 christos \gdef\cindexsub "#1" #2^^M{\endgroup % 2609 1.1 christos \dosubind{cp}{#2}{#1}}} 2610 1.1 christos 2611 1.1 christos % Define the macros used in formatting output of the sorted index material. 2612 1.1 christos 2613 1.1 christos % @printindex causes a particular index (the ??s file) to get printed. 2614 1.1 christos % It does not print any chapter heading (usually an @unnumbered). 2615 1.1 christos % 2616 1.1 christos \def\printindex{\parsearg\doprintindex} 2617 1.1 christos \def\doprintindex#1{\begingroup 2618 1.1 christos \dobreak \chapheadingskip{10000}% 2619 1.1 christos % 2620 1.1 christos \indexfonts \rm 2621 1.1 christos \tolerance = 9500 2622 1.1 christos \indexbreaks 2623 1.1 christos % 2624 1.1 christos % See if the index file exists and is nonempty. 2625 1.1 christos % Change catcode of @ here so that if the index file contains 2626 1.1 christos % \initial {@} 2627 1.1 christos % as its first line, TeX doesn't complain about mismatched braces 2628 1.1 christos % (because it thinks @} is a control sequence). 2629 1.1 christos \catcode`\@ = 11 2630 1.1 christos \openin 1 \jobname.#1s 2631 1.1 christos \ifeof 1 2632 1.1 christos % \enddoublecolumns gets confused if there is no text in the index, 2633 1.1 christos % and it loses the chapter title and the aux file entries for the 2634 1.1 christos % index. The easiest way to prevent this problem is to make sure 2635 1.1 christos % there is some text. 2636 1.1 christos (Index is nonexistent) 2637 1.1 christos \else 2638 1.1 christos % 2639 1.1 christos % If the index file exists but is empty, then \openin leaves \ifeof 2640 1.1 christos % false. We have to make TeX try to read something from the file, so 2641 1.1 christos % it can discover if there is anything in it. 2642 1.1 christos \read 1 to \temp 2643 1.1 christos \ifeof 1 2644 1.1 christos (Index is empty) 2645 1.1 christos \else 2646 1.1 christos % Index files are almost Texinfo source, but we use \ as the escape 2647 1.1 christos % character. It would be better to use @, but that's too big a change 2648 1.1 christos % to make right now. 2649 1.1 christos \def\indexbackslash{\rawbackslashxx}% 2650 1.1 christos \catcode`\\ = 0 2651 1.1 christos \escapechar = `\\ 2652 1.1 christos \begindoublecolumns 2653 1.1 christos \input \jobname.#1s 2654 1.1 christos \enddoublecolumns 2655 1.1 christos \fi 2656 1.1 christos \fi 2657 1.1 christos \closein 1 2658 1.1 christos \endgroup} 2659 1.1 christos 2660 1.1 christos % These macros are used by the sorted index file itself. 2661 1.1 christos % Change them to control the appearance of the index. 2662 1.1 christos 2663 1.1 christos % Same as \bigskipamount except no shrink. 2664 1.1 christos % \balancecolumns gets confused if there is any shrink. 2665 1.1 christos \newskip\initialskipamount \initialskipamount 12pt plus4pt 2666 1.1 christos 2667 1.1 christos \def\initial #1{% 2668 1.1 christos {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt 2669 1.1 christos \ifdim\lastskip<\initialskipamount 2670 1.1 christos \removelastskip \penalty-200 \vskip \initialskipamount\fi 2671 1.1 christos \line{\secbf#1\hfill}\kern 2pt\penalty10000}} 2672 1.1 christos 2673 1.1 christos % This typesets a paragraph consisting of #1, dot leaders, and then #2 2674 1.1 christos % flush to the right margin. It is used for index and table of contents 2675 1.1 christos % entries. The paragraph is indented by \leftskip. 2676 1.1 christos % 2677 1.1 christos \def\entry #1#2{\begingroup 2678 1.1 christos % 2679 1.1 christos % Start a new paragraph if necessary, so our assignments below can't 2680 1.1 christos % affect previous text. 2681 1.1 christos \par 2682 1.1 christos % 2683 1.1 christos % Do not fill out the last line with white space. 2684 1.1 christos \parfillskip = 0in 2685 1.1 christos % 2686 1.1 christos % No extra space above this paragraph. 2687 1.1 christos \parskip = 0in 2688 1.1 christos % 2689 1.1 christos % Do not prefer a separate line ending with a hyphen to fewer lines. 2690 1.1 christos \finalhyphendemerits = 0 2691 1.1 christos % 2692 1.1 christos % \hangindent is only relevant when the entry text and page number 2693 1.1 christos % don't both fit on one line. In that case, bob suggests starting the 2694 1.1 christos % dots pretty far over on the line. Unfortunately, a large 2695 1.1 christos % indentation looks wrong when the entry text itself is broken across 2696 1.1 christos % lines. So we use a small indentation and put up with long leaders. 2697 1.1 christos % 2698 1.1 christos % \hangafter is reset to 1 (which is the value we want) at the start 2699 1.1 christos % of each paragraph, so we need not do anything with that. 2700 1.1 christos \hangindent=2em 2701 1.1 christos % 2702 1.1 christos % When the entry text needs to be broken, just fill out the first line 2703 1.1 christos % with blank space. 2704 1.1 christos \rightskip = 0pt plus1fil 2705 1.1 christos % 2706 1.1 christos % Start a ``paragraph'' for the index entry so the line breaking 2707 1.1 christos % parameters we've set above will have an effect. 2708 1.1 christos \noindent 2709 1.1 christos % 2710 1.1 christos % Insert the text of the index entry. TeX will do line-breaking on it. 2711 1.1 christos #1% 2712 1.1 christos % The following is kludged to not output a line of dots in the index if 2713 1.1 christos % there are no page numbers. The next person who breaks this will be 2714 1.1 christos % cursed by a Unix daemon. 2715 1.1 christos \def\tempa{{\rm }}% 2716 1.1 christos \def\tempb{#2}% 2717 1.1 christos \edef\tempc{\tempa}% 2718 1.1 christos \edef\tempd{\tempb}% 2719 1.1 christos \ifx\tempc\tempd\ \else% 2720 1.1 christos % 2721 1.1 christos % If we must, put the page number on a line of its own, and fill out 2722 1.1 christos % this line with blank space. (The \hfil is overwhelmed with the 2723 1.1 christos % fill leaders glue in \indexdotfill if the page number does fit.) 2724 1.1 christos \hfil\penalty50 2725 1.1 christos \null\nobreak\indexdotfill % Have leaders before the page number. 2726 1.1 christos % 2727 1.1 christos % The `\ ' here is removed by the implicit \unskip that TeX does as 2728 1.1 christos % part of (the primitive) \par. Without it, a spurious underfull 2729 1.1 christos % \hbox ensues. 2730 1.1 christos \ #2% The page number ends the paragraph. 2731 1.1 christos \fi% 2732 1.1 christos \par 2733 1.1 christos \endgroup} 2734 1.1 christos 2735 1.1 christos % Like \dotfill except takes at least 1 em. 2736 1.1 christos \def\indexdotfill{\cleaders 2737 1.1 christos \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} 2738 1.1 christos 2739 1.1 christos \def\primary #1{\line{#1\hfil}} 2740 1.1 christos 2741 1.1 christos \newskip\secondaryindent \secondaryindent=0.5cm 2742 1.1 christos 2743 1.1 christos \def\secondary #1#2{ 2744 1.1 christos {\parfillskip=0in \parskip=0in 2745 1.1 christos \hangindent =1in \hangafter=1 2746 1.1 christos \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par 2747 1.1 christos }} 2748 1.1 christos 2749 1.1 christos % Define two-column mode, which we use to typeset indexes. 2750 1.1 christos % Adapted from the TeXbook, page 416, which is to say, 2751 1.1 christos % the manmac.tex format used to print the TeXbook itself. 2752 1.1 christos \catcode`\@=11 2753 1.1 christos 2754 1.1 christos \newbox\partialpage 2755 1.1 christos \newdimen\doublecolumnhsize 2756 1.1 christos 2757 1.1 christos \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns 2758 1.1 christos % Grab any single-column material above us. 2759 1.1 christos \output = {\global\setbox\partialpage = \vbox{% 2760 1.1 christos % 2761 1.1 christos % Here is a possibility not foreseen in manmac: if we accumulate a 2762 1.1 christos % whole lot of material, we might end up calling this \output 2763 1.1 christos % routine twice in a row (see the doublecol-lose test, which is 2764 1.1 christos % essentially a couple of indexes with @setchapternewpage off). In 2765 1.1 christos % that case, we must prevent the second \partialpage from 2766 1.1 christos % simply overwriting the first, causing us to lose the page. 2767 1.1 christos % This will preserve it until a real output routine can ship it 2768 1.1 christos % out. Generally, \partialpage will be empty when this runs and 2769 1.1 christos % this will be a no-op. 2770 1.1 christos \unvbox\partialpage 2771 1.1 christos % 2772 1.1 christos % Unvbox the main output page. 2773 1.1 christos \unvbox255 2774 1.1 christos \kern-\topskip \kern\baselineskip 2775 1.1 christos }}% 2776 1.1 christos \eject 2777 1.1 christos % 2778 1.1 christos % Use the double-column output routine for subsequent pages. 2779 1.1 christos \output = {\doublecolumnout}% 2780 1.1 christos % 2781 1.1 christos % Change the page size parameters. We could do this once outside this 2782 1.1 christos % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 2783 1.1 christos % format, but then we repeat the same computation. Repeating a couple 2784 1.1 christos % of assignments once per index is clearly meaningless for the 2785 1.1 christos % execution time, so we may as well do it in one place. 2786 1.1 christos % 2787 1.1 christos % First we halve the line length, less a little for the gutter between 2788 1.1 christos % the columns. We compute the gutter based on the line length, so it 2789 1.1 christos % changes automatically with the paper format. The magic constant 2790 1.1 christos % below is chosen so that the gutter has the same value (well, +-<1pt) 2791 1.1 christos % as it did when we hard-coded it. 2792 1.1 christos % 2793 1.1 christos % We put the result in a separate register, \doublecolumhsize, so we 2794 1.1 christos % can restore it in \pagesofar, after \hsize itself has (potentially) 2795 1.1 christos % been clobbered. 2796 1.1 christos % 2797 1.1 christos \doublecolumnhsize = \hsize 2798 1.1 christos \advance\doublecolumnhsize by -.04154\hsize 2799 1.1 christos \divide\doublecolumnhsize by 2 2800 1.1 christos \hsize = \doublecolumnhsize 2801 1.1 christos % 2802 1.1 christos % Double the \vsize as well. (We don't need a separate register here, 2803 1.1 christos % since nobody clobbers \vsize.) 2804 1.1 christos \vsize = 2\vsize 2805 1.1 christos } 2806 1.1 christos \def\doublecolumnout{% 2807 1.1 christos \splittopskip=\topskip \splitmaxdepth=\maxdepth 2808 1.1 christos % Get the available space for the double columns -- the normal 2809 1.1 christos % (undoubled) page height minus any material left over from the 2810 1.1 christos % previous page. 2811 1.1 christos \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage 2812 1.1 christos % box0 will be the left-hand column, box2 the right. 2813 1.1 christos \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ 2814 1.1 christos \onepageout\pagesofar 2815 1.1 christos \unvbox255 2816 1.1 christos \penalty\outputpenalty 2817 1.1 christos } 2818 1.1 christos \def\pagesofar{% 2819 1.1 christos % Re-output the contents of the output page -- any previous material, 2820 1.1 christos % followed by the two boxes we just split. 2821 1.1 christos \unvbox\partialpage 2822 1.1 christos \hsize = \doublecolumnhsize 2823 1.1 christos \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% 2824 1.1 christos } 2825 1.1 christos \def\enddoublecolumns{% 2826 1.1 christos \output = {\balancecolumns}\eject % split what we have 2827 1.1 christos \endgroup % started in \begindoublecolumns 2828 1.1 christos % 2829 1.1 christos % Back to normal single-column typesetting, but take account of the 2830 1.1 christos % fact that we just accumulated some stuff on the output page. 2831 1.1 christos \pagegoal = \vsize 2832 1.1 christos } 2833 1.1 christos \def\balancecolumns{% 2834 1.1 christos % Called at the end of the double column material. 2835 1.1 christos \setbox0 = \vbox{\unvbox255}% 2836 1.1 christos \dimen@ = \ht0 2837 1.1 christos \advance\dimen@ by \topskip 2838 1.1 christos \advance\dimen@ by-\baselineskip 2839 1.1 christos \divide\dimen@ by 2 2840 1.1 christos \splittopskip = \topskip 2841 1.1 christos % Loop until we get a decent breakpoint. 2842 1.1 christos {\vbadness=10000 \loop 2843 1.1 christos \global\setbox3=\copy0 2844 1.1 christos \global\setbox1=\vsplit3 to\dimen@ 2845 1.1 christos \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt 2846 1.1 christos \repeat}% 2847 1.1 christos \setbox0=\vbox to\dimen@{\unvbox1}% 2848 1.1 christos \setbox2=\vbox to\dimen@{\unvbox3}% 2849 1.1 christos \pagesofar 2850 1.1 christos } 2851 1.1 christos \catcode`\@ = \other 2852 1.1 christos 2853 1.1 christos 2854 1.1 christos \message{sectioning,} 2855 1.1 christos % Define chapters, sections, etc. 2856 1.1 christos 2857 1.1 christos \newcount\chapno 2858 1.1 christos \newcount\secno \secno=0 2859 1.1 christos \newcount\subsecno \subsecno=0 2860 1.1 christos \newcount\subsubsecno \subsubsecno=0 2861 1.1 christos 2862 1.1 christos % This counter is funny since it counts through charcodes of letters A, B, ... 2863 1.1 christos \newcount\appendixno \appendixno = `\@ 2864 1.1 christos \def\appendixletter{\char\the\appendixno} 2865 1.1 christos 2866 1.1 christos \newwrite\contentsfile 2867 1.1 christos % This is called from \setfilename. 2868 1.1 christos \def\opencontents{\openout\contentsfile = \jobname.toc } 2869 1.1 christos 2870 1.1 christos % Each @chapter defines this as the name of the chapter. 2871 1.1 christos % page headings and footings can use it. @section does likewise 2872 1.1 christos 2873 1.1 christos \def\thischapter{} \def\thissection{} 2874 1.1 christos \def\seccheck#1{\ifnum \pageno<0 2875 1.1 christos \errmessage{@#1 not allowed after generating table of contents}% 2876 1.1 christos \fi} 2877 1.1 christos 2878 1.1 christos \def\chapternofonts{% 2879 1.1 christos \let\rawbackslash=\relax 2880 1.1 christos \let\frenchspacing=\relax 2881 1.1 christos \def\result{\realbackslash result}% 2882 1.1 christos \def\equiv{\realbackslash equiv}% 2883 1.1 christos \def\expansion{\realbackslash expansion}% 2884 1.1 christos \def\print{\realbackslash print}% 2885 1.1 christos \def\TeX{\realbackslash TeX}% 2886 1.1 christos \def\dots{\realbackslash dots}% 2887 1.1 christos \def\result{\realbackslash result}% 2888 1.1 christos \def\equiv{\realbackslash equiv}% 2889 1.1 christos \def\expansion{\realbackslash expansion}% 2890 1.1 christos \def\print{\realbackslash print}% 2891 1.1 christos \def\error{\realbackslash error}% 2892 1.1 christos \def\point{\realbackslash point}% 2893 1.1 christos \def\copyright{\realbackslash copyright}% 2894 1.1 christos \def\tt{\realbackslash tt}% 2895 1.1 christos \def\bf{\realbackslash bf}% 2896 1.1 christos \def\w{\realbackslash w}% 2897 1.1 christos \def\less{\realbackslash less}% 2898 1.1 christos \def\gtr{\realbackslash gtr}% 2899 1.1 christos \def\hat{\realbackslash hat}% 2900 1.1 christos \def\char{\realbackslash char}% 2901 1.1 christos \def\tclose##1{\realbackslash tclose{##1}}% 2902 1.1 christos \def\code##1{\realbackslash code{##1}}% 2903 1.1 christos \def\samp##1{\realbackslash samp{##1}}% 2904 1.1 christos \def\r##1{\realbackslash r{##1}}% 2905 1.1 christos \def\b##1{\realbackslash b{##1}}% 2906 1.1 christos \def\key##1{\realbackslash key{##1}}% 2907 1.1 christos \def\file##1{\realbackslash file{##1}}% 2908 1.1 christos \def\kbd##1{\realbackslash kbd{##1}}% 2909 1.1 christos % These are redefined because @smartitalic wouldn't work inside xdef. 2910 1.1 christos \def\i##1{\realbackslash i{##1}}% 2911 1.1 christos \def\cite##1{\realbackslash cite{##1}}% 2912 1.1 christos \def\var##1{\realbackslash var{##1}}% 2913 1.1 christos \def\emph##1{\realbackslash emph{##1}}% 2914 1.1 christos \def\dfn##1{\realbackslash dfn{##1}}% 2915 1.1 christos } 2916 1.1 christos 2917 1.1 christos \newcount\absseclevel % used to calculate proper heading level 2918 1.1 christos \newcount\secbase\secbase=0 % @raise/lowersections modify this count 2919 1.1 christos 2920 1.1 christos % @raisesections: treat @section as chapter, @subsection as section, etc. 2921 1.1 christos \def\raisesections{\global\advance\secbase by -1} 2922 1.1 christos \let\up=\raisesections % original BFox name 2923 1.1 christos 2924 1.1 christos % @lowersections: treat @chapter as section, @section as subsection, etc. 2925 1.1 christos \def\lowersections{\global\advance\secbase by 1} 2926 1.1 christos \let\down=\lowersections % original BFox name 2927 1.1 christos 2928 1.1 christos % Choose a numbered-heading macro 2929 1.1 christos % #1 is heading level if unmodified by @raisesections or @lowersections 2930 1.1 christos % #2 is text for heading 2931 1.1 christos \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 2932 1.1 christos \ifcase\absseclevel 2933 1.1 christos \chapterzzz{#2} 2934 1.1 christos \or 2935 1.1 christos \seczzz{#2} 2936 1.1 christos \or 2937 1.1 christos \numberedsubseczzz{#2} 2938 1.1 christos \or 2939 1.1 christos \numberedsubsubseczzz{#2} 2940 1.1 christos \else 2941 1.1 christos \ifnum \absseclevel<0 2942 1.1 christos \chapterzzz{#2} 2943 1.1 christos \else 2944 1.1 christos \numberedsubsubseczzz{#2} 2945 1.1 christos \fi 2946 1.1 christos \fi 2947 1.1 christos } 2948 1.1 christos 2949 1.1 christos % like \numhead, but chooses appendix heading levels 2950 1.1 christos \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 2951 1.1 christos \ifcase\absseclevel 2952 1.1 christos \appendixzzz{#2} 2953 1.1 christos \or 2954 1.1 christos \appendixsectionzzz{#2} 2955 1.1 christos \or 2956 1.1 christos \appendixsubseczzz{#2} 2957 1.1 christos \or 2958 1.1 christos \appendixsubsubseczzz{#2} 2959 1.1 christos \else 2960 1.1 christos \ifnum \absseclevel<0 2961 1.1 christos \appendixzzz{#2} 2962 1.1 christos \else 2963 1.1 christos \appendixsubsubseczzz{#2} 2964 1.1 christos \fi 2965 1.1 christos \fi 2966 1.1 christos } 2967 1.1 christos 2968 1.1 christos % like \numhead, but chooses numberless heading levels 2969 1.1 christos \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 2970 1.1 christos \ifcase\absseclevel 2971 1.1 christos \unnumberedzzz{#2} 2972 1.1 christos \or 2973 1.1 christos \unnumberedseczzz{#2} 2974 1.1 christos \or 2975 1.1 christos \unnumberedsubseczzz{#2} 2976 1.1 christos \or 2977 1.1 christos \unnumberedsubsubseczzz{#2} 2978 1.1 christos \else 2979 1.1 christos \ifnum \absseclevel<0 2980 1.1 christos \unnumberedzzz{#2} 2981 1.1 christos \else 2982 1.1 christos \unnumberedsubsubseczzz{#2} 2983 1.1 christos \fi 2984 1.1 christos \fi 2985 1.1 christos } 2986 1.1 christos 2987 1.1 christos 2988 1.1 christos \def\thischaptername{No Chapter Title} 2989 1.1 christos \outer\def\chapter{\parsearg\chapteryyy} 2990 1.1 christos \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz 2991 1.1 christos \def\chapterzzz #1{\seccheck{chapter}% 2992 1.1 christos \secno=0 \subsecno=0 \subsubsecno=0 2993 1.1 christos \global\advance \chapno by 1 \message{\putwordChapter \the\chapno}% 2994 1.1 christos \chapmacro {#1}{\the\chapno}% 2995 1.1 christos \gdef\thissection{#1}% 2996 1.1 christos \gdef\thischaptername{#1}% 2997 1.1 christos % We don't substitute the actual chapter name into \thischapter 2998 1.1 christos % because we don't want its macros evaluated now. 2999 1.1 christos \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% 3000 1.1 christos {\chapternofonts% 3001 1.1 christos \toks0 = {#1}% 3002 1.1 christos \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}% 3003 1.1 christos \escapechar=`\\% 3004 1.1 christos \iflinks \write\contentsfile\temp \fi 3005 1.1 christos \donoderef % 3006 1.1 christos \global\let\section = \numberedsec 3007 1.1 christos \global\let\subsection = \numberedsubsec 3008 1.1 christos \global\let\subsubsection = \numberedsubsubsec 3009 1.1 christos }} 3010 1.1 christos 3011 1.1 christos \outer\def\appendix{\parsearg\appendixyyy} 3012 1.1 christos \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz 3013 1.1 christos \def\appendixzzz #1{\seccheck{appendix}% 3014 1.1 christos \secno=0 \subsecno=0 \subsubsecno=0 3015 1.1 christos \global\advance \appendixno by 1 \message{Appendix \appendixletter}% 3016 1.1 christos \chapmacro {#1}{\putwordAppendix{} \appendixletter}% 3017 1.1 christos \gdef\thissection{#1}% 3018 1.1 christos \gdef\thischaptername{#1}% 3019 1.1 christos \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% 3020 1.1 christos {\chapternofonts% 3021 1.1 christos \toks0 = {#1}% 3022 1.1 christos \edef\temp{{\realbackslash chapentry{\the\toks0}% 3023 1.1 christos {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}% 3024 1.1 christos \escapechar=`\\% 3025 1.1 christos \iflinks \write\contentsfile\temp \fi 3026 1.1 christos \appendixnoderef % 3027 1.1 christos \global\let\section = \appendixsec 3028 1.1 christos \global\let\subsection = \appendixsubsec 3029 1.1 christos \global\let\subsubsection = \appendixsubsubsec 3030 1.1 christos }} 3031 1.1 christos 3032 1.1 christos % @centerchap is like @unnumbered, but the heading is centered. 3033 1.1 christos \outer\def\centerchap{\parsearg\centerchapyyy} 3034 1.1 christos \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} 3035 1.1 christos 3036 1.1 christos \outer\def\top{\parsearg\unnumberedyyy} 3037 1.1 christos \outer\def\unnumbered{\parsearg\unnumberedyyy} 3038 1.1 christos \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz 3039 1.1 christos \def\unnumberedzzz #1{\seccheck{unnumbered}% 3040 1.1 christos \secno=0 \subsecno=0 \subsubsecno=0 3041 1.1 christos % 3042 1.1 christos % This used to be simply \message{#1}, but TeX fully expands the 3043 1.1 christos % argument to \message. Therefore, if #1 contained @-commands, TeX 3044 1.1 christos % expanded them. For example, in `@unnumbered The @cite{Book}', TeX 3045 1.1 christos % expanded @cite (which turns out to cause errors because \cite is meant 3046 1.1 christos % to be executed, not expanded). 3047 1.1 christos % 3048 1.1 christos % Anyway, we don't want the fully-expanded definition of @cite to appear 3049 1.1 christos % as a result of the \message, we just want `@cite' itself. We use 3050 1.1 christos % \the<toks register> to achieve this: TeX expands \the<toks> only once, 3051 1.1 christos % simply yielding the contents of the <toks register>. 3052 1.1 christos \toks0 = {#1}\message{(\the\toks0)}% 3053 1.1 christos % 3054 1.1 christos \unnumbchapmacro {#1}% 3055 1.1 christos \gdef\thischapter{#1}\gdef\thissection{#1}% 3056 1.1 christos {\chapternofonts% 3057 1.1 christos \toks0 = {#1}% 3058 1.1 christos \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}% 3059 1.1 christos \escapechar=`\\% 3060 1.1 christos \iflinks \write\contentsfile\temp \fi 3061 1.1 christos \unnumbnoderef % 3062 1.1 christos \global\let\section = \unnumberedsec 3063 1.1 christos \global\let\subsection = \unnumberedsubsec 3064 1.1 christos \global\let\subsubsection = \unnumberedsubsubsec 3065 1.1 christos }} 3066 1.1 christos 3067 1.1 christos \outer\def\numberedsec{\parsearg\secyyy} 3068 1.1 christos \def\secyyy #1{\numhead1{#1}} % normally calls seczzz 3069 1.1 christos \def\seczzz #1{\seccheck{section}% 3070 1.1 christos \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % 3071 1.1 christos \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% 3072 1.1 christos {\chapternofonts% 3073 1.1 christos \toks0 = {#1}% 3074 1.1 christos \edef\temp{{\realbackslash secentry % 3075 1.1 christos {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}% 3076 1.1 christos \escapechar=`\\% 3077 1.1 christos \iflinks \write\contentsfile\temp \fi 3078 1.1 christos \donoderef % 3079 1.1 christos \penalty 10000 % 3080 1.1 christos }} 3081 1.1 christos 3082 1.1 christos \outer\def\appendixsection{\parsearg\appendixsecyyy} 3083 1.1 christos \outer\def\appendixsec{\parsearg\appendixsecyyy} 3084 1.1 christos \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz 3085 1.1 christos \def\appendixsectionzzz #1{\seccheck{appendixsection}% 3086 1.1 christos \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % 3087 1.1 christos \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% 3088 1.1 christos {\chapternofonts% 3089 1.1 christos \toks0 = {#1}% 3090 1.1 christos \edef\temp{{\realbackslash secentry % 3091 1.1 christos {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}% 3092 1.1 christos \escapechar=`\\% 3093 1.1 christos \iflinks \write\contentsfile\temp \fi 3094 1.1 christos \appendixnoderef % 3095 1.1 christos \penalty 10000 % 3096 1.1 christos }} 3097 1.1 christos 3098 1.1 christos \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} 3099 1.1 christos \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz 3100 1.1 christos \def\unnumberedseczzz #1{\seccheck{unnumberedsec}% 3101 1.1 christos \plainsecheading {#1}\gdef\thissection{#1}% 3102 1.1 christos {\chapternofonts% 3103 1.1 christos \toks0 = {#1}% 3104 1.1 christos \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}% 3105 1.1 christos \escapechar=`\\% 3106 1.1 christos \iflinks \write\contentsfile\temp \fi 3107 1.1 christos \unnumbnoderef % 3108 1.1 christos \penalty 10000 % 3109 1.1 christos }} 3110 1.1 christos 3111 1.1 christos \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} 3112 1.1 christos \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz 3113 1.1 christos \def\numberedsubseczzz #1{\seccheck{subsection}% 3114 1.1 christos \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % 3115 1.1 christos \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% 3116 1.1 christos {\chapternofonts% 3117 1.1 christos \toks0 = {#1}% 3118 1.1 christos \edef\temp{{\realbackslash subsecentry % 3119 1.1 christos {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% 3120 1.1 christos \escapechar=`\\% 3121 1.1 christos \iflinks \write\contentsfile\temp \fi 3122 1.1 christos \donoderef % 3123 1.1 christos \penalty 10000 % 3124 1.1 christos }} 3125 1.1 christos 3126 1.1 christos \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} 3127 1.1 christos \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz 3128 1.1 christos \def\appendixsubseczzz #1{\seccheck{appendixsubsec}% 3129 1.1 christos \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % 3130 1.1 christos \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% 3131 1.1 christos {\chapternofonts% 3132 1.1 christos \toks0 = {#1}% 3133 1.1 christos \edef\temp{{\realbackslash subsecentry % 3134 1.1 christos {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% 3135 1.1 christos \escapechar=`\\% 3136 1.1 christos \iflinks \write\contentsfile\temp \fi 3137 1.1 christos \appendixnoderef % 3138 1.1 christos \penalty 10000 % 3139 1.1 christos }} 3140 1.1 christos 3141 1.1 christos \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} 3142 1.1 christos \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz 3143 1.1 christos \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}% 3144 1.1 christos \plainsubsecheading {#1}\gdef\thissection{#1}% 3145 1.1 christos {\chapternofonts% 3146 1.1 christos \toks0 = {#1}% 3147 1.1 christos \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}% 3148 1.1 christos \escapechar=`\\% 3149 1.1 christos \iflinks \write\contentsfile\temp \fi 3150 1.1 christos \unnumbnoderef % 3151 1.1 christos \penalty 10000 % 3152 1.1 christos }} 3153 1.1 christos 3154 1.1 christos \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} 3155 1.1 christos \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz 3156 1.1 christos \def\numberedsubsubseczzz #1{\seccheck{subsubsection}% 3157 1.1 christos \gdef\thissection{#1}\global\advance \subsubsecno by 1 % 3158 1.1 christos \subsubsecheading {#1} 3159 1.1 christos {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% 3160 1.1 christos {\chapternofonts% 3161 1.1 christos \toks0 = {#1}% 3162 1.1 christos \edef\temp{{\realbackslash subsubsecentry{\the\toks0} 3163 1.1 christos {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno} 3164 1.1 christos {\noexpand\folio}}}% 3165 1.1 christos \escapechar=`\\% 3166 1.1 christos \iflinks \write\contentsfile\temp \fi 3167 1.1 christos \donoderef % 3168 1.1 christos \penalty 10000 % 3169 1.1 christos }} 3170 1.1 christos 3171 1.1 christos \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} 3172 1.1 christos \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz 3173 1.1 christos \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}% 3174 1.1 christos \gdef\thissection{#1}\global\advance \subsubsecno by 1 % 3175 1.1 christos \subsubsecheading {#1} 3176 1.1 christos {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% 3177 1.1 christos {\chapternofonts% 3178 1.1 christos \toks0 = {#1}% 3179 1.1 christos \edef\temp{{\realbackslash subsubsecentry{\the\toks0}% 3180 1.1 christos {\appendixletter} 3181 1.1 christos {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}% 3182 1.1 christos \escapechar=`\\% 3183 1.1 christos \iflinks \write\contentsfile\temp \fi 3184 1.1 christos \appendixnoderef % 3185 1.1 christos \penalty 10000 % 3186 1.1 christos }} 3187 1.1 christos 3188 1.1 christos \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} 3189 1.1 christos \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz 3190 1.1 christos \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}% 3191 1.1 christos \plainsubsubsecheading {#1}\gdef\thissection{#1}% 3192 1.1 christos {\chapternofonts% 3193 1.1 christos \toks0 = {#1}% 3194 1.1 christos \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}% 3195 1.1 christos \escapechar=`\\% 3196 1.1 christos \iflinks \write\contentsfile\temp \fi 3197 1.1 christos \unnumbnoderef % 3198 1.1 christos \penalty 10000 % 3199 1.1 christos }} 3200 1.1 christos 3201 1.1 christos % These are variants which are not "outer", so they can appear in @ifinfo. 3202 1.1 christos % Actually, they should now be obsolete; ordinary section commands should work. 3203 1.1 christos \def\infotop{\parsearg\unnumberedzzz} 3204 1.1 christos \def\infounnumbered{\parsearg\unnumberedzzz} 3205 1.1 christos \def\infounnumberedsec{\parsearg\unnumberedseczzz} 3206 1.1 christos \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} 3207 1.1 christos \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} 3208 1.1 christos 3209 1.1 christos \def\infoappendix{\parsearg\appendixzzz} 3210 1.1 christos \def\infoappendixsec{\parsearg\appendixseczzz} 3211 1.1 christos \def\infoappendixsubsec{\parsearg\appendixsubseczzz} 3212 1.1 christos \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} 3213 1.1 christos 3214 1.1 christos \def\infochapter{\parsearg\chapterzzz} 3215 1.1 christos \def\infosection{\parsearg\sectionzzz} 3216 1.1 christos \def\infosubsection{\parsearg\subsectionzzz} 3217 1.1 christos \def\infosubsubsection{\parsearg\subsubsectionzzz} 3218 1.1 christos 3219 1.1 christos % These macros control what the section commands do, according 3220 1.1 christos % to what kind of chapter we are in (ordinary, appendix, or unnumbered). 3221 1.1 christos % Define them by default for a numbered chapter. 3222 1.1 christos \global\let\section = \numberedsec 3223 1.1 christos \global\let\subsection = \numberedsubsec 3224 1.1 christos \global\let\subsubsection = \numberedsubsubsec 3225 1.1 christos 3226 1.1 christos % Define @majorheading, @heading and @subheading 3227 1.1 christos 3228 1.1 christos % NOTE on use of \vbox for chapter headings, section headings, and 3229 1.1 christos % such: 3230 1.1 christos % 1) We use \vbox rather than the earlier \line to permit 3231 1.1 christos % overlong headings to fold. 3232 1.1 christos % 2) \hyphenpenalty is set to 10000 because hyphenation in a 3233 1.1 christos % heading is obnoxious; this forbids it. 3234 1.1 christos % 3) Likewise, headings look best if no \parindent is used, and 3235 1.1 christos % if justification is not attempted. Hence \raggedright. 3236 1.1 christos 3237 1.1 christos 3238 1.1 christos \def\majorheading{\parsearg\majorheadingzzz} 3239 1.1 christos \def\majorheadingzzz #1{% 3240 1.1 christos {\advance\chapheadingskip by 10pt \chapbreak }% 3241 1.1 christos {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3242 1.1 christos \parindent=0pt\raggedright 3243 1.1 christos \rm #1\hfill}}\bigskip \par\penalty 200} 3244 1.1 christos 3245 1.1 christos \def\chapheading{\parsearg\chapheadingzzz} 3246 1.1 christos \def\chapheadingzzz #1{\chapbreak % 3247 1.1 christos {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3248 1.1 christos \parindent=0pt\raggedright 3249 1.1 christos \rm #1\hfill}}\bigskip \par\penalty 200} 3250 1.1 christos 3251 1.1 christos % @heading, @subheading, @subsubheading. 3252 1.1 christos \def\heading{\parsearg\plainsecheading} 3253 1.1 christos \def\subheading{\parsearg\plainsubsecheading} 3254 1.1 christos \def\subsubheading{\parsearg\plainsubsubsecheading} 3255 1.1 christos 3256 1.1 christos % These macros generate a chapter, section, etc. heading only 3257 1.1 christos % (including whitespace, linebreaking, etc. around it), 3258 1.1 christos % given all the information in convenient, parsed form. 3259 1.1 christos 3260 1.1 christos %%% Args are the skip and penalty (usually negative) 3261 1.1 christos \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} 3262 1.1 christos 3263 1.1 christos \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} 3264 1.1 christos 3265 1.1 christos %%% Define plain chapter starts, and page on/off switching for it 3266 1.1 christos % Parameter controlling skip before chapter headings (if needed) 3267 1.1 christos 3268 1.1 christos \newskip\chapheadingskip 3269 1.1 christos 3270 1.1 christos \def\chapbreak{\dobreak \chapheadingskip {-4000}} 3271 1.1 christos \def\chappager{\par\vfill\supereject} 3272 1.1 christos \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} 3273 1.1 christos 3274 1.1 christos \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} 3275 1.1 christos 3276 1.1 christos \def\CHAPPAGoff{ 3277 1.1 christos \global\let\contentsalignmacro = \chappager 3278 1.1 christos \global\let\pchapsepmacro=\chapbreak 3279 1.1 christos \global\let\pagealignmacro=\chappager} 3280 1.1 christos 3281 1.1 christos \def\CHAPPAGon{ 3282 1.1 christos \global\let\contentsalignmacro = \chappager 3283 1.1 christos \global\let\pchapsepmacro=\chappager 3284 1.1 christos \global\let\pagealignmacro=\chappager 3285 1.1 christos \global\def\HEADINGSon{\HEADINGSsingle}} 3286 1.1 christos 3287 1.1 christos \def\CHAPPAGodd{ 3288 1.1 christos \global\let\contentsalignmacro = \chapoddpage 3289 1.1 christos \global\let\pchapsepmacro=\chapoddpage 3290 1.1 christos \global\let\pagealignmacro=\chapoddpage 3291 1.1 christos \global\def\HEADINGSon{\HEADINGSdouble}} 3292 1.1 christos 3293 1.1 christos \CHAPPAGon 3294 1.1 christos 3295 1.1 christos \def\CHAPFplain{ 3296 1.1 christos \global\let\chapmacro=\chfplain 3297 1.1 christos \global\let\unnumbchapmacro=\unnchfplain 3298 1.1 christos \global\let\centerchapmacro=\centerchfplain} 3299 1.1 christos 3300 1.1 christos % Plain chapter opening. 3301 1.1 christos % #1 is the text, #2 the chapter number or empty if unnumbered. 3302 1.1 christos \def\chfplain#1#2{% 3303 1.1 christos \pchapsepmacro 3304 1.1 christos {% 3305 1.1 christos \chapfonts \rm 3306 1.1 christos \def\chapnum{#2}% 3307 1.1 christos \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% 3308 1.1 christos \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright 3309 1.1 christos \hangindent = \wd0 \centerparametersmaybe 3310 1.1 christos \unhbox0 #1\par}% 3311 1.1 christos }% 3312 1.1 christos \nobreak\bigskip % no page break after a chapter title 3313 1.1 christos \nobreak 3314 1.1 christos } 3315 1.1 christos 3316 1.1 christos % Plain opening for unnumbered. 3317 1.1 christos \def\unnchfplain#1{\chfplain{#1}{}} 3318 1.1 christos 3319 1.1 christos % @centerchap -- centered and unnumbered. 3320 1.1 christos \let\centerparametersmaybe = \relax 3321 1.1 christos \def\centerchfplain#1{{% 3322 1.1 christos \def\centerparametersmaybe{% 3323 1.1 christos \advance\rightskip by 3\rightskip 3324 1.1 christos \leftskip = \rightskip 3325 1.1 christos \parfillskip = 0pt 3326 1.1 christos }% 3327 1.1 christos \chfplain{#1}{}% 3328 1.1 christos }} 3329 1.1 christos 3330 1.1 christos \CHAPFplain % The default 3331 1.1 christos 3332 1.1 christos \def\unnchfopen #1{% 3333 1.1 christos \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3334 1.1 christos \parindent=0pt\raggedright 3335 1.1 christos \rm #1\hfill}}\bigskip \par\penalty 10000 % 3336 1.1 christos } 3337 1.1 christos 3338 1.1 christos \def\chfopen #1#2{\chapoddpage {\chapfonts 3339 1.1 christos \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% 3340 1.1 christos \par\penalty 5000 % 3341 1.1 christos } 3342 1.1 christos 3343 1.1 christos \def\centerchfopen #1{% 3344 1.1 christos \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 3345 1.1 christos \parindent=0pt 3346 1.1 christos \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 % 3347 1.1 christos } 3348 1.1 christos 3349 1.1 christos \def\CHAPFopen{ 3350 1.1 christos \global\let\chapmacro=\chfopen 3351 1.1 christos \global\let\unnumbchapmacro=\unnchfopen 3352 1.1 christos \global\let\centerchapmacro=\centerchfopen} 3353 1.1 christos 3354 1.1 christos 3355 1.1 christos % Section titles. 3356 1.1 christos \newskip\secheadingskip 3357 1.1 christos \def\secheadingbreak{\dobreak \secheadingskip {-1000}} 3358 1.1 christos \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} 3359 1.1 christos \def\plainsecheading#1{\sectionheading{sec}{}{#1}} 3360 1.1 christos 3361 1.1 christos % Subsection titles. 3362 1.1 christos \newskip \subsecheadingskip 3363 1.1 christos \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} 3364 1.1 christos \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} 3365 1.1 christos \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} 3366 1.1 christos 3367 1.1 christos % Subsubsection titles. 3368 1.1 christos \let\subsubsecheadingskip = \subsecheadingskip 3369 1.1 christos \let\subsubsecheadingbreak = \subsecheadingbreak 3370 1.1 christos \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} 3371 1.1 christos \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} 3372 1.1 christos 3373 1.1 christos 3374 1.1 christos % Print any size section title. 3375 1.1 christos % 3376 1.1 christos % #1 is the section type (sec/subsec/subsubsec), #2 is the section 3377 1.1 christos % number (maybe empty), #3 the text. 3378 1.1 christos \def\sectionheading#1#2#3{% 3379 1.1 christos {% 3380 1.1 christos \expandafter\advance\csname #1headingskip\endcsname by \parskip 3381 1.1 christos \csname #1headingbreak\endcsname 3382 1.1 christos }% 3383 1.1 christos {% 3384 1.1 christos % Switch to the right set of fonts. 3385 1.1 christos \csname #1fonts\endcsname \rm 3386 1.1 christos % 3387 1.1 christos % Only insert the separating space if we have a section number. 3388 1.1 christos \def\secnum{#2}% 3389 1.1 christos \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% 3390 1.1 christos % 3391 1.1 christos \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright 3392 1.1 christos \hangindent = \wd0 % zero if no section number 3393 1.1 christos \unhbox0 #3}% 3394 1.1 christos }% 3395 1.1 christos \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak 3396 1.1 christos } 3397 1.1 christos 3398 1.1 christos 3399 1.1 christos \message{toc printing,} 3400 1.1 christos % Finish up the main text and prepare to read what we've written 3401 1.1 christos % to \contentsfile. 3402 1.1 christos 3403 1.1 christos \newskip\contentsrightmargin \contentsrightmargin=1in 3404 1.1 christos \def\startcontents#1{% 3405 1.1 christos % If @setchapternewpage on, and @headings double, the contents should 3406 1.1 christos % start on an odd page, unlike chapters. Thus, we maintain 3407 1.1 christos % \contentsalignmacro in parallel with \pagealignmacro. 3408 1.1 christos % From: Torbjorn Granlund <tege (a] matematik.su.se> 3409 1.1 christos \contentsalignmacro 3410 1.1 christos \immediate\closeout \contentsfile 3411 1.1 christos \ifnum \pageno>0 3412 1.1 christos \pageno = -1 % Request roman numbered pages. 3413 1.1 christos \fi 3414 1.1 christos % Don't need to put `Contents' or `Short Contents' in the headline. 3415 1.1 christos % It is abundantly clear what they are. 3416 1.1 christos \unnumbchapmacro{#1}\def\thischapter{}% 3417 1.1 christos \begingroup % Set up to handle contents files properly. 3418 1.1 christos \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 3419 1.1 christos % We can't do this, because then an actual ^ in a section 3420 1.1 christos % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. 3421 1.1 christos %\catcode`\^=7 % to see ^^e4 as \"a etc. juha (a] piuha.ydi.vtt.fi 3422 1.1 christos \raggedbottom % Worry more about breakpoints than the bottom. 3423 1.1 christos \advance\hsize by -\contentsrightmargin % Don't use the full line length. 3424 1.1 christos } 3425 1.1 christos 3426 1.1 christos 3427 1.1 christos % Normal (long) toc. 3428 1.1 christos \outer\def\contents{% 3429 1.1 christos \startcontents{\putwordTableofContents}% 3430 1.1 christos \input \jobname.toc 3431 1.1 christos \endgroup 3432 1.1 christos \vfill \eject 3433 1.1 christos } 3434 1.1 christos 3435 1.1 christos % And just the chapters. 3436 1.1 christos \outer\def\summarycontents{% 3437 1.1 christos \startcontents{\putwordShortContents}% 3438 1.1 christos % 3439 1.1 christos \let\chapentry = \shortchapentry 3440 1.1 christos \let\unnumbchapentry = \shortunnumberedentry 3441 1.1 christos % We want a true roman here for the page numbers. 3442 1.1 christos \secfonts 3443 1.1 christos \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl 3444 1.1 christos \rm 3445 1.1 christos \hyphenpenalty = 10000 3446 1.1 christos \advance\baselineskip by 1pt % Open it up a little. 3447 1.1 christos \def\secentry ##1##2##3##4{} 3448 1.1 christos \def\unnumbsecentry ##1##2{} 3449 1.1 christos \def\subsecentry ##1##2##3##4##5{} 3450 1.1 christos \def\unnumbsubsecentry ##1##2{} 3451 1.1 christos \def\subsubsecentry ##1##2##3##4##5##6{} 3452 1.1 christos \def\unnumbsubsubsecentry ##1##2{} 3453 1.1 christos \input \jobname.toc 3454 1.1 christos \endgroup 3455 1.1 christos \vfill \eject 3456 1.1 christos } 3457 1.1 christos \let\shortcontents = \summarycontents 3458 1.1 christos 3459 1.1 christos % These macros generate individual entries in the table of contents. 3460 1.1 christos % The first argument is the chapter or section name. 3461 1.1 christos % The last argument is the page number. 3462 1.1 christos % The arguments in between are the chapter number, section number, ... 3463 1.1 christos 3464 1.1 christos % Chapter-level things, for both the long and short contents. 3465 1.1 christos \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} 3466 1.1 christos 3467 1.1 christos % See comments in \dochapentry re vbox and related settings 3468 1.1 christos \def\shortchapentry#1#2#3{% 3469 1.1 christos \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}% 3470 1.1 christos } 3471 1.1 christos 3472 1.1 christos % Typeset the label for a chapter or appendix for the short contents. 3473 1.1 christos % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. 3474 1.1 christos % We could simplify the code here by writing out an \appendixentry 3475 1.1 christos % command in the toc file for appendices, instead of using \chapentry 3476 1.1 christos % for both, but it doesn't seem worth it. 3477 1.1 christos \setbox0 = \hbox{\shortcontrm \putwordAppendix } 3478 1.1 christos \newdimen\shortappendixwidth \shortappendixwidth = \wd0 3479 1.1 christos 3480 1.1 christos \def\shortchaplabel#1{% 3481 1.1 christos % We typeset #1 in a box of constant width, regardless of the text of 3482 1.1 christos % #1, so the chapter titles will come out aligned. 3483 1.1 christos \setbox0 = \hbox{#1}% 3484 1.1 christos \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi 3485 1.1 christos % 3486 1.1 christos % This space should be plenty, since a single number is .5em, and the 3487 1.1 christos % widest letter (M) is 1em, at least in the Computer Modern fonts. 3488 1.1 christos % (This space doesn't include the extra space that gets added after 3489 1.1 christos % the label; that gets put in by \shortchapentry above.) 3490 1.1 christos \advance\dimen0 by 1.1em 3491 1.1 christos \hbox to \dimen0{#1\hfil}% 3492 1.1 christos } 3493 1.1 christos 3494 1.1 christos \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} 3495 1.1 christos \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}} 3496 1.1 christos 3497 1.1 christos % Sections. 3498 1.1 christos \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} 3499 1.1 christos \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} 3500 1.1 christos 3501 1.1 christos % Subsections. 3502 1.1 christos \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} 3503 1.1 christos \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} 3504 1.1 christos 3505 1.1 christos % And subsubsections. 3506 1.1 christos \def\subsubsecentry#1#2#3#4#5#6{% 3507 1.1 christos \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} 3508 1.1 christos \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} 3509 1.1 christos 3510 1.1 christos % This parameter controls the indentation of the various levels. 3511 1.1 christos \newdimen\tocindent \tocindent = 3pc 3512 1.1 christos 3513 1.1 christos % Now for the actual typesetting. In all these, #1 is the text and #2 is the 3514 1.1 christos % page number. 3515 1.1 christos % 3516 1.1 christos % If the toc has to be broken over pages, we want it to be at chapters 3517 1.1 christos % if at all possible; hence the \penalty. 3518 1.1 christos \def\dochapentry#1#2{% 3519 1.1 christos \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip 3520 1.1 christos \begingroup 3521 1.1 christos \chapentryfonts 3522 1.1 christos \tocentry{#1}{\dopageno{#2}}% 3523 1.1 christos \endgroup 3524 1.1 christos \nobreak\vskip .25\baselineskip plus.1\baselineskip 3525 1.1 christos } 3526 1.1 christos 3527 1.1 christos \def\dosecentry#1#2{\begingroup 3528 1.1 christos \secentryfonts \leftskip=\tocindent 3529 1.1 christos \tocentry{#1}{\dopageno{#2}}% 3530 1.1 christos \endgroup} 3531 1.1 christos 3532 1.1 christos \def\dosubsecentry#1#2{\begingroup 3533 1.1 christos \subsecentryfonts \leftskip=2\tocindent 3534 1.1 christos \tocentry{#1}{\dopageno{#2}}% 3535 1.1 christos \endgroup} 3536 1.1 christos 3537 1.1 christos \def\dosubsubsecentry#1#2{\begingroup 3538 1.1 christos \subsubsecentryfonts \leftskip=3\tocindent 3539 1.1 christos \tocentry{#1}{\dopageno{#2}}% 3540 1.1 christos \endgroup} 3541 1.1 christos 3542 1.1 christos % Final typesetting of a toc entry; we use the same \entry macro as for 3543 1.1 christos % the index entries, but we want to suppress hyphenation here. (We 3544 1.1 christos % can't do that in the \entry macro, since index entries might consist 3545 1.1 christos % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) 3546 1.1 christos \def\tocentry#1#2{\begingroup 3547 1.1 christos \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks 3548 1.1 christos % Do not use \turnoffactive in these arguments. Since the toc is 3549 1.1 christos % typeset in cmr, so characters such as _ would come out wrong; we 3550 1.1 christos % have to do the usual translation tricks. 3551 1.1 christos \entry{#1}{#2}% 3552 1.1 christos \endgroup} 3553 1.1 christos 3554 1.1 christos % Space between chapter (or whatever) number and the title. 3555 1.1 christos \def\labelspace{\hskip1em \relax} 3556 1.1 christos 3557 1.1 christos \def\dopageno#1{{\rm #1}} 3558 1.1 christos \def\doshortpageno#1{{\rm #1}} 3559 1.1 christos 3560 1.1 christos \def\chapentryfonts{\secfonts \rm} 3561 1.1 christos \def\secentryfonts{\textfonts} 3562 1.1 christos \let\subsecentryfonts = \textfonts 3563 1.1 christos \let\subsubsecentryfonts = \textfonts 3564 1.1 christos 3565 1.1 christos 3566 1.1 christos \message{environments,} 3567 1.1 christos 3568 1.1 christos % Since these characters are used in examples, it should be an even number of 3569 1.1 christos % \tt widths. Each \tt character is 1en, so two makes it 1em. 3570 1.1 christos % Furthermore, these definitions must come after we define our fonts. 3571 1.1 christos \newbox\dblarrowbox \newbox\longdblarrowbox 3572 1.1 christos \newbox\pushcharbox \newbox\bullbox 3573 1.1 christos \newbox\equivbox \newbox\errorbox 3574 1.1 christos 3575 1.1 christos %{\tentt 3576 1.1 christos %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} 3577 1.1 christos %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} 3578 1.1 christos %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} 3579 1.1 christos %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} 3580 1.1 christos % Adapted from the manmac format (p.420 of TeXbook) 3581 1.1 christos %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex 3582 1.1 christos % depth .1ex\hfil} 3583 1.1 christos %} 3584 1.1 christos 3585 1.1 christos % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. 3586 1.1 christos \def\point{$\star$} 3587 1.1 christos \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} 3588 1.1 christos \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} 3589 1.1 christos \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} 3590 1.1 christos \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} 3591 1.1 christos 3592 1.1 christos % Adapted from the TeXbook's \boxit. 3593 1.1 christos {\tentt \global\dimen0 = 3em}% Width of the box. 3594 1.1 christos \dimen2 = .55pt % Thickness of rules 3595 1.1 christos % The text. (`r' is open on the right, `e' somewhat less so on the left.) 3596 1.1 christos \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} 3597 1.1 christos 3598 1.1 christos \global\setbox\errorbox=\hbox to \dimen0{\hfil 3599 1.1 christos \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 3600 1.1 christos \advance\hsize by -2\dimen2 % Rules. 3601 1.1 christos \vbox{ 3602 1.1 christos \hrule height\dimen2 3603 1.1 christos \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. 3604 1.1 christos \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. 3605 1.1 christos \kern3pt\vrule width\dimen2}% Space to right. 3606 1.1 christos \hrule height\dimen2} 3607 1.1 christos \hfil} 3608 1.1 christos 3609 1.1 christos % The @error{} command. 3610 1.1 christos \def\error{\leavevmode\lower.7ex\copy\errorbox} 3611 1.1 christos 3612 1.1 christos % @tex ... @end tex escapes into raw Tex temporarily. 3613 1.1 christos % One exception: @ is still an escape character, so that @end tex works. 3614 1.1 christos % But \@ or @@ will get a plain tex @ character. 3615 1.1 christos 3616 1.1 christos \def\tex{\begingroup 3617 1.1 christos \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 3618 1.1 christos \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 3619 1.1 christos \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie 3620 1.1 christos \catcode `\%=14 3621 1.1 christos \catcode 43=12 % plus 3622 1.1 christos \catcode`\"=12 3623 1.1 christos \catcode`\==12 3624 1.1 christos \catcode`\|=12 3625 1.1 christos \catcode`\<=12 3626 1.1 christos \catcode`\>=12 3627 1.1 christos \escapechar=`\\ 3628 1.1 christos % 3629 1.1 christos \let\b=\ptexb 3630 1.1 christos \let\bullet=\ptexbullet 3631 1.1 christos \let\c=\ptexc 3632 1.1 christos \let\,=\ptexcomma 3633 1.1 christos \let\.=\ptexdot 3634 1.1 christos \let\dots=\ptexdots 3635 1.1 christos \let\equiv=\ptexequiv 3636 1.1 christos \let\!=\ptexexclam 3637 1.1 christos \let\i=\ptexi 3638 1.1 christos \let\{=\ptexlbrace 3639 1.1 christos \let\+=\tabalign 3640 1.1 christos \let\}=\ptexrbrace 3641 1.1 christos \let\*=\ptexstar 3642 1.1 christos \let\t=\ptext 3643 1.1 christos % 3644 1.1 christos \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% 3645 1.1 christos \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% 3646 1.1 christos \def\@{@}% 3647 1.1 christos \let\Etex=\endgroup} 3648 1.1 christos 3649 1.1 christos % Define @lisp ... @endlisp. 3650 1.1 christos % @lisp does a \begingroup so it can rebind things, 3651 1.1 christos % including the definition of @endlisp (which normally is erroneous). 3652 1.1 christos 3653 1.1 christos % Amount to narrow the margins by for @lisp. 3654 1.1 christos \newskip\lispnarrowing \lispnarrowing=0.4in 3655 1.1 christos 3656 1.1 christos % This is the definition that ^^M gets inside @lisp, @example, and other 3657 1.1 christos % such environments. \null is better than a space, since it doesn't 3658 1.1 christos % have any width. 3659 1.1 christos \def\lisppar{\null\endgraf} 3660 1.1 christos 3661 1.1 christos % Make each space character in the input produce a normal interword 3662 1.1 christos % space in the output. Don't allow a line break at this space, as this 3663 1.1 christos % is used only in environments like @example, where each line of input 3664 1.1 christos % should produce a line of output anyway. 3665 1.1 christos % 3666 1.1 christos {\obeyspaces % 3667 1.1 christos \gdef\sepspaces{\obeyspaces\let =\tie}} 3668 1.1 christos 3669 1.1 christos % Define \obeyedspace to be our active space, whatever it is. This is 3670 1.1 christos % for use in \parsearg. 3671 1.1 christos {\sepspaces% 3672 1.1 christos \global\let\obeyedspace= } 3673 1.1 christos 3674 1.1 christos % This space is always present above and below environments. 3675 1.1 christos \newskip\envskipamount \envskipamount = 0pt 3676 1.1 christos 3677 1.1 christos % Make spacing and below environment symmetrical. We use \parskip here 3678 1.1 christos % to help in doing that, since in @example-like environments \parskip 3679 1.1 christos % is reset to zero; thus the \afterenvbreak inserts no space -- but the 3680 1.1 christos % start of the next paragraph will insert \parskip 3681 1.1 christos % 3682 1.1 christos \def\aboveenvbreak{{\advance\envskipamount by \parskip 3683 1.1 christos \endgraf \ifdim\lastskip<\envskipamount 3684 1.1 christos \removelastskip \penalty-50 \vskip\envskipamount \fi}} 3685 1.1 christos 3686 1.1 christos \let\afterenvbreak = \aboveenvbreak 3687 1.1 christos 3688 1.1 christos % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. 3689 1.1 christos \let\nonarrowing=\relax 3690 1.1 christos 3691 1.1 christos % @cartouche ... @end cartouche: draw rectangle w/rounded corners around 3692 1.1 christos % environment contents. 3693 1.1 christos \font\circle=lcircle10 3694 1.1 christos \newdimen\circthick 3695 1.1 christos \newdimen\cartouter\newdimen\cartinner 3696 1.1 christos \newskip\normbskip\newskip\normpskip\newskip\normlskip 3697 1.1 christos \circthick=\fontdimen8\circle 3698 1.1 christos % 3699 1.1 christos \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth 3700 1.1 christos \def\ctr{{\hskip 6pt\circle\char'010}} 3701 1.1 christos \def\cbl{{\circle\char'012\hskip -6pt}} 3702 1.1 christos \def\cbr{{\hskip 6pt\circle\char'011}} 3703 1.1 christos \def\carttop{\hbox to \cartouter{\hskip\lskip 3704 1.1 christos \ctl\leaders\hrule height\circthick\hfil\ctr 3705 1.1 christos \hskip\rskip}} 3706 1.1 christos \def\cartbot{\hbox to \cartouter{\hskip\lskip 3707 1.1 christos \cbl\leaders\hrule height\circthick\hfil\cbr 3708 1.1 christos \hskip\rskip}} 3709 1.1 christos % 3710 1.1 christos \newskip\lskip\newskip\rskip 3711 1.1 christos 3712 1.1 christos \long\def\cartouche{% 3713 1.1 christos \begingroup 3714 1.1 christos \lskip=\leftskip \rskip=\rightskip 3715 1.1 christos \leftskip=0pt\rightskip=0pt %we want these *outside*. 3716 1.1 christos \cartinner=\hsize \advance\cartinner by-\lskip 3717 1.1 christos \advance\cartinner by-\rskip 3718 1.1 christos \cartouter=\hsize 3719 1.1 christos \advance\cartouter by 18.4pt % allow for 3pt kerns on either 3720 1.1 christos % side, and for 6pt waste from 3721 1.1 christos % each corner char, and rule thickness 3722 1.1 christos \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 3723 1.1 christos % Flag to tell @lisp, etc., not to narrow margin. 3724 1.1 christos \let\nonarrowing=\comment 3725 1.1 christos \vbox\bgroup 3726 1.1 christos \baselineskip=0pt\parskip=0pt\lineskip=0pt 3727 1.1 christos \carttop 3728 1.1 christos \hbox\bgroup 3729 1.1 christos \hskip\lskip 3730 1.1 christos \vrule\kern3pt 3731 1.1 christos \vbox\bgroup 3732 1.1 christos \hsize=\cartinner 3733 1.1 christos \kern3pt 3734 1.1 christos \begingroup 3735 1.1 christos \baselineskip=\normbskip 3736 1.1 christos \lineskip=\normlskip 3737 1.1 christos \parskip=\normpskip 3738 1.1 christos \vskip -\parskip 3739 1.1 christos \def\Ecartouche{% 3740 1.1 christos \endgroup 3741 1.1 christos \kern3pt 3742 1.1 christos \egroup 3743 1.1 christos \kern3pt\vrule 3744 1.1 christos \hskip\rskip 3745 1.1 christos \egroup 3746 1.1 christos \cartbot 3747 1.1 christos \egroup 3748 1.1 christos \endgroup 3749 1.1 christos }} 3750 1.1 christos 3751 1.1 christos 3752 1.1 christos % This macro is called at the beginning of all the @example variants, 3753 1.1 christos % inside a group. 3754 1.1 christos \def\nonfillstart{% 3755 1.1 christos \aboveenvbreak 3756 1.1 christos \inENV % This group ends at the end of the body 3757 1.1 christos \hfuzz = 12pt % Don't be fussy 3758 1.1 christos \sepspaces % Make spaces be word-separators rather than space tokens. 3759 1.1 christos \singlespace 3760 1.1 christos \let\par = \lisppar % don't ignore blank lines 3761 1.1 christos \obeylines % each line of input is a line of output 3762 1.1 christos \parskip = 0pt 3763 1.1 christos \parindent = 0pt 3764 1.1 christos \emergencystretch = 0pt % don't try to avoid overfull boxes 3765 1.1 christos % @cartouche defines \nonarrowing to inhibit narrowing 3766 1.1 christos % at next level down. 3767 1.1 christos \ifx\nonarrowing\relax 3768 1.1 christos \advance \leftskip by \lispnarrowing 3769 1.1 christos \exdentamount=\lispnarrowing 3770 1.1 christos \let\exdent=\nofillexdent 3771 1.1 christos \let\nonarrowing=\relax 3772 1.1 christos \fi 3773 1.1 christos } 3774 1.1 christos 3775 1.1 christos % To ending an @example-like environment, we first end the paragraph 3776 1.1 christos % (via \afterenvbreak's vertical glue), and then the group. That way we 3777 1.1 christos % keep the zero \parskip that the environments set -- \parskip glue 3778 1.1 christos % will be inserted at the beginning of the next paragraph in the 3779 1.1 christos % document, after the environment. 3780 1.1 christos % 3781 1.1 christos \def\nonfillfinish{\afterenvbreak\endgroup}% 3782 1.1 christos 3783 1.1 christos \def\lisp{\begingroup 3784 1.1 christos \nonfillstart 3785 1.1 christos \let\Elisp = \nonfillfinish 3786 1.1 christos \tt 3787 1.1 christos % Make @kbd do something special, if requested. 3788 1.1 christos \let\kbdfont\kbdexamplefont 3789 1.1 christos \rawbackslash % have \ input char produce \ char from current font 3790 1.1 christos \gobble 3791 1.1 christos } 3792 1.1 christos 3793 1.1 christos % Define the \E... control sequence only if we are inside the 3794 1.1 christos % environment, so the error checking in \end will work. 3795 1.1 christos % 3796 1.1 christos % We must call \lisp last in the definition, since it reads the 3797 1.1 christos % return following the @example (or whatever) command. 3798 1.1 christos % 3799 1.1 christos \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} 3800 1.1 christos \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp} 3801 1.1 christos \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp} 3802 1.1 christos 3803 1.1 christos % @smallexample and @smalllisp. This is not used unless the @smallbook 3804 1.1 christos % command is given. Originally contributed by Pavel@xerox. 3805 1.1 christos % 3806 1.1 christos \def\smalllispx{\begingroup 3807 1.1 christos \nonfillstart 3808 1.1 christos \let\Esmalllisp = \nonfillfinish 3809 1.1 christos \let\Esmallexample = \nonfillfinish 3810 1.1 christos % 3811 1.1 christos % Smaller fonts for small examples. 3812 1.1 christos \indexfonts \tt 3813 1.1 christos \rawbackslash % make \ output the \ character from the current font (tt) 3814 1.1 christos \gobble 3815 1.1 christos } 3816 1.1 christos 3817 1.1 christos % This is @display; same as @lisp except use roman font. 3818 1.1 christos % 3819 1.1 christos \def\display{\begingroup 3820 1.1 christos \nonfillstart 3821 1.1 christos \let\Edisplay = \nonfillfinish 3822 1.1 christos \gobble 3823 1.1 christos } 3824 1.1 christos 3825 1.1 christos % This is @format; same as @display except don't narrow margins. 3826 1.1 christos % 3827 1.1 christos \def\format{\begingroup 3828 1.1 christos \let\nonarrowing = t 3829 1.1 christos \nonfillstart 3830 1.1 christos \let\Eformat = \nonfillfinish 3831 1.1 christos \gobble 3832 1.1 christos } 3833 1.1 christos 3834 1.1 christos % @flushleft (same as @format) and @flushright. 3835 1.1 christos % 3836 1.1 christos \def\flushleft{\begingroup 3837 1.1 christos \let\nonarrowing = t 3838 1.1 christos \nonfillstart 3839 1.1 christos \let\Eflushleft = \nonfillfinish 3840 1.1 christos \gobble 3841 1.1 christos } 3842 1.1 christos \def\flushright{\begingroup 3843 1.1 christos \let\nonarrowing = t 3844 1.1 christos \nonfillstart 3845 1.1 christos \let\Eflushright = \nonfillfinish 3846 1.1 christos \advance\leftskip by 0pt plus 1fill 3847 1.1 christos \gobble} 3848 1.1 christos 3849 1.1 christos % @quotation does normal linebreaking (hence we can't use \nonfillstart) 3850 1.1 christos % and narrows the margins. 3851 1.1 christos % 3852 1.1 christos \def\quotation{% 3853 1.1 christos \begingroup\inENV %This group ends at the end of the @quotation body 3854 1.1 christos {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip 3855 1.1 christos \singlespace 3856 1.1 christos \parindent=0pt 3857 1.1 christos % We have retained a nonzero parskip for the environment, since we're 3858 1.1 christos % doing normal filling. So to avoid extra space below the environment... 3859 1.1 christos \def\Equotation{\parskip = 0pt \nonfillfinish}% 3860 1.1 christos % 3861 1.1 christos % @cartouche defines \nonarrowing to inhibit narrowing at next level down. 3862 1.1 christos \ifx\nonarrowing\relax 3863 1.1 christos \advance\leftskip by \lispnarrowing 3864 1.1 christos \advance\rightskip by \lispnarrowing 3865 1.1 christos \exdentamount = \lispnarrowing 3866 1.1 christos \let\nonarrowing = \relax 3867 1.1 christos \fi 3868 1.1 christos } 3869 1.1 christos 3870 1.1 christos \message{defuns,} 3871 1.1 christos % Define formatter for defuns 3872 1.1 christos % First, allow user to change definition object font (\df) internally 3873 1.1 christos \def\setdeffont #1 {\csname DEF#1\endcsname} 3874 1.1 christos 3875 1.1 christos \newskip\defbodyindent \defbodyindent=.4in 3876 1.1 christos \newskip\defargsindent \defargsindent=50pt 3877 1.1 christos \newskip\deftypemargin \deftypemargin=12pt 3878 1.1 christos \newskip\deflastargmargin \deflastargmargin=18pt 3879 1.1 christos 3880 1.1 christos \newcount\parencount 3881 1.1 christos % define \functionparens, which makes ( and ) and & do special things. 3882 1.1 christos % \functionparens affects the group it is contained in. 3883 1.1 christos \def\activeparens{% 3884 1.1 christos \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active 3885 1.1 christos \catcode`\[=\active \catcode`\]=\active} 3886 1.1 christos 3887 1.1 christos % Make control sequences which act like normal parenthesis chars. 3888 1.1 christos \let\lparen = ( \let\rparen = ) 3889 1.1 christos 3890 1.1 christos {\activeparens % Now, smart parens don't turn on until &foo (see \amprm) 3891 1.1 christos 3892 1.1 christos % Be sure that we always have a definition for `(', etc. For example, 3893 1.1 christos % if the fn name has parens in it, \boldbrax will not be in effect yet, 3894 1.1 christos % so TeX would otherwise complain about undefined control sequence. 3895 1.1 christos \global\let(=\lparen \global\let)=\rparen 3896 1.1 christos \global\let[=\lbrack \global\let]=\rbrack 3897 1.1 christos 3898 1.1 christos \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } 3899 1.1 christos \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} 3900 1.1 christos % This is used to turn on special parens 3901 1.1 christos % but make & act ordinary (given that it's active). 3902 1.1 christos \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} 3903 1.1 christos 3904 1.1 christos % Definitions of (, ) and & used in args for functions. 3905 1.1 christos % This is the definition of ( outside of all parentheses. 3906 1.1 christos \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested 3907 1.1 christos \global\advance\parencount by 1 3908 1.1 christos } 3909 1.1 christos % 3910 1.1 christos % This is the definition of ( when already inside a level of parens. 3911 1.1 christos \gdef\opnested{\char`\(\global\advance\parencount by 1 } 3912 1.1 christos % 3913 1.1 christos \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. 3914 1.1 christos % also in that case restore the outer-level definition of (. 3915 1.1 christos \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi 3916 1.1 christos \global\advance \parencount by -1 } 3917 1.1 christos % If we encounter &foo, then turn on ()-hacking afterwards 3918 1.1 christos \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } 3919 1.1 christos % 3920 1.1 christos \gdef\normalparens{\boldbrax\let&=\ampnr} 3921 1.1 christos } % End of definition inside \activeparens 3922 1.1 christos %% These parens (in \boldbrax) actually are a little bolder than the 3923 1.1 christos %% contained text. This is especially needed for [ and ] 3924 1.1 christos \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } 3925 1.1 christos \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } 3926 1.1 christos \def\ampnr{\&} 3927 1.1 christos \def\lbrb{{\bf\char`\[}} 3928 1.1 christos \def\rbrb{{\bf\char`\]}} 3929 1.1 christos 3930 1.1 christos % First, defname, which formats the header line itself. 3931 1.1 christos % #1 should be the function name. 3932 1.1 christos % #2 should be the type of definition, such as "Function". 3933 1.1 christos 3934 1.1 christos \def\defname #1#2{% 3935 1.1 christos % Get the values of \leftskip and \rightskip as they were 3936 1.1 christos % outside the @def... 3937 1.1 christos \dimen2=\leftskip 3938 1.1 christos \advance\dimen2 by -\defbodyindent 3939 1.1 christos \dimen3=\rightskip 3940 1.1 christos \advance\dimen3 by -\defbodyindent 3941 1.1 christos \noindent % 3942 1.1 christos \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% 3943 1.1 christos \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line 3944 1.1 christos \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations 3945 1.1 christos \parshape 2 0in \dimen0 \defargsindent \dimen1 % 3946 1.1 christos % Now output arg 2 ("Function" or some such) 3947 1.1 christos % ending at \deftypemargin from the right margin, 3948 1.1 christos % but stuck inside a box of width 0 so it does not interfere with linebreaking 3949 1.1 christos {% Adjust \hsize to exclude the ambient margins, 3950 1.1 christos % so that \rightline will obey them. 3951 1.1 christos \advance \hsize by -\dimen2 \advance \hsize by -\dimen3 3952 1.1 christos \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}% 3953 1.1 christos % Make all lines underfull and no complaints: 3954 1.1 christos \tolerance=10000 \hbadness=10000 3955 1.1 christos \advance\leftskip by -\defbodyindent 3956 1.1 christos \exdentamount=\defbodyindent 3957 1.1 christos {\df #1}\enskip % Generate function name 3958 1.1 christos } 3959 1.1 christos 3960 1.1 christos % Actually process the body of a definition 3961 1.1 christos % #1 should be the terminating control sequence, such as \Edefun. 3962 1.1 christos % #2 should be the "another name" control sequence, such as \defunx. 3963 1.1 christos % #3 should be the control sequence that actually processes the header, 3964 1.1 christos % such as \defunheader. 3965 1.1 christos 3966 1.1 christos \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody 3967 1.1 christos \medbreak % 3968 1.1 christos % Define the end token that this defining construct specifies 3969 1.1 christos % so that it will exit this group. 3970 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 3971 1.1 christos \def#2{\begingroup\obeylines\activeparens\spacesplit#3}% 3972 1.1 christos \parindent=0in 3973 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 3974 1.1 christos \exdentamount=\defbodyindent 3975 1.1 christos \begingroup % 3976 1.1 christos \catcode 61=\active % 61 is `=' 3977 1.1 christos \obeylines\activeparens\spacesplit#3} 3978 1.1 christos 3979 1.1 christos % #1 is the \E... control sequence to end the definition (which we define). 3980 1.1 christos % #2 is the \...x control sequence for consecutive fns (which we define). 3981 1.1 christos % #3 is the control sequence to call to resume processing. 3982 1.1 christos % #4, delimited by the space, is the class name. 3983 1.1 christos % 3984 1.1 christos \def\defmethparsebody#1#2#3#4 {\begingroup\inENV % 3985 1.1 christos \medbreak % 3986 1.1 christos % Define the end token that this defining construct specifies 3987 1.1 christos % so that it will exit this group. 3988 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 3989 1.1 christos \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% 3990 1.1 christos \parindent=0in 3991 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 3992 1.1 christos \exdentamount=\defbodyindent 3993 1.1 christos \begingroup\obeylines\activeparens\spacesplit{#3{#4}}} 3994 1.1 christos 3995 1.1 christos % @deftypemethod has an extra argument that nothing else does. Sigh. 3996 1.1 christos % #1 is the \E... control sequence to end the definition (which we define). 3997 1.1 christos % #2 is the \...x control sequence for consecutive fns (which we define). 3998 1.1 christos % #3 is the control sequence to call to resume processing. 3999 1.1 christos % #4, delimited by the space, is the class name. 4000 1.1 christos % #5 is the method's return type. 4001 1.1 christos % 4002 1.1 christos \def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV % 4003 1.1 christos \medbreak % 4004 1.1 christos % Define the end token that this defining construct specifies 4005 1.1 christos % so that it will exit this group. 4006 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 4007 1.1 christos \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% 4008 1.1 christos \parindent=0in 4009 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 4010 1.1 christos \exdentamount=\defbodyindent 4011 1.1 christos \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} 4012 1.1 christos 4013 1.1 christos \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % 4014 1.1 christos \medbreak % 4015 1.1 christos % Define the end token that this defining construct specifies 4016 1.1 christos % so that it will exit this group. 4017 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 4018 1.1 christos \def#2##1 ##2 {\def#4{##1}% 4019 1.1 christos \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% 4020 1.1 christos \parindent=0in 4021 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 4022 1.1 christos \exdentamount=\defbodyindent 4023 1.1 christos \begingroup\obeylines\activeparens\spacesplit{#3{#5}}} 4024 1.1 christos 4025 1.1 christos % These parsing functions are similar to the preceding ones 4026 1.1 christos % except that they do not make parens into active characters. 4027 1.1 christos % These are used for "variables" since they have no arguments. 4028 1.1 christos 4029 1.1 christos \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody 4030 1.1 christos \medbreak % 4031 1.1 christos % Define the end token that this defining construct specifies 4032 1.1 christos % so that it will exit this group. 4033 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 4034 1.1 christos \def#2{\begingroup\obeylines\spacesplit#3}% 4035 1.1 christos \parindent=0in 4036 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 4037 1.1 christos \exdentamount=\defbodyindent 4038 1.1 christos \begingroup % 4039 1.1 christos \catcode 61=\active % 4040 1.1 christos \obeylines\spacesplit#3} 4041 1.1 christos 4042 1.1 christos % This is used for \def{tp,vr}parsebody. It could probably be used for 4043 1.1 christos % some of the others, too, with some judicious conditionals. 4044 1.1 christos % 4045 1.1 christos \def\parsebodycommon#1#2#3{% 4046 1.1 christos \begingroup\inENV % 4047 1.1 christos \medbreak % 4048 1.1 christos % Define the end token that this defining construct specifies 4049 1.1 christos % so that it will exit this group. 4050 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 4051 1.1 christos \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% 4052 1.1 christos \parindent=0in 4053 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 4054 1.1 christos \exdentamount=\defbodyindent 4055 1.1 christos \begingroup\obeylines 4056 1.1 christos } 4057 1.1 christos 4058 1.1 christos \def\defvrparsebody#1#2#3#4 {% 4059 1.1 christos \parsebodycommon{#1}{#2}{#3}% 4060 1.1 christos \spacesplit{#3{#4}}% 4061 1.1 christos } 4062 1.1 christos 4063 1.1 christos % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the 4064 1.1 christos % type is just `struct', because we lose the braces in `{struct 4065 1.1 christos % termios}' when \spacesplit reads its undelimited argument. Sigh. 4066 1.1 christos % \let\deftpparsebody=\defvrparsebody 4067 1.1 christos % 4068 1.1 christos % So, to get around this, we put \empty in with the type name. That 4069 1.1 christos % way, TeX won't find exactly `{...}' as an undelimited argument, and 4070 1.1 christos % won't strip off the braces. 4071 1.1 christos % 4072 1.1 christos \def\deftpparsebody #1#2#3#4 {% 4073 1.1 christos \parsebodycommon{#1}{#2}{#3}% 4074 1.1 christos \spacesplit{\parsetpheaderline{#3{#4}}}\empty 4075 1.1 christos } 4076 1.1 christos 4077 1.1 christos % Fine, but then we have to eventually remove the \empty *and* the 4078 1.1 christos % braces (if any). That's what this does. 4079 1.1 christos % 4080 1.1 christos \def\removeemptybraces\empty#1\relax{#1} 4081 1.1 christos 4082 1.1 christos % After \spacesplit has done its work, this is called -- #1 is the final 4083 1.1 christos % thing to call, #2 the type name (which starts with \empty), and #3 4084 1.1 christos % (which might be empty) the arguments. 4085 1.1 christos % 4086 1.1 christos \def\parsetpheaderline#1#2#3{% 4087 1.1 christos #1{\removeemptybraces#2\relax}{#3}% 4088 1.1 christos }% 4089 1.1 christos 4090 1.1 christos \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % 4091 1.1 christos \medbreak % 4092 1.1 christos % Define the end token that this defining construct specifies 4093 1.1 christos % so that it will exit this group. 4094 1.1 christos \def#1{\endgraf\endgroup\medbreak}% 4095 1.1 christos \def#2##1 ##2 {\def#4{##1}% 4096 1.1 christos \begingroup\obeylines\spacesplit{#3{##2}}}% 4097 1.1 christos \parindent=0in 4098 1.1 christos \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent 4099 1.1 christos \exdentamount=\defbodyindent 4100 1.1 christos \begingroup\obeylines\spacesplit{#3{#5}}} 4101 1.1 christos 4102 1.1 christos % Split up #2 at the first space token. 4103 1.1 christos % call #1 with two arguments: 4104 1.1 christos % the first is all of #2 before the space token, 4105 1.1 christos % the second is all of #2 after that space token. 4106 1.1 christos % If #2 contains no space token, all of it is passed as the first arg 4107 1.1 christos % and the second is passed as empty. 4108 1.1 christos 4109 1.1 christos {\obeylines 4110 1.1 christos \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% 4111 1.1 christos \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% 4112 1.1 christos \ifx\relax #3% 4113 1.1 christos #1{#2}{}\else #1{#2}{#3#4}\fi}} 4114 1.1 christos 4115 1.1 christos % So much for the things common to all kinds of definitions. 4116 1.1 christos 4117 1.1 christos % Define @defun. 4118 1.1 christos 4119 1.1 christos % First, define the processing that is wanted for arguments of \defun 4120 1.1 christos % Use this to expand the args and terminate the paragraph they make up 4121 1.1 christos 4122 1.1 christos \def\defunargs #1{\functionparens \sl 4123 1.1 christos % Expand, preventing hyphenation at `-' chars. 4124 1.1 christos % Note that groups don't affect changes in \hyphenchar. 4125 1.1 christos \hyphenchar\tensl=0 4126 1.1 christos #1% 4127 1.1 christos \hyphenchar\tensl=45 4128 1.1 christos \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% 4129 1.1 christos \interlinepenalty=10000 4130 1.1 christos \advance\rightskip by 0pt plus 1fil 4131 1.1 christos \endgraf\penalty 10000\vskip -\parskip\penalty 10000% 4132 1.1 christos } 4133 1.1 christos 4134 1.1 christos \def\deftypefunargs #1{% 4135 1.1 christos % Expand, preventing hyphenation at `-' chars. 4136 1.1 christos % Note that groups don't affect changes in \hyphenchar. 4137 1.1 christos % Use \boldbraxnoamp, not \functionparens, so that & is not special. 4138 1.1 christos \boldbraxnoamp 4139 1.1 christos \tclose{#1}% avoid \code because of side effects on active chars 4140 1.1 christos \interlinepenalty=10000 4141 1.1 christos \advance\rightskip by 0pt plus 1fil 4142 1.1 christos \endgraf\penalty 10000\vskip -\parskip\penalty 10000% 4143 1.1 christos } 4144 1.1 christos 4145 1.1 christos % Do complete processing of one @defun or @defunx line already parsed. 4146 1.1 christos 4147 1.1 christos % @deffn Command forward-char nchars 4148 1.1 christos 4149 1.1 christos \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} 4150 1.1 christos 4151 1.1 christos \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% 4152 1.1 christos \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % 4153 1.1 christos \catcode 61=\other % Turn off change made in \defparsebody 4154 1.1 christos } 4155 1.1 christos 4156 1.1 christos % @defun == @deffn Function 4157 1.1 christos 4158 1.1 christos \def\defun{\defparsebody\Edefun\defunx\defunheader} 4159 1.1 christos 4160 1.1 christos \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4161 1.1 christos \begingroup\defname {#1}{Function}% 4162 1.1 christos \defunargs {#2}\endgroup % 4163 1.1 christos \catcode 61=\other % Turn off change made in \defparsebody 4164 1.1 christos } 4165 1.1 christos 4166 1.1 christos % @deftypefun int foobar (int @var{foo}, float @var{bar}) 4167 1.1 christos 4168 1.1 christos \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} 4169 1.1 christos 4170 1.1 christos % #1 is the data type. #2 is the name and args. 4171 1.1 christos \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} 4172 1.1 christos % #1 is the data type, #2 the name, #3 the args. 4173 1.1 christos \def\deftypefunheaderx #1#2 #3\relax{% 4174 1.1 christos \doind {fn}{\code{#2}}% Make entry in function index 4175 1.1 christos \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}% 4176 1.1 christos \deftypefunargs {#3}\endgroup % 4177 1.1 christos \catcode 61=\other % Turn off change made in \defparsebody 4178 1.1 christos } 4179 1.1 christos 4180 1.1 christos % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) 4181 1.1 christos 4182 1.1 christos \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} 4183 1.1 christos 4184 1.1 christos % \defheaderxcond#1\relax$$$ 4185 1.1 christos % puts #1 in @code, followed by a space, but does nothing if #1 is null. 4186 1.1 christos \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} 4187 1.1 christos 4188 1.1 christos % #1 is the classification. #2 is the data type. #3 is the name and args. 4189 1.1 christos \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} 4190 1.1 christos % #1 is the classification, #2 the data type, #3 the name, #4 the args. 4191 1.1 christos \def\deftypefnheaderx #1#2#3 #4\relax{% 4192 1.1 christos \doind {fn}{\code{#3}}% Make entry in function index 4193 1.1 christos \begingroup 4194 1.1 christos \normalparens % notably, turn off `&' magic, which prevents 4195 1.1 christos % at least some C++ text from working 4196 1.1 christos \defname {\defheaderxcond#2\relax$$$#3}{#1}% 4197 1.1 christos \deftypefunargs {#4}\endgroup % 4198 1.1 christos \catcode 61=\other % Turn off change made in \defparsebody 4199 1.1 christos } 4200 1.1 christos 4201 1.1 christos % @defmac == @deffn Macro 4202 1.1 christos 4203 1.1 christos \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} 4204 1.1 christos 4205 1.1 christos \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4206 1.1 christos \begingroup\defname {#1}{Macro}% 4207 1.1 christos \defunargs {#2}\endgroup % 4208 1.1 christos \catcode 61=\other % Turn off change made in \defparsebody 4209 1.1 christos } 4210 1.1 christos 4211 1.1 christos % @defspec == @deffn Special Form 4212 1.1 christos 4213 1.1 christos \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} 4214 1.1 christos 4215 1.1 christos \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index 4216 1.1 christos \begingroup\defname {#1}{Special Form}% 4217 1.1 christos \defunargs {#2}\endgroup % 4218 1.1 christos \catcode 61=\other % Turn off change made in \defparsebody 4219 1.1 christos } 4220 1.1 christos 4221 1.1 christos % This definition is run if you use @defunx 4222 1.1 christos % anywhere other than immediately after a @defun or @defunx. 4223 1.1 christos 4224 1.1 christos \def\deffnx #1 {\errmessage{@deffnx in invalid context}} 4225 1.1 christos \def\defunx #1 {\errmessage{@defunx in invalid context}} 4226 1.1 christos \def\defmacx #1 {\errmessage{@defmacx in invalid context}} 4227 1.1 christos \def\defspecx #1 {\errmessage{@defspecx in invalid context}} 4228 1.1 christos \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}} 4229 1.1 christos \def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}} 4230 1.1 christos \def\deftypefunx #1 {\errmessage{@deftypeunx in invalid context}} 4231 1.1 christos 4232 1.1 christos % @defmethod, and so on 4233 1.1 christos 4234 1.1 christos % @defop CATEGORY CLASS OPERATION ARG... 4235 1.1 christos 4236 1.1 christos \def\defop #1 {\def\defoptype{#1}% 4237 1.1 christos \defopparsebody\Edefop\defopx\defopheader\defoptype} 4238 1.1 christos 4239 1.1 christos \def\defopheader #1#2#3{% 4240 1.1 christos \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index 4241 1.1 christos \begingroup\defname {#2}{\defoptype{} on #1}% 4242 1.1 christos \defunargs {#3}\endgroup % 4243 1.1 christos } 4244 1.1 christos 4245 1.1 christos % @deftypemethod CLASS RETURN-TYPE METHOD ARG... 4246 1.1 christos % 4247 1.1 christos \def\deftypemethod{% 4248 1.1 christos \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} 4249 1.1 christos % 4250 1.1 christos % #1 is the class name, #2 the data type, #3 the method name, #4 the args. 4251 1.1 christos \def\deftypemethodheader#1#2#3#4{% 4252 1.1 christos \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index 4253 1.1 christos \begingroup 4254 1.1 christos \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% 4255 1.1 christos \deftypefunargs{#4}% 4256 1.1 christos \endgroup 4257 1.1 christos } 4258 1.1 christos 4259 1.1 christos % @defmethod == @defop Method 4260 1.1 christos % 4261 1.1 christos \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} 4262 1.1 christos % 4263 1.1 christos % #1 is the class name, #2 the method name, #3 the args. 4264 1.1 christos \def\defmethodheader#1#2#3{% 4265 1.1 christos \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index 4266 1.1 christos \begingroup 4267 1.1 christos \defname{#2}{\putwordMethodon\ \code{#1}}% 4268 1.1 christos \defunargs{#3}% 4269 1.1 christos \endgroup 4270 1.1 christos } 4271 1.1 christos 4272 1.1 christos % @defcv {Class Option} foo-class foo-flag 4273 1.1 christos 4274 1.1 christos \def\defcv #1 {\def\defcvtype{#1}% 4275 1.1 christos \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} 4276 1.1 christos 4277 1.1 christos \def\defcvarheader #1#2#3{% 4278 1.1 christos \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index 4279 1.1 christos \begingroup\defname {#2}{\defcvtype{} of #1}% 4280 1.1 christos \defvarargs {#3}\endgroup % 4281 1.1 christos } 4282 1.1 christos 4283 1.1 christos % @defivar == @defcv {Instance Variable} 4284 1.1 christos 4285 1.1 christos \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} 4286 1.1 christos 4287 1.1 christos \def\defivarheader #1#2#3{% 4288 1.1 christos \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index 4289 1.1 christos \begingroup\defname {#2}{Instance Variable of #1}% 4290 1.1 christos \defvarargs {#3}\endgroup % 4291 1.1 christos } 4292 1.1 christos 4293 1.1 christos % These definitions are run if you use @defmethodx, etc., 4294 1.1 christos % anywhere other than immediately after a @defmethod, etc. 4295 1.1 christos 4296 1.1 christos \def\defopx #1 {\errmessage{@defopx in invalid context}} 4297 1.1 christos \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}} 4298 1.1 christos \def\defcvx #1 {\errmessage{@defcvx in invalid context}} 4299 1.1 christos \def\defivarx #1 {\errmessage{@defivarx in invalid context}} 4300 1.1 christos 4301 1.1 christos % Now @defvar 4302 1.1 christos 4303 1.1 christos % First, define the processing that is wanted for arguments of @defvar. 4304 1.1 christos % This is actually simple: just print them in roman. 4305 1.1 christos % This must expand the args and terminate the paragraph they make up 4306 1.1 christos \def\defvarargs #1{\normalparens #1% 4307 1.1 christos \interlinepenalty=10000 4308 1.1 christos \endgraf\penalty 10000\vskip -\parskip\penalty 10000} 4309 1.1 christos 4310 1.1 christos % @defvr Counter foo-count 4311 1.1 christos 4312 1.1 christos \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} 4313 1.1 christos 4314 1.1 christos \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% 4315 1.1 christos \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} 4316 1.1 christos 4317 1.1 christos % @defvar == @defvr Variable 4318 1.1 christos 4319 1.1 christos \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} 4320 1.1 christos 4321 1.1 christos \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index 4322 1.1 christos \begingroup\defname {#1}{Variable}% 4323 1.1 christos \defvarargs {#2}\endgroup % 4324 1.1 christos } 4325 1.1 christos 4326 1.1 christos % @defopt == @defvr {User Option} 4327 1.1 christos 4328 1.1 christos \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} 4329 1.1 christos 4330 1.1 christos \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index 4331 1.1 christos \begingroup\defname {#1}{User Option}% 4332 1.1 christos \defvarargs {#2}\endgroup % 4333 1.1 christos } 4334 1.1 christos 4335 1.1 christos % @deftypevar int foobar 4336 1.1 christos 4337 1.1 christos \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} 4338 1.1 christos 4339 1.1 christos % #1 is the data type. #2 is the name, perhaps followed by text that 4340 1.1 christos % is actually part of the data type, which should not be put into the index. 4341 1.1 christos \def\deftypevarheader #1#2{% 4342 1.1 christos \dovarind#2 \relax% Make entry in variables index 4343 1.1 christos \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}% 4344 1.1 christos \interlinepenalty=10000 4345 1.1 christos \endgraf\penalty 10000\vskip -\parskip\penalty 10000 4346 1.1 christos \endgroup} 4347 1.1 christos \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} 4348 1.1 christos 4349 1.1 christos % @deftypevr {Global Flag} int enable 4350 1.1 christos 4351 1.1 christos \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} 4352 1.1 christos 4353 1.1 christos \def\deftypevrheader #1#2#3{\dovarind#3 \relax% 4354 1.1 christos \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} 4355 1.1 christos \interlinepenalty=10000 4356 1.1 christos \endgraf\penalty 10000\vskip -\parskip\penalty 10000 4357 1.1 christos \endgroup} 4358 1.1 christos 4359 1.1 christos % This definition is run if you use @defvarx 4360 1.1 christos % anywhere other than immediately after a @defvar or @defvarx. 4361 1.1 christos 4362 1.1 christos \def\defvrx #1 {\errmessage{@defvrx in invalid context}} 4363 1.1 christos \def\defvarx #1 {\errmessage{@defvarx in invalid context}} 4364 1.1 christos \def\defoptx #1 {\errmessage{@defoptx in invalid context}} 4365 1.1 christos \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}} 4366 1.1 christos \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}} 4367 1.1 christos 4368 1.1 christos % Now define @deftp 4369 1.1 christos % Args are printed in bold, a slight difference from @defvar. 4370 1.1 christos 4371 1.1 christos \def\deftpargs #1{\bf \defvarargs{#1}} 4372 1.1 christos 4373 1.1 christos % @deftp Class window height width ... 4374 1.1 christos 4375 1.1 christos \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} 4376 1.1 christos 4377 1.1 christos \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% 4378 1.1 christos \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} 4379 1.1 christos 4380 1.1 christos % This definition is run if you use @deftpx, etc 4381 1.1 christos % anywhere other than immediately after a @deftp, etc. 4382 1.1 christos 4383 1.1 christos \def\deftpx #1 {\errmessage{@deftpx in invalid context}} 4384 1.1 christos 4385 1.1 christos 4386 1.1 christos \message{macros,} 4387 1.1 christos % @macro. 4388 1.1 christos % The basic scheme is as follows: 4389 1.1 christos % We read the first line and split it up into macro name and parameter 4390 1.1 christos % list. We then walk the parameter list defining control sequences 4391 1.1 christos % named \MAC@<macro name><parameter name>. Each expands to another 4392 1.1 christos % control sequence named \MAC@<macro name>.<parameter number>. Those 4393 1.1 christos % control sequences will be defined at macro runtime to be the 4394 1.1 christos % parameter expansion text. 4395 1.1 christos % 4396 1.1 christos % The body is then read in as a single argument in a context where \ 4397 1.1 christos % is an active character, and the cs \MACb.<macro name> is defined as 4398 1.1 christos % the macro body. The active character \ takes one argument delimited 4399 1.1 christos % by another \, and uses it to index the table of macro arguments 4400 1.1 christos % described above. 4401 1.1 christos % 4402 1.1 christos % Finally, we define a control sequence \<macro name> which calls one 4403 1.1 christos % of the six (!) macro execution commands. These six commands 4404 1.1 christos % correspond to recursive and nonrecursive macros with no, one, and 4405 1.1 christos % many arguments. They all take one argument, <macro name>, set up 4406 1.1 christos % the environment appropriately, and call the real macro. 4407 1.1 christos % 4408 1.1 christos % \macsave@<macro name> holds the old definition of \<macro name>. 4409 1.1 christos 4410 1.1 christos \newcount\paramno 4411 1.1 christos \newtoks\macname 4412 1.1 christos 4413 1.1 christos % This does \let #1 = #2, except with \csnames. 4414 1.1 christos \def\cslet#1#2{% 4415 1.1 christos \expandafter\expandafter\expandafter 4416 1.1 christos \let 4417 1.1 christos \expandafter\expandafter 4418 1.1 christos \csname#1\endcsname 4419 1.1 christos \csname#2\endcsname} 4420 1.1 christos 4421 1.1 christos % We have to play lots of games with the catcodes. Initially { and } 4422 1.1 christos % are made `other' so that \splitarg (below) can use them as argument 4423 1.1 christos % delimiters. Then - is made a letter so that \iimacro can recognize 4424 1.1 christos % @allow-recursion. 4425 1.1 christos \def\macro{\bgroup\catcode`\{=\other\catcode`\}=\other\parsearg\imacro} 4426 1.1 christos \def\imacro#1{\egroup % started in \macro 4427 1.1 christos \splitarg{#1}% now \macname is the macname and \toks0 the arglist 4428 1.1 christos \paramno=0% 4429 1.1 christos \edef\tmp{\the\toks0}% 4430 1.1 christos \ifx\tmp\empty % no arguments 4431 1.1 christos \else 4432 1.1 christos \expandafter\parsemargdef \the\toks0;% 4433 1.1 christos \fi 4434 1.1 christos \bgroup\catcode`\-=11\global\futurelet\nxt\iimacro} 4435 1.1 christos 4436 1.1 christos % \imacro has noted whether the macro takes one, two, or many 4437 1.1 christos % arguments (in \paramno). \iimacro figures out whether it's 4438 1.1 christos % recursive, and then uses the argument count and the recursivity to 4439 1.1 christos % select one of the six macro execution sequences. Then we save the 4440 1.1 christos % original definition of @foo in \macsave@foo, and define @foo to call 4441 1.1 christos % the selected execution sequence. \edef conveniently just expands 4442 1.1 christos % the token registers, not the deep structure. 4443 1.1 christos \def\iimacro{% 4444 1.1 christos \egroup % started in \imacro 4445 1.1 christos \ifx\nxt\allowrecur 4446 1.1 christos \let\next\parserbody 4447 1.1 christos \toks0=\expandafter{\csname dormacro\ifcase\paramno na\or oa\fi\endcsname}% 4448 1.1 christos \else 4449 1.1 christos \let\next\parsebody 4450 1.1 christos \toks0=\expandafter{\csname domacro\ifcase\paramno na\or oa\fi\endcsname}% 4451 1.1 christos \fi 4452 1.1 christos \expandafter\ifx \csname macsave@\the\macname\endcsname \relax 4453 1.1 christos \cslet{macsave@\the\macname}{\the\macname}% 4454 1.1 christos \else 4455 1.1 christos \errmessage{warning: redefining macro \the\macname}% 4456 1.1 christos \fi 4457 1.1 christos \expandafter\edef\csname\the\macname\endcsname{\the\toks0{\the\macname}}% 4458 1.1 christos \next} 4459 1.1 christos 4460 1.1 christos % @allow-recursion is noticed and handled by \iimacro. It should 4461 1.1 christos % never actually be executed. It has two names so we don't need 4462 1.1 christos % strange catcodes while defining \iimacro. 4463 1.1 christos \def\allowrecur{\errmessage{Internal error: \noexpand\allowrecur executed}} 4464 1.1 christos {\catcode`\-=11\global\let\allow-recursion\allowrecur} 4465 1.1 christos 4466 1.1 christos % unmacro just restores the old meaning; the MAC@<macname> macros 4467 1.1 christos % remain defined. (Memory leak!) \norecurse is defined below, near 4468 1.1 christos % the execution commands. 4469 1.1 christos \def\unmacro{\parsearg\iunmacro} 4470 1.1 christos \def\iunmacro#1{\macname={#1} \norecurse} 4471 1.1 christos 4472 1.1 christos % We need {} to be ordinary inside these commands. [] are temporary 4473 1.1 christos % grouping symbols. 4474 1.1 christos \begingroup 4475 1.1 christos \catcode`\{=\other \catcode`\}=\other 4476 1.1 christos \catcode`\[=1 \catcode`\]=2 4477 1.1 christos 4478 1.1 christos % @macro can be called with or without a brace-surrounded macro 4479 1.1 christos % argument list. These three sequences extract the macro name and arg 4480 1.1 christos % list in hopefully all cases. *Note, anything on the line after the 4481 1.1 christos % first pair of braces will be thrown out. 4482 1.1 christos \gdef\splitarg#1[\isplitarg|#1 {}|] 4483 1.1 christos \gdef\isplitarg|#1 {#2}#3|[% 4484 1.1 christos \toks0=[#2]% 4485 1.1 christos \edef\tmp[\the\toks0]% 4486 1.1 christos \ifx\tmp\empty 4487 1.1 christos \isplitargnospaces|#1{}|% 4488 1.1 christos \else 4489 1.1 christos \macname=[#1]% 4490 1.1 christos \fi] 4491 1.1 christos \gdef\isplitargnospaces|#1{#2}#3|[\macname=[#1] \toks0=[#2]] 4492 1.1 christos 4493 1.1 christos % \parsebrace gets around the situation produced by \braceorline 4494 1.1 christos % (below) where the { has the wrong catcode because of \futurelet. 4495 1.1 christos % The \egroup matches a \bgroup in \braceorline. 4496 1.1 christos \gdef\parsebrace#1{#2}[\egroup\let\next=#1\next[#2]] 4497 1.1 christos 4498 1.1 christos \global\let\brace={ % used by \braceorline, below 4499 1.1 christos 4500 1.1 christos \endgroup 4501 1.1 christos 4502 1.1 christos 4503 1.1 christos % Argument parsing. 4504 1.1 christos % These routines iterate over a comma-separated list defining 4505 1.1 christos % tokens that map macro formal to actual parameters. 4506 1.1 christos % \parsemargdef sets the formal -> positional correspondence at macro 4507 1.1 christos % definition time; \parsemarg sets positional -> actual at runtime. 4508 1.1 christos % 4509 1.1 christos % The definitions are not symmetric because the callers have the 4510 1.1 christos % argument list in different places (token register and #arg) 4511 1.1 christos \def\parsemargdef#1;{\paramno=0\iparsemargdef#1,;,} 4512 1.1 christos \def\iparsemargdef#1,{% 4513 1.1 christos \if#1;\let\next=\relax 4514 1.1 christos \else \let\next=\iparsemargdef 4515 1.1 christos \advance\paramno by 1% 4516 1.1 christos \expandafter\edef\csname MAC@\the\macname#1\endcsname 4517 1.1 christos {\csname MAC@\the\macname.\the\paramno\endcsname}% 4518 1.1 christos \fi\next} 4519 1.1 christos 4520 1.1 christos \def\parsemarg#1{\paramno=1\iparsemarg#1,;,} 4521 1.1 christos \def\iparsemarg#1,{% 4522 1.1 christos \if#1;\let\next=\relax 4523 1.1 christos \else \let\next=\iparsemarg 4524 1.1 christos \expandafter\def\csname MAC@\the\macname.\the\paramno\endcsname{#1}% 4525 1.1 christos \advance\paramno by 1% 4526 1.1 christos \fi\next} 4527 1.1 christos 4528 1.1 christos % Argument substitution. 4529 1.1 christos % \ is active when the body is read and tokenized; it converts its 4530 1.1 christos % argument to a macro-argument name and expands it. We use | as a 4531 1.1 christos % temporary escape character. 4532 1.1 christos { 4533 1.1 christos \catcode`\|=0 |catcode`|\=|active 4534 1.1 christos |gdef\#1\{|csname MAC@|the|macname#1|endcsname} 4535 1.1 christos } 4536 1.1 christos 4537 1.1 christos % These sequences read and save the macro body. \parserbody absorbs 4538 1.1 christos % the @allow-recursion in its argument, and then falls through to 4539 1.1 christos % \parsebody. 4540 1.1 christos \def\parsebody{\begingroup\catcode`\\=\active\iparsebody} 4541 1.1 christos \def\parserbody#1{\parsebody} 4542 1.1 christos 4543 1.1 christos % \iparsebody reads the entire macro in as an argument. \ was made 4544 1.1 christos % active by \parsebody while the reading occurs. 4545 1.1 christos \long\def\iparsebody#1 \end macro% The space eats the final CR. 4546 1.1 christos {\endgroup % started in \parsebody 4547 1.1 christos \expandafter\def\csname MACb.\the\macname \endcsname{#1}} 4548 1.1 christos 4549 1.1 christos % These six sequences execute recursive and nonrecursive macros of no, 4550 1.1 christos % one, and many arguments. We need to distinguish one arg from many 4551 1.1 christos % args because a one-argument macro invoked with no arguments gets the 4552 1.1 christos % rest of the line as its argument. 4553 1.1 christos % 4554 1.1 christos % Please note that all macros are executed inside a group, so any 4555 1.1 christos % changes made by a macro (@set, etc.) won't stick. 4556 1.1 christos \def\dormacrona#1{\begingroup\macname={#1}\idomacro{}} 4557 1.1 christos \def\dormacrooa#1{\begingroup\macname={#1}\braceorline} 4558 1.1 christos \def\dormacro#1{\begingroup\macname={#1}\idomacro} 4559 1.1 christos 4560 1.1 christos \def\domacrona#1{\begingroup\macname={#1}\norecurse\idomacro{}} 4561 1.1 christos \def\domacrooa#1{\begingroup\macname={#1}\norecurse\braceorline} 4562 1.1 christos \def\domacro#1{\begingroup\macname={#1}\norecurse\idomacro} 4563 1.1 christos 4564 1.1 christos % some helpers: 4565 1.1 christos \def\norecurse{\cslet{\the\macname}{macsave@\the\macname}} 4566 1.1 christos \def\idomacro#1{\parsemarg{#1}\csname MACb.\the\macname\endcsname\endgroup} 4567 1.1 christos 4568 1.1 christos % \braceorline decides whether the next nonwhitespace character is a 4569 1.1 christos % {. If so it reads up to the closing }, if not, it reads the whole 4570 1.1 christos % line. Whatever was read is then fed to \idomacro. \parsebrace is 4571 1.1 christos % defined above, near \splitarg, in a strange catcode environment; 4572 1.1 christos % this is necessary because \futurelet freezes the catcode of the 4573 1.1 christos % peeked-at character. 4574 1.1 christos \def\braceorline{\bgroup 4575 1.1 christos \catcode`\{=\other\catcode`\}=\other \futurelet\nxt\ibraceorline} 4576 1.1 christos \def\ibraceorline{% 4577 1.1 christos \ifx\nxt\brace 4578 1.1 christos \expandafter\parsebrace 4579 1.1 christos \else 4580 1.1 christos \egroup \expandafter\parsearg 4581 1.1 christos \fi \idomacro} 4582 1.1 christos 4583 1.1 christos 4584 1.1 christos \message{cross references,} 4585 1.1 christos \newwrite\auxfile 4586 1.1 christos 4587 1.1 christos \newif\ifhavexrefs % True if xref values are known. 4588 1.1 christos \newif\ifwarnedxrefs % True if we warned once that they aren't known. 4589 1.1 christos 4590 1.1 christos % @inforef is relatively simple. 4591 1.1 christos \def\inforef #1{\inforefzzz #1,,,,**} 4592 1.1 christos \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 4593 1.1 christos node \samp{\ignorespaces#1{}}} 4594 1.1 christos 4595 1.1 christos % @setref{foo} defines a cross-reference point named foo. 4596 1.1 christos 4597 1.1 christos \def\setref#1{% 4598 1.1 christos \dosetq{#1-title}{Ytitle}% 4599 1.1 christos \dosetq{#1-pg}{Ypagenumber}% 4600 1.1 christos \dosetq{#1-snt}{Ysectionnumberandtype}} 4601 1.1 christos 4602 1.1 christos \def\unnumbsetref#1{% 4603 1.1 christos \dosetq{#1-title}{Ytitle}% 4604 1.1 christos \dosetq{#1-pg}{Ypagenumber}% 4605 1.1 christos \dosetq{#1-snt}{Ynothing}} 4606 1.1 christos 4607 1.1 christos \def\appendixsetref#1{% 4608 1.1 christos \dosetq{#1-title}{Ytitle}% 4609 1.1 christos \dosetq{#1-pg}{Ypagenumber}% 4610 1.1 christos \dosetq{#1-snt}{Yappendixletterandtype}} 4611 1.1 christos 4612 1.1 christos % \xref, \pxref, and \ref generate cross-references to specified points. 4613 1.1 christos % For \xrefX, #1 is the node name, #2 the name of the Info 4614 1.1 christos % cross-reference, #3 the printed node name, #4 the name of the Info 4615 1.1 christos % file, #5 the name of the printed manual. All but the node name can be 4616 1.1 christos % omitted. 4617 1.1 christos % 4618 1.1 christos \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} 4619 1.1 christos \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} 4620 1.1 christos \def\ref#1{\xrefX[#1,,,,,,,]} 4621 1.1 christos \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 4622 1.1 christos \def\printedmanual{\ignorespaces #5}% 4623 1.1 christos \def\printednodename{\ignorespaces #3}% 4624 1.1 christos \setbox1=\hbox{\printedmanual}% 4625 1.1 christos \setbox0=\hbox{\printednodename}% 4626 1.1 christos \ifdim \wd0 = 0pt 4627 1.1 christos % No printed node name was explicitly given. 4628 1.1 christos \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax 4629 1.1 christos % Use the node name inside the square brackets. 4630 1.1 christos \def\printednodename{\ignorespaces #1}% 4631 1.1 christos \else 4632 1.1 christos % Use the actual chapter/section title appear inside 4633 1.1 christos % the square brackets. Use the real section title if we have it. 4634 1.1 christos \ifdim \wd1>0pt% 4635 1.1 christos % It is in another manual, so we don't have it. 4636 1.1 christos \def\printednodename{\ignorespaces #1}% 4637 1.1 christos \else 4638 1.1 christos \ifhavexrefs 4639 1.1 christos % We know the real title if we have the xref values. 4640 1.1 christos \def\printednodename{\refx{#1-title}{}}% 4641 1.1 christos \else 4642 1.1 christos % Otherwise just copy the Info node name. 4643 1.1 christos \def\printednodename{\ignorespaces #1}% 4644 1.1 christos \fi% 4645 1.1 christos \fi 4646 1.1 christos \fi 4647 1.1 christos \fi 4648 1.1 christos % 4649 1.1 christos % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not 4650 1.1 christos % insert empty discretionaries after hyphens, which means that it will 4651 1.1 christos % not find a line break at a hyphen in a node names. Since some manuals 4652 1.1 christos % are best written with fairly long node names, containing hyphens, this 4653 1.1 christos % is a loss. Therefore, we give the text of the node name again, so it 4654 1.1 christos % is as if TeX is seeing it for the first time. 4655 1.1 christos \ifdim \wd1 > 0pt 4656 1.1 christos \putwordsection{} ``\printednodename'' in \cite{\printedmanual}% 4657 1.1 christos \else 4658 1.1 christos % _ (for example) has to be the character _ for the purposes of the 4659 1.1 christos % control sequence corresponding to the node, but it has to expand 4660 1.1 christos % into the usual \leavevmode...\vrule stuff for purposes of 4661 1.1 christos % printing. So we \turnoffactive for the \refx-snt, back on for the 4662 1.1 christos % printing, back off for the \refx-pg. 4663 1.1 christos {\normalturnoffactive \refx{#1-snt}{}}% 4664 1.1 christos \space [\printednodename],\space 4665 1.1 christos \turnoffactive \putwordpage\tie\refx{#1-pg}{}% 4666 1.1 christos \fi 4667 1.1 christos \endgroup} 4668 1.1 christos 4669 1.1 christos % \dosetq is the interface for calls from other macros 4670 1.1 christos 4671 1.1 christos % Use \normalturnoffactive so that punctuation chars such as underscore 4672 1.1 christos % and backslash work in node names. (\turnoffactive doesn't do \.) 4673 1.1 christos \def\dosetq#1#2{% 4674 1.1 christos {\let\folio=0 4675 1.1 christos \normalturnoffactive 4676 1.1 christos \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% 4677 1.1 christos \iflinks 4678 1.1 christos \next 4679 1.1 christos \fi 4680 1.1 christos }% 4681 1.1 christos } 4682 1.1 christos 4683 1.1 christos % \internalsetq {foo}{page} expands into 4684 1.1 christos % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} 4685 1.1 christos % When the aux file is read, ' is the escape character 4686 1.1 christos 4687 1.1 christos \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} 4688 1.1 christos 4689 1.1 christos % Things to be expanded by \internalsetq 4690 1.1 christos 4691 1.1 christos \def\Ypagenumber{\folio} 4692 1.1 christos 4693 1.1 christos \def\Ytitle{\thissection} 4694 1.1 christos 4695 1.1 christos \def\Ynothing{} 4696 1.1 christos 4697 1.1 christos \def\Ysectionnumberandtype{% 4698 1.1 christos \ifnum\secno=0 \putwordChapter\xreftie\the\chapno % 4699 1.1 christos \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % 4700 1.1 christos \else \ifnum \subsubsecno=0 % 4701 1.1 christos \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % 4702 1.1 christos \else % 4703 1.1 christos \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % 4704 1.1 christos \fi \fi \fi } 4705 1.1 christos 4706 1.1 christos \def\Yappendixletterandtype{% 4707 1.1 christos \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% 4708 1.1 christos \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % 4709 1.1 christos \else \ifnum \subsubsecno=0 % 4710 1.1 christos \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % 4711 1.1 christos \else % 4712 1.1 christos \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % 4713 1.1 christos \fi \fi \fi } 4714 1.1 christos 4715 1.1 christos \gdef\xreftie{'tie} 4716 1.1 christos 4717 1.1 christos % Use TeX 3.0's \inputlineno to get the line number, for better error 4718 1.1 christos % messages, but if we're using an old version of TeX, don't do anything. 4719 1.1 christos % 4720 1.1 christos \ifx\inputlineno\thisisundefined 4721 1.1 christos \let\linenumber = \empty % Non-3.0. 4722 1.1 christos \else 4723 1.1 christos \def\linenumber{\the\inputlineno:\space} 4724 1.1 christos \fi 4725 1.1 christos 4726 1.1 christos % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. 4727 1.1 christos % If its value is nonempty, SUFFIX is output afterward. 4728 1.1 christos 4729 1.1 christos \def\refx#1#2{% 4730 1.1 christos \expandafter\ifx\csname X#1\endcsname\relax 4731 1.1 christos % If not defined, say something at least. 4732 1.1 christos \angleleft un\-de\-fined\angleright 4733 1.1 christos \iflinks 4734 1.1 christos \ifhavexrefs 4735 1.1 christos \message{\linenumber Undefined cross reference `#1'.}% 4736 1.1 christos \else 4737 1.1 christos \ifwarnedxrefs\else 4738 1.1 christos \global\warnedxrefstrue 4739 1.1 christos \message{Cross reference values unknown; you must run TeX again.}% 4740 1.1 christos \fi 4741 1.1 christos \fi 4742 1.1 christos \fi 4743 1.1 christos \else 4744 1.1 christos % It's defined, so just use it. 4745 1.1 christos \csname X#1\endcsname 4746 1.1 christos \fi 4747 1.1 christos #2% Output the suffix in any case. 4748 1.1 christos } 4749 1.1 christos 4750 1.1 christos % This is the macro invoked by entries in the aux file. 4751 1.1 christos % 4752 1.1 christos \def\xrdef#1{\begingroup 4753 1.1 christos % Reenable \ as an escape while reading the second argument. 4754 1.1 christos \catcode`\\ = 0 4755 1.1 christos \afterassignment\endgroup 4756 1.1 christos \expandafter\gdef\csname X#1\endcsname 4757 1.1 christos } 4758 1.1 christos 4759 1.1 christos % Read the last existing aux file, if any. No error if none exists. 4760 1.1 christos \def\readauxfile{\begingroup 4761 1.1 christos \catcode`\^^@=\other 4762 1.1 christos \catcode`\^^A=\other 4763 1.1 christos \catcode`\^^B=\other 4764 1.1 christos \catcode`\^^C=\other 4765 1.1 christos \catcode`\^^D=\other 4766 1.1 christos \catcode`\^^E=\other 4767 1.1 christos \catcode`\^^F=\other 4768 1.1 christos \catcode`\^^G=\other 4769 1.1 christos \catcode`\^^H=\other 4770 1.1 christos \catcode`\^^K=\other 4771 1.1 christos \catcode`\^^L=\other 4772 1.1 christos \catcode`\^^N=\other 4773 1.1 christos \catcode`\^^P=\other 4774 1.1 christos \catcode`\^^Q=\other 4775 1.1 christos \catcode`\^^R=\other 4776 1.1 christos \catcode`\^^S=\other 4777 1.1 christos \catcode`\^^T=\other 4778 1.1 christos \catcode`\^^U=\other 4779 1.1 christos \catcode`\^^V=\other 4780 1.1 christos \catcode`\^^W=\other 4781 1.1 christos \catcode`\^^X=\other 4782 1.1 christos \catcode`\^^Z=\other 4783 1.1 christos \catcode`\^^[=\other 4784 1.1 christos \catcode`\^^\=\other 4785 1.1 christos \catcode`\^^]=\other 4786 1.1 christos \catcode`\^^^=\other 4787 1.1 christos \catcode`\^^_=\other 4788 1.1 christos \catcode`\@=\other 4789 1.1 christos \catcode`\^=\other 4790 1.1 christos % It was suggested to define this as 7, which would allow ^^e4 etc. 4791 1.1 christos % in xref tags, i.e., node names. But since ^^e4 notation isn't 4792 1.1 christos % supported in the main text, it doesn't seem desirable. Furthermore, 4793 1.1 christos % that is not enough: for node names that actually contain a ^ 4794 1.1 christos % character, we would end up writing a line like this: 'xrdef {'hat 4795 1.1 christos % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first 4796 1.1 christos % argument, and \hat is not an expandable control sequence. It could 4797 1.1 christos % all be worked out, but why? Either we support ^^ or we don't. 4798 1.1 christos % 4799 1.1 christos % The other change necessary for this was to define \auxhat: 4800 1.1 christos % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter 4801 1.1 christos % and then to call \auxhat in \setq. 4802 1.1 christos % 4803 1.1 christos \catcode`\~=\other 4804 1.1 christos \catcode`\[=\other 4805 1.1 christos \catcode`\]=\other 4806 1.1 christos \catcode`\"=\other 4807 1.1 christos \catcode`\_=\other 4808 1.1 christos \catcode`\|=\other 4809 1.1 christos \catcode`\<=\other 4810 1.1 christos \catcode`\>=\other 4811 1.1 christos \catcode`\$=\other 4812 1.1 christos \catcode`\#=\other 4813 1.1 christos \catcode`\&=\other 4814 1.1 christos \catcode`+=\other % avoid \+ for paranoia even though we've turned it off 4815 1.1 christos % Make the characters 128-255 be printing characters 4816 1.1 christos {% 4817 1.1 christos \count 1=128 4818 1.1 christos \def\loop{% 4819 1.1 christos \catcode\count 1=\other 4820 1.1 christos \advance\count 1 by 1 4821 1.1 christos \ifnum \count 1<256 \loop \fi 4822 1.1 christos }% 4823 1.1 christos }% 4824 1.1 christos % The aux file uses ' as the escape (for now). 4825 1.1 christos % Turn off \ as an escape so we do not lose on 4826 1.1 christos % entries which were dumped with control sequences in their names. 4827 1.1 christos % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ 4828 1.1 christos % Reference to such entries still does not work the way one would wish, 4829 1.1 christos % but at least they do not bomb out when the aux file is read in. 4830 1.1 christos \catcode`\{=1 4831 1.1 christos \catcode`\}=2 4832 1.1 christos \catcode`\%=\other 4833 1.1 christos \catcode`\'=0 4834 1.1 christos \catcode`\\=\other 4835 1.1 christos % 4836 1.1 christos \openin 1 \jobname.aux 4837 1.1 christos \ifeof 1 \else 4838 1.1 christos \closein 1 4839 1.1 christos \input \jobname.aux 4840 1.1 christos \global\havexrefstrue 4841 1.1 christos \global\warnedobstrue 4842 1.1 christos \fi 4843 1.1 christos % Open the new aux file. TeX will close it automatically at exit. 4844 1.1 christos \openout\auxfile=\jobname.aux 4845 1.1 christos \endgroup} 4846 1.1 christos 4847 1.1 christos 4848 1.1 christos % Footnotes. 4849 1.1 christos 4850 1.1 christos \newcount \footnoteno 4851 1.1 christos 4852 1.1 christos % The trailing space in the following definition for supereject is 4853 1.1 christos % vital for proper filling; pages come out unaligned when you do a 4854 1.1 christos % pagealignmacro call if that space before the closing brace is 4855 1.1 christos % removed. (Generally, numeric constants should always be followed by a 4856 1.1 christos % space to prevent strange expansion errors.) 4857 1.1 christos \def\supereject{\par\penalty -20000\footnoteno =0 } 4858 1.1 christos 4859 1.1 christos % @footnotestyle is meaningful for info output only. 4860 1.1 christos \let\footnotestyle=\comment 4861 1.1 christos 4862 1.1 christos \let\ptexfootnote=\footnote 4863 1.1 christos 4864 1.1 christos {\catcode `\@=11 4865 1.1 christos % 4866 1.1 christos % Auto-number footnotes. Otherwise like plain. 4867 1.1 christos \gdef\footnote{% 4868 1.1 christos \global\advance\footnoteno by \@ne 4869 1.1 christos \edef\thisfootno{$^{\the\footnoteno}$}% 4870 1.1 christos % 4871 1.1 christos % In case the footnote comes at the end of a sentence, preserve the 4872 1.1 christos % extra spacing after we do the footnote number. 4873 1.1 christos \let\@sf\empty 4874 1.1 christos \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi 4875 1.1 christos % 4876 1.1 christos % Remove inadvertent blank space before typesetting the footnote number. 4877 1.1 christos \unskip 4878 1.1 christos \thisfootno\@sf 4879 1.1 christos \footnotezzz 4880 1.1 christos }% 4881 1.1 christos 4882 1.1 christos % Don't bother with the trickery in plain.tex to not require the 4883 1.1 christos % footnote text as a parameter. Our footnotes don't need to be so general. 4884 1.1 christos % 4885 1.1 christos % Oh yes, they do; otherwise, @ifset and anything else that uses 4886 1.1 christos % \parseargline fail inside footnotes because the tokens are fixed when 4887 1.1 christos % the footnote is read. --karl, 16nov96. 4888 1.1 christos % 4889 1.1 christos \long\gdef\footnotezzz{\insert\footins\bgroup 4890 1.1 christos % We want to typeset this text as a normal paragraph, even if the 4891 1.1 christos % footnote reference occurs in (for example) a display environment. 4892 1.1 christos % So reset some parameters. 4893 1.1 christos \interlinepenalty\interfootnotelinepenalty 4894 1.1 christos \splittopskip\ht\strutbox % top baseline for broken footnotes 4895 1.1 christos \splitmaxdepth\dp\strutbox 4896 1.1 christos \floatingpenalty\@MM 4897 1.1 christos \leftskip\z@skip 4898 1.1 christos \rightskip\z@skip 4899 1.1 christos \spaceskip\z@skip 4900 1.1 christos \xspaceskip\z@skip 4901 1.1 christos \parindent\defaultparindent 4902 1.1 christos % 4903 1.1 christos % Hang the footnote text off the number. 4904 1.1 christos \hang 4905 1.1 christos \textindent{\thisfootno}% 4906 1.1 christos % 4907 1.1 christos % Don't crash into the line above the footnote text. Since this 4908 1.1 christos % expands into a box, it must come within the paragraph, lest it 4909 1.1 christos % provide a place where TeX can split the footnote. 4910 1.1 christos \footstrut 4911 1.1 christos \futurelet\next\fo@t 4912 1.1 christos } 4913 1.1 christos \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t 4914 1.1 christos \else\let\next\f@t\fi \next} 4915 1.1 christos \def\f@@t{\bgroup\aftergroup\@foot\let\next} 4916 1.1 christos \def\f@t#1{#1\@foot} 4917 1.1 christos \def\@foot{\strut\egroup} 4918 1.1 christos 4919 1.1 christos }%end \catcode `\@=11 4920 1.1 christos 4921 1.1 christos % Set the baselineskip to #1, and the lineskip and strut size 4922 1.1 christos % correspondingly. There is no deep meaning behind these magic numbers 4923 1.1 christos % used as factors; they just match (closely enough) what Knuth defined. 4924 1.1 christos % 4925 1.1 christos \def\lineskipfactor{.08333} 4926 1.1 christos \def\strutheightpercent{.70833} 4927 1.1 christos \def\strutdepthpercent {.29167} 4928 1.1 christos % 4929 1.1 christos \def\setleading#1{% 4930 1.1 christos \normalbaselineskip = #1\relax 4931 1.1 christos \normallineskip = \lineskipfactor\normalbaselineskip 4932 1.1 christos \normalbaselines 4933 1.1 christos \setbox\strutbox =\hbox{% 4934 1.1 christos \vrule width0pt height\strutheightpercent\baselineskip 4935 1.1 christos depth \strutdepthpercent \baselineskip 4936 1.1 christos }% 4937 1.1 christos } 4938 1.1 christos 4939 1.1 christos % @| inserts a changebar to the left of the current line. It should 4940 1.1 christos % surround any changed text. This approach does *not* work if the 4941 1.1 christos % change spans more than two lines of output. To handle that, we would 4942 1.1 christos % have adopt a much more difficult approach (putting marks into the main 4943 1.1 christos % vertical list for the beginning and end of each change). 4944 1.1 christos % 4945 1.1 christos \def\|{% 4946 1.1 christos % \vadjust can only be used in horizontal mode. 4947 1.1 christos \leavevmode 4948 1.1 christos % 4949 1.1 christos % Append this vertical mode material after the current line in the output. 4950 1.1 christos \vadjust{% 4951 1.1 christos % We want to insert a rule with the height and depth of the current 4952 1.1 christos % leading; that is exactly what \strutbox is supposed to record. 4953 1.1 christos \vskip-\baselineskip 4954 1.1 christos % 4955 1.1 christos % \vadjust-items are inserted at the left edge of the type. So 4956 1.1 christos % the \llap here moves out into the left-hand margin. 4957 1.1 christos \llap{% 4958 1.1 christos % 4959 1.1 christos % For a thicker or thinner bar, change the `1pt'. 4960 1.1 christos \vrule height\baselineskip width1pt 4961 1.1 christos % 4962 1.1 christos % This is the space between the bar and the text. 4963 1.1 christos \hskip 12pt 4964 1.1 christos }% 4965 1.1 christos }% 4966 1.1 christos } 4967 1.1 christos 4968 1.1 christos % For a final copy, take out the rectangles 4969 1.1 christos % that mark overfull boxes (in case you have decided 4970 1.1 christos % that the text looks ok even though it passes the margin). 4971 1.1 christos % 4972 1.1 christos \def\finalout{\overfullrule=0pt} 4973 1.1 christos 4974 1.1 christos % @image. We use the macros from epsf.tex to support this. 4975 1.1 christos % If epsf.tex is not installed and @image is used, we complain. 4976 1.1 christos % 4977 1.1 christos % Check for and read epsf.tex up front. If we read it only at @image 4978 1.1 christos % time, we might be inside a group, and then its definitions would get 4979 1.1 christos % undone and the next image would fail. 4980 1.1 christos \openin 1 = epsf.tex 4981 1.1 christos \ifeof 1 \else 4982 1.1 christos \closein 1 4983 1.1 christos % Do not bother showing banner with post-v2.7 epsf.tex (available in 4984 1.1 christos % doc/epsf.tex until it shows up on ctan). 4985 1.1 christos \def\epsfannounce{\toks0 = }% 4986 1.1 christos \input epsf.tex 4987 1.1 christos \fi 4988 1.1 christos % 4989 1.1 christos \newif\ifwarnednoepsf 4990 1.1 christos \newhelp\noepsfhelp{epsf.tex must be installed for images to 4991 1.1 christos work. It is also included in the Texinfo distribution, or you can get 4992 1.1 christos it from ftp://ftp.tug.org/tex/epsf.tex.} 4993 1.1 christos % 4994 1.1 christos % Only complain once about lack of epsf.tex. 4995 1.1 christos \def\image#1{% 4996 1.1 christos \ifx\epsfbox\undefined 4997 1.1 christos \ifwarnednoepsf \else 4998 1.1 christos \errhelp = \noepsfhelp 4999 1.1 christos \errmessage{epsf.tex not found, images will be ignored}% 5000 1.1 christos \global\warnednoepsftrue 5001 1.1 christos \fi 5002 1.1 christos \else 5003 1.1 christos \imagexxx #1,,,\finish 5004 1.1 christos \fi 5005 1.1 christos } 5006 1.1 christos % 5007 1.1 christos % Arguments to @image: 5008 1.1 christos % #1 is (mandatory) image filename; we tack on .eps extension. 5009 1.1 christos % #2 is (optional) width, #3 is (optional) height. 5010 1.1 christos % #4 is just the usual extra ignored arg for parsing this stuff. 5011 1.1 christos \def\imagexxx#1,#2,#3,#4\finish{% 5012 1.1 christos % \epsfbox itself resets \epsf?size at each figure. 5013 1.1 christos \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi 5014 1.1 christos \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi 5015 1.1 christos % If the image is by itself, center it. 5016 1.1 christos \ifvmode 5017 1.1 christos \centerline{\epsfbox{#1.eps}}% 5018 1.1 christos \else 5019 1.1 christos \epsfbox{#1.eps}% 5020 1.1 christos \fi 5021 1.1 christos } 5022 1.1 christos 5023 1.1 christos % End of control word definitions. 5024 1.1 christos 5025 1.1 christos 5026 1.1 christos \message{and turning on texinfo input format.} 5027 1.1 christos 5028 1.1 christos \def\openindices{% 5029 1.1 christos \newindex{cp}% 5030 1.1 christos \newcodeindex{fn}% 5031 1.1 christos \newcodeindex{vr}% 5032 1.1 christos \newcodeindex{tp}% 5033 1.1 christos \newcodeindex{ky}% 5034 1.1 christos \newcodeindex{pg}% 5035 1.1 christos } 5036 1.1 christos 5037 1.1 christos % Set some numeric style parameters, for 8.5 x 11 format. 5038 1.1 christos 5039 1.1 christos \hsize = 6in 5040 1.1 christos \hoffset = .25in 5041 1.1 christos \newdimen\defaultparindent \defaultparindent = 15pt 5042 1.1 christos \parindent = \defaultparindent 5043 1.1 christos \parskip 3pt plus 2pt minus 1pt 5044 1.1 christos \setleading{13.2pt} 5045 1.1 christos \advance\topskip by 1.2cm 5046 1.1 christos 5047 1.1 christos \chapheadingskip = 15pt plus 4pt minus 2pt 5048 1.1 christos \secheadingskip = 12pt plus 3pt minus 2pt 5049 1.1 christos \subsecheadingskip = 9pt plus 2pt minus 2pt 5050 1.1 christos 5051 1.1 christos % Prevent underfull vbox error messages. 5052 1.1 christos \vbadness=10000 5053 1.1 christos 5054 1.1 christos % Following George Bush, just get rid of widows and orphans. 5055 1.1 christos \widowpenalty=10000 5056 1.1 christos \clubpenalty=10000 5057 1.1 christos 5058 1.1 christos % Use TeX 3.0's \emergencystretch to help line breaking, but if we're 5059 1.1 christos % using an old version of TeX, don't do anything. We want the amount of 5060 1.1 christos % stretch added to depend on the line length, hence the dependence on 5061 1.1 christos % \hsize. This makes it come to about 9pt for the 8.5x11 format. 5062 1.1 christos % 5063 1.1 christos \ifx\emergencystretch\thisisundefined 5064 1.1 christos % Allow us to assign to \emergencystretch anyway. 5065 1.1 christos \def\emergencystretch{\dimen0}% 5066 1.1 christos \else 5067 1.1 christos \emergencystretch = \hsize 5068 1.1 christos \divide\emergencystretch by 45 5069 1.1 christos \fi 5070 1.1 christos 5071 1.1 christos % Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25) 5072 1.1 christos \def\smallbook{ 5073 1.1 christos \global\chapheadingskip = 15pt plus 4pt minus 2pt 5074 1.1 christos \global\secheadingskip = 12pt plus 3pt minus 2pt 5075 1.1 christos \global\subsecheadingskip = 9pt plus 2pt minus 2pt 5076 1.1 christos % 5077 1.1 christos \global\lispnarrowing = 0.3in 5078 1.1 christos \setleading{12pt} 5079 1.1 christos \advance\topskip by -1cm 5080 1.1 christos \global\parskip 2pt plus 1pt 5081 1.1 christos \global\hsize = 5in 5082 1.1 christos \global\vsize=7.5in 5083 1.1 christos \global\tolerance=700 5084 1.1 christos \global\hfuzz=1pt 5085 1.1 christos \global\contentsrightmargin=0pt 5086 1.1 christos \global\deftypemargin=0pt 5087 1.1 christos \global\defbodyindent=.5cm 5088 1.1 christos % 5089 1.1 christos \global\pagewidth=\hsize 5090 1.1 christos \global\pageheight=\vsize 5091 1.1 christos % 5092 1.1 christos \global\let\smalllisp=\smalllispx 5093 1.1 christos \global\let\smallexample=\smalllispx 5094 1.1 christos \global\def\Esmallexample{\Esmalllisp} 5095 1.1 christos } 5096 1.1 christos 5097 1.1 christos % Use @afourpaper to print on European A4 paper. 5098 1.1 christos \def\afourpaper{ 5099 1.1 christos \global\tolerance=700 5100 1.1 christos \global\hfuzz=1pt 5101 1.1 christos \setleading{12pt} 5102 1.1 christos \global\parskip 15pt plus 1pt 5103 1.1 christos 5104 1.1 christos \global\vsize= 53\baselineskip 5105 1.1 christos \advance\vsize by \topskip 5106 1.1 christos %\global\hsize= 5.85in % A4 wide 10pt 5107 1.1 christos \global\hsize= 6.5in 5108 1.1 christos \global\outerhsize=\hsize 5109 1.1 christos \global\advance\outerhsize by 0.5in 5110 1.1 christos \global\outervsize=\vsize 5111 1.1 christos \global\advance\outervsize by 0.6in 5112 1.1 christos 5113 1.1 christos \global\pagewidth=\hsize 5114 1.1 christos \global\pageheight=\vsize 5115 1.1 christos } 5116 1.1 christos 5117 1.1 christos \bindingoffset=0pt 5118 1.1 christos \normaloffset=\hoffset 5119 1.1 christos \pagewidth=\hsize 5120 1.1 christos \pageheight=\vsize 5121 1.1 christos 5122 1.1 christos % Allow control of the text dimensions. Parameters in order: textheight; 5123 1.1 christos % textwidth; voffset; hoffset; binding offset; topskip. 5124 1.1 christos % All require a dimension; 5125 1.1 christos % header is additional; added length extends the bottom of the page. 5126 1.1 christos 5127 1.1 christos \def\changepagesizes#1#2#3#4#5#6{ 5128 1.1 christos \global\vsize= #1 5129 1.1 christos \global\topskip= #6 5130 1.1 christos \advance\vsize by \topskip 5131 1.1 christos \global\voffset= #3 5132 1.1 christos \global\hsize= #2 5133 1.1 christos \global\outerhsize=\hsize 5134 1.1 christos \global\advance\outerhsize by 0.5in 5135 1.1 christos \global\outervsize=\vsize 5136 1.1 christos \global\advance\outervsize by 0.6in 5137 1.1 christos \global\pagewidth=\hsize 5138 1.1 christos \global\pageheight=\vsize 5139 1.1 christos \global\normaloffset= #4 5140 1.1 christos \global\bindingoffset= #5} 5141 1.1 christos 5142 1.1 christos % A specific text layout, 24x15cm overall, intended for A4 paper. Top margin 5143 1.1 christos % 29mm, hence bottom margin 28mm, nominal side margin 3cm. 5144 1.1 christos \def\afourlatex 5145 1.1 christos {\global\tolerance=700 5146 1.1 christos \global\hfuzz=1pt 5147 1.1 christos \setleading{12pt} 5148 1.1 christos \global\parskip 15pt plus 1pt 5149 1.1 christos \advance\baselineskip by 1.6pt 5150 1.1 christos \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm} 5151 1.1 christos } 5152 1.1 christos 5153 1.1 christos % Use @afourwide to print on European A4 paper in wide format. 5154 1.1 christos \def\afourwide{\afourpaper 5155 1.1 christos \changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}} 5156 1.1 christos 5157 1.1 christos % Define macros to output various characters with catcode for normal text. 5158 1.1 christos \catcode`\"=\other 5159 1.1 christos \catcode`\~=\other 5160 1.1 christos \catcode`\^=\other 5161 1.1 christos \catcode`\_=\other 5162 1.1 christos \catcode`\|=\other 5163 1.1 christos \catcode`\<=\other 5164 1.1 christos \catcode`\>=\other 5165 1.1 christos \catcode`\+=\other 5166 1.1 christos \def\normaldoublequote{"} 5167 1.1 christos \def\normaltilde{~} 5168 1.1 christos \def\normalcaret{^} 5169 1.1 christos \def\normalunderscore{_} 5170 1.1 christos \def\normalverticalbar{|} 5171 1.1 christos \def\normalless{<} 5172 1.1 christos \def\normalgreater{>} 5173 1.1 christos \def\normalplus{+} 5174 1.1 christos 5175 1.1 christos % This macro is used to make a character print one way in ttfont 5176 1.1 christos % where it can probably just be output, and another way in other fonts, 5177 1.1 christos % where something hairier probably needs to be done. 5178 1.1 christos % 5179 1.1 christos % #1 is what to print if we are indeed using \tt; #2 is what to print 5180 1.1 christos % otherwise. Since all the Computer Modern typewriter fonts have zero 5181 1.1 christos % interword stretch (and shrink), and it is reasonable to expect all 5182 1.1 christos % typewriter fonts to have this, we can check that font parameter. 5183 1.1 christos % 5184 1.1 christos \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi} 5185 1.1 christos 5186 1.1 christos % Turn off all special characters except @ 5187 1.1 christos % (and those which the user can use as if they were ordinary). 5188 1.1 christos % Most of these we simply print from the \tt font, but for some, we can 5189 1.1 christos % use math or other variants that look better in normal text. 5190 1.1 christos 5191 1.1 christos \catcode`\"=\active 5192 1.1 christos \def\activedoublequote{{\tt\char34}} 5193 1.1 christos \let"=\activedoublequote 5194 1.1 christos \catcode`\~=\active 5195 1.1 christos \def~{{\tt\char126}} 5196 1.1 christos \chardef\hat=`\^ 5197 1.1 christos \catcode`\^=\active 5198 1.1 christos \def^{{\tt \hat}} 5199 1.1 christos 5200 1.1 christos \catcode`\_=\active 5201 1.1 christos \def_{\ifusingtt\normalunderscore\_} 5202 1.1 christos % Subroutine for the previous macro. 5203 1.1 christos \def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} 5204 1.1 christos 5205 1.1 christos \catcode`\|=\active 5206 1.1 christos \def|{{\tt\char124}} 5207 1.1 christos \chardef \less=`\< 5208 1.1 christos \catcode`\<=\active 5209 1.1 christos \def<{{\tt \less}} 5210 1.1 christos \chardef \gtr=`\> 5211 1.1 christos \catcode`\>=\active 5212 1.1 christos \def>{{\tt \gtr}} 5213 1.1 christos \catcode`\+=\active 5214 1.1 christos \def+{{\tt \char 43}} 5215 1.1 christos %\catcode 27=\active 5216 1.1 christos %\def^^[{$\diamondsuit$} 5217 1.1 christos 5218 1.1 christos % Set up an active definition for =, but don't enable it most of the time. 5219 1.1 christos {\catcode`\==\active 5220 1.1 christos \global\def={{\tt \char 61}}} 5221 1.1 christos 5222 1.1 christos \catcode`+=\active 5223 1.1 christos \catcode`\_=\active 5224 1.1 christos 5225 1.1 christos % If a .fmt file is being used, characters that might appear in a file 5226 1.1 christos % name cannot be active until we have parsed the command line. 5227 1.1 christos % So turn them off again, and have \everyjob (or @setfilename) turn them on. 5228 1.1 christos % \otherifyactive is called near the end of this file. 5229 1.1 christos \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} 5230 1.1 christos 5231 1.1 christos \catcode`\@=0 5232 1.1 christos 5233 1.1 christos % \rawbackslashxx output one backslash character in current font 5234 1.1 christos \global\chardef\rawbackslashxx=`\\ 5235 1.1 christos %{\catcode`\\=\other 5236 1.1 christos %@gdef@rawbackslashxx{\}} 5237 1.1 christos 5238 1.1 christos % \rawbackslash redefines \ as input to do \rawbackslashxx. 5239 1.1 christos {\catcode`\\=\active 5240 1.1 christos @gdef@rawbackslash{@let\=@rawbackslashxx }} 5241 1.1 christos 5242 1.1 christos % \normalbackslash outputs one backslash in fixed width font. 5243 1.1 christos \def\normalbackslash{{\tt\rawbackslashxx}} 5244 1.1 christos 5245 1.1 christos % Say @foo, not \foo, in error messages. 5246 1.1 christos \escapechar=`\@ 5247 1.1 christos 5248 1.1 christos % \catcode 17=0 % Define control-q 5249 1.1 christos \catcode`\\=\active 5250 1.1 christos 5251 1.1 christos % Used sometimes to turn off (effectively) the active characters 5252 1.1 christos % even after parsing them. 5253 1.1 christos @def@turnoffactive{@let"=@normaldoublequote 5254 1.1 christos @let\=@realbackslash 5255 1.1 christos @let~=@normaltilde 5256 1.1 christos @let^=@normalcaret 5257 1.1 christos @let_=@normalunderscore 5258 1.1 christos @let|=@normalverticalbar 5259 1.1 christos @let<=@normalless 5260 1.1 christos @let>=@normalgreater 5261 1.1 christos @let+=@normalplus} 5262 1.1 christos 5263 1.1 christos @def@normalturnoffactive{@let"=@normaldoublequote 5264 1.1 christos @let\=@normalbackslash 5265 1.1 christos @let~=@normaltilde 5266 1.1 christos @let^=@normalcaret 5267 1.1 christos @let_=@normalunderscore 5268 1.1 christos @let|=@normalverticalbar 5269 1.1 christos @let<=@normalless 5270 1.1 christos @let>=@normalgreater 5271 1.1 christos @let+=@normalplus} 5272 1.1 christos 5273 1.1 christos % Make _ and + \other characters, temporarily. 5274 1.1 christos % This is canceled by @fixbackslash. 5275 1.1 christos @otherifyactive 5276 1.1 christos 5277 1.1 christos % If a .fmt file is being used, we don't want the `\input texinfo' to show up. 5278 1.1 christos % That is what \eatinput is for; after that, the `\' should revert to printing 5279 1.1 christos % a backslash. 5280 1.1 christos % 5281 1.1 christos @gdef@eatinput input texinfo{@fixbackslash} 5282 1.1 christos @global@let\ = @eatinput 5283 1.1 christos 5284 1.1 christos % On the other hand, perhaps the file did not have a `\input texinfo'. Then 5285 1.1 christos % the first `\{ in the file would cause an error. This macro tries to fix 5286 1.1 christos % that, assuming it is called before the first `\' could plausibly occur. 5287 1.1 christos % Also back turn on active characters that might appear in the input 5288 1.1 christos % file name, in case not using a pre-dumped format. 5289 1.1 christos % 5290 1.1 christos @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi 5291 1.1 christos @catcode`+=@active @catcode`@_=@active} 5292 1.1 christos 5293 1.1 christos % These look ok in all fonts, so just make them not special. The @rm below 5294 1.1 christos % makes sure that the current font starts out as the newly loaded cmr10 5295 1.1 christos @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other 5296 1.1 christos 5297 1.1 christos @textfonts 5298 1.1 christos @rm 5299 1.1 christos 5300 1.1 christos @c Local variables: 5301 1.1 christos @c page-delimiter: "^\\\\message" 5302 1.1 christos @c End: 5303