annotate src/fftw-3.3.3/doc/texinfo.tex @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 89f5e221ed7b
children
rev   line source
cannam@95 1 % texinfo.tex -- TeX macros to handle Texinfo files.
cannam@95 2 %
cannam@95 3 % Load plain if necessary, i.e., if running under initex.
cannam@95 4 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
cannam@95 5 %
cannam@95 6 \def\texinfoversion{2012-03-11.15}
cannam@95 7 %
cannam@95 8 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
cannam@95 9 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
cannam@95 10 % 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
cannam@95 11 %
cannam@95 12 % This texinfo.tex file is free software: you can redistribute it and/or
cannam@95 13 % modify it under the terms of the GNU General Public License as
cannam@95 14 % published by the Free Software Foundation, either version 3 of the
cannam@95 15 % License, or (at your option) any later version.
cannam@95 16 %
cannam@95 17 % This texinfo.tex file is distributed in the hope that it will be
cannam@95 18 % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
cannam@95 19 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cannam@95 20 % General Public License for more details.
cannam@95 21 %
cannam@95 22 % You should have received a copy of the GNU General Public License
cannam@95 23 % along with this program. If not, see <http://www.gnu.org/licenses/>.
cannam@95 24 %
cannam@95 25 % As a special exception, when this file is read by TeX when processing
cannam@95 26 % a Texinfo source document, you may use the result without
cannam@95 27 % restriction. (This has been our intent since Texinfo was invented.)
cannam@95 28 %
cannam@95 29 % Please try the latest version of texinfo.tex before submitting bug
cannam@95 30 % reports; you can get the latest version from:
cannam@95 31 % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
cannam@95 32 % ftp://tug.org/tex/texinfo.tex
cannam@95 33 % (and all CTAN mirrors, see http://www.ctan.org).
cannam@95 34 % The texinfo.tex in any given distribution could well be out
cannam@95 35 % of date, so if that's what you're using, please check.
cannam@95 36 %
cannam@95 37 % Send bug reports to bug-texinfo@gnu.org. Please include including a
cannam@95 38 % complete document in each bug report with which we can reproduce the
cannam@95 39 % problem. Patches are, of course, greatly appreciated.
cannam@95 40 %
cannam@95 41 % To process a Texinfo manual with TeX, it's most reliable to use the
cannam@95 42 % texi2dvi shell script that comes with the distribution. For a simple
cannam@95 43 % manual foo.texi, however, you can get away with this:
cannam@95 44 % tex foo.texi
cannam@95 45 % texindex foo.??
cannam@95 46 % tex foo.texi
cannam@95 47 % tex foo.texi
cannam@95 48 % dvips foo.dvi -o # or whatever; this makes foo.ps.
cannam@95 49 % The extra TeX runs get the cross-reference information correct.
cannam@95 50 % Sometimes one run after texindex suffices, and sometimes you need more
cannam@95 51 % than two; texi2dvi does it as many times as necessary.
cannam@95 52 %
cannam@95 53 % It is possible to adapt texinfo.tex for other languages, to some
cannam@95 54 % extent. You can get the existing language-specific files from the
cannam@95 55 % full Texinfo distribution.
cannam@95 56 %
cannam@95 57 % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
cannam@95 58
cannam@95 59
cannam@95 60 \message{Loading texinfo [version \texinfoversion]:}
cannam@95 61
cannam@95 62 % If in a .fmt file, print the version number
cannam@95 63 % and turn on active characters that we couldn't do earlier because
cannam@95 64 % they might have appeared in the input file name.
cannam@95 65 \everyjob{\message{[Texinfo version \texinfoversion]}%
cannam@95 66 \catcode`+=\active \catcode`\_=\active}
cannam@95 67
cannam@95 68 \chardef\other=12
cannam@95 69
cannam@95 70 % We never want plain's \outer definition of \+ in Texinfo.
cannam@95 71 % For @tex, we can use \tabalign.
cannam@95 72 \let\+ = \relax
cannam@95 73
cannam@95 74 % Save some plain tex macros whose names we will redefine.
cannam@95 75 \let\ptexb=\b
cannam@95 76 \let\ptexbullet=\bullet
cannam@95 77 \let\ptexc=\c
cannam@95 78 \let\ptexcomma=\,
cannam@95 79 \let\ptexdot=\.
cannam@95 80 \let\ptexdots=\dots
cannam@95 81 \let\ptexend=\end
cannam@95 82 \let\ptexequiv=\equiv
cannam@95 83 \let\ptexexclam=\!
cannam@95 84 \let\ptexfootnote=\footnote
cannam@95 85 \let\ptexgtr=>
cannam@95 86 \let\ptexhat=^
cannam@95 87 \let\ptexi=\i
cannam@95 88 \let\ptexindent=\indent
cannam@95 89 \let\ptexinsert=\insert
cannam@95 90 \let\ptexlbrace=\{
cannam@95 91 \let\ptexless=<
cannam@95 92 \let\ptexnewwrite\newwrite
cannam@95 93 \let\ptexnoindent=\noindent
cannam@95 94 \let\ptexplus=+
cannam@95 95 \let\ptexraggedright=\raggedright
cannam@95 96 \let\ptexrbrace=\}
cannam@95 97 \let\ptexslash=\/
cannam@95 98 \let\ptexstar=\*
cannam@95 99 \let\ptext=\t
cannam@95 100 \let\ptextop=\top
cannam@95 101 {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
cannam@95 102
cannam@95 103 % If this character appears in an error message or help string, it
cannam@95 104 % starts a new line in the output.
cannam@95 105 \newlinechar = `^^J
cannam@95 106
cannam@95 107 % Use TeX 3.0's \inputlineno to get the line number, for better error
cannam@95 108 % messages, but if we're using an old version of TeX, don't do anything.
cannam@95 109 %
cannam@95 110 \ifx\inputlineno\thisisundefined
cannam@95 111 \let\linenumber = \empty % Pre-3.0.
cannam@95 112 \else
cannam@95 113 \def\linenumber{l.\the\inputlineno:\space}
cannam@95 114 \fi
cannam@95 115
cannam@95 116 % Set up fixed words for English if not already set.
cannam@95 117 \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
cannam@95 118 \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
cannam@95 119 \ifx\putworderror\undefined \gdef\putworderror{error}\fi
cannam@95 120 \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
cannam@95 121 \ifx\putwordin\undefined \gdef\putwordin{in}\fi
cannam@95 122 \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
cannam@95 123 \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
cannam@95 124 \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
cannam@95 125 \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
cannam@95 126 \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
cannam@95 127 \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
cannam@95 128 \ifx\putwordof\undefined \gdef\putwordof{of}\fi
cannam@95 129 \ifx\putwordon\undefined \gdef\putwordon{on}\fi
cannam@95 130 \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
cannam@95 131 \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
cannam@95 132 \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
cannam@95 133 \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
cannam@95 134 \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
cannam@95 135 \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
cannam@95 136 \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
cannam@95 137 %
cannam@95 138 \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
cannam@95 139 \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
cannam@95 140 \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
cannam@95 141 \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
cannam@95 142 \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
cannam@95 143 \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
cannam@95 144 \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
cannam@95 145 \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
cannam@95 146 \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
cannam@95 147 \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
cannam@95 148 \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
cannam@95 149 \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
cannam@95 150 %
cannam@95 151 \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
cannam@95 152 \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
cannam@95 153 \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
cannam@95 154 \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
cannam@95 155 \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
cannam@95 156
cannam@95 157 % Since the category of space is not known, we have to be careful.
cannam@95 158 \chardef\spacecat = 10
cannam@95 159 \def\spaceisspace{\catcode`\ =\spacecat}
cannam@95 160
cannam@95 161 % sometimes characters are active, so we need control sequences.
cannam@95 162 \chardef\ampChar = `\&
cannam@95 163 \chardef\colonChar = `\:
cannam@95 164 \chardef\commaChar = `\,
cannam@95 165 \chardef\dashChar = `\-
cannam@95 166 \chardef\dotChar = `\.
cannam@95 167 \chardef\exclamChar= `\!
cannam@95 168 \chardef\hashChar = `\#
cannam@95 169 \chardef\lquoteChar= `\`
cannam@95 170 \chardef\questChar = `\?
cannam@95 171 \chardef\rquoteChar= `\'
cannam@95 172 \chardef\semiChar = `\;
cannam@95 173 \chardef\slashChar = `\/
cannam@95 174 \chardef\underChar = `\_
cannam@95 175
cannam@95 176 % Ignore a token.
cannam@95 177 %
cannam@95 178 \def\gobble#1{}
cannam@95 179
cannam@95 180 % The following is used inside several \edef's.
cannam@95 181 \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
cannam@95 182
cannam@95 183 % Hyphenation fixes.
cannam@95 184 \hyphenation{
cannam@95 185 Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
cannam@95 186 ap-pen-dix bit-map bit-maps
cannam@95 187 data-base data-bases eshell fall-ing half-way long-est man-u-script
cannam@95 188 man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
cannam@95 189 par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
cannam@95 190 spell-ing spell-ings
cannam@95 191 stand-alone strong-est time-stamp time-stamps which-ever white-space
cannam@95 192 wide-spread wrap-around
cannam@95 193 }
cannam@95 194
cannam@95 195 % Margin to add to right of even pages, to left of odd pages.
cannam@95 196 \newdimen\bindingoffset
cannam@95 197 \newdimen\normaloffset
cannam@95 198 \newdimen\pagewidth \newdimen\pageheight
cannam@95 199
cannam@95 200 % For a final copy, take out the rectangles
cannam@95 201 % that mark overfull boxes (in case you have decided
cannam@95 202 % that the text looks ok even though it passes the margin).
cannam@95 203 %
cannam@95 204 \def\finalout{\overfullrule=0pt }
cannam@95 205
cannam@95 206 % Sometimes it is convenient to have everything in the transcript file
cannam@95 207 % and nothing on the terminal. We don't just call \tracingall here,
cannam@95 208 % since that produces some useless output on the terminal. We also make
cannam@95 209 % some effort to order the tracing commands to reduce output in the log
cannam@95 210 % file; cf. trace.sty in LaTeX.
cannam@95 211 %
cannam@95 212 \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
cannam@95 213 \def\loggingall{%
cannam@95 214 \tracingstats2
cannam@95 215 \tracingpages1
cannam@95 216 \tracinglostchars2 % 2 gives us more in etex
cannam@95 217 \tracingparagraphs1
cannam@95 218 \tracingoutput1
cannam@95 219 \tracingmacros2
cannam@95 220 \tracingrestores1
cannam@95 221 \showboxbreadth\maxdimen \showboxdepth\maxdimen
cannam@95 222 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
cannam@95 223 \tracingscantokens1
cannam@95 224 \tracingifs1
cannam@95 225 \tracinggroups1
cannam@95 226 \tracingnesting2
cannam@95 227 \tracingassigns1
cannam@95 228 \fi
cannam@95 229 \tracingcommands3 % 3 gives us more in etex
cannam@95 230 \errorcontextlines16
cannam@95 231 }%
cannam@95 232
cannam@95 233 % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
cannam@95 234 % aren't perfect, it's not the end of the world, being an error message,
cannam@95 235 % after all.
cannam@95 236 %
cannam@95 237 \def\errormsg{\begingroup \indexnofonts \doerrormsg}
cannam@95 238 \def\doerrormsg#1{\errmessage{#1}}
cannam@95 239
cannam@95 240 % add check for \lastpenalty to plain's definitions. If the last thing
cannam@95 241 % we did was a \nobreak, we don't want to insert more space.
cannam@95 242 %
cannam@95 243 \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
cannam@95 244 \removelastskip\penalty-50\smallskip\fi\fi}
cannam@95 245 \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
cannam@95 246 \removelastskip\penalty-100\medskip\fi\fi}
cannam@95 247 \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
cannam@95 248 \removelastskip\penalty-200\bigskip\fi\fi}
cannam@95 249
cannam@95 250 % Do @cropmarks to get crop marks.
cannam@95 251 %
cannam@95 252 \newif\ifcropmarks
cannam@95 253 \let\cropmarks = \cropmarkstrue
cannam@95 254 %
cannam@95 255 % Dimensions to add cropmarks at corners.
cannam@95 256 % Added by P. A. MacKay, 12 Nov. 1986
cannam@95 257 %
cannam@95 258 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
cannam@95 259 \newdimen\cornerlong \cornerlong=1pc
cannam@95 260 \newdimen\cornerthick \cornerthick=.3pt
cannam@95 261 \newdimen\topandbottommargin \topandbottommargin=.75in
cannam@95 262
cannam@95 263 % Output a mark which sets \thischapter, \thissection and \thiscolor.
cannam@95 264 % We dump everything together because we only have one kind of mark.
cannam@95 265 % This works because we only use \botmark / \topmark, not \firstmark.
cannam@95 266 %
cannam@95 267 % A mark contains a subexpression of the \ifcase ... \fi construct.
cannam@95 268 % \get*marks macros below extract the needed part using \ifcase.
cannam@95 269 %
cannam@95 270 % Another complication is to let the user choose whether \thischapter
cannam@95 271 % (\thissection) refers to the chapter (section) in effect at the top
cannam@95 272 % of a page, or that at the bottom of a page. The solution is
cannam@95 273 % described on page 260 of The TeXbook. It involves outputting two
cannam@95 274 % marks for the sectioning macros, one before the section break, and
cannam@95 275 % one after. I won't pretend I can describe this better than DEK...
cannam@95 276 \def\domark{%
cannam@95 277 \toks0=\expandafter{\lastchapterdefs}%
cannam@95 278 \toks2=\expandafter{\lastsectiondefs}%
cannam@95 279 \toks4=\expandafter{\prevchapterdefs}%
cannam@95 280 \toks6=\expandafter{\prevsectiondefs}%
cannam@95 281 \toks8=\expandafter{\lastcolordefs}%
cannam@95 282 \mark{%
cannam@95 283 \the\toks0 \the\toks2
cannam@95 284 \noexpand\or \the\toks4 \the\toks6
cannam@95 285 \noexpand\else \the\toks8
cannam@95 286 }%
cannam@95 287 }
cannam@95 288 % \topmark doesn't work for the very first chapter (after the title
cannam@95 289 % page or the contents), so we use \firstmark there -- this gets us
cannam@95 290 % the mark with the chapter defs, unless the user sneaks in, e.g.,
cannam@95 291 % @setcolor (or @url, or @link, etc.) between @contents and the very
cannam@95 292 % first @chapter.
cannam@95 293 \def\gettopheadingmarks{%
cannam@95 294 \ifcase0\topmark\fi
cannam@95 295 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
cannam@95 296 }
cannam@95 297 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
cannam@95 298 \def\getcolormarks{\ifcase2\topmark\fi}
cannam@95 299
cannam@95 300 % Avoid "undefined control sequence" errors.
cannam@95 301 \def\lastchapterdefs{}
cannam@95 302 \def\lastsectiondefs{}
cannam@95 303 \def\prevchapterdefs{}
cannam@95 304 \def\prevsectiondefs{}
cannam@95 305 \def\lastcolordefs{}
cannam@95 306
cannam@95 307 % Main output routine.
cannam@95 308 \chardef\PAGE = 255
cannam@95 309 \output = {\onepageout{\pagecontents\PAGE}}
cannam@95 310
cannam@95 311 \newbox\headlinebox
cannam@95 312 \newbox\footlinebox
cannam@95 313
cannam@95 314 % \onepageout takes a vbox as an argument. Note that \pagecontents
cannam@95 315 % does insertions, but you have to call it yourself.
cannam@95 316 \def\onepageout#1{%
cannam@95 317 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
cannam@95 318 %
cannam@95 319 \ifodd\pageno \advance\hoffset by \bindingoffset
cannam@95 320 \else \advance\hoffset by -\bindingoffset\fi
cannam@95 321 %
cannam@95 322 % Do this outside of the \shipout so @code etc. will be expanded in
cannam@95 323 % the headline as they should be, not taken literally (outputting ''code).
cannam@95 324 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
cannam@95 325 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
cannam@95 326 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
cannam@95 327 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
cannam@95 328 %
cannam@95 329 {%
cannam@95 330 % Have to do this stuff outside the \shipout because we want it to
cannam@95 331 % take effect in \write's, yet the group defined by the \vbox ends
cannam@95 332 % before the \shipout runs.
cannam@95 333 %
cannam@95 334 \indexdummies % don't expand commands in the output.
cannam@95 335 \normalturnoffactive % \ in index entries must not stay \, e.g., if
cannam@95 336 % the page break happens to be in the middle of an example.
cannam@95 337 % We don't want .vr (or whatever) entries like this:
cannam@95 338 % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
cannam@95 339 % "\acronym" won't work when it's read back in;
cannam@95 340 % it needs to be
cannam@95 341 % {\code {{\tt \backslashcurfont }acronym}
cannam@95 342 \shipout\vbox{%
cannam@95 343 % Do this early so pdf references go to the beginning of the page.
cannam@95 344 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
cannam@95 345 %
cannam@95 346 \ifcropmarks \vbox to \outervsize\bgroup
cannam@95 347 \hsize = \outerhsize
cannam@95 348 \vskip-\topandbottommargin
cannam@95 349 \vtop to0pt{%
cannam@95 350 \line{\ewtop\hfil\ewtop}%
cannam@95 351 \nointerlineskip
cannam@95 352 \line{%
cannam@95 353 \vbox{\moveleft\cornerthick\nstop}%
cannam@95 354 \hfill
cannam@95 355 \vbox{\moveright\cornerthick\nstop}%
cannam@95 356 }%
cannam@95 357 \vss}%
cannam@95 358 \vskip\topandbottommargin
cannam@95 359 \line\bgroup
cannam@95 360 \hfil % center the page within the outer (page) hsize.
cannam@95 361 \ifodd\pageno\hskip\bindingoffset\fi
cannam@95 362 \vbox\bgroup
cannam@95 363 \fi
cannam@95 364 %
cannam@95 365 \unvbox\headlinebox
cannam@95 366 \pagebody{#1}%
cannam@95 367 \ifdim\ht\footlinebox > 0pt
cannam@95 368 % Only leave this space if the footline is nonempty.
cannam@95 369 % (We lessened \vsize for it in \oddfootingyyy.)
cannam@95 370 % The \baselineskip=24pt in plain's \makefootline has no effect.
cannam@95 371 \vskip 24pt
cannam@95 372 \unvbox\footlinebox
cannam@95 373 \fi
cannam@95 374 %
cannam@95 375 \ifcropmarks
cannam@95 376 \egroup % end of \vbox\bgroup
cannam@95 377 \hfil\egroup % end of (centering) \line\bgroup
cannam@95 378 \vskip\topandbottommargin plus1fill minus1fill
cannam@95 379 \boxmaxdepth = \cornerthick
cannam@95 380 \vbox to0pt{\vss
cannam@95 381 \line{%
cannam@95 382 \vbox{\moveleft\cornerthick\nsbot}%
cannam@95 383 \hfill
cannam@95 384 \vbox{\moveright\cornerthick\nsbot}%
cannam@95 385 }%
cannam@95 386 \nointerlineskip
cannam@95 387 \line{\ewbot\hfil\ewbot}%
cannam@95 388 }%
cannam@95 389 \egroup % \vbox from first cropmarks clause
cannam@95 390 \fi
cannam@95 391 }% end of \shipout\vbox
cannam@95 392 }% end of group with \indexdummies
cannam@95 393 \advancepageno
cannam@95 394 \ifnum\outputpenalty>-20000 \else\dosupereject\fi
cannam@95 395 }
cannam@95 396
cannam@95 397 \newinsert\margin \dimen\margin=\maxdimen
cannam@95 398
cannam@95 399 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
cannam@95 400 {\catcode`\@ =11
cannam@95 401 \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
cannam@95 402 % marginal hacks, juha@viisa.uucp (Juha Takala)
cannam@95 403 \ifvoid\margin\else % marginal info is present
cannam@95 404 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
cannam@95 405 \dimen@=\dp#1\relax \unvbox#1\relax
cannam@95 406 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
cannam@95 407 \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
cannam@95 408 }
cannam@95 409
cannam@95 410 % Here are the rules for the cropmarks. Note that they are
cannam@95 411 % offset so that the space between them is truly \outerhsize or \outervsize
cannam@95 412 % (P. A. MacKay, 12 November, 1986)
cannam@95 413 %
cannam@95 414 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
cannam@95 415 \def\nstop{\vbox
cannam@95 416 {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
cannam@95 417 \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
cannam@95 418 \def\nsbot{\vbox
cannam@95 419 {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
cannam@95 420
cannam@95 421 % Parse an argument, then pass it to #1. The argument is the rest of
cannam@95 422 % the input line (except we remove a trailing comment). #1 should be a
cannam@95 423 % macro which expects an ordinary undelimited TeX argument.
cannam@95 424 %
cannam@95 425 \def\parsearg{\parseargusing{}}
cannam@95 426 \def\parseargusing#1#2{%
cannam@95 427 \def\argtorun{#2}%
cannam@95 428 \begingroup
cannam@95 429 \obeylines
cannam@95 430 \spaceisspace
cannam@95 431 #1%
cannam@95 432 \parseargline\empty% Insert the \empty token, see \finishparsearg below.
cannam@95 433 }
cannam@95 434
cannam@95 435 {\obeylines %
cannam@95 436 \gdef\parseargline#1^^M{%
cannam@95 437 \endgroup % End of the group started in \parsearg.
cannam@95 438 \argremovecomment #1\comment\ArgTerm%
cannam@95 439 }%
cannam@95 440 }
cannam@95 441
cannam@95 442 % First remove any @comment, then any @c comment.
cannam@95 443 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
cannam@95 444 \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
cannam@95 445
cannam@95 446 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
cannam@95 447 %
cannam@95 448 % \argremovec might leave us with trailing space, e.g.,
cannam@95 449 % @end itemize @c foo
cannam@95 450 % This space token undergoes the same procedure and is eventually removed
cannam@95 451 % by \finishparsearg.
cannam@95 452 %
cannam@95 453 \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
cannam@95 454 \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
cannam@95 455 \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
cannam@95 456 \def\temp{#3}%
cannam@95 457 \ifx\temp\empty
cannam@95 458 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
cannam@95 459 \let\temp\finishparsearg
cannam@95 460 \else
cannam@95 461 \let\temp\argcheckspaces
cannam@95 462 \fi
cannam@95 463 % Put the space token in:
cannam@95 464 \temp#1 #3\ArgTerm
cannam@95 465 }
cannam@95 466
cannam@95 467 % If a _delimited_ argument is enclosed in braces, they get stripped; so
cannam@95 468 % to get _exactly_ the rest of the line, we had to prevent such situation.
cannam@95 469 % We prepended an \empty token at the very beginning and we expand it now,
cannam@95 470 % just before passing the control to \argtorun.
cannam@95 471 % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
cannam@95 472 % either the null string, or it ends with \^^M---thus there is no danger
cannam@95 473 % that a pair of braces would be stripped.
cannam@95 474 %
cannam@95 475 % But first, we have to remove the trailing space token.
cannam@95 476 %
cannam@95 477 \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
cannam@95 478
cannam@95 479 % \parseargdef\foo{...}
cannam@95 480 % is roughly equivalent to
cannam@95 481 % \def\foo{\parsearg\Xfoo}
cannam@95 482 % \def\Xfoo#1{...}
cannam@95 483 %
cannam@95 484 % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
cannam@95 485 % favourite TeX trick. --kasal, 16nov03
cannam@95 486
cannam@95 487 \def\parseargdef#1{%
cannam@95 488 \expandafter \doparseargdef \csname\string#1\endcsname #1%
cannam@95 489 }
cannam@95 490 \def\doparseargdef#1#2{%
cannam@95 491 \def#2{\parsearg#1}%
cannam@95 492 \def#1##1%
cannam@95 493 }
cannam@95 494
cannam@95 495 % Several utility definitions with active space:
cannam@95 496 {
cannam@95 497 \obeyspaces
cannam@95 498 \gdef\obeyedspace{ }
cannam@95 499
cannam@95 500 % Make each space character in the input produce a normal interword
cannam@95 501 % space in the output. Don't allow a line break at this space, as this
cannam@95 502 % is used only in environments like @example, where each line of input
cannam@95 503 % should produce a line of output anyway.
cannam@95 504 %
cannam@95 505 \gdef\sepspaces{\obeyspaces\let =\tie}
cannam@95 506
cannam@95 507 % If an index command is used in an @example environment, any spaces
cannam@95 508 % therein should become regular spaces in the raw index file, not the
cannam@95 509 % expansion of \tie (\leavevmode \penalty \@M \ ).
cannam@95 510 \gdef\unsepspaces{\let =\space}
cannam@95 511 }
cannam@95 512
cannam@95 513
cannam@95 514 \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
cannam@95 515
cannam@95 516 % Define the framework for environments in texinfo.tex. It's used like this:
cannam@95 517 %
cannam@95 518 % \envdef\foo{...}
cannam@95 519 % \def\Efoo{...}
cannam@95 520 %
cannam@95 521 % It's the responsibility of \envdef to insert \begingroup before the
cannam@95 522 % actual body; @end closes the group after calling \Efoo. \envdef also
cannam@95 523 % defines \thisenv, so the current environment is known; @end checks
cannam@95 524 % whether the environment name matches. The \checkenv macro can also be
cannam@95 525 % used to check whether the current environment is the one expected.
cannam@95 526 %
cannam@95 527 % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
cannam@95 528 % are not treated as environments; they don't open a group. (The
cannam@95 529 % implementation of @end takes care not to call \endgroup in this
cannam@95 530 % special case.)
cannam@95 531
cannam@95 532
cannam@95 533 % At run-time, environments start with this:
cannam@95 534 \def\startenvironment#1{\begingroup\def\thisenv{#1}}
cannam@95 535 % initialize
cannam@95 536 \let\thisenv\empty
cannam@95 537
cannam@95 538 % ... but they get defined via ``\envdef\foo{...}'':
cannam@95 539 \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
cannam@95 540 \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
cannam@95 541
cannam@95 542 % Check whether we're in the right environment:
cannam@95 543 \def\checkenv#1{%
cannam@95 544 \def\temp{#1}%
cannam@95 545 \ifx\thisenv\temp
cannam@95 546 \else
cannam@95 547 \badenverr
cannam@95 548 \fi
cannam@95 549 }
cannam@95 550
cannam@95 551 % Environment mismatch, #1 expected:
cannam@95 552 \def\badenverr{%
cannam@95 553 \errhelp = \EMsimple
cannam@95 554 \errmessage{This command can appear only \inenvironment\temp,
cannam@95 555 not \inenvironment\thisenv}%
cannam@95 556 }
cannam@95 557 \def\inenvironment#1{%
cannam@95 558 \ifx#1\empty
cannam@95 559 outside of any environment%
cannam@95 560 \else
cannam@95 561 in environment \expandafter\string#1%
cannam@95 562 \fi
cannam@95 563 }
cannam@95 564
cannam@95 565 % @end foo executes the definition of \Efoo.
cannam@95 566 % But first, it executes a specialized version of \checkenv
cannam@95 567 %
cannam@95 568 \parseargdef\end{%
cannam@95 569 \if 1\csname iscond.#1\endcsname
cannam@95 570 \else
cannam@95 571 % The general wording of \badenverr may not be ideal.
cannam@95 572 \expandafter\checkenv\csname#1\endcsname
cannam@95 573 \csname E#1\endcsname
cannam@95 574 \endgroup
cannam@95 575 \fi
cannam@95 576 }
cannam@95 577
cannam@95 578 \newhelp\EMsimple{Press RETURN to continue.}
cannam@95 579
cannam@95 580
cannam@95 581 % Be sure we're in horizontal mode when doing a tie, since we make space
cannam@95 582 % equivalent to this in @example-like environments. Otherwise, a space
cannam@95 583 % at the beginning of a line will start with \penalty -- and
cannam@95 584 % since \penalty is valid in vertical mode, we'd end up putting the
cannam@95 585 % penalty on the vertical list instead of in the new paragraph.
cannam@95 586 {\catcode`@ = 11
cannam@95 587 % Avoid using \@M directly, because that causes trouble
cannam@95 588 % if the definition is written into an index file.
cannam@95 589 \global\let\tiepenalty = \@M
cannam@95 590 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
cannam@95 591 }
cannam@95 592
cannam@95 593 % @: forces normal size whitespace following.
cannam@95 594 \def\:{\spacefactor=1000 }
cannam@95 595
cannam@95 596 % @* forces a line break.
cannam@95 597 \def\*{\hfil\break\hbox{}\ignorespaces}
cannam@95 598
cannam@95 599 % @/ allows a line break.
cannam@95 600 \let\/=\allowbreak
cannam@95 601
cannam@95 602 % @. is an end-of-sentence period.
cannam@95 603 \def\.{.\spacefactor=\endofsentencespacefactor\space}
cannam@95 604
cannam@95 605 % @! is an end-of-sentence bang.
cannam@95 606 \def\!{!\spacefactor=\endofsentencespacefactor\space}
cannam@95 607
cannam@95 608 % @? is an end-of-sentence query.
cannam@95 609 \def\?{?\spacefactor=\endofsentencespacefactor\space}
cannam@95 610
cannam@95 611 % @frenchspacing on|off says whether to put extra space after punctuation.
cannam@95 612 %
cannam@95 613 \def\onword{on}
cannam@95 614 \def\offword{off}
cannam@95 615 %
cannam@95 616 \parseargdef\frenchspacing{%
cannam@95 617 \def\temp{#1}%
cannam@95 618 \ifx\temp\onword \plainfrenchspacing
cannam@95 619 \else\ifx\temp\offword \plainnonfrenchspacing
cannam@95 620 \else
cannam@95 621 \errhelp = \EMsimple
cannam@95 622 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
cannam@95 623 \fi\fi
cannam@95 624 }
cannam@95 625
cannam@95 626 % @w prevents a word break. Without the \leavevmode, @w at the
cannam@95 627 % beginning of a paragraph, when TeX is still in vertical mode, would
cannam@95 628 % produce a whole line of output instead of starting the paragraph.
cannam@95 629 \def\w#1{\leavevmode\hbox{#1}}
cannam@95 630
cannam@95 631 % @group ... @end group forces ... to be all on one page, by enclosing
cannam@95 632 % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
cannam@95 633 % to keep its height that of a normal line. According to the rules for
cannam@95 634 % \topskip (p.114 of the TeXbook), the glue inserted is
cannam@95 635 % max (\topskip - \ht (first item), 0). If that height is large,
cannam@95 636 % therefore, no glue is inserted, and the space between the headline and
cannam@95 637 % the text is small, which looks bad.
cannam@95 638 %
cannam@95 639 % Another complication is that the group might be very large. This can
cannam@95 640 % cause the glue on the previous page to be unduly stretched, because it
cannam@95 641 % does not have much material. In this case, it's better to add an
cannam@95 642 % explicit \vfill so that the extra space is at the bottom. The
cannam@95 643 % threshold for doing this is if the group is more than \vfilllimit
cannam@95 644 % percent of a page (\vfilllimit can be changed inside of @tex).
cannam@95 645 %
cannam@95 646 \newbox\groupbox
cannam@95 647 \def\vfilllimit{0.7}
cannam@95 648 %
cannam@95 649 \envdef\group{%
cannam@95 650 \ifnum\catcode`\^^M=\active \else
cannam@95 651 \errhelp = \groupinvalidhelp
cannam@95 652 \errmessage{@group invalid in context where filling is enabled}%
cannam@95 653 \fi
cannam@95 654 \startsavinginserts
cannam@95 655 %
cannam@95 656 \setbox\groupbox = \vtop\bgroup
cannam@95 657 % Do @comment since we are called inside an environment such as
cannam@95 658 % @example, where each end-of-line in the input causes an
cannam@95 659 % end-of-line in the output. We don't want the end-of-line after
cannam@95 660 % the `@group' to put extra space in the output. Since @group
cannam@95 661 % should appear on a line by itself (according to the Texinfo
cannam@95 662 % manual), we don't worry about eating any user text.
cannam@95 663 \comment
cannam@95 664 }
cannam@95 665 %
cannam@95 666 % The \vtop produces a box with normal height and large depth; thus, TeX puts
cannam@95 667 % \baselineskip glue before it, and (when the next line of text is done)
cannam@95 668 % \lineskip glue after it. Thus, space below is not quite equal to space
cannam@95 669 % above. But it's pretty close.
cannam@95 670 \def\Egroup{%
cannam@95 671 % To get correct interline space between the last line of the group
cannam@95 672 % and the first line afterwards, we have to propagate \prevdepth.
cannam@95 673 \endgraf % Not \par, as it may have been set to \lisppar.
cannam@95 674 \global\dimen1 = \prevdepth
cannam@95 675 \egroup % End the \vtop.
cannam@95 676 % \dimen0 is the vertical size of the group's box.
cannam@95 677 \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
cannam@95 678 % \dimen2 is how much space is left on the page (more or less).
cannam@95 679 \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
cannam@95 680 % if the group doesn't fit on the current page, and it's a big big
cannam@95 681 % group, force a page break.
cannam@95 682 \ifdim \dimen0 > \dimen2
cannam@95 683 \ifdim \pagetotal < \vfilllimit\pageheight
cannam@95 684 \page
cannam@95 685 \fi
cannam@95 686 \fi
cannam@95 687 \box\groupbox
cannam@95 688 \prevdepth = \dimen1
cannam@95 689 \checkinserts
cannam@95 690 }
cannam@95 691 %
cannam@95 692 % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
cannam@95 693 % message, so this ends up printing `@group can only ...'.
cannam@95 694 %
cannam@95 695 \newhelp\groupinvalidhelp{%
cannam@95 696 group can only be used in environments such as @example,^^J%
cannam@95 697 where each line of input produces a line of output.}
cannam@95 698
cannam@95 699 % @need space-in-mils
cannam@95 700 % forces a page break if there is not space-in-mils remaining.
cannam@95 701
cannam@95 702 \newdimen\mil \mil=0.001in
cannam@95 703
cannam@95 704 \parseargdef\need{%
cannam@95 705 % Ensure vertical mode, so we don't make a big box in the middle of a
cannam@95 706 % paragraph.
cannam@95 707 \par
cannam@95 708 %
cannam@95 709 % If the @need value is less than one line space, it's useless.
cannam@95 710 \dimen0 = #1\mil
cannam@95 711 \dimen2 = \ht\strutbox
cannam@95 712 \advance\dimen2 by \dp\strutbox
cannam@95 713 \ifdim\dimen0 > \dimen2
cannam@95 714 %
cannam@95 715 % Do a \strut just to make the height of this box be normal, so the
cannam@95 716 % normal leading is inserted relative to the preceding line.
cannam@95 717 % And a page break here is fine.
cannam@95 718 \vtop to #1\mil{\strut\vfil}%
cannam@95 719 %
cannam@95 720 % TeX does not even consider page breaks if a penalty added to the
cannam@95 721 % main vertical list is 10000 or more. But in order to see if the
cannam@95 722 % empty box we just added fits on the page, we must make it consider
cannam@95 723 % page breaks. On the other hand, we don't want to actually break the
cannam@95 724 % page after the empty box. So we use a penalty of 9999.
cannam@95 725 %
cannam@95 726 % There is an extremely small chance that TeX will actually break the
cannam@95 727 % page at this \penalty, if there are no other feasible breakpoints in
cannam@95 728 % sight. (If the user is using lots of big @group commands, which
cannam@95 729 % almost-but-not-quite fill up a page, TeX will have a hard time doing
cannam@95 730 % good page breaking, for example.) However, I could not construct an
cannam@95 731 % example where a page broke at this \penalty; if it happens in a real
cannam@95 732 % document, then we can reconsider our strategy.
cannam@95 733 \penalty9999
cannam@95 734 %
cannam@95 735 % Back up by the size of the box, whether we did a page break or not.
cannam@95 736 \kern -#1\mil
cannam@95 737 %
cannam@95 738 % Do not allow a page break right after this kern.
cannam@95 739 \nobreak
cannam@95 740 \fi
cannam@95 741 }
cannam@95 742
cannam@95 743 % @br forces paragraph break (and is undocumented).
cannam@95 744
cannam@95 745 \let\br = \par
cannam@95 746
cannam@95 747 % @page forces the start of a new page.
cannam@95 748 %
cannam@95 749 \def\page{\par\vfill\supereject}
cannam@95 750
cannam@95 751 % @exdent text....
cannam@95 752 % outputs text on separate line in roman font, starting at standard page margin
cannam@95 753
cannam@95 754 % This records the amount of indent in the innermost environment.
cannam@95 755 % That's how much \exdent should take out.
cannam@95 756 \newskip\exdentamount
cannam@95 757
cannam@95 758 % This defn is used inside fill environments such as @defun.
cannam@95 759 \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
cannam@95 760
cannam@95 761 % This defn is used inside nofill environments such as @example.
cannam@95 762 \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
cannam@95 763 \leftline{\hskip\leftskip{\rm#1}}}}
cannam@95 764
cannam@95 765 % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
cannam@95 766 % paragraph. For more general purposes, use the \margin insertion
cannam@95 767 % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
cannam@95 768 %
cannam@95 769 \newskip\inmarginspacing \inmarginspacing=1cm
cannam@95 770 \def\strutdepth{\dp\strutbox}
cannam@95 771 %
cannam@95 772 \def\doinmargin#1#2{\strut\vadjust{%
cannam@95 773 \nobreak
cannam@95 774 \kern-\strutdepth
cannam@95 775 \vtop to \strutdepth{%
cannam@95 776 \baselineskip=\strutdepth
cannam@95 777 \vss
cannam@95 778 % if you have multiple lines of stuff to put here, you'll need to
cannam@95 779 % make the vbox yourself of the appropriate size.
cannam@95 780 \ifx#1l%
cannam@95 781 \llap{\ignorespaces #2\hskip\inmarginspacing}%
cannam@95 782 \else
cannam@95 783 \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
cannam@95 784 \fi
cannam@95 785 \null
cannam@95 786 }%
cannam@95 787 }}
cannam@95 788 \def\inleftmargin{\doinmargin l}
cannam@95 789 \def\inrightmargin{\doinmargin r}
cannam@95 790 %
cannam@95 791 % @inmargin{TEXT [, RIGHT-TEXT]}
cannam@95 792 % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
cannam@95 793 % else use TEXT for both).
cannam@95 794 %
cannam@95 795 \def\inmargin#1{\parseinmargin #1,,\finish}
cannam@95 796 \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
cannam@95 797 \setbox0 = \hbox{\ignorespaces #2}%
cannam@95 798 \ifdim\wd0 > 0pt
cannam@95 799 \def\lefttext{#1}% have both texts
cannam@95 800 \def\righttext{#2}%
cannam@95 801 \else
cannam@95 802 \def\lefttext{#1}% have only one text
cannam@95 803 \def\righttext{#1}%
cannam@95 804 \fi
cannam@95 805 %
cannam@95 806 \ifodd\pageno
cannam@95 807 \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
cannam@95 808 \else
cannam@95 809 \def\temp{\inleftmargin\lefttext}%
cannam@95 810 \fi
cannam@95 811 \temp
cannam@95 812 }
cannam@95 813
cannam@95 814 % @| inserts a changebar to the left of the current line. It should
cannam@95 815 % surround any changed text. This approach does *not* work if the
cannam@95 816 % change spans more than two lines of output. To handle that, we would
cannam@95 817 % have adopt a much more difficult approach (putting marks into the main
cannam@95 818 % vertical list for the beginning and end of each change). This command
cannam@95 819 % is not documented, not supported, and doesn't work.
cannam@95 820 %
cannam@95 821 \def\|{%
cannam@95 822 % \vadjust can only be used in horizontal mode.
cannam@95 823 \leavevmode
cannam@95 824 %
cannam@95 825 % Append this vertical mode material after the current line in the output.
cannam@95 826 \vadjust{%
cannam@95 827 % We want to insert a rule with the height and depth of the current
cannam@95 828 % leading; that is exactly what \strutbox is supposed to record.
cannam@95 829 \vskip-\baselineskip
cannam@95 830 %
cannam@95 831 % \vadjust-items are inserted at the left edge of the type. So
cannam@95 832 % the \llap here moves out into the left-hand margin.
cannam@95 833 \llap{%
cannam@95 834 %
cannam@95 835 % For a thicker or thinner bar, change the `1pt'.
cannam@95 836 \vrule height\baselineskip width1pt
cannam@95 837 %
cannam@95 838 % This is the space between the bar and the text.
cannam@95 839 \hskip 12pt
cannam@95 840 }%
cannam@95 841 }%
cannam@95 842 }
cannam@95 843
cannam@95 844 % @include FILE -- \input text of FILE.
cannam@95 845 %
cannam@95 846 \def\include{\parseargusing\filenamecatcodes\includezzz}
cannam@95 847 \def\includezzz#1{%
cannam@95 848 \pushthisfilestack
cannam@95 849 \def\thisfile{#1}%
cannam@95 850 {%
cannam@95 851 \makevalueexpandable % we want to expand any @value in FILE.
cannam@95 852 \turnoffactive % and allow special characters in the expansion
cannam@95 853 \indexnofonts % Allow `@@' and other weird things in file names.
cannam@95 854 \wlog{texinfo.tex: doing @include of #1^^J}%
cannam@95 855 \edef\temp{\noexpand\input #1 }%
cannam@95 856 %
cannam@95 857 % This trickery is to read FILE outside of a group, in case it makes
cannam@95 858 % definitions, etc.
cannam@95 859 \expandafter
cannam@95 860 }\temp
cannam@95 861 \popthisfilestack
cannam@95 862 }
cannam@95 863 \def\filenamecatcodes{%
cannam@95 864 \catcode`\\=\other
cannam@95 865 \catcode`~=\other
cannam@95 866 \catcode`^=\other
cannam@95 867 \catcode`_=\other
cannam@95 868 \catcode`|=\other
cannam@95 869 \catcode`<=\other
cannam@95 870 \catcode`>=\other
cannam@95 871 \catcode`+=\other
cannam@95 872 \catcode`-=\other
cannam@95 873 \catcode`\`=\other
cannam@95 874 \catcode`\'=\other
cannam@95 875 }
cannam@95 876
cannam@95 877 \def\pushthisfilestack{%
cannam@95 878 \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
cannam@95 879 }
cannam@95 880 \def\pushthisfilestackX{%
cannam@95 881 \expandafter\pushthisfilestackY\thisfile\StackTerm
cannam@95 882 }
cannam@95 883 \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
cannam@95 884 \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
cannam@95 885 }
cannam@95 886
cannam@95 887 \def\popthisfilestack{\errthisfilestackempty}
cannam@95 888 \def\errthisfilestackempty{\errmessage{Internal error:
cannam@95 889 the stack of filenames is empty.}}
cannam@95 890 %
cannam@95 891 \def\thisfile{}
cannam@95 892
cannam@95 893 % @center line
cannam@95 894 % outputs that line, centered.
cannam@95 895 %
cannam@95 896 \parseargdef\center{%
cannam@95 897 \ifhmode
cannam@95 898 \let\centersub\centerH
cannam@95 899 \else
cannam@95 900 \let\centersub\centerV
cannam@95 901 \fi
cannam@95 902 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
cannam@95 903 \let\centersub\relax % don't let the definition persist, just in case
cannam@95 904 }
cannam@95 905 \def\centerH#1{{%
cannam@95 906 \hfil\break
cannam@95 907 \advance\hsize by -\leftskip
cannam@95 908 \advance\hsize by -\rightskip
cannam@95 909 \line{#1}%
cannam@95 910 \break
cannam@95 911 }}
cannam@95 912 %
cannam@95 913 \newcount\centerpenalty
cannam@95 914 \def\centerV#1{%
cannam@95 915 % The idea here is the same as in \startdefun, \cartouche, etc.: if
cannam@95 916 % @center is the first thing after a section heading, we need to wipe
cannam@95 917 % out the negative parskip inserted by \sectionheading, but still
cannam@95 918 % prevent a page break here.
cannam@95 919 \centerpenalty = \lastpenalty
cannam@95 920 \ifnum\centerpenalty>10000 \vskip\parskip \fi
cannam@95 921 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
cannam@95 922 \line{\kern\leftskip #1\kern\rightskip}%
cannam@95 923 }
cannam@95 924
cannam@95 925 % @sp n outputs n lines of vertical space
cannam@95 926 %
cannam@95 927 \parseargdef\sp{\vskip #1\baselineskip}
cannam@95 928
cannam@95 929 % @comment ...line which is ignored...
cannam@95 930 % @c is the same as @comment
cannam@95 931 % @ignore ... @end ignore is another way to write a comment
cannam@95 932 %
cannam@95 933 \def\comment{\begingroup \catcode`\^^M=\other%
cannam@95 934 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
cannam@95 935 \commentxxx}
cannam@95 936 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
cannam@95 937 %
cannam@95 938 \let\c=\comment
cannam@95 939
cannam@95 940 % @paragraphindent NCHARS
cannam@95 941 % We'll use ems for NCHARS, close enough.
cannam@95 942 % NCHARS can also be the word `asis' or `none'.
cannam@95 943 % We cannot feasibly implement @paragraphindent asis, though.
cannam@95 944 %
cannam@95 945 \def\asisword{asis} % no translation, these are keywords
cannam@95 946 \def\noneword{none}
cannam@95 947 %
cannam@95 948 \parseargdef\paragraphindent{%
cannam@95 949 \def\temp{#1}%
cannam@95 950 \ifx\temp\asisword
cannam@95 951 \else
cannam@95 952 \ifx\temp\noneword
cannam@95 953 \defaultparindent = 0pt
cannam@95 954 \else
cannam@95 955 \defaultparindent = #1em
cannam@95 956 \fi
cannam@95 957 \fi
cannam@95 958 \parindent = \defaultparindent
cannam@95 959 }
cannam@95 960
cannam@95 961 % @exampleindent NCHARS
cannam@95 962 % We'll use ems for NCHARS like @paragraphindent.
cannam@95 963 % It seems @exampleindent asis isn't necessary, but
cannam@95 964 % I preserve it to make it similar to @paragraphindent.
cannam@95 965 \parseargdef\exampleindent{%
cannam@95 966 \def\temp{#1}%
cannam@95 967 \ifx\temp\asisword
cannam@95 968 \else
cannam@95 969 \ifx\temp\noneword
cannam@95 970 \lispnarrowing = 0pt
cannam@95 971 \else
cannam@95 972 \lispnarrowing = #1em
cannam@95 973 \fi
cannam@95 974 \fi
cannam@95 975 }
cannam@95 976
cannam@95 977 % @firstparagraphindent WORD
cannam@95 978 % If WORD is `none', then suppress indentation of the first paragraph
cannam@95 979 % after a section heading. If WORD is `insert', then do indent at such
cannam@95 980 % paragraphs.
cannam@95 981 %
cannam@95 982 % The paragraph indentation is suppressed or not by calling
cannam@95 983 % \suppressfirstparagraphindent, which the sectioning commands do.
cannam@95 984 % We switch the definition of this back and forth according to WORD.
cannam@95 985 % By default, we suppress indentation.
cannam@95 986 %
cannam@95 987 \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
cannam@95 988 \def\insertword{insert}
cannam@95 989 %
cannam@95 990 \parseargdef\firstparagraphindent{%
cannam@95 991 \def\temp{#1}%
cannam@95 992 \ifx\temp\noneword
cannam@95 993 \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
cannam@95 994 \else\ifx\temp\insertword
cannam@95 995 \let\suppressfirstparagraphindent = \relax
cannam@95 996 \else
cannam@95 997 \errhelp = \EMsimple
cannam@95 998 \errmessage{Unknown @firstparagraphindent option `\temp'}%
cannam@95 999 \fi\fi
cannam@95 1000 }
cannam@95 1001
cannam@95 1002 % Here is how we actually suppress indentation. Redefine \everypar to
cannam@95 1003 % \kern backwards by \parindent, and then reset itself to empty.
cannam@95 1004 %
cannam@95 1005 % We also make \indent itself not actually do anything until the next
cannam@95 1006 % paragraph.
cannam@95 1007 %
cannam@95 1008 \gdef\dosuppressfirstparagraphindent{%
cannam@95 1009 \gdef\indent{%
cannam@95 1010 \restorefirstparagraphindent
cannam@95 1011 \indent
cannam@95 1012 }%
cannam@95 1013 \gdef\noindent{%
cannam@95 1014 \restorefirstparagraphindent
cannam@95 1015 \noindent
cannam@95 1016 }%
cannam@95 1017 \global\everypar = {%
cannam@95 1018 \kern -\parindent
cannam@95 1019 \restorefirstparagraphindent
cannam@95 1020 }%
cannam@95 1021 }
cannam@95 1022
cannam@95 1023 \gdef\restorefirstparagraphindent{%
cannam@95 1024 \global \let \indent = \ptexindent
cannam@95 1025 \global \let \noindent = \ptexnoindent
cannam@95 1026 \global \everypar = {}%
cannam@95 1027 }
cannam@95 1028
cannam@95 1029
cannam@95 1030 % @refill is a no-op.
cannam@95 1031 \let\refill=\relax
cannam@95 1032
cannam@95 1033 % If working on a large document in chapters, it is convenient to
cannam@95 1034 % be able to disable indexing, cross-referencing, and contents, for test runs.
cannam@95 1035 % This is done with @novalidate (before @setfilename).
cannam@95 1036 %
cannam@95 1037 \newif\iflinks \linkstrue % by default we want the aux files.
cannam@95 1038 \let\novalidate = \linksfalse
cannam@95 1039
cannam@95 1040 % @setfilename is done at the beginning of every texinfo file.
cannam@95 1041 % So open here the files we need to have open while reading the input.
cannam@95 1042 % This makes it possible to make a .fmt file for texinfo.
cannam@95 1043 \def\setfilename{%
cannam@95 1044 \fixbackslash % Turn off hack to swallow `\input texinfo'.
cannam@95 1045 \iflinks
cannam@95 1046 \tryauxfile
cannam@95 1047 % Open the new aux file. TeX will close it automatically at exit.
cannam@95 1048 \immediate\openout\auxfile=\jobname.aux
cannam@95 1049 \fi % \openindices needs to do some work in any case.
cannam@95 1050 \openindices
cannam@95 1051 \let\setfilename=\comment % Ignore extra @setfilename cmds.
cannam@95 1052 %
cannam@95 1053 % If texinfo.cnf is present on the system, read it.
cannam@95 1054 % Useful for site-wide @afourpaper, etc.
cannam@95 1055 \openin 1 texinfo.cnf
cannam@95 1056 \ifeof 1 \else \input texinfo.cnf \fi
cannam@95 1057 \closein 1
cannam@95 1058 %
cannam@95 1059 \comment % Ignore the actual filename.
cannam@95 1060 }
cannam@95 1061
cannam@95 1062 % Called from \setfilename.
cannam@95 1063 %
cannam@95 1064 \def\openindices{%
cannam@95 1065 \newindex{cp}%
cannam@95 1066 \newcodeindex{fn}%
cannam@95 1067 \newcodeindex{vr}%
cannam@95 1068 \newcodeindex{tp}%
cannam@95 1069 \newcodeindex{ky}%
cannam@95 1070 \newcodeindex{pg}%
cannam@95 1071 }
cannam@95 1072
cannam@95 1073 % @bye.
cannam@95 1074 \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
cannam@95 1075
cannam@95 1076
cannam@95 1077 \message{pdf,}
cannam@95 1078 % adobe `portable' document format
cannam@95 1079 \newcount\tempnum
cannam@95 1080 \newcount\lnkcount
cannam@95 1081 \newtoks\filename
cannam@95 1082 \newcount\filenamelength
cannam@95 1083 \newcount\pgn
cannam@95 1084 \newtoks\toksA
cannam@95 1085 \newtoks\toksB
cannam@95 1086 \newtoks\toksC
cannam@95 1087 \newtoks\toksD
cannam@95 1088 \newbox\boxA
cannam@95 1089 \newcount\countA
cannam@95 1090 \newif\ifpdf
cannam@95 1091 \newif\ifpdfmakepagedest
cannam@95 1092
cannam@95 1093 % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
cannam@95 1094 % can be set). So we test for \relax and 0 as well as being undefined.
cannam@95 1095 \ifx\pdfoutput\thisisundefined
cannam@95 1096 \else
cannam@95 1097 \ifx\pdfoutput\relax
cannam@95 1098 \else
cannam@95 1099 \ifcase\pdfoutput
cannam@95 1100 \else
cannam@95 1101 \pdftrue
cannam@95 1102 \fi
cannam@95 1103 \fi
cannam@95 1104 \fi
cannam@95 1105
cannam@95 1106 % PDF uses PostScript string constants for the names of xref targets,
cannam@95 1107 % for display in the outlines, and in other places. Thus, we have to
cannam@95 1108 % double any backslashes. Otherwise, a name like "\node" will be
cannam@95 1109 % interpreted as a newline (\n), followed by o, d, e. Not good.
cannam@95 1110 %
cannam@95 1111 % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
cannam@95 1112 % related messages. The final outcome is that it is up to the TeX user
cannam@95 1113 % to double the backslashes and otherwise make the string valid, so
cannam@95 1114 % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
cannam@95 1115 % do this reliably, so we use it.
cannam@95 1116
cannam@95 1117 % #1 is a control sequence in which to do the replacements,
cannam@95 1118 % which we \xdef.
cannam@95 1119 \def\txiescapepdf#1{%
cannam@95 1120 \ifx\pdfescapestring\relax
cannam@95 1121 % No primitive available; should we give a warning or log?
cannam@95 1122 % Many times it won't matter.
cannam@95 1123 \else
cannam@95 1124 % The expandable \pdfescapestring primitive escapes parentheses,
cannam@95 1125 % backslashes, and other special chars.
cannam@95 1126 \xdef#1{\pdfescapestring{#1}}%
cannam@95 1127 \fi
cannam@95 1128 }
cannam@95 1129
cannam@95 1130 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
cannam@95 1131 with PDF output, and none of those formats could be found. (.eps cannot
cannam@95 1132 be supported due to the design of the PDF format; use regular TeX (DVI
cannam@95 1133 output) for that.)}
cannam@95 1134
cannam@95 1135 \ifpdf
cannam@95 1136 %
cannam@95 1137 % Color manipulation macros based on pdfcolor.tex,
cannam@95 1138 % except using rgb instead of cmyk; the latter is said to render as a
cannam@95 1139 % very dark gray on-screen and a very dark halftone in print, instead
cannam@95 1140 % of actual black.
cannam@95 1141 \def\rgbDarkRed{0.50 0.09 0.12}
cannam@95 1142 \def\rgbBlack{0 0 0}
cannam@95 1143 %
cannam@95 1144 % k sets the color for filling (usual text, etc.);
cannam@95 1145 % K sets the color for stroking (thin rules, e.g., normal _'s).
cannam@95 1146 \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
cannam@95 1147 %
cannam@95 1148 % Set color, and create a mark which defines \thiscolor accordingly,
cannam@95 1149 % so that \makeheadline knows which color to restore.
cannam@95 1150 \def\setcolor#1{%
cannam@95 1151 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
cannam@95 1152 \domark
cannam@95 1153 \pdfsetcolor{#1}%
cannam@95 1154 }
cannam@95 1155 %
cannam@95 1156 \def\maincolor{\rgbBlack}
cannam@95 1157 \pdfsetcolor{\maincolor}
cannam@95 1158 \edef\thiscolor{\maincolor}
cannam@95 1159 \def\lastcolordefs{}
cannam@95 1160 %
cannam@95 1161 \def\makefootline{%
cannam@95 1162 \baselineskip24pt
cannam@95 1163 \line{\pdfsetcolor{\maincolor}\the\footline}%
cannam@95 1164 }
cannam@95 1165 %
cannam@95 1166 \def\makeheadline{%
cannam@95 1167 \vbox to 0pt{%
cannam@95 1168 \vskip-22.5pt
cannam@95 1169 \line{%
cannam@95 1170 \vbox to8.5pt{}%
cannam@95 1171 % Extract \thiscolor definition from the marks.
cannam@95 1172 \getcolormarks
cannam@95 1173 % Typeset the headline with \maincolor, then restore the color.
cannam@95 1174 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
cannam@95 1175 }%
cannam@95 1176 \vss
cannam@95 1177 }%
cannam@95 1178 \nointerlineskip
cannam@95 1179 }
cannam@95 1180 %
cannam@95 1181 %
cannam@95 1182 \pdfcatalog{/PageMode /UseOutlines}
cannam@95 1183 %
cannam@95 1184 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
cannam@95 1185 \def\dopdfimage#1#2#3{%
cannam@95 1186 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
cannam@95 1187 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
cannam@95 1188 %
cannam@95 1189 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
cannam@95 1190 % others). Let's try in that order, PDF first since if
cannam@95 1191 % someone has a scalable image, presumably better to use that than a
cannam@95 1192 % bitmap.
cannam@95 1193 \let\pdfimgext=\empty
cannam@95 1194 \begingroup
cannam@95 1195 \openin 1 #1.pdf \ifeof 1
cannam@95 1196 \openin 1 #1.PDF \ifeof 1
cannam@95 1197 \openin 1 #1.png \ifeof 1
cannam@95 1198 \openin 1 #1.jpg \ifeof 1
cannam@95 1199 \openin 1 #1.jpeg \ifeof 1
cannam@95 1200 \openin 1 #1.JPG \ifeof 1
cannam@95 1201 \errhelp = \nopdfimagehelp
cannam@95 1202 \errmessage{Could not find image file #1 for pdf}%
cannam@95 1203 \else \gdef\pdfimgext{JPG}%
cannam@95 1204 \fi
cannam@95 1205 \else \gdef\pdfimgext{jpeg}%
cannam@95 1206 \fi
cannam@95 1207 \else \gdef\pdfimgext{jpg}%
cannam@95 1208 \fi
cannam@95 1209 \else \gdef\pdfimgext{png}%
cannam@95 1210 \fi
cannam@95 1211 \else \gdef\pdfimgext{PDF}%
cannam@95 1212 \fi
cannam@95 1213 \else \gdef\pdfimgext{pdf}%
cannam@95 1214 \fi
cannam@95 1215 \closein 1
cannam@95 1216 \endgroup
cannam@95 1217 %
cannam@95 1218 % without \immediate, ancient pdftex seg faults when the same image is
cannam@95 1219 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
cannam@95 1220 \ifnum\pdftexversion < 14
cannam@95 1221 \immediate\pdfimage
cannam@95 1222 \else
cannam@95 1223 \immediate\pdfximage
cannam@95 1224 \fi
cannam@95 1225 \ifdim \wd0 >0pt width \pdfimagewidth \fi
cannam@95 1226 \ifdim \wd2 >0pt height \pdfimageheight \fi
cannam@95 1227 \ifnum\pdftexversion<13
cannam@95 1228 #1.\pdfimgext
cannam@95 1229 \else
cannam@95 1230 {#1.\pdfimgext}%
cannam@95 1231 \fi
cannam@95 1232 \ifnum\pdftexversion < 14 \else
cannam@95 1233 \pdfrefximage \pdflastximage
cannam@95 1234 \fi}
cannam@95 1235 %
cannam@95 1236 \def\pdfmkdest#1{{%
cannam@95 1237 % We have to set dummies so commands such as @code, and characters
cannam@95 1238 % such as \, aren't expanded when present in a section title.
cannam@95 1239 \indexnofonts
cannam@95 1240 \turnoffactive
cannam@95 1241 \makevalueexpandable
cannam@95 1242 \def\pdfdestname{#1}%
cannam@95 1243 \txiescapepdf\pdfdestname
cannam@95 1244 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
cannam@95 1245 }}
cannam@95 1246 %
cannam@95 1247 % used to mark target names; must be expandable.
cannam@95 1248 \def\pdfmkpgn#1{#1}
cannam@95 1249 %
cannam@95 1250 % by default, use a color that is dark enough to print on paper as
cannam@95 1251 % nearly black, but still distinguishable for online viewing.
cannam@95 1252 \def\urlcolor{\rgbDarkRed}
cannam@95 1253 \def\linkcolor{\rgbDarkRed}
cannam@95 1254 \def\endlink{\setcolor{\maincolor}\pdfendlink}
cannam@95 1255 %
cannam@95 1256 % Adding outlines to PDF; macros for calculating structure of outlines
cannam@95 1257 % come from Petr Olsak
cannam@95 1258 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
cannam@95 1259 \else \csname#1\endcsname \fi}
cannam@95 1260 \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
cannam@95 1261 \advance\tempnum by 1
cannam@95 1262 \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
cannam@95 1263 %
cannam@95 1264 % #1 is the section text, which is what will be displayed in the
cannam@95 1265 % outline by the pdf viewer. #2 is the pdf expression for the number
cannam@95 1266 % of subentries (or empty, for subsubsections). #3 is the node text,
cannam@95 1267 % which might be empty if this toc entry had no corresponding node.
cannam@95 1268 % #4 is the page number
cannam@95 1269 %
cannam@95 1270 \def\dopdfoutline#1#2#3#4{%
cannam@95 1271 % Generate a link to the node text if that exists; else, use the
cannam@95 1272 % page number. We could generate a destination for the section
cannam@95 1273 % text in the case where a section has no node, but it doesn't
cannam@95 1274 % seem worth the trouble, since most documents are normally structured.
cannam@95 1275 \edef\pdfoutlinedest{#3}%
cannam@95 1276 \ifx\pdfoutlinedest\empty
cannam@95 1277 \def\pdfoutlinedest{#4}%
cannam@95 1278 \else
cannam@95 1279 \txiescapepdf\pdfoutlinedest
cannam@95 1280 \fi
cannam@95 1281 %
cannam@95 1282 % Also escape PDF chars in the display string.
cannam@95 1283 \edef\pdfoutlinetext{#1}%
cannam@95 1284 \txiescapepdf\pdfoutlinetext
cannam@95 1285 %
cannam@95 1286 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
cannam@95 1287 }
cannam@95 1288 %
cannam@95 1289 \def\pdfmakeoutlines{%
cannam@95 1290 \begingroup
cannam@95 1291 % Read toc silently, to get counts of subentries for \pdfoutline.
cannam@95 1292 \def\partentry##1##2##3##4{}% ignore parts in the outlines
cannam@95 1293 \def\numchapentry##1##2##3##4{%
cannam@95 1294 \def\thischapnum{##2}%
cannam@95 1295 \def\thissecnum{0}%
cannam@95 1296 \def\thissubsecnum{0}%
cannam@95 1297 }%
cannam@95 1298 \def\numsecentry##1##2##3##4{%
cannam@95 1299 \advancenumber{chap\thischapnum}%
cannam@95 1300 \def\thissecnum{##2}%
cannam@95 1301 \def\thissubsecnum{0}%
cannam@95 1302 }%
cannam@95 1303 \def\numsubsecentry##1##2##3##4{%
cannam@95 1304 \advancenumber{sec\thissecnum}%
cannam@95 1305 \def\thissubsecnum{##2}%
cannam@95 1306 }%
cannam@95 1307 \def\numsubsubsecentry##1##2##3##4{%
cannam@95 1308 \advancenumber{subsec\thissubsecnum}%
cannam@95 1309 }%
cannam@95 1310 \def\thischapnum{0}%
cannam@95 1311 \def\thissecnum{0}%
cannam@95 1312 \def\thissubsecnum{0}%
cannam@95 1313 %
cannam@95 1314 % use \def rather than \let here because we redefine \chapentry et
cannam@95 1315 % al. a second time, below.
cannam@95 1316 \def\appentry{\numchapentry}%
cannam@95 1317 \def\appsecentry{\numsecentry}%
cannam@95 1318 \def\appsubsecentry{\numsubsecentry}%
cannam@95 1319 \def\appsubsubsecentry{\numsubsubsecentry}%
cannam@95 1320 \def\unnchapentry{\numchapentry}%
cannam@95 1321 \def\unnsecentry{\numsecentry}%
cannam@95 1322 \def\unnsubsecentry{\numsubsecentry}%
cannam@95 1323 \def\unnsubsubsecentry{\numsubsubsecentry}%
cannam@95 1324 \readdatafile{toc}%
cannam@95 1325 %
cannam@95 1326 % Read toc second time, this time actually producing the outlines.
cannam@95 1327 % The `-' means take the \expnumber as the absolute number of
cannam@95 1328 % subentries, which we calculated on our first read of the .toc above.
cannam@95 1329 %
cannam@95 1330 % We use the node names as the destinations.
cannam@95 1331 \def\numchapentry##1##2##3##4{%
cannam@95 1332 \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
cannam@95 1333 \def\numsecentry##1##2##3##4{%
cannam@95 1334 \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
cannam@95 1335 \def\numsubsecentry##1##2##3##4{%
cannam@95 1336 \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
cannam@95 1337 \def\numsubsubsecentry##1##2##3##4{% count is always zero
cannam@95 1338 \dopdfoutline{##1}{}{##3}{##4}}%
cannam@95 1339 %
cannam@95 1340 % PDF outlines are displayed using system fonts, instead of
cannam@95 1341 % document fonts. Therefore we cannot use special characters,
cannam@95 1342 % since the encoding is unknown. For example, the eogonek from
cannam@95 1343 % Latin 2 (0xea) gets translated to a | character. Info from
cannam@95 1344 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
cannam@95 1345 %
cannam@95 1346 % TODO this right, we have to translate 8-bit characters to
cannam@95 1347 % their "best" equivalent, based on the @documentencoding. Too
cannam@95 1348 % much work for too little return. Just use the ASCII equivalents
cannam@95 1349 % we use for the index sort strings.
cannam@95 1350 %
cannam@95 1351 \indexnofonts
cannam@95 1352 \setupdatafile
cannam@95 1353 % We can have normal brace characters in the PDF outlines, unlike
cannam@95 1354 % Texinfo index files. So set that up.
cannam@95 1355 \def\{{\lbracecharliteral}%
cannam@95 1356 \def\}{\rbracecharliteral}%
cannam@95 1357 \catcode`\\=\active \otherbackslash
cannam@95 1358 \input \tocreadfilename
cannam@95 1359 \endgroup
cannam@95 1360 }
cannam@95 1361 {\catcode`[=1 \catcode`]=2
cannam@95 1362 \catcode`{=\other \catcode`}=\other
cannam@95 1363 \gdef\lbracecharliteral[{]%
cannam@95 1364 \gdef\rbracecharliteral[}]%
cannam@95 1365 ]
cannam@95 1366 %
cannam@95 1367 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
cannam@95 1368 \ifx\PP\D\let\nextsp\relax
cannam@95 1369 \else\let\nextsp\skipspaces
cannam@95 1370 \ifx\p\space\else\addtokens{\filename}{\PP}%
cannam@95 1371 \advance\filenamelength by 1
cannam@95 1372 \fi
cannam@95 1373 \fi
cannam@95 1374 \nextsp}
cannam@95 1375 \def\getfilename#1{%
cannam@95 1376 \filenamelength=0
cannam@95 1377 % If we don't expand the argument now, \skipspaces will get
cannam@95 1378 % snagged on things like "@value{foo}".
cannam@95 1379 \edef\temp{#1}%
cannam@95 1380 \expandafter\skipspaces\temp|\relax
cannam@95 1381 }
cannam@95 1382 \ifnum\pdftexversion < 14
cannam@95 1383 \let \startlink \pdfannotlink
cannam@95 1384 \else
cannam@95 1385 \let \startlink \pdfstartlink
cannam@95 1386 \fi
cannam@95 1387 % make a live url in pdf output.
cannam@95 1388 \def\pdfurl#1{%
cannam@95 1389 \begingroup
cannam@95 1390 % it seems we really need yet another set of dummies; have not
cannam@95 1391 % tried to figure out what each command should do in the context
cannam@95 1392 % of @url. for now, just make @/ a no-op, that's the only one
cannam@95 1393 % people have actually reported a problem with.
cannam@95 1394 %
cannam@95 1395 \normalturnoffactive
cannam@95 1396 \def\@{@}%
cannam@95 1397 \let\/=\empty
cannam@95 1398 \makevalueexpandable
cannam@95 1399 % do we want to go so far as to use \indexnofonts instead of just
cannam@95 1400 % special-casing \var here?
cannam@95 1401 \def\var##1{##1}%
cannam@95 1402 %
cannam@95 1403 \leavevmode\setcolor{\urlcolor}%
cannam@95 1404 \startlink attr{/Border [0 0 0]}%
cannam@95 1405 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
cannam@95 1406 \endgroup}
cannam@95 1407 \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
cannam@95 1408 \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
cannam@95 1409 \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
cannam@95 1410 \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
cannam@95 1411 \def\maketoks{%
cannam@95 1412 \expandafter\poptoks\the\toksA|ENDTOKS|\relax
cannam@95 1413 \ifx\first0\adn0
cannam@95 1414 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
cannam@95 1415 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
cannam@95 1416 \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
cannam@95 1417 \else
cannam@95 1418 \ifnum0=\countA\else\makelink\fi
cannam@95 1419 \ifx\first.\let\next=\done\else
cannam@95 1420 \let\next=\maketoks
cannam@95 1421 \addtokens{\toksB}{\the\toksD}
cannam@95 1422 \ifx\first,\addtokens{\toksB}{\space}\fi
cannam@95 1423 \fi
cannam@95 1424 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
cannam@95 1425 \next}
cannam@95 1426 \def\makelink{\addtokens{\toksB}%
cannam@95 1427 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
cannam@95 1428 \def\pdflink#1{%
cannam@95 1429 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
cannam@95 1430 \setcolor{\linkcolor}#1\endlink}
cannam@95 1431 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
cannam@95 1432 \else
cannam@95 1433 % non-pdf mode
cannam@95 1434 \let\pdfmkdest = \gobble
cannam@95 1435 \let\pdfurl = \gobble
cannam@95 1436 \let\endlink = \relax
cannam@95 1437 \let\setcolor = \gobble
cannam@95 1438 \let\pdfsetcolor = \gobble
cannam@95 1439 \let\pdfmakeoutlines = \relax
cannam@95 1440 \fi % \ifx\pdfoutput
cannam@95 1441
cannam@95 1442
cannam@95 1443 \message{fonts,}
cannam@95 1444
cannam@95 1445 % Change the current font style to #1, remembering it in \curfontstyle.
cannam@95 1446 % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
cannam@95 1447 % italics, not bold italics.
cannam@95 1448 %
cannam@95 1449 \def\setfontstyle#1{%
cannam@95 1450 \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
cannam@95 1451 \csname ten#1\endcsname % change the current font
cannam@95 1452 }
cannam@95 1453
cannam@95 1454 % Select #1 fonts with the current style.
cannam@95 1455 %
cannam@95 1456 \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
cannam@95 1457
cannam@95 1458 \def\rm{\fam=0 \setfontstyle{rm}}
cannam@95 1459 \def\it{\fam=\itfam \setfontstyle{it}}
cannam@95 1460 \def\sl{\fam=\slfam \setfontstyle{sl}}
cannam@95 1461 \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
cannam@95 1462 \def\tt{\fam=\ttfam \setfontstyle{tt}}
cannam@95 1463
cannam@95 1464 % Unfortunately, we have to override this for titles and the like, since
cannam@95 1465 % in those cases "rm" is bold. Sigh.
cannam@95 1466 \def\rmisbold{\rm\def\curfontstyle{bf}}
cannam@95 1467
cannam@95 1468 % Texinfo sort of supports the sans serif font style, which plain TeX does not.
cannam@95 1469 % So we set up a \sf.
cannam@95 1470 \newfam\sffam
cannam@95 1471 \def\sf{\fam=\sffam \setfontstyle{sf}}
cannam@95 1472 \let\li = \sf % Sometimes we call it \li, not \sf.
cannam@95 1473
cannam@95 1474 % We don't need math for this font style.
cannam@95 1475 \def\ttsl{\setfontstyle{ttsl}}
cannam@95 1476
cannam@95 1477
cannam@95 1478 % Default leading.
cannam@95 1479 \newdimen\textleading \textleading = 13.2pt
cannam@95 1480
cannam@95 1481 % Set the baselineskip to #1, and the lineskip and strut size
cannam@95 1482 % correspondingly. There is no deep meaning behind these magic numbers
cannam@95 1483 % used as factors; they just match (closely enough) what Knuth defined.
cannam@95 1484 %
cannam@95 1485 \def\lineskipfactor{.08333}
cannam@95 1486 \def\strutheightpercent{.70833}
cannam@95 1487 \def\strutdepthpercent {.29167}
cannam@95 1488 %
cannam@95 1489 % can get a sort of poor man's double spacing by redefining this.
cannam@95 1490 \def\baselinefactor{1}
cannam@95 1491 %
cannam@95 1492 \def\setleading#1{%
cannam@95 1493 \dimen0 = #1\relax
cannam@95 1494 \normalbaselineskip = \baselinefactor\dimen0
cannam@95 1495 \normallineskip = \lineskipfactor\normalbaselineskip
cannam@95 1496 \normalbaselines
cannam@95 1497 \setbox\strutbox =\hbox{%
cannam@95 1498 \vrule width0pt height\strutheightpercent\baselineskip
cannam@95 1499 depth \strutdepthpercent \baselineskip
cannam@95 1500 }%
cannam@95 1501 }
cannam@95 1502
cannam@95 1503 % PDF CMaps. See also LaTeX's t1.cmap.
cannam@95 1504 %
cannam@95 1505 % do nothing with this by default.
cannam@95 1506 \expandafter\let\csname cmapOT1\endcsname\gobble
cannam@95 1507 \expandafter\let\csname cmapOT1IT\endcsname\gobble
cannam@95 1508 \expandafter\let\csname cmapOT1TT\endcsname\gobble
cannam@95 1509
cannam@95 1510 % if we are producing pdf, and we have \pdffontattr, then define cmaps.
cannam@95 1511 % (\pdffontattr was introduced many years ago, but people still run
cannam@95 1512 % older pdftex's; it's easy to conditionalize, so we do.)
cannam@95 1513 \ifpdf \ifx\pdffontattr\thisisundefined \else
cannam@95 1514 \begingroup
cannam@95 1515 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
cannam@95 1516 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
cannam@95 1517 %%DocumentNeededResources: ProcSet (CIDInit)
cannam@95 1518 %%IncludeResource: ProcSet (CIDInit)
cannam@95 1519 %%BeginResource: CMap (TeX-OT1-0)
cannam@95 1520 %%Title: (TeX-OT1-0 TeX OT1 0)
cannam@95 1521 %%Version: 1.000
cannam@95 1522 %%EndComments
cannam@95 1523 /CIDInit /ProcSet findresource begin
cannam@95 1524 12 dict begin
cannam@95 1525 begincmap
cannam@95 1526 /CIDSystemInfo
cannam@95 1527 << /Registry (TeX)
cannam@95 1528 /Ordering (OT1)
cannam@95 1529 /Supplement 0
cannam@95 1530 >> def
cannam@95 1531 /CMapName /TeX-OT1-0 def
cannam@95 1532 /CMapType 2 def
cannam@95 1533 1 begincodespacerange
cannam@95 1534 <00> <7F>
cannam@95 1535 endcodespacerange
cannam@95 1536 8 beginbfrange
cannam@95 1537 <00> <01> <0393>
cannam@95 1538 <09> <0A> <03A8>
cannam@95 1539 <23> <26> <0023>
cannam@95 1540 <28> <3B> <0028>
cannam@95 1541 <3F> <5B> <003F>
cannam@95 1542 <5D> <5E> <005D>
cannam@95 1543 <61> <7A> <0061>
cannam@95 1544 <7B> <7C> <2013>
cannam@95 1545 endbfrange
cannam@95 1546 40 beginbfchar
cannam@95 1547 <02> <0398>
cannam@95 1548 <03> <039B>
cannam@95 1549 <04> <039E>
cannam@95 1550 <05> <03A0>
cannam@95 1551 <06> <03A3>
cannam@95 1552 <07> <03D2>
cannam@95 1553 <08> <03A6>
cannam@95 1554 <0B> <00660066>
cannam@95 1555 <0C> <00660069>
cannam@95 1556 <0D> <0066006C>
cannam@95 1557 <0E> <006600660069>
cannam@95 1558 <0F> <00660066006C>
cannam@95 1559 <10> <0131>
cannam@95 1560 <11> <0237>
cannam@95 1561 <12> <0060>
cannam@95 1562 <13> <00B4>
cannam@95 1563 <14> <02C7>
cannam@95 1564 <15> <02D8>
cannam@95 1565 <16> <00AF>
cannam@95 1566 <17> <02DA>
cannam@95 1567 <18> <00B8>
cannam@95 1568 <19> <00DF>
cannam@95 1569 <1A> <00E6>
cannam@95 1570 <1B> <0153>
cannam@95 1571 <1C> <00F8>
cannam@95 1572 <1D> <00C6>
cannam@95 1573 <1E> <0152>
cannam@95 1574 <1F> <00D8>
cannam@95 1575 <21> <0021>
cannam@95 1576 <22> <201D>
cannam@95 1577 <27> <2019>
cannam@95 1578 <3C> <00A1>
cannam@95 1579 <3D> <003D>
cannam@95 1580 <3E> <00BF>
cannam@95 1581 <5C> <201C>
cannam@95 1582 <5F> <02D9>
cannam@95 1583 <60> <2018>
cannam@95 1584 <7D> <02DD>
cannam@95 1585 <7E> <007E>
cannam@95 1586 <7F> <00A8>
cannam@95 1587 endbfchar
cannam@95 1588 endcmap
cannam@95 1589 CMapName currentdict /CMap defineresource pop
cannam@95 1590 end
cannam@95 1591 end
cannam@95 1592 %%EndResource
cannam@95 1593 %%EOF
cannam@95 1594 }\endgroup
cannam@95 1595 \expandafter\edef\csname cmapOT1\endcsname#1{%
cannam@95 1596 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
cannam@95 1597 }%
cannam@95 1598 %
cannam@95 1599 % \cmapOT1IT
cannam@95 1600 \begingroup
cannam@95 1601 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
cannam@95 1602 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
cannam@95 1603 %%DocumentNeededResources: ProcSet (CIDInit)
cannam@95 1604 %%IncludeResource: ProcSet (CIDInit)
cannam@95 1605 %%BeginResource: CMap (TeX-OT1IT-0)
cannam@95 1606 %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
cannam@95 1607 %%Version: 1.000
cannam@95 1608 %%EndComments
cannam@95 1609 /CIDInit /ProcSet findresource begin
cannam@95 1610 12 dict begin
cannam@95 1611 begincmap
cannam@95 1612 /CIDSystemInfo
cannam@95 1613 << /Registry (TeX)
cannam@95 1614 /Ordering (OT1IT)
cannam@95 1615 /Supplement 0
cannam@95 1616 >> def
cannam@95 1617 /CMapName /TeX-OT1IT-0 def
cannam@95 1618 /CMapType 2 def
cannam@95 1619 1 begincodespacerange
cannam@95 1620 <00> <7F>
cannam@95 1621 endcodespacerange
cannam@95 1622 8 beginbfrange
cannam@95 1623 <00> <01> <0393>
cannam@95 1624 <09> <0A> <03A8>
cannam@95 1625 <25> <26> <0025>
cannam@95 1626 <28> <3B> <0028>
cannam@95 1627 <3F> <5B> <003F>
cannam@95 1628 <5D> <5E> <005D>
cannam@95 1629 <61> <7A> <0061>
cannam@95 1630 <7B> <7C> <2013>
cannam@95 1631 endbfrange
cannam@95 1632 42 beginbfchar
cannam@95 1633 <02> <0398>
cannam@95 1634 <03> <039B>
cannam@95 1635 <04> <039E>
cannam@95 1636 <05> <03A0>
cannam@95 1637 <06> <03A3>
cannam@95 1638 <07> <03D2>
cannam@95 1639 <08> <03A6>
cannam@95 1640 <0B> <00660066>
cannam@95 1641 <0C> <00660069>
cannam@95 1642 <0D> <0066006C>
cannam@95 1643 <0E> <006600660069>
cannam@95 1644 <0F> <00660066006C>
cannam@95 1645 <10> <0131>
cannam@95 1646 <11> <0237>
cannam@95 1647 <12> <0060>
cannam@95 1648 <13> <00B4>
cannam@95 1649 <14> <02C7>
cannam@95 1650 <15> <02D8>
cannam@95 1651 <16> <00AF>
cannam@95 1652 <17> <02DA>
cannam@95 1653 <18> <00B8>
cannam@95 1654 <19> <00DF>
cannam@95 1655 <1A> <00E6>
cannam@95 1656 <1B> <0153>
cannam@95 1657 <1C> <00F8>
cannam@95 1658 <1D> <00C6>
cannam@95 1659 <1E> <0152>
cannam@95 1660 <1F> <00D8>
cannam@95 1661 <21> <0021>
cannam@95 1662 <22> <201D>
cannam@95 1663 <23> <0023>
cannam@95 1664 <24> <00A3>
cannam@95 1665 <27> <2019>
cannam@95 1666 <3C> <00A1>
cannam@95 1667 <3D> <003D>
cannam@95 1668 <3E> <00BF>
cannam@95 1669 <5C> <201C>
cannam@95 1670 <5F> <02D9>
cannam@95 1671 <60> <2018>
cannam@95 1672 <7D> <02DD>
cannam@95 1673 <7E> <007E>
cannam@95 1674 <7F> <00A8>
cannam@95 1675 endbfchar
cannam@95 1676 endcmap
cannam@95 1677 CMapName currentdict /CMap defineresource pop
cannam@95 1678 end
cannam@95 1679 end
cannam@95 1680 %%EndResource
cannam@95 1681 %%EOF
cannam@95 1682 }\endgroup
cannam@95 1683 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
cannam@95 1684 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
cannam@95 1685 }%
cannam@95 1686 %
cannam@95 1687 % \cmapOT1TT
cannam@95 1688 \begingroup
cannam@95 1689 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
cannam@95 1690 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
cannam@95 1691 %%DocumentNeededResources: ProcSet (CIDInit)
cannam@95 1692 %%IncludeResource: ProcSet (CIDInit)
cannam@95 1693 %%BeginResource: CMap (TeX-OT1TT-0)
cannam@95 1694 %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
cannam@95 1695 %%Version: 1.000
cannam@95 1696 %%EndComments
cannam@95 1697 /CIDInit /ProcSet findresource begin
cannam@95 1698 12 dict begin
cannam@95 1699 begincmap
cannam@95 1700 /CIDSystemInfo
cannam@95 1701 << /Registry (TeX)
cannam@95 1702 /Ordering (OT1TT)
cannam@95 1703 /Supplement 0
cannam@95 1704 >> def
cannam@95 1705 /CMapName /TeX-OT1TT-0 def
cannam@95 1706 /CMapType 2 def
cannam@95 1707 1 begincodespacerange
cannam@95 1708 <00> <7F>
cannam@95 1709 endcodespacerange
cannam@95 1710 5 beginbfrange
cannam@95 1711 <00> <01> <0393>
cannam@95 1712 <09> <0A> <03A8>
cannam@95 1713 <21> <26> <0021>
cannam@95 1714 <28> <5F> <0028>
cannam@95 1715 <61> <7E> <0061>
cannam@95 1716 endbfrange
cannam@95 1717 32 beginbfchar
cannam@95 1718 <02> <0398>
cannam@95 1719 <03> <039B>
cannam@95 1720 <04> <039E>
cannam@95 1721 <05> <03A0>
cannam@95 1722 <06> <03A3>
cannam@95 1723 <07> <03D2>
cannam@95 1724 <08> <03A6>
cannam@95 1725 <0B> <2191>
cannam@95 1726 <0C> <2193>
cannam@95 1727 <0D> <0027>
cannam@95 1728 <0E> <00A1>
cannam@95 1729 <0F> <00BF>
cannam@95 1730 <10> <0131>
cannam@95 1731 <11> <0237>
cannam@95 1732 <12> <0060>
cannam@95 1733 <13> <00B4>
cannam@95 1734 <14> <02C7>
cannam@95 1735 <15> <02D8>
cannam@95 1736 <16> <00AF>
cannam@95 1737 <17> <02DA>
cannam@95 1738 <18> <00B8>
cannam@95 1739 <19> <00DF>
cannam@95 1740 <1A> <00E6>
cannam@95 1741 <1B> <0153>
cannam@95 1742 <1C> <00F8>
cannam@95 1743 <1D> <00C6>
cannam@95 1744 <1E> <0152>
cannam@95 1745 <1F> <00D8>
cannam@95 1746 <20> <2423>
cannam@95 1747 <27> <2019>
cannam@95 1748 <60> <2018>
cannam@95 1749 <7F> <00A8>
cannam@95 1750 endbfchar
cannam@95 1751 endcmap
cannam@95 1752 CMapName currentdict /CMap defineresource pop
cannam@95 1753 end
cannam@95 1754 end
cannam@95 1755 %%EndResource
cannam@95 1756 %%EOF
cannam@95 1757 }\endgroup
cannam@95 1758 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
cannam@95 1759 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
cannam@95 1760 }%
cannam@95 1761 \fi\fi
cannam@95 1762
cannam@95 1763
cannam@95 1764 % Set the font macro #1 to the font named #2, adding on the
cannam@95 1765 % specified font prefix (normally `cm').
cannam@95 1766 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
cannam@95 1767 % encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
cannam@95 1768 % empty to omit).
cannam@95 1769 \def\setfont#1#2#3#4#5{%
cannam@95 1770 \font#1=\fontprefix#2#3 scaled #4
cannam@95 1771 \csname cmap#5\endcsname#1%
cannam@95 1772 }
cannam@95 1773 % This is what gets called when #5 of \setfont is empty.
cannam@95 1774 \let\cmap\gobble
cannam@95 1775 % emacs-page end of cmaps
cannam@95 1776
cannam@95 1777 % Use cm as the default font prefix.
cannam@95 1778 % To specify the font prefix, you must define \fontprefix
cannam@95 1779 % before you read in texinfo.tex.
cannam@95 1780 \ifx\fontprefix\thisisundefined
cannam@95 1781 \def\fontprefix{cm}
cannam@95 1782 \fi
cannam@95 1783 % Support font families that don't use the same naming scheme as CM.
cannam@95 1784 \def\rmshape{r}
cannam@95 1785 \def\rmbshape{bx} %where the normal face is bold
cannam@95 1786 \def\bfshape{b}
cannam@95 1787 \def\bxshape{bx}
cannam@95 1788 \def\ttshape{tt}
cannam@95 1789 \def\ttbshape{tt}
cannam@95 1790 \def\ttslshape{sltt}
cannam@95 1791 \def\itshape{ti}
cannam@95 1792 \def\itbshape{bxti}
cannam@95 1793 \def\slshape{sl}
cannam@95 1794 \def\slbshape{bxsl}
cannam@95 1795 \def\sfshape{ss}
cannam@95 1796 \def\sfbshape{ss}
cannam@95 1797 \def\scshape{csc}
cannam@95 1798 \def\scbshape{csc}
cannam@95 1799
cannam@95 1800 % Definitions for a main text size of 11pt. This is the default in
cannam@95 1801 % Texinfo.
cannam@95 1802 %
cannam@95 1803 \def\definetextfontsizexi{%
cannam@95 1804 % Text fonts (11.2pt, magstep1).
cannam@95 1805 \def\textnominalsize{11pt}
cannam@95 1806 \edef\mainmagstep{\magstephalf}
cannam@95 1807 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
cannam@95 1808 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
cannam@95 1809 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
cannam@95 1810 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
cannam@95 1811 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
cannam@95 1812 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
cannam@95 1813 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
cannam@95 1814 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
cannam@95 1815 \font\texti=cmmi10 scaled \mainmagstep
cannam@95 1816 \font\textsy=cmsy10 scaled \mainmagstep
cannam@95 1817 \def\textecsize{1095}
cannam@95 1818
cannam@95 1819 % A few fonts for @defun names and args.
cannam@95 1820 \setfont\defbf\bfshape{10}{\magstep1}{OT1}
cannam@95 1821 \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
cannam@95 1822 \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
cannam@95 1823 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
cannam@95 1824
cannam@95 1825 % Fonts for indices, footnotes, small examples (9pt).
cannam@95 1826 \def\smallnominalsize{9pt}
cannam@95 1827 \setfont\smallrm\rmshape{9}{1000}{OT1}
cannam@95 1828 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
cannam@95 1829 \setfont\smallbf\bfshape{10}{900}{OT1}
cannam@95 1830 \setfont\smallit\itshape{9}{1000}{OT1IT}
cannam@95 1831 \setfont\smallsl\slshape{9}{1000}{OT1}
cannam@95 1832 \setfont\smallsf\sfshape{9}{1000}{OT1}
cannam@95 1833 \setfont\smallsc\scshape{10}{900}{OT1}
cannam@95 1834 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
cannam@95 1835 \font\smalli=cmmi9
cannam@95 1836 \font\smallsy=cmsy9
cannam@95 1837 \def\smallecsize{0900}
cannam@95 1838
cannam@95 1839 % Fonts for small examples (8pt).
cannam@95 1840 \def\smallernominalsize{8pt}
cannam@95 1841 \setfont\smallerrm\rmshape{8}{1000}{OT1}
cannam@95 1842 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
cannam@95 1843 \setfont\smallerbf\bfshape{10}{800}{OT1}
cannam@95 1844 \setfont\smallerit\itshape{8}{1000}{OT1IT}
cannam@95 1845 \setfont\smallersl\slshape{8}{1000}{OT1}
cannam@95 1846 \setfont\smallersf\sfshape{8}{1000}{OT1}
cannam@95 1847 \setfont\smallersc\scshape{10}{800}{OT1}
cannam@95 1848 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
cannam@95 1849 \font\smalleri=cmmi8
cannam@95 1850 \font\smallersy=cmsy8
cannam@95 1851 \def\smallerecsize{0800}
cannam@95 1852
cannam@95 1853 % Fonts for title page (20.4pt):
cannam@95 1854 \def\titlenominalsize{20pt}
cannam@95 1855 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
cannam@95 1856 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
cannam@95 1857 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
cannam@95 1858 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
cannam@95 1859 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
cannam@95 1860 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
cannam@95 1861 \let\titlebf=\titlerm
cannam@95 1862 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
cannam@95 1863 \font\titlei=cmmi12 scaled \magstep3
cannam@95 1864 \font\titlesy=cmsy10 scaled \magstep4
cannam@95 1865 \def\titleecsize{2074}
cannam@95 1866
cannam@95 1867 % Chapter (and unnumbered) fonts (17.28pt).
cannam@95 1868 \def\chapnominalsize{17pt}
cannam@95 1869 \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
cannam@95 1870 \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
cannam@95 1871 \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
cannam@95 1872 \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
cannam@95 1873 \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
cannam@95 1874 \setfont\chapsf\sfbshape{17}{1000}{OT1}
cannam@95 1875 \let\chapbf=\chaprm
cannam@95 1876 \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
cannam@95 1877 \font\chapi=cmmi12 scaled \magstep2
cannam@95 1878 \font\chapsy=cmsy10 scaled \magstep3
cannam@95 1879 \def\chapecsize{1728}
cannam@95 1880
cannam@95 1881 % Section fonts (14.4pt).
cannam@95 1882 \def\secnominalsize{14pt}
cannam@95 1883 \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
cannam@95 1884 \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
cannam@95 1885 \setfont\secsl\slbshape{10}{\magstep2}{OT1}
cannam@95 1886 \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
cannam@95 1887 \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
cannam@95 1888 \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
cannam@95 1889 \let\secbf\secrm
cannam@95 1890 \setfont\secsc\scbshape{10}{\magstep2}{OT1}
cannam@95 1891 \font\seci=cmmi12 scaled \magstep1
cannam@95 1892 \font\secsy=cmsy10 scaled \magstep2
cannam@95 1893 \def\sececsize{1440}
cannam@95 1894
cannam@95 1895 % Subsection fonts (13.15pt).
cannam@95 1896 \def\ssecnominalsize{13pt}
cannam@95 1897 \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
cannam@95 1898 \setfont\ssecit\itbshape{10}{1315}{OT1IT}
cannam@95 1899 \setfont\ssecsl\slbshape{10}{1315}{OT1}
cannam@95 1900 \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
cannam@95 1901 \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
cannam@95 1902 \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
cannam@95 1903 \let\ssecbf\ssecrm
cannam@95 1904 \setfont\ssecsc\scbshape{10}{1315}{OT1}
cannam@95 1905 \font\sseci=cmmi12 scaled \magstephalf
cannam@95 1906 \font\ssecsy=cmsy10 scaled 1315
cannam@95 1907 \def\ssececsize{1200}
cannam@95 1908
cannam@95 1909 % Reduced fonts for @acro in text (10pt).
cannam@95 1910 \def\reducednominalsize{10pt}
cannam@95 1911 \setfont\reducedrm\rmshape{10}{1000}{OT1}
cannam@95 1912 \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
cannam@95 1913 \setfont\reducedbf\bfshape{10}{1000}{OT1}
cannam@95 1914 \setfont\reducedit\itshape{10}{1000}{OT1IT}
cannam@95 1915 \setfont\reducedsl\slshape{10}{1000}{OT1}
cannam@95 1916 \setfont\reducedsf\sfshape{10}{1000}{OT1}
cannam@95 1917 \setfont\reducedsc\scshape{10}{1000}{OT1}
cannam@95 1918 \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
cannam@95 1919 \font\reducedi=cmmi10
cannam@95 1920 \font\reducedsy=cmsy10
cannam@95 1921 \def\reducedecsize{1000}
cannam@95 1922
cannam@95 1923 \textleading = 13.2pt % line spacing for 11pt CM
cannam@95 1924 \textfonts % reset the current fonts
cannam@95 1925 \rm
cannam@95 1926 } % end of 11pt text font size definitions
cannam@95 1927
cannam@95 1928
cannam@95 1929 % Definitions to make the main text be 10pt Computer Modern, with
cannam@95 1930 % section, chapter, etc., sizes following suit. This is for the GNU
cannam@95 1931 % Press printing of the Emacs 22 manual. Maybe other manuals in the
cannam@95 1932 % future. Used with @smallbook, which sets the leading to 12pt.
cannam@95 1933 %
cannam@95 1934 \def\definetextfontsizex{%
cannam@95 1935 % Text fonts (10pt).
cannam@95 1936 \def\textnominalsize{10pt}
cannam@95 1937 \edef\mainmagstep{1000}
cannam@95 1938 \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
cannam@95 1939 \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
cannam@95 1940 \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
cannam@95 1941 \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
cannam@95 1942 \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
cannam@95 1943 \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
cannam@95 1944 \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
cannam@95 1945 \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
cannam@95 1946 \font\texti=cmmi10 scaled \mainmagstep
cannam@95 1947 \font\textsy=cmsy10 scaled \mainmagstep
cannam@95 1948 \def\textecsize{1000}
cannam@95 1949
cannam@95 1950 % A few fonts for @defun names and args.
cannam@95 1951 \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
cannam@95 1952 \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
cannam@95 1953 \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
cannam@95 1954 \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
cannam@95 1955
cannam@95 1956 % Fonts for indices, footnotes, small examples (9pt).
cannam@95 1957 \def\smallnominalsize{9pt}
cannam@95 1958 \setfont\smallrm\rmshape{9}{1000}{OT1}
cannam@95 1959 \setfont\smalltt\ttshape{9}{1000}{OT1TT}
cannam@95 1960 \setfont\smallbf\bfshape{10}{900}{OT1}
cannam@95 1961 \setfont\smallit\itshape{9}{1000}{OT1IT}
cannam@95 1962 \setfont\smallsl\slshape{9}{1000}{OT1}
cannam@95 1963 \setfont\smallsf\sfshape{9}{1000}{OT1}
cannam@95 1964 \setfont\smallsc\scshape{10}{900}{OT1}
cannam@95 1965 \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
cannam@95 1966 \font\smalli=cmmi9
cannam@95 1967 \font\smallsy=cmsy9
cannam@95 1968 \def\smallecsize{0900}
cannam@95 1969
cannam@95 1970 % Fonts for small examples (8pt).
cannam@95 1971 \def\smallernominalsize{8pt}
cannam@95 1972 \setfont\smallerrm\rmshape{8}{1000}{OT1}
cannam@95 1973 \setfont\smallertt\ttshape{8}{1000}{OT1TT}
cannam@95 1974 \setfont\smallerbf\bfshape{10}{800}{OT1}
cannam@95 1975 \setfont\smallerit\itshape{8}{1000}{OT1IT}
cannam@95 1976 \setfont\smallersl\slshape{8}{1000}{OT1}
cannam@95 1977 \setfont\smallersf\sfshape{8}{1000}{OT1}
cannam@95 1978 \setfont\smallersc\scshape{10}{800}{OT1}
cannam@95 1979 \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
cannam@95 1980 \font\smalleri=cmmi8
cannam@95 1981 \font\smallersy=cmsy8
cannam@95 1982 \def\smallerecsize{0800}
cannam@95 1983
cannam@95 1984 % Fonts for title page (20.4pt):
cannam@95 1985 \def\titlenominalsize{20pt}
cannam@95 1986 \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
cannam@95 1987 \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
cannam@95 1988 \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
cannam@95 1989 \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
cannam@95 1990 \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
cannam@95 1991 \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
cannam@95 1992 \let\titlebf=\titlerm
cannam@95 1993 \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
cannam@95 1994 \font\titlei=cmmi12 scaled \magstep3
cannam@95 1995 \font\titlesy=cmsy10 scaled \magstep4
cannam@95 1996 \def\titleecsize{2074}
cannam@95 1997
cannam@95 1998 % Chapter fonts (14.4pt).
cannam@95 1999 \def\chapnominalsize{14pt}
cannam@95 2000 \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
cannam@95 2001 \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
cannam@95 2002 \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
cannam@95 2003 \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
cannam@95 2004 \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
cannam@95 2005 \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
cannam@95 2006 \let\chapbf\chaprm
cannam@95 2007 \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
cannam@95 2008 \font\chapi=cmmi12 scaled \magstep1
cannam@95 2009 \font\chapsy=cmsy10 scaled \magstep2
cannam@95 2010 \def\chapecsize{1440}
cannam@95 2011
cannam@95 2012 % Section fonts (12pt).
cannam@95 2013 \def\secnominalsize{12pt}
cannam@95 2014 \setfont\secrm\rmbshape{12}{1000}{OT1}
cannam@95 2015 \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
cannam@95 2016 \setfont\secsl\slbshape{10}{\magstep1}{OT1}
cannam@95 2017 \setfont\sectt\ttbshape{12}{1000}{OT1TT}
cannam@95 2018 \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
cannam@95 2019 \setfont\secsf\sfbshape{12}{1000}{OT1}
cannam@95 2020 \let\secbf\secrm
cannam@95 2021 \setfont\secsc\scbshape{10}{\magstep1}{OT1}
cannam@95 2022 \font\seci=cmmi12
cannam@95 2023 \font\secsy=cmsy10 scaled \magstep1
cannam@95 2024 \def\sececsize{1200}
cannam@95 2025
cannam@95 2026 % Subsection fonts (10pt).
cannam@95 2027 \def\ssecnominalsize{10pt}
cannam@95 2028 \setfont\ssecrm\rmbshape{10}{1000}{OT1}
cannam@95 2029 \setfont\ssecit\itbshape{10}{1000}{OT1IT}
cannam@95 2030 \setfont\ssecsl\slbshape{10}{1000}{OT1}
cannam@95 2031 \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
cannam@95 2032 \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
cannam@95 2033 \setfont\ssecsf\sfbshape{10}{1000}{OT1}
cannam@95 2034 \let\ssecbf\ssecrm
cannam@95 2035 \setfont\ssecsc\scbshape{10}{1000}{OT1}
cannam@95 2036 \font\sseci=cmmi10
cannam@95 2037 \font\ssecsy=cmsy10
cannam@95 2038 \def\ssececsize{1000}
cannam@95 2039
cannam@95 2040 % Reduced fonts for @acro in text (9pt).
cannam@95 2041 \def\reducednominalsize{9pt}
cannam@95 2042 \setfont\reducedrm\rmshape{9}{1000}{OT1}
cannam@95 2043 \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
cannam@95 2044 \setfont\reducedbf\bfshape{10}{900}{OT1}
cannam@95 2045 \setfont\reducedit\itshape{9}{1000}{OT1IT}
cannam@95 2046 \setfont\reducedsl\slshape{9}{1000}{OT1}
cannam@95 2047 \setfont\reducedsf\sfshape{9}{1000}{OT1}
cannam@95 2048 \setfont\reducedsc\scshape{10}{900}{OT1}
cannam@95 2049 \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
cannam@95 2050 \font\reducedi=cmmi9
cannam@95 2051 \font\reducedsy=cmsy9
cannam@95 2052 \def\reducedecsize{0900}
cannam@95 2053
cannam@95 2054 \divide\parskip by 2 % reduce space between paragraphs
cannam@95 2055 \textleading = 12pt % line spacing for 10pt CM
cannam@95 2056 \textfonts % reset the current fonts
cannam@95 2057 \rm
cannam@95 2058 } % end of 10pt text font size definitions
cannam@95 2059
cannam@95 2060
cannam@95 2061 % We provide the user-level command
cannam@95 2062 % @fonttextsize 10
cannam@95 2063 % (or 11) to redefine the text font size. pt is assumed.
cannam@95 2064 %
cannam@95 2065 \def\xiword{11}
cannam@95 2066 \def\xword{10}
cannam@95 2067 \def\xwordpt{10pt}
cannam@95 2068 %
cannam@95 2069 \parseargdef\fonttextsize{%
cannam@95 2070 \def\textsizearg{#1}%
cannam@95 2071 %\wlog{doing @fonttextsize \textsizearg}%
cannam@95 2072 %
cannam@95 2073 % Set \globaldefs so that documents can use this inside @tex, since
cannam@95 2074 % makeinfo 4.8 does not support it, but we need it nonetheless.
cannam@95 2075 %
cannam@95 2076 \begingroup \globaldefs=1
cannam@95 2077 \ifx\textsizearg\xword \definetextfontsizex
cannam@95 2078 \else \ifx\textsizearg\xiword \definetextfontsizexi
cannam@95 2079 \else
cannam@95 2080 \errhelp=\EMsimple
cannam@95 2081 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
cannam@95 2082 \fi\fi
cannam@95 2083 \endgroup
cannam@95 2084 }
cannam@95 2085
cannam@95 2086
cannam@95 2087 % In order for the font changes to affect most math symbols and letters,
cannam@95 2088 % we have to define the \textfont of the standard families. Since
cannam@95 2089 % texinfo doesn't allow for producing subscripts and superscripts except
cannam@95 2090 % in the main text, we don't bother to reset \scriptfont and
cannam@95 2091 % \scriptscriptfont (which would also require loading a lot more fonts).
cannam@95 2092 %
cannam@95 2093 \def\resetmathfonts{%
cannam@95 2094 \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
cannam@95 2095 \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
cannam@95 2096 \textfont\ttfam=\tentt \textfont\sffam=\tensf
cannam@95 2097 }
cannam@95 2098
cannam@95 2099 % The font-changing commands redefine the meanings of \tenSTYLE, instead
cannam@95 2100 % of just \STYLE. We do this because \STYLE needs to also set the
cannam@95 2101 % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
cannam@95 2102 % \tenSTYLE to set the current font.
cannam@95 2103 %
cannam@95 2104 % Each font-changing command also sets the names \lsize (one size lower)
cannam@95 2105 % and \lllsize (three sizes lower). These relative commands are used in
cannam@95 2106 % the LaTeX logo and acronyms.
cannam@95 2107 %
cannam@95 2108 % This all needs generalizing, badly.
cannam@95 2109 %
cannam@95 2110 \def\textfonts{%
cannam@95 2111 \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
cannam@95 2112 \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
cannam@95 2113 \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
cannam@95 2114 \let\tenttsl=\textttsl
cannam@95 2115 \def\curfontsize{text}%
cannam@95 2116 \def\lsize{reduced}\def\lllsize{smaller}%
cannam@95 2117 \resetmathfonts \setleading{\textleading}}
cannam@95 2118 \def\titlefonts{%
cannam@95 2119 \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
cannam@95 2120 \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
cannam@95 2121 \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
cannam@95 2122 \let\tenttsl=\titlettsl
cannam@95 2123 \def\curfontsize{title}%
cannam@95 2124 \def\lsize{chap}\def\lllsize{subsec}%
cannam@95 2125 \resetmathfonts \setleading{27pt}}
cannam@95 2126 \def\titlefont#1{{\titlefonts\rmisbold #1}}
cannam@95 2127 \def\chapfonts{%
cannam@95 2128 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
cannam@95 2129 \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
cannam@95 2130 \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
cannam@95 2131 \let\tenttsl=\chapttsl
cannam@95 2132 \def\curfontsize{chap}%
cannam@95 2133 \def\lsize{sec}\def\lllsize{text}%
cannam@95 2134 \resetmathfonts \setleading{19pt}}
cannam@95 2135 \def\secfonts{%
cannam@95 2136 \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
cannam@95 2137 \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
cannam@95 2138 \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
cannam@95 2139 \let\tenttsl=\secttsl
cannam@95 2140 \def\curfontsize{sec}%
cannam@95 2141 \def\lsize{subsec}\def\lllsize{reduced}%
cannam@95 2142 \resetmathfonts \setleading{16pt}}
cannam@95 2143 \def\subsecfonts{%
cannam@95 2144 \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
cannam@95 2145 \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
cannam@95 2146 \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
cannam@95 2147 \let\tenttsl=\ssecttsl
cannam@95 2148 \def\curfontsize{ssec}%
cannam@95 2149 \def\lsize{text}\def\lllsize{small}%
cannam@95 2150 \resetmathfonts \setleading{15pt}}
cannam@95 2151 \let\subsubsecfonts = \subsecfonts
cannam@95 2152 \def\reducedfonts{%
cannam@95 2153 \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
cannam@95 2154 \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
cannam@95 2155 \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
cannam@95 2156 \let\tenttsl=\reducedttsl
cannam@95 2157 \def\curfontsize{reduced}%
cannam@95 2158 \def\lsize{small}\def\lllsize{smaller}%
cannam@95 2159 \resetmathfonts \setleading{10.5pt}}
cannam@95 2160 \def\smallfonts{%
cannam@95 2161 \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
cannam@95 2162 \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
cannam@95 2163 \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
cannam@95 2164 \let\tenttsl=\smallttsl
cannam@95 2165 \def\curfontsize{small}%
cannam@95 2166 \def\lsize{smaller}\def\lllsize{smaller}%
cannam@95 2167 \resetmathfonts \setleading{10.5pt}}
cannam@95 2168 \def\smallerfonts{%
cannam@95 2169 \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
cannam@95 2170 \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
cannam@95 2171 \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
cannam@95 2172 \let\tenttsl=\smallerttsl
cannam@95 2173 \def\curfontsize{smaller}%
cannam@95 2174 \def\lsize{smaller}\def\lllsize{smaller}%
cannam@95 2175 \resetmathfonts \setleading{9.5pt}}
cannam@95 2176
cannam@95 2177 % Fonts for short table of contents.
cannam@95 2178 \setfont\shortcontrm\rmshape{12}{1000}{OT1}
cannam@95 2179 \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
cannam@95 2180 \setfont\shortcontsl\slshape{12}{1000}{OT1}
cannam@95 2181 \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
cannam@95 2182
cannam@95 2183 % Define these just so they can be easily changed for other fonts.
cannam@95 2184 \def\angleleft{$\langle$}
cannam@95 2185 \def\angleright{$\rangle$}
cannam@95 2186
cannam@95 2187 % Set the fonts to use with the @small... environments.
cannam@95 2188 \let\smallexamplefonts = \smallfonts
cannam@95 2189
cannam@95 2190 % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
cannam@95 2191 % can fit this many characters:
cannam@95 2192 % 8.5x11=86 smallbook=72 a4=90 a5=69
cannam@95 2193 % If we use \scriptfonts (8pt), then we can fit this many characters:
cannam@95 2194 % 8.5x11=90+ smallbook=80 a4=90+ a5=77
cannam@95 2195 % For me, subjectively, the few extra characters that fit aren't worth
cannam@95 2196 % the additional smallness of 8pt. So I'm making the default 9pt.
cannam@95 2197 %
cannam@95 2198 % By the way, for comparison, here's what fits with @example (10pt):
cannam@95 2199 % 8.5x11=71 smallbook=60 a4=75 a5=58
cannam@95 2200 % --karl, 24jan03.
cannam@95 2201
cannam@95 2202 % Set up the default fonts, so we can use them for creating boxes.
cannam@95 2203 %
cannam@95 2204 \definetextfontsizexi
cannam@95 2205
cannam@95 2206
cannam@95 2207 \message{markup,}
cannam@95 2208
cannam@95 2209 % Check if we are currently using a typewriter font. Since all the
cannam@95 2210 % Computer Modern typewriter fonts have zero interword stretch (and
cannam@95 2211 % shrink), and it is reasonable to expect all typewriter fonts to have
cannam@95 2212 % this property, we can check that font parameter.
cannam@95 2213 %
cannam@95 2214 \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
cannam@95 2215
cannam@95 2216 % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
cannam@95 2217 % define and register \INITMACRO to be called on markup style changes.
cannam@95 2218 % \INITMACRO can check \currentmarkupstyle for the innermost
cannam@95 2219 % style and the set of \ifmarkupSTYLE switches for all styles
cannam@95 2220 % currently in effect.
cannam@95 2221 \newif\ifmarkupvar
cannam@95 2222 \newif\ifmarkupsamp
cannam@95 2223 \newif\ifmarkupkey
cannam@95 2224 %\newif\ifmarkupfile % @file == @samp.
cannam@95 2225 %\newif\ifmarkupoption % @option == @samp.
cannam@95 2226 \newif\ifmarkupcode
cannam@95 2227 \newif\ifmarkupkbd
cannam@95 2228 %\newif\ifmarkupenv % @env == @code.
cannam@95 2229 %\newif\ifmarkupcommand % @command == @code.
cannam@95 2230 \newif\ifmarkuptex % @tex (and part of @math, for now).
cannam@95 2231 \newif\ifmarkupexample
cannam@95 2232 \newif\ifmarkupverb
cannam@95 2233 \newif\ifmarkupverbatim
cannam@95 2234
cannam@95 2235 \let\currentmarkupstyle\empty
cannam@95 2236
cannam@95 2237 \def\setupmarkupstyle#1{%
cannam@95 2238 \csname markup#1true\endcsname
cannam@95 2239 \def\currentmarkupstyle{#1}%
cannam@95 2240 \markupstylesetup
cannam@95 2241 }
cannam@95 2242
cannam@95 2243 \let\markupstylesetup\empty
cannam@95 2244
cannam@95 2245 \def\defmarkupstylesetup#1{%
cannam@95 2246 \expandafter\def\expandafter\markupstylesetup
cannam@95 2247 \expandafter{\markupstylesetup #1}%
cannam@95 2248 \def#1%
cannam@95 2249 }
cannam@95 2250
cannam@95 2251 % Markup style setup for left and right quotes.
cannam@95 2252 \defmarkupstylesetup\markupsetuplq{%
cannam@95 2253 \expandafter\let\expandafter \temp
cannam@95 2254 \csname markupsetuplq\currentmarkupstyle\endcsname
cannam@95 2255 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
cannam@95 2256 }
cannam@95 2257
cannam@95 2258 \defmarkupstylesetup\markupsetuprq{%
cannam@95 2259 \expandafter\let\expandafter \temp
cannam@95 2260 \csname markupsetuprq\currentmarkupstyle\endcsname
cannam@95 2261 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
cannam@95 2262 }
cannam@95 2263
cannam@95 2264 {
cannam@95 2265 \catcode`\'=\active
cannam@95 2266 \catcode`\`=\active
cannam@95 2267
cannam@95 2268 \gdef\markupsetuplqdefault{\let`\lq}
cannam@95 2269 \gdef\markupsetuprqdefault{\let'\rq}
cannam@95 2270
cannam@95 2271 \gdef\markupsetcodequoteleft{\let`\codequoteleft}
cannam@95 2272 \gdef\markupsetcodequoteright{\let'\codequoteright}
cannam@95 2273
cannam@95 2274 \gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
cannam@95 2275 }
cannam@95 2276
cannam@95 2277 \let\markupsetuplqcode \markupsetcodequoteleft
cannam@95 2278 \let\markupsetuprqcode \markupsetcodequoteright
cannam@95 2279 %
cannam@95 2280 \let\markupsetuplqexample \markupsetcodequoteleft
cannam@95 2281 \let\markupsetuprqexample \markupsetcodequoteright
cannam@95 2282 %
cannam@95 2283 \let\markupsetuplqsamp \markupsetcodequoteleft
cannam@95 2284 \let\markupsetuprqsamp \markupsetcodequoteright
cannam@95 2285 %
cannam@95 2286 \let\markupsetuplqverb \markupsetcodequoteleft
cannam@95 2287 \let\markupsetuprqverb \markupsetcodequoteright
cannam@95 2288 %
cannam@95 2289 \let\markupsetuplqverbatim \markupsetcodequoteleft
cannam@95 2290 \let\markupsetuprqverbatim \markupsetcodequoteright
cannam@95 2291
cannam@95 2292 \let\markupsetuplqkbd \markupsetnoligaturesquoteleft
cannam@95 2293
cannam@95 2294 % Allow an option to not use regular directed right quote/apostrophe
cannam@95 2295 % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
cannam@95 2296 % The undirected quote is ugly, so don't make it the default, but it
cannam@95 2297 % works for pasting with more pdf viewers (at least evince), the
cannam@95 2298 % lilypond developers report. xpdf does work with the regular 0x27.
cannam@95 2299 %
cannam@95 2300 \def\codequoteright{%
cannam@95 2301 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
cannam@95 2302 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
cannam@95 2303 '%
cannam@95 2304 \else \char'15 \fi
cannam@95 2305 \else \char'15 \fi
cannam@95 2306 }
cannam@95 2307 %
cannam@95 2308 % and a similar option for the left quote char vs. a grave accent.
cannam@95 2309 % Modern fonts display ASCII 0x60 as a grave accent, so some people like
cannam@95 2310 % the code environments to do likewise.
cannam@95 2311 %
cannam@95 2312 \def\codequoteleft{%
cannam@95 2313 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
cannam@95 2314 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
cannam@95 2315 % [Knuth] pp. 380,381,391
cannam@95 2316 % \relax disables Spanish ligatures ?` and !` of \tt font.
cannam@95 2317 \relax`%
cannam@95 2318 \else \char'22 \fi
cannam@95 2319 \else \char'22 \fi
cannam@95 2320 }
cannam@95 2321
cannam@95 2322 % Commands to set the quote options.
cannam@95 2323 %
cannam@95 2324 \parseargdef\codequoteundirected{%
cannam@95 2325 \def\temp{#1}%
cannam@95 2326 \ifx\temp\onword
cannam@95 2327 \expandafter\let\csname SETtxicodequoteundirected\endcsname
cannam@95 2328 = t%
cannam@95 2329 \else\ifx\temp\offword
cannam@95 2330 \expandafter\let\csname SETtxicodequoteundirected\endcsname
cannam@95 2331 = \relax
cannam@95 2332 \else
cannam@95 2333 \errhelp = \EMsimple
cannam@95 2334 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
cannam@95 2335 \fi\fi
cannam@95 2336 }
cannam@95 2337 %
cannam@95 2338 \parseargdef\codequotebacktick{%
cannam@95 2339 \def\temp{#1}%
cannam@95 2340 \ifx\temp\onword
cannam@95 2341 \expandafter\let\csname SETtxicodequotebacktick\endcsname
cannam@95 2342 = t%
cannam@95 2343 \else\ifx\temp\offword
cannam@95 2344 \expandafter\let\csname SETtxicodequotebacktick\endcsname
cannam@95 2345 = \relax
cannam@95 2346 \else
cannam@95 2347 \errhelp = \EMsimple
cannam@95 2348 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
cannam@95 2349 \fi\fi
cannam@95 2350 }
cannam@95 2351
cannam@95 2352 % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
cannam@95 2353 \def\noligaturesquoteleft{\relax\lq}
cannam@95 2354
cannam@95 2355 % Count depth in font-changes, for error checks
cannam@95 2356 \newcount\fontdepth \fontdepth=0
cannam@95 2357
cannam@95 2358 % Font commands.
cannam@95 2359
cannam@95 2360 % #1 is the font command (\sl or \it), #2 is the text to slant.
cannam@95 2361 % If we are in a monospaced environment, however, 1) always use \ttsl,
cannam@95 2362 % and 2) do not add an italic correction.
cannam@95 2363 \def\dosmartslant#1#2{%
cannam@95 2364 \ifusingtt
cannam@95 2365 {{\ttsl #2}\let\next=\relax}%
cannam@95 2366 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
cannam@95 2367 \next
cannam@95 2368 }
cannam@95 2369 \def\smartslanted{\dosmartslant\sl}
cannam@95 2370 \def\smartitalic{\dosmartslant\it}
cannam@95 2371
cannam@95 2372 % Output an italic correction unless \next (presumed to be the following
cannam@95 2373 % character) is such as not to need one.
cannam@95 2374 \def\smartitaliccorrection{%
cannam@95 2375 \ifx\next,%
cannam@95 2376 \else\ifx\next-%
cannam@95 2377 \else\ifx\next.%
cannam@95 2378 \else\ptexslash
cannam@95 2379 \fi\fi\fi
cannam@95 2380 \aftersmartic
cannam@95 2381 }
cannam@95 2382
cannam@95 2383 % like \smartslanted except unconditionally uses \ttsl, and no ic.
cannam@95 2384 % @var is set to this for defun arguments.
cannam@95 2385 \def\ttslanted#1{{\ttsl #1}}
cannam@95 2386
cannam@95 2387 % @cite is like \smartslanted except unconditionally use \sl. We never want
cannam@95 2388 % ttsl for book titles, do we?
cannam@95 2389 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
cannam@95 2390
cannam@95 2391 \def\aftersmartic{}
cannam@95 2392 \def\var#1{%
cannam@95 2393 \let\saveaftersmartic = \aftersmartic
cannam@95 2394 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
cannam@95 2395 \smartslanted{#1}%
cannam@95 2396 }
cannam@95 2397
cannam@95 2398 \let\i=\smartitalic
cannam@95 2399 \let\slanted=\smartslanted
cannam@95 2400 \let\dfn=\smartslanted
cannam@95 2401 \let\emph=\smartitalic
cannam@95 2402
cannam@95 2403 % Explicit font changes: @r, @sc, undocumented @ii.
cannam@95 2404 \def\r#1{{\rm #1}} % roman font
cannam@95 2405 \def\sc#1{{\smallcaps#1}} % smallcaps font
cannam@95 2406 \def\ii#1{{\it #1}} % italic font
cannam@95 2407
cannam@95 2408 % @b, explicit bold. Also @strong.
cannam@95 2409 \def\b#1{{\bf #1}}
cannam@95 2410 \let\strong=\b
cannam@95 2411
cannam@95 2412 % @sansserif, explicit sans.
cannam@95 2413 \def\sansserif#1{{\sf #1}}
cannam@95 2414
cannam@95 2415 % We can't just use \exhyphenpenalty, because that only has effect at
cannam@95 2416 % the end of a paragraph. Restore normal hyphenation at the end of the
cannam@95 2417 % group within which \nohyphenation is presumably called.
cannam@95 2418 %
cannam@95 2419 \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
cannam@95 2420 \def\restorehyphenation{\hyphenchar\font = `- }
cannam@95 2421
cannam@95 2422 % Set sfcode to normal for the chars that usually have another value.
cannam@95 2423 % Can't use plain's \frenchspacing because it uses the `\x notation, and
cannam@95 2424 % sometimes \x has an active definition that messes things up.
cannam@95 2425 %
cannam@95 2426 \catcode`@=11
cannam@95 2427 \def\plainfrenchspacing{%
cannam@95 2428 \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
cannam@95 2429 \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
cannam@95 2430 \def\endofsentencespacefactor{1000}% for @. and friends
cannam@95 2431 }
cannam@95 2432 \def\plainnonfrenchspacing{%
cannam@95 2433 \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
cannam@95 2434 \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
cannam@95 2435 \def\endofsentencespacefactor{3000}% for @. and friends
cannam@95 2436 }
cannam@95 2437 \catcode`@=\other
cannam@95 2438 \def\endofsentencespacefactor{3000}% default
cannam@95 2439
cannam@95 2440 % @t, explicit typewriter.
cannam@95 2441 \def\t#1{%
cannam@95 2442 {\tt \rawbackslash \plainfrenchspacing #1}%
cannam@95 2443 \null
cannam@95 2444 }
cannam@95 2445
cannam@95 2446 % @samp.
cannam@95 2447 \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
cannam@95 2448
cannam@95 2449 % definition of @key that produces a lozenge. Doesn't adjust to text size.
cannam@95 2450 %\setfont\keyrm\rmshape{8}{1000}{OT1}
cannam@95 2451 %\font\keysy=cmsy9
cannam@95 2452 %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
cannam@95 2453 % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
cannam@95 2454 % \vbox{\hrule\kern-0.4pt
cannam@95 2455 % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
cannam@95 2456 % \kern-0.4pt\hrule}%
cannam@95 2457 % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
cannam@95 2458
cannam@95 2459 % definition of @key with no lozenge. If the current font is already
cannam@95 2460 % monospace, don't change it; that way, we respect @kbdinputstyle. But
cannam@95 2461 % if it isn't monospace, then use \tt.
cannam@95 2462 %
cannam@95 2463 \def\key#1{{\setupmarkupstyle{key}%
cannam@95 2464 \nohyphenation
cannam@95 2465 \ifmonospace\else\tt\fi
cannam@95 2466 #1}\null}
cannam@95 2467
cannam@95 2468 % ctrl is no longer a Texinfo command.
cannam@95 2469 \def\ctrl #1{{\tt \rawbackslash \hat}#1}
cannam@95 2470
cannam@95 2471 % @file, @option are the same as @samp.
cannam@95 2472 \let\file=\samp
cannam@95 2473 \let\option=\samp
cannam@95 2474
cannam@95 2475 % @code is a modification of @t,
cannam@95 2476 % which makes spaces the same size as normal in the surrounding text.
cannam@95 2477 \def\tclose#1{%
cannam@95 2478 {%
cannam@95 2479 % Change normal interword space to be same as for the current font.
cannam@95 2480 \spaceskip = \fontdimen2\font
cannam@95 2481 %
cannam@95 2482 % Switch to typewriter.
cannam@95 2483 \tt
cannam@95 2484 %
cannam@95 2485 % But `\ ' produces the large typewriter interword space.
cannam@95 2486 \def\ {{\spaceskip = 0pt{} }}%
cannam@95 2487 %
cannam@95 2488 % Turn off hyphenation.
cannam@95 2489 \nohyphenation
cannam@95 2490 %
cannam@95 2491 \rawbackslash
cannam@95 2492 \plainfrenchspacing
cannam@95 2493 #1%
cannam@95 2494 }%
cannam@95 2495 \null % reset spacefactor to 1000
cannam@95 2496 }
cannam@95 2497
cannam@95 2498 % We *must* turn on hyphenation at `-' and `_' in @code.
cannam@95 2499 % Otherwise, it is too hard to avoid overfull hboxes
cannam@95 2500 % in the Emacs manual, the Library manual, etc.
cannam@95 2501
cannam@95 2502 % Unfortunately, TeX uses one parameter (\hyphenchar) to control
cannam@95 2503 % both hyphenation at - and hyphenation within words.
cannam@95 2504 % We must therefore turn them both off (\tclose does that)
cannam@95 2505 % and arrange explicitly to hyphenate at a dash.
cannam@95 2506 % -- rms.
cannam@95 2507 {
cannam@95 2508 \catcode`\-=\active \catcode`\_=\active
cannam@95 2509 \catcode`\'=\active \catcode`\`=\active
cannam@95 2510 \global\let'=\rq \global\let`=\lq % default definitions
cannam@95 2511 %
cannam@95 2512 \global\def\code{\begingroup
cannam@95 2513 \setupmarkupstyle{code}%
cannam@95 2514 % The following should really be moved into \setupmarkupstyle handlers.
cannam@95 2515 \catcode\dashChar=\active \catcode\underChar=\active
cannam@95 2516 \ifallowcodebreaks
cannam@95 2517 \let-\codedash
cannam@95 2518 \let_\codeunder
cannam@95 2519 \else
cannam@95 2520 \let-\realdash
cannam@95 2521 \let_\realunder
cannam@95 2522 \fi
cannam@95 2523 \codex
cannam@95 2524 }
cannam@95 2525 }
cannam@95 2526
cannam@95 2527 \def\codex #1{\tclose{#1}\endgroup}
cannam@95 2528
cannam@95 2529 \def\realdash{-}
cannam@95 2530 \def\codedash{-\discretionary{}{}{}}
cannam@95 2531 \def\codeunder{%
cannam@95 2532 % this is all so @math{@code{var_name}+1} can work. In math mode, _
cannam@95 2533 % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
cannam@95 2534 % will therefore expand the active definition of _, which is us
cannam@95 2535 % (inside @code that is), therefore an endless loop.
cannam@95 2536 \ifusingtt{\ifmmode
cannam@95 2537 \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
cannam@95 2538 \else\normalunderscore \fi
cannam@95 2539 \discretionary{}{}{}}%
cannam@95 2540 {\_}%
cannam@95 2541 }
cannam@95 2542
cannam@95 2543 % An additional complication: the above will allow breaks after, e.g.,
cannam@95 2544 % each of the four underscores in __typeof__. This is undesirable in
cannam@95 2545 % some manuals, especially if they don't have long identifiers in
cannam@95 2546 % general. @allowcodebreaks provides a way to control this.
cannam@95 2547 %
cannam@95 2548 \newif\ifallowcodebreaks \allowcodebreakstrue
cannam@95 2549
cannam@95 2550 \def\keywordtrue{true}
cannam@95 2551 \def\keywordfalse{false}
cannam@95 2552
cannam@95 2553 \parseargdef\allowcodebreaks{%
cannam@95 2554 \def\txiarg{#1}%
cannam@95 2555 \ifx\txiarg\keywordtrue
cannam@95 2556 \allowcodebreakstrue
cannam@95 2557 \else\ifx\txiarg\keywordfalse
cannam@95 2558 \allowcodebreaksfalse
cannam@95 2559 \else
cannam@95 2560 \errhelp = \EMsimple
cannam@95 2561 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
cannam@95 2562 \fi\fi
cannam@95 2563 }
cannam@95 2564
cannam@95 2565 % @uref (abbreviation for `urlref') takes an optional (comma-separated)
cannam@95 2566 % second argument specifying the text to display and an optional third
cannam@95 2567 % arg as text to display instead of (rather than in addition to) the url
cannam@95 2568 % itself. First (mandatory) arg is the url.
cannam@95 2569 % (This \urefnobreak definition isn't used now, leaving it for a while
cannam@95 2570 % for comparison.)
cannam@95 2571 \def\urefnobreak#1{\dourefnobreak #1,,,\finish}
cannam@95 2572 \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
cannam@95 2573 \unsepspaces
cannam@95 2574 \pdfurl{#1}%
cannam@95 2575 \setbox0 = \hbox{\ignorespaces #3}%
cannam@95 2576 \ifdim\wd0 > 0pt
cannam@95 2577 \unhbox0 % third arg given, show only that
cannam@95 2578 \else
cannam@95 2579 \setbox0 = \hbox{\ignorespaces #2}%
cannam@95 2580 \ifdim\wd0 > 0pt
cannam@95 2581 \ifpdf
cannam@95 2582 \unhbox0 % PDF: 2nd arg given, show only it
cannam@95 2583 \else
cannam@95 2584 \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
cannam@95 2585 \fi
cannam@95 2586 \else
cannam@95 2587 \code{#1}% only url given, so show it
cannam@95 2588 \fi
cannam@95 2589 \fi
cannam@95 2590 \endlink
cannam@95 2591 \endgroup}
cannam@95 2592
cannam@95 2593 % This \urefbreak definition is the active one.
cannam@95 2594 \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
cannam@95 2595 \let\uref=\urefbreak
cannam@95 2596 \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
cannam@95 2597 \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
cannam@95 2598 \unsepspaces
cannam@95 2599 \pdfurl{#1}%
cannam@95 2600 \setbox0 = \hbox{\ignorespaces #3}%
cannam@95 2601 \ifdim\wd0 > 0pt
cannam@95 2602 \unhbox0 % third arg given, show only that
cannam@95 2603 \else
cannam@95 2604 \setbox0 = \hbox{\ignorespaces #2}%
cannam@95 2605 \ifdim\wd0 > 0pt
cannam@95 2606 \ifpdf
cannam@95 2607 \unhbox0 % PDF: 2nd arg given, show only it
cannam@95 2608 \else
cannam@95 2609 \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
cannam@95 2610 \fi
cannam@95 2611 \else
cannam@95 2612 \urefcode{#1}% only url given, so show it
cannam@95 2613 \fi
cannam@95 2614 \fi
cannam@95 2615 \endlink
cannam@95 2616 \endgroup}
cannam@95 2617
cannam@95 2618 % Allow line breaks around only a few characters (only).
cannam@95 2619 \def\urefcatcodes{%
cannam@95 2620 \catcode\ampChar=\active \catcode\dotChar=\active
cannam@95 2621 \catcode\hashChar=\active \catcode\questChar=\active
cannam@95 2622 \catcode\slashChar=\active
cannam@95 2623 }
cannam@95 2624 {
cannam@95 2625 \urefcatcodes
cannam@95 2626 %
cannam@95 2627 \global\def\urefcode{\begingroup
cannam@95 2628 \setupmarkupstyle{code}%
cannam@95 2629 \urefcatcodes
cannam@95 2630 \let&\urefcodeamp
cannam@95 2631 \let.\urefcodedot
cannam@95 2632 \let#\urefcodehash
cannam@95 2633 \let?\urefcodequest
cannam@95 2634 \let/\urefcodeslash
cannam@95 2635 \codex
cannam@95 2636 }
cannam@95 2637 %
cannam@95 2638 % By default, they are just regular characters.
cannam@95 2639 \global\def&{\normalamp}
cannam@95 2640 \global\def.{\normaldot}
cannam@95 2641 \global\def#{\normalhash}
cannam@95 2642 \global\def?{\normalquest}
cannam@95 2643 \global\def/{\normalslash}
cannam@95 2644 }
cannam@95 2645
cannam@95 2646 % we put a little stretch before and after the breakable chars, to help
cannam@95 2647 % line breaking of long url's. The unequal skips make look better in
cannam@95 2648 % cmtt at least, especially for dots.
cannam@95 2649 \def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
cannam@95 2650 \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
cannam@95 2651 %
cannam@95 2652 \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
cannam@95 2653 \def\urefcodedot{\urefprestretch .\urefpoststretch}
cannam@95 2654 \def\urefcodehash{\urefprestretch \#\urefpoststretch}
cannam@95 2655 \def\urefcodequest{\urefprestretch ?\urefpoststretch}
cannam@95 2656 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
cannam@95 2657 {
cannam@95 2658 \catcode`\/=\active
cannam@95 2659 \global\def\urefcodeslashfinish{%
cannam@95 2660 \urefprestretch \slashChar
cannam@95 2661 % Allow line break only after the final / in a sequence of
cannam@95 2662 % slashes, to avoid line break between the slashes in http://.
cannam@95 2663 \ifx\next/\else \urefpoststretch \fi
cannam@95 2664 }
cannam@95 2665 }
cannam@95 2666
cannam@95 2667 % One more complication: by default we'll break after the special
cannam@95 2668 % characters, but some people like to break before the special chars, so
cannam@95 2669 % allow that. Also allow no breaking at all, for manual control.
cannam@95 2670 %
cannam@95 2671 \parseargdef\urefbreakstyle{%
cannam@95 2672 \def\txiarg{#1}%
cannam@95 2673 \ifx\txiarg\wordnone
cannam@95 2674 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
cannam@95 2675 \else\ifx\txiarg\wordbefore
cannam@95 2676 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
cannam@95 2677 \else\ifx\txiarg\wordafter
cannam@95 2678 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
cannam@95 2679 \else
cannam@95 2680 \errhelp = \EMsimple
cannam@95 2681 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
cannam@95 2682 \fi\fi\fi
cannam@95 2683 }
cannam@95 2684 \def\wordafter{after}
cannam@95 2685 \def\wordbefore{before}
cannam@95 2686 \def\wordnone{none}
cannam@95 2687
cannam@95 2688 \urefbreakstyle after
cannam@95 2689
cannam@95 2690 % @url synonym for @uref, since that's how everyone uses it.
cannam@95 2691 %
cannam@95 2692 \let\url=\uref
cannam@95 2693
cannam@95 2694 % rms does not like angle brackets --karl, 17may97.
cannam@95 2695 % So now @email is just like @uref, unless we are pdf.
cannam@95 2696 %
cannam@95 2697 %\def\email#1{\angleleft{\tt #1}\angleright}
cannam@95 2698 \ifpdf
cannam@95 2699 \def\email#1{\doemail#1,,\finish}
cannam@95 2700 \def\doemail#1,#2,#3\finish{\begingroup
cannam@95 2701 \unsepspaces
cannam@95 2702 \pdfurl{mailto:#1}%
cannam@95 2703 \setbox0 = \hbox{\ignorespaces #2}%
cannam@95 2704 \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
cannam@95 2705 \endlink
cannam@95 2706 \endgroup}
cannam@95 2707 \else
cannam@95 2708 \let\email=\uref
cannam@95 2709 \fi
cannam@95 2710
cannam@95 2711 % @kbd is like @code, except that if the argument is just one @key command,
cannam@95 2712 % then @kbd has no effect.
cannam@95 2713 \def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
cannam@95 2714
cannam@95 2715 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
cannam@95 2716 % `example' (@kbd uses ttsl only inside of @example and friends),
cannam@95 2717 % or `code' (@kbd uses normal tty font always).
cannam@95 2718 \parseargdef\kbdinputstyle{%
cannam@95 2719 \def\txiarg{#1}%
cannam@95 2720 \ifx\txiarg\worddistinct
cannam@95 2721 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
cannam@95 2722 \else\ifx\txiarg\wordexample
cannam@95 2723 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
cannam@95 2724 \else\ifx\txiarg\wordcode
cannam@95 2725 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
cannam@95 2726 \else
cannam@95 2727 \errhelp = \EMsimple
cannam@95 2728 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
cannam@95 2729 \fi\fi\fi
cannam@95 2730 }
cannam@95 2731 \def\worddistinct{distinct}
cannam@95 2732 \def\wordexample{example}
cannam@95 2733 \def\wordcode{code}
cannam@95 2734
cannam@95 2735 % Default is `distinct'.
cannam@95 2736 \kbdinputstyle distinct
cannam@95 2737
cannam@95 2738 \def\xkey{\key}
cannam@95 2739 \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
cannam@95 2740 \ifx\one\xkey\ifx\threex\three \key{#2}%
cannam@95 2741 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
cannam@95 2742 \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
cannam@95 2743
cannam@95 2744 % For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
cannam@95 2745 \let\indicateurl=\code
cannam@95 2746 \let\env=\code
cannam@95 2747 \let\command=\code
cannam@95 2748
cannam@95 2749 % @clicksequence{File @click{} Open ...}
cannam@95 2750 \def\clicksequence#1{\begingroup #1\endgroup}
cannam@95 2751
cannam@95 2752 % @clickstyle @arrow (by default)
cannam@95 2753 \parseargdef\clickstyle{\def\click{#1}}
cannam@95 2754 \def\click{\arrow}
cannam@95 2755
cannam@95 2756 % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
cannam@95 2757 % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
cannam@95 2758 %
cannam@95 2759 \def\dmn#1{\thinspace #1}
cannam@95 2760
cannam@95 2761 % @l was never documented to mean ``switch to the Lisp font'',
cannam@95 2762 % and it is not used as such in any manual I can find. We need it for
cannam@95 2763 % Polish suppressed-l. --karl, 22sep96.
cannam@95 2764 %\def\l#1{{\li #1}\null}
cannam@95 2765
cannam@95 2766 % @acronym for "FBI", "NATO", and the like.
cannam@95 2767 % We print this one point size smaller, since it's intended for
cannam@95 2768 % all-uppercase.
cannam@95 2769 %
cannam@95 2770 \def\acronym#1{\doacronym #1,,\finish}
cannam@95 2771 \def\doacronym#1,#2,#3\finish{%
cannam@95 2772 {\selectfonts\lsize #1}%
cannam@95 2773 \def\temp{#2}%
cannam@95 2774 \ifx\temp\empty \else
cannam@95 2775 \space ({\unsepspaces \ignorespaces \temp \unskip})%
cannam@95 2776 \fi
cannam@95 2777 \null % reset \spacefactor=1000
cannam@95 2778 }
cannam@95 2779
cannam@95 2780 % @abbr for "Comput. J." and the like.
cannam@95 2781 % No font change, but don't do end-of-sentence spacing.
cannam@95 2782 %
cannam@95 2783 \def\abbr#1{\doabbr #1,,\finish}
cannam@95 2784 \def\doabbr#1,#2,#3\finish{%
cannam@95 2785 {\plainfrenchspacing #1}%
cannam@95 2786 \def\temp{#2}%
cannam@95 2787 \ifx\temp\empty \else
cannam@95 2788 \space ({\unsepspaces \ignorespaces \temp \unskip})%
cannam@95 2789 \fi
cannam@95 2790 \null % reset \spacefactor=1000
cannam@95 2791 }
cannam@95 2792
cannam@95 2793 % @asis just yields its argument. Used with @table, for example.
cannam@95 2794 %
cannam@95 2795 \def\asis#1{#1}
cannam@95 2796
cannam@95 2797 % @math outputs its argument in math mode.
cannam@95 2798 %
cannam@95 2799 % One complication: _ usually means subscripts, but it could also mean
cannam@95 2800 % an actual _ character, as in @math{@var{some_variable} + 1}. So make
cannam@95 2801 % _ active, and distinguish by seeing if the current family is \slfam,
cannam@95 2802 % which is what @var uses.
cannam@95 2803 {
cannam@95 2804 \catcode`\_ = \active
cannam@95 2805 \gdef\mathunderscore{%
cannam@95 2806 \catcode`\_=\active
cannam@95 2807 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
cannam@95 2808 }
cannam@95 2809 }
cannam@95 2810 % Another complication: we want \\ (and @\) to output a math (or tt) \.
cannam@95 2811 % FYI, plain.tex uses \\ as a temporary control sequence (for no
cannam@95 2812 % particular reason), but this is not advertised and we don't care.
cannam@95 2813 %
cannam@95 2814 % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
cannam@95 2815 \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
cannam@95 2816 %
cannam@95 2817 \def\math{%
cannam@95 2818 \tex
cannam@95 2819 \mathunderscore
cannam@95 2820 \let\\ = \mathbackslash
cannam@95 2821 \mathactive
cannam@95 2822 % make the texinfo accent commands work in math mode
cannam@95 2823 \let\"=\ddot
cannam@95 2824 \let\'=\acute
cannam@95 2825 \let\==\bar
cannam@95 2826 \let\^=\hat
cannam@95 2827 \let\`=\grave
cannam@95 2828 \let\u=\breve
cannam@95 2829 \let\v=\check
cannam@95 2830 \let\~=\tilde
cannam@95 2831 \let\dotaccent=\dot
cannam@95 2832 $\finishmath
cannam@95 2833 }
cannam@95 2834 \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
cannam@95 2835
cannam@95 2836 % Some active characters (such as <) are spaced differently in math.
cannam@95 2837 % We have to reset their definitions in case the @math was an argument
cannam@95 2838 % to a command which sets the catcodes (such as @item or @section).
cannam@95 2839 %
cannam@95 2840 {
cannam@95 2841 \catcode`^ = \active
cannam@95 2842 \catcode`< = \active
cannam@95 2843 \catcode`> = \active
cannam@95 2844 \catcode`+ = \active
cannam@95 2845 \catcode`' = \active
cannam@95 2846 \gdef\mathactive{%
cannam@95 2847 \let^ = \ptexhat
cannam@95 2848 \let< = \ptexless
cannam@95 2849 \let> = \ptexgtr
cannam@95 2850 \let+ = \ptexplus
cannam@95 2851 \let' = \ptexquoteright
cannam@95 2852 }
cannam@95 2853 }
cannam@95 2854
cannam@95 2855 % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
cannam@95 2856 % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
cannam@95 2857 % except specified as a normal braced arg, so no newlines to worry about.
cannam@95 2858 %
cannam@95 2859 \def\outfmtnametex{tex}
cannam@95 2860 %
cannam@95 2861 \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
cannam@95 2862 \long\def\doinlinefmt#1,#2,\finish{%
cannam@95 2863 \def\inlinefmtname{#1}%
cannam@95 2864 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
cannam@95 2865 }
cannam@95 2866 % For raw, must switch into @tex before parsing the argument, to avoid
cannam@95 2867 % setting catcodes prematurely. Doing it this way means that, for
cannam@95 2868 % example, @inlineraw{html, foo{bar} gets a parse error instead of being
cannam@95 2869 % ignored. But this isn't important because if people want a literal
cannam@95 2870 % *right* brace they would have to use a command anyway, so they may as
cannam@95 2871 % well use a command to get a left brace too. We could re-use the
cannam@95 2872 % delimiter character idea from \verb, but it seems like overkill.
cannam@95 2873 %
cannam@95 2874 \long\def\inlineraw{\tex \doinlineraw}
cannam@95 2875 \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
cannam@95 2876 \def\doinlinerawtwo#1,#2,\finish{%
cannam@95 2877 \def\inlinerawname{#1}%
cannam@95 2878 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
cannam@95 2879 \endgroup % close group opened by \tex.
cannam@95 2880 }
cannam@95 2881
cannam@95 2882
cannam@95 2883 \message{glyphs,}
cannam@95 2884 % and logos.
cannam@95 2885
cannam@95 2886 % @@ prints an @, as does @atchar{}.
cannam@95 2887 \def\@{\char64 }
cannam@95 2888 \let\atchar=\@
cannam@95 2889
cannam@95 2890 % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
cannam@95 2891 % Unless we're in typewriter, use \ecfont because the CM text fonts do
cannam@95 2892 % not have braces, and we don't want to switch into math.
cannam@95 2893 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
cannam@95 2894 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
cannam@95 2895 \let\{=\mylbrace \let\lbracechar=\{
cannam@95 2896 \let\}=\myrbrace \let\rbracechar=\}
cannam@95 2897 \begingroup
cannam@95 2898 % Definitions to produce \{ and \} commands for indices,
cannam@95 2899 % and @{ and @} for the aux/toc files.
cannam@95 2900 \catcode`\{ = \other \catcode`\} = \other
cannam@95 2901 \catcode`\[ = 1 \catcode`\] = 2
cannam@95 2902 \catcode`\! = 0 \catcode`\\ = \other
cannam@95 2903 !gdef!lbracecmd[\{]%
cannam@95 2904 !gdef!rbracecmd[\}]%
cannam@95 2905 !gdef!lbraceatcmd[@{]%
cannam@95 2906 !gdef!rbraceatcmd[@}]%
cannam@95 2907 !endgroup
cannam@95 2908
cannam@95 2909 % @comma{} to avoid , parsing problems.
cannam@95 2910 \let\comma = ,
cannam@95 2911
cannam@95 2912 % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
cannam@95 2913 % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
cannam@95 2914 \let\, = \ptexc
cannam@95 2915 \let\dotaccent = \ptexdot
cannam@95 2916 \def\ringaccent#1{{\accent23 #1}}
cannam@95 2917 \let\tieaccent = \ptext
cannam@95 2918 \let\ubaraccent = \ptexb
cannam@95 2919 \let\udotaccent = \d
cannam@95 2920
cannam@95 2921 % Other special characters: @questiondown @exclamdown @ordf @ordm
cannam@95 2922 % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
cannam@95 2923 \def\questiondown{?`}
cannam@95 2924 \def\exclamdown{!`}
cannam@95 2925 \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
cannam@95 2926 \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
cannam@95 2927
cannam@95 2928 % Dotless i and dotless j, used for accents.
cannam@95 2929 \def\imacro{i}
cannam@95 2930 \def\jmacro{j}
cannam@95 2931 \def\dotless#1{%
cannam@95 2932 \def\temp{#1}%
cannam@95 2933 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
cannam@95 2934 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
cannam@95 2935 \else \errmessage{@dotless can be used only with i or j}%
cannam@95 2936 \fi\fi
cannam@95 2937 }
cannam@95 2938
cannam@95 2939 % The \TeX{} logo, as in plain, but resetting the spacing so that a
cannam@95 2940 % period following counts as ending a sentence. (Idea found in latex.)
cannam@95 2941 %
cannam@95 2942 \edef\TeX{\TeX \spacefactor=1000 }
cannam@95 2943
cannam@95 2944 % @LaTeX{} logo. Not quite the same results as the definition in
cannam@95 2945 % latex.ltx, since we use a different font for the raised A; it's most
cannam@95 2946 % convenient for us to use an explicitly smaller font, rather than using
cannam@95 2947 % the \scriptstyle font (since we don't reset \scriptstyle and
cannam@95 2948 % \scriptscriptstyle).
cannam@95 2949 %
cannam@95 2950 \def\LaTeX{%
cannam@95 2951 L\kern-.36em
cannam@95 2952 {\setbox0=\hbox{T}%
cannam@95 2953 \vbox to \ht0{\hbox{%
cannam@95 2954 \ifx\textnominalsize\xwordpt
cannam@95 2955 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
cannam@95 2956 % Revert to plain's \scriptsize, which is 7pt.
cannam@95 2957 \count255=\the\fam $\fam\count255 \scriptstyle A$%
cannam@95 2958 \else
cannam@95 2959 % For 11pt, we can use our lllsize.
cannam@95 2960 \selectfonts\lllsize A%
cannam@95 2961 \fi
cannam@95 2962 }%
cannam@95 2963 \vss
cannam@95 2964 }}%
cannam@95 2965 \kern-.15em
cannam@95 2966 \TeX
cannam@95 2967 }
cannam@95 2968
cannam@95 2969 % Some math mode symbols.
cannam@95 2970 \def\bullet{$\ptexbullet$}
cannam@95 2971 \def\geq{\ifmmode \ge\else $\ge$\fi}
cannam@95 2972 \def\leq{\ifmmode \le\else $\le$\fi}
cannam@95 2973 \def\minus{\ifmmode -\else $-$\fi}
cannam@95 2974
cannam@95 2975 % @dots{} outputs an ellipsis using the current font.
cannam@95 2976 % We do .5em per period so that it has the same spacing in the cm
cannam@95 2977 % typewriter fonts as three actual period characters; on the other hand,
cannam@95 2978 % in other typewriter fonts three periods are wider than 1.5em. So do
cannam@95 2979 % whichever is larger.
cannam@95 2980 %
cannam@95 2981 \def\dots{%
cannam@95 2982 \leavevmode
cannam@95 2983 \setbox0=\hbox{...}% get width of three periods
cannam@95 2984 \ifdim\wd0 > 1.5em
cannam@95 2985 \dimen0 = \wd0
cannam@95 2986 \else
cannam@95 2987 \dimen0 = 1.5em
cannam@95 2988 \fi
cannam@95 2989 \hbox to \dimen0{%
cannam@95 2990 \hskip 0pt plus.25fil
cannam@95 2991 .\hskip 0pt plus1fil
cannam@95 2992 .\hskip 0pt plus1fil
cannam@95 2993 .\hskip 0pt plus.5fil
cannam@95 2994 }%
cannam@95 2995 }
cannam@95 2996
cannam@95 2997 % @enddots{} is an end-of-sentence ellipsis.
cannam@95 2998 %
cannam@95 2999 \def\enddots{%
cannam@95 3000 \dots
cannam@95 3001 \spacefactor=\endofsentencespacefactor
cannam@95 3002 }
cannam@95 3003
cannam@95 3004 % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
cannam@95 3005 %
cannam@95 3006 % Since these characters are used in examples, they should be an even number of
cannam@95 3007 % \tt widths. Each \tt character is 1en, so two makes it 1em.
cannam@95 3008 %
cannam@95 3009 \def\point{$\star$}
cannam@95 3010 \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
cannam@95 3011 \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
cannam@95 3012 \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
cannam@95 3013 \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
cannam@95 3014 \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
cannam@95 3015
cannam@95 3016 % The @error{} command.
cannam@95 3017 % Adapted from the TeXbook's \boxit.
cannam@95 3018 %
cannam@95 3019 \newbox\errorbox
cannam@95 3020 %
cannam@95 3021 {\tentt \global\dimen0 = 3em}% Width of the box.
cannam@95 3022 \dimen2 = .55pt % Thickness of rules
cannam@95 3023 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
cannam@95 3024 \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
cannam@95 3025 %
cannam@95 3026 \setbox\errorbox=\hbox to \dimen0{\hfil
cannam@95 3027 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
cannam@95 3028 \advance\hsize by -2\dimen2 % Rules.
cannam@95 3029 \vbox{%
cannam@95 3030 \hrule height\dimen2
cannam@95 3031 \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
cannam@95 3032 \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
cannam@95 3033 \kern3pt\vrule width\dimen2}% Space to right.
cannam@95 3034 \hrule height\dimen2}
cannam@95 3035 \hfil}
cannam@95 3036 %
cannam@95 3037 \def\error{\leavevmode\lower.7ex\copy\errorbox}
cannam@95 3038
cannam@95 3039 % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
cannam@95 3040 %
cannam@95 3041 \def\pounds{{\it\$}}
cannam@95 3042
cannam@95 3043 % @euro{} comes from a separate font, depending on the current style.
cannam@95 3044 % We use the free feym* fonts from the eurosym package by Henrik
cannam@95 3045 % Theiling, which support regular, slanted, bold and bold slanted (and
cannam@95 3046 % "outlined" (blackboard board, sort of) versions, which we don't need).
cannam@95 3047 % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
cannam@95 3048 %
cannam@95 3049 % Although only regular is the truly official Euro symbol, we ignore
cannam@95 3050 % that. The Euro is designed to be slightly taller than the regular
cannam@95 3051 % font height.
cannam@95 3052 %
cannam@95 3053 % feymr - regular
cannam@95 3054 % feymo - slanted
cannam@95 3055 % feybr - bold
cannam@95 3056 % feybo - bold slanted
cannam@95 3057 %
cannam@95 3058 % There is no good (free) typewriter version, to my knowledge.
cannam@95 3059 % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
cannam@95 3060 % Hmm.
cannam@95 3061 %
cannam@95 3062 % Also doesn't work in math. Do we need to do math with euro symbols?
cannam@95 3063 % Hope not.
cannam@95 3064 %
cannam@95 3065 %
cannam@95 3066 \def\euro{{\eurofont e}}
cannam@95 3067 \def\eurofont{%
cannam@95 3068 % We set the font at each command, rather than predefining it in
cannam@95 3069 % \textfonts and the other font-switching commands, so that
cannam@95 3070 % installations which never need the symbol don't have to have the
cannam@95 3071 % font installed.
cannam@95 3072 %
cannam@95 3073 % There is only one designed size (nominal 10pt), so we always scale
cannam@95 3074 % that to the current nominal size.
cannam@95 3075 %
cannam@95 3076 % By the way, simply using "at 1em" works for cmr10 and the like, but
cannam@95 3077 % does not work for cmbx10 and other extended/shrunken fonts.
cannam@95 3078 %
cannam@95 3079 \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
cannam@95 3080 %
cannam@95 3081 \ifx\curfontstyle\bfstylename
cannam@95 3082 % bold:
cannam@95 3083 \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
cannam@95 3084 \else
cannam@95 3085 % regular:
cannam@95 3086 \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
cannam@95 3087 \fi
cannam@95 3088 \thiseurofont
cannam@95 3089 }
cannam@95 3090
cannam@95 3091 % Glyphs from the EC fonts. We don't use \let for the aliases, because
cannam@95 3092 % sometimes we redefine the original macro, and the alias should reflect
cannam@95 3093 % the redefinition.
cannam@95 3094 %
cannam@95 3095 % Use LaTeX names for the Icelandic letters.
cannam@95 3096 \def\DH{{\ecfont \char"D0}} % Eth
cannam@95 3097 \def\dh{{\ecfont \char"F0}} % eth
cannam@95 3098 \def\TH{{\ecfont \char"DE}} % Thorn
cannam@95 3099 \def\th{{\ecfont \char"FE}} % thorn
cannam@95 3100 %
cannam@95 3101 \def\guillemetleft{{\ecfont \char"13}}
cannam@95 3102 \def\guillemotleft{\guillemetleft}
cannam@95 3103 \def\guillemetright{{\ecfont \char"14}}
cannam@95 3104 \def\guillemotright{\guillemetright}
cannam@95 3105 \def\guilsinglleft{{\ecfont \char"0E}}
cannam@95 3106 \def\guilsinglright{{\ecfont \char"0F}}
cannam@95 3107 \def\quotedblbase{{\ecfont \char"12}}
cannam@95 3108 \def\quotesinglbase{{\ecfont \char"0D}}
cannam@95 3109 %
cannam@95 3110 % This positioning is not perfect (see the ogonek LaTeX package), but
cannam@95 3111 % we have the precomposed glyphs for the most common cases. We put the
cannam@95 3112 % tests to use those glyphs in the single \ogonek macro so we have fewer
cannam@95 3113 % dummy definitions to worry about for index entries, etc.
cannam@95 3114 %
cannam@95 3115 % ogonek is also used with other letters in Lithuanian (IOU), but using
cannam@95 3116 % the precomposed glyphs for those is not so easy since they aren't in
cannam@95 3117 % the same EC font.
cannam@95 3118 \def\ogonek#1{{%
cannam@95 3119 \def\temp{#1}%
cannam@95 3120 \ifx\temp\macrocharA\Aogonek
cannam@95 3121 \else\ifx\temp\macrochara\aogonek
cannam@95 3122 \else\ifx\temp\macrocharE\Eogonek
cannam@95 3123 \else\ifx\temp\macrochare\eogonek
cannam@95 3124 \else
cannam@95 3125 \ecfont \setbox0=\hbox{#1}%
cannam@95 3126 \ifdim\ht0=1ex\accent"0C #1%
cannam@95 3127 \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
cannam@95 3128 \fi
cannam@95 3129 \fi\fi\fi\fi
cannam@95 3130 }%
cannam@95 3131 }
cannam@95 3132 \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
cannam@95 3133 \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
cannam@95 3134 \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
cannam@95 3135 \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
cannam@95 3136 %
cannam@95 3137 % Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
cannam@95 3138 \def\ecfont{%
cannam@95 3139 % We can't distinguish serif/sans and italic/slanted, but this
cannam@95 3140 % is used for crude hacks anyway (like adding French and German
cannam@95 3141 % quotes to documents typeset with CM, where we lose kerning), so
cannam@95 3142 % hopefully nobody will notice/care.
cannam@95 3143 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
cannam@95 3144 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
cannam@95 3145 \ifx\curfontstyle\bfstylename
cannam@95 3146 % bold:
cannam@95 3147 \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
cannam@95 3148 \else
cannam@95 3149 % regular:
cannam@95 3150 \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
cannam@95 3151 \fi
cannam@95 3152 \thisecfont
cannam@95 3153 }
cannam@95 3154
cannam@95 3155 % @registeredsymbol - R in a circle. The font for the R should really
cannam@95 3156 % be smaller yet, but lllsize is the best we can do for now.
cannam@95 3157 % Adapted from the plain.tex definition of \copyright.
cannam@95 3158 %
cannam@95 3159 \def\registeredsymbol{%
cannam@95 3160 $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
cannam@95 3161 \hfil\crcr\Orb}}%
cannam@95 3162 }$%
cannam@95 3163 }
cannam@95 3164
cannam@95 3165 % @textdegree - the normal degrees sign.
cannam@95 3166 %
cannam@95 3167 \def\textdegree{$^\circ$}
cannam@95 3168
cannam@95 3169 % Laurent Siebenmann reports \Orb undefined with:
cannam@95 3170 % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
cannam@95 3171 % so we'll define it if necessary.
cannam@95 3172 %
cannam@95 3173 \ifx\Orb\thisisundefined
cannam@95 3174 \def\Orb{\mathhexbox20D}
cannam@95 3175 \fi
cannam@95 3176
cannam@95 3177 % Quotes.
cannam@95 3178 \chardef\quotedblleft="5C
cannam@95 3179 \chardef\quotedblright=`\"
cannam@95 3180 \chardef\quoteleft=`\`
cannam@95 3181 \chardef\quoteright=`\'
cannam@95 3182
cannam@95 3183
cannam@95 3184 \message{page headings,}
cannam@95 3185
cannam@95 3186 \newskip\titlepagetopglue \titlepagetopglue = 1.5in
cannam@95 3187 \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
cannam@95 3188
cannam@95 3189 % First the title page. Must do @settitle before @titlepage.
cannam@95 3190 \newif\ifseenauthor
cannam@95 3191 \newif\iffinishedtitlepage
cannam@95 3192
cannam@95 3193 % Do an implicit @contents or @shortcontents after @end titlepage if the
cannam@95 3194 % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
cannam@95 3195 %
cannam@95 3196 \newif\ifsetcontentsaftertitlepage
cannam@95 3197 \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
cannam@95 3198 \newif\ifsetshortcontentsaftertitlepage
cannam@95 3199 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
cannam@95 3200
cannam@95 3201 \parseargdef\shorttitlepage{%
cannam@95 3202 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
cannam@95 3203 \endgroup\page\hbox{}\page}
cannam@95 3204
cannam@95 3205 \envdef\titlepage{%
cannam@95 3206 % Open one extra group, as we want to close it in the middle of \Etitlepage.
cannam@95 3207 \begingroup
cannam@95 3208 \parindent=0pt \textfonts
cannam@95 3209 % Leave some space at the very top of the page.
cannam@95 3210 \vglue\titlepagetopglue
cannam@95 3211 % No rule at page bottom unless we print one at the top with @title.
cannam@95 3212 \finishedtitlepagetrue
cannam@95 3213 %
cannam@95 3214 % Most title ``pages'' are actually two pages long, with space
cannam@95 3215 % at the top of the second. We don't want the ragged left on the second.
cannam@95 3216 \let\oldpage = \page
cannam@95 3217 \def\page{%
cannam@95 3218 \iffinishedtitlepage\else
cannam@95 3219 \finishtitlepage
cannam@95 3220 \fi
cannam@95 3221 \let\page = \oldpage
cannam@95 3222 \page
cannam@95 3223 \null
cannam@95 3224 }%
cannam@95 3225 }
cannam@95 3226
cannam@95 3227 \def\Etitlepage{%
cannam@95 3228 \iffinishedtitlepage\else
cannam@95 3229 \finishtitlepage
cannam@95 3230 \fi
cannam@95 3231 % It is important to do the page break before ending the group,
cannam@95 3232 % because the headline and footline are only empty inside the group.
cannam@95 3233 % If we use the new definition of \page, we always get a blank page
cannam@95 3234 % after the title page, which we certainly don't want.
cannam@95 3235 \oldpage
cannam@95 3236 \endgroup
cannam@95 3237 %
cannam@95 3238 % Need this before the \...aftertitlepage checks so that if they are
cannam@95 3239 % in effect the toc pages will come out with page numbers.
cannam@95 3240 \HEADINGSon
cannam@95 3241 %
cannam@95 3242 % If they want short, they certainly want long too.
cannam@95 3243 \ifsetshortcontentsaftertitlepage
cannam@95 3244 \shortcontents
cannam@95 3245 \contents
cannam@95 3246 \global\let\shortcontents = \relax
cannam@95 3247 \global\let\contents = \relax
cannam@95 3248 \fi
cannam@95 3249 %
cannam@95 3250 \ifsetcontentsaftertitlepage
cannam@95 3251 \contents
cannam@95 3252 \global\let\contents = \relax
cannam@95 3253 \global\let\shortcontents = \relax
cannam@95 3254 \fi
cannam@95 3255 }
cannam@95 3256
cannam@95 3257 \def\finishtitlepage{%
cannam@95 3258 \vskip4pt \hrule height 2pt width \hsize
cannam@95 3259 \vskip\titlepagebottomglue
cannam@95 3260 \finishedtitlepagetrue
cannam@95 3261 }
cannam@95 3262
cannam@95 3263 % Macros to be used within @titlepage:
cannam@95 3264
cannam@95 3265 \let\subtitlerm=\tenrm
cannam@95 3266 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
cannam@95 3267
cannam@95 3268 \parseargdef\title{%
cannam@95 3269 \checkenv\titlepage
cannam@95 3270 \leftline{\titlefonts\rmisbold #1}
cannam@95 3271 % print a rule at the page bottom also.
cannam@95 3272 \finishedtitlepagefalse
cannam@95 3273 \vskip4pt \hrule height 4pt width \hsize \vskip4pt
cannam@95 3274 }
cannam@95 3275
cannam@95 3276 \parseargdef\subtitle{%
cannam@95 3277 \checkenv\titlepage
cannam@95 3278 {\subtitlefont \rightline{#1}}%
cannam@95 3279 }
cannam@95 3280
cannam@95 3281 % @author should come last, but may come many times.
cannam@95 3282 % It can also be used inside @quotation.
cannam@95 3283 %
cannam@95 3284 \parseargdef\author{%
cannam@95 3285 \def\temp{\quotation}%
cannam@95 3286 \ifx\thisenv\temp
cannam@95 3287 \def\quotationauthor{#1}% printed in \Equotation.
cannam@95 3288 \else
cannam@95 3289 \checkenv\titlepage
cannam@95 3290 \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
cannam@95 3291 {\secfonts\rmisbold \leftline{#1}}%
cannam@95 3292 \fi
cannam@95 3293 }
cannam@95 3294
cannam@95 3295
cannam@95 3296 % Set up page headings and footings.
cannam@95 3297
cannam@95 3298 \let\thispage=\folio
cannam@95 3299
cannam@95 3300 \newtoks\evenheadline % headline on even pages
cannam@95 3301 \newtoks\oddheadline % headline on odd pages
cannam@95 3302 \newtoks\evenfootline % footline on even pages
cannam@95 3303 \newtoks\oddfootline % footline on odd pages
cannam@95 3304
cannam@95 3305 % Now make TeX use those variables
cannam@95 3306 \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
cannam@95 3307 \else \the\evenheadline \fi}}
cannam@95 3308 \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
cannam@95 3309 \else \the\evenfootline \fi}\HEADINGShook}
cannam@95 3310 \let\HEADINGShook=\relax
cannam@95 3311
cannam@95 3312 % Commands to set those variables.
cannam@95 3313 % For example, this is what @headings on does
cannam@95 3314 % @evenheading @thistitle|@thispage|@thischapter
cannam@95 3315 % @oddheading @thischapter|@thispage|@thistitle
cannam@95 3316 % @evenfooting @thisfile||
cannam@95 3317 % @oddfooting ||@thisfile
cannam@95 3318
cannam@95 3319
cannam@95 3320 \def\evenheading{\parsearg\evenheadingxxx}
cannam@95 3321 \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
cannam@95 3322 \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
cannam@95 3323 \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
cannam@95 3324
cannam@95 3325 \def\oddheading{\parsearg\oddheadingxxx}
cannam@95 3326 \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
cannam@95 3327 \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
cannam@95 3328 \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
cannam@95 3329
cannam@95 3330 \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
cannam@95 3331
cannam@95 3332 \def\evenfooting{\parsearg\evenfootingxxx}
cannam@95 3333 \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
cannam@95 3334 \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
cannam@95 3335 \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
cannam@95 3336
cannam@95 3337 \def\oddfooting{\parsearg\oddfootingxxx}
cannam@95 3338 \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
cannam@95 3339 \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
cannam@95 3340 \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
cannam@95 3341 %
cannam@95 3342 % Leave some space for the footline. Hopefully ok to assume
cannam@95 3343 % @evenfooting will not be used by itself.
cannam@95 3344 \global\advance\pageheight by -12pt
cannam@95 3345 \global\advance\vsize by -12pt
cannam@95 3346 }
cannam@95 3347
cannam@95 3348 \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
cannam@95 3349
cannam@95 3350 % @evenheadingmarks top \thischapter <- chapter at the top of a page
cannam@95 3351 % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
cannam@95 3352 %
cannam@95 3353 % The same set of arguments for:
cannam@95 3354 %
cannam@95 3355 % @oddheadingmarks
cannam@95 3356 % @evenfootingmarks
cannam@95 3357 % @oddfootingmarks
cannam@95 3358 % @everyheadingmarks
cannam@95 3359 % @everyfootingmarks
cannam@95 3360
cannam@95 3361 \def\evenheadingmarks{\headingmarks{even}{heading}}
cannam@95 3362 \def\oddheadingmarks{\headingmarks{odd}{heading}}
cannam@95 3363 \def\evenfootingmarks{\headingmarks{even}{footing}}
cannam@95 3364 \def\oddfootingmarks{\headingmarks{odd}{footing}}
cannam@95 3365 \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
cannam@95 3366 \headingmarks{odd}{heading}{#1} }
cannam@95 3367 \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
cannam@95 3368 \headingmarks{odd}{footing}{#1} }
cannam@95 3369 % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
cannam@95 3370 \def\headingmarks#1#2#3 {%
cannam@95 3371 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
cannam@95 3372 \global\expandafter\let\csname get#1#2marks\endcsname \temp
cannam@95 3373 }
cannam@95 3374
cannam@95 3375 \everyheadingmarks bottom
cannam@95 3376 \everyfootingmarks bottom
cannam@95 3377
cannam@95 3378 % @headings double turns headings on for double-sided printing.
cannam@95 3379 % @headings single turns headings on for single-sided printing.
cannam@95 3380 % @headings off turns them off.
cannam@95 3381 % @headings on same as @headings double, retained for compatibility.
cannam@95 3382 % @headings after turns on double-sided headings after this page.
cannam@95 3383 % @headings doubleafter turns on double-sided headings after this page.
cannam@95 3384 % @headings singleafter turns on single-sided headings after this page.
cannam@95 3385 % By default, they are off at the start of a document,
cannam@95 3386 % and turned `on' after @end titlepage.
cannam@95 3387
cannam@95 3388 \def\headings #1 {\csname HEADINGS#1\endcsname}
cannam@95 3389
cannam@95 3390 \def\headingsoff{% non-global headings elimination
cannam@95 3391 \evenheadline={\hfil}\evenfootline={\hfil}%
cannam@95 3392 \oddheadline={\hfil}\oddfootline={\hfil}%
cannam@95 3393 }
cannam@95 3394
cannam@95 3395 \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
cannam@95 3396 \HEADINGSoff % it's the default
cannam@95 3397
cannam@95 3398 % When we turn headings on, set the page number to 1.
cannam@95 3399 % For double-sided printing, put current file name in lower left corner,
cannam@95 3400 % chapter name on inside top of right hand pages, document
cannam@95 3401 % title on inside top of left hand pages, and page numbers on outside top
cannam@95 3402 % edge of all pages.
cannam@95 3403 \def\HEADINGSdouble{%
cannam@95 3404 \global\pageno=1
cannam@95 3405 \global\evenfootline={\hfil}
cannam@95 3406 \global\oddfootline={\hfil}
cannam@95 3407 \global\evenheadline={\line{\folio\hfil\thistitle}}
cannam@95 3408 \global\oddheadline={\line{\thischapter\hfil\folio}}
cannam@95 3409 \global\let\contentsalignmacro = \chapoddpage
cannam@95 3410 }
cannam@95 3411 \let\contentsalignmacro = \chappager
cannam@95 3412
cannam@95 3413 % For single-sided printing, chapter title goes across top left of page,
cannam@95 3414 % page number on top right.
cannam@95 3415 \def\HEADINGSsingle{%
cannam@95 3416 \global\pageno=1
cannam@95 3417 \global\evenfootline={\hfil}
cannam@95 3418 \global\oddfootline={\hfil}
cannam@95 3419 \global\evenheadline={\line{\thischapter\hfil\folio}}
cannam@95 3420 \global\oddheadline={\line{\thischapter\hfil\folio}}
cannam@95 3421 \global\let\contentsalignmacro = \chappager
cannam@95 3422 }
cannam@95 3423 \def\HEADINGSon{\HEADINGSdouble}
cannam@95 3424
cannam@95 3425 \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
cannam@95 3426 \let\HEADINGSdoubleafter=\HEADINGSafter
cannam@95 3427 \def\HEADINGSdoublex{%
cannam@95 3428 \global\evenfootline={\hfil}
cannam@95 3429 \global\oddfootline={\hfil}
cannam@95 3430 \global\evenheadline={\line{\folio\hfil\thistitle}}
cannam@95 3431 \global\oddheadline={\line{\thischapter\hfil\folio}}
cannam@95 3432 \global\let\contentsalignmacro = \chapoddpage
cannam@95 3433 }
cannam@95 3434
cannam@95 3435 \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
cannam@95 3436 \def\HEADINGSsinglex{%
cannam@95 3437 \global\evenfootline={\hfil}
cannam@95 3438 \global\oddfootline={\hfil}
cannam@95 3439 \global\evenheadline={\line{\thischapter\hfil\folio}}
cannam@95 3440 \global\oddheadline={\line{\thischapter\hfil\folio}}
cannam@95 3441 \global\let\contentsalignmacro = \chappager
cannam@95 3442 }
cannam@95 3443
cannam@95 3444 % Subroutines used in generating headings
cannam@95 3445 % This produces Day Month Year style of output.
cannam@95 3446 % Only define if not already defined, in case a txi-??.tex file has set
cannam@95 3447 % up a different format (e.g., txi-cs.tex does this).
cannam@95 3448 \ifx\today\thisisundefined
cannam@95 3449 \def\today{%
cannam@95 3450 \number\day\space
cannam@95 3451 \ifcase\month
cannam@95 3452 \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
cannam@95 3453 \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
cannam@95 3454 \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
cannam@95 3455 \fi
cannam@95 3456 \space\number\year}
cannam@95 3457 \fi
cannam@95 3458
cannam@95 3459 % @settitle line... specifies the title of the document, for headings.
cannam@95 3460 % It generates no output of its own.
cannam@95 3461 \def\thistitle{\putwordNoTitle}
cannam@95 3462 \def\settitle{\parsearg{\gdef\thistitle}}
cannam@95 3463
cannam@95 3464
cannam@95 3465 \message{tables,}
cannam@95 3466 % Tables -- @table, @ftable, @vtable, @item(x).
cannam@95 3467
cannam@95 3468 % default indentation of table text
cannam@95 3469 \newdimen\tableindent \tableindent=.8in
cannam@95 3470 % default indentation of @itemize and @enumerate text
cannam@95 3471 \newdimen\itemindent \itemindent=.3in
cannam@95 3472 % margin between end of table item and start of table text.
cannam@95 3473 \newdimen\itemmargin \itemmargin=.1in
cannam@95 3474
cannam@95 3475 % used internally for \itemindent minus \itemmargin
cannam@95 3476 \newdimen\itemmax
cannam@95 3477
cannam@95 3478 % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
cannam@95 3479 % these defs.
cannam@95 3480 % They also define \itemindex
cannam@95 3481 % to index the item name in whatever manner is desired (perhaps none).
cannam@95 3482
cannam@95 3483 \newif\ifitemxneedsnegativevskip
cannam@95 3484
cannam@95 3485 \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
cannam@95 3486
cannam@95 3487 \def\internalBitem{\smallbreak \parsearg\itemzzz}
cannam@95 3488 \def\internalBitemx{\itemxpar \parsearg\itemzzz}
cannam@95 3489
cannam@95 3490 \def\itemzzz #1{\begingroup %
cannam@95 3491 \advance\hsize by -\rightskip
cannam@95 3492 \advance\hsize by -\tableindent
cannam@95 3493 \setbox0=\hbox{\itemindicate{#1}}%
cannam@95 3494 \itemindex{#1}%
cannam@95 3495 \nobreak % This prevents a break before @itemx.
cannam@95 3496 %
cannam@95 3497 % If the item text does not fit in the space we have, put it on a line
cannam@95 3498 % by itself, and do not allow a page break either before or after that
cannam@95 3499 % line. We do not start a paragraph here because then if the next
cannam@95 3500 % command is, e.g., @kindex, the whatsit would get put into the
cannam@95 3501 % horizontal list on a line by itself, resulting in extra blank space.
cannam@95 3502 \ifdim \wd0>\itemmax
cannam@95 3503 %
cannam@95 3504 % Make this a paragraph so we get the \parskip glue and wrapping,
cannam@95 3505 % but leave it ragged-right.
cannam@95 3506 \begingroup
cannam@95 3507 \advance\leftskip by-\tableindent
cannam@95 3508 \advance\hsize by\tableindent
cannam@95 3509 \advance\rightskip by0pt plus1fil\relax
cannam@95 3510 \leavevmode\unhbox0\par
cannam@95 3511 \endgroup
cannam@95 3512 %
cannam@95 3513 % We're going to be starting a paragraph, but we don't want the
cannam@95 3514 % \parskip glue -- logically it's part of the @item we just started.
cannam@95 3515 \nobreak \vskip-\parskip
cannam@95 3516 %
cannam@95 3517 % Stop a page break at the \parskip glue coming up. However, if
cannam@95 3518 % what follows is an environment such as @example, there will be no
cannam@95 3519 % \parskip glue; then the negative vskip we just inserted would
cannam@95 3520 % cause the example and the item to crash together. So we use this
cannam@95 3521 % bizarre value of 10001 as a signal to \aboveenvbreak to insert
cannam@95 3522 % \parskip glue after all. Section titles are handled this way also.
cannam@95 3523 %
cannam@95 3524 \penalty 10001
cannam@95 3525 \endgroup
cannam@95 3526 \itemxneedsnegativevskipfalse
cannam@95 3527 \else
cannam@95 3528 % The item text fits into the space. Start a paragraph, so that the
cannam@95 3529 % following text (if any) will end up on the same line.
cannam@95 3530 \noindent
cannam@95 3531 % Do this with kerns and \unhbox so that if there is a footnote in
cannam@95 3532 % the item text, it can migrate to the main vertical list and
cannam@95 3533 % eventually be printed.
cannam@95 3534 \nobreak\kern-\tableindent
cannam@95 3535 \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
cannam@95 3536 \unhbox0
cannam@95 3537 \nobreak\kern\dimen0
cannam@95 3538 \endgroup
cannam@95 3539 \itemxneedsnegativevskiptrue
cannam@95 3540 \fi
cannam@95 3541 }
cannam@95 3542
cannam@95 3543 \def\item{\errmessage{@item while not in a list environment}}
cannam@95 3544 \def\itemx{\errmessage{@itemx while not in a list environment}}
cannam@95 3545
cannam@95 3546 % @table, @ftable, @vtable.
cannam@95 3547 \envdef\table{%
cannam@95 3548 \let\itemindex\gobble
cannam@95 3549 \tablecheck{table}%
cannam@95 3550 }
cannam@95 3551 \envdef\ftable{%
cannam@95 3552 \def\itemindex ##1{\doind {fn}{\code{##1}}}%
cannam@95 3553 \tablecheck{ftable}%
cannam@95 3554 }
cannam@95 3555 \envdef\vtable{%
cannam@95 3556 \def\itemindex ##1{\doind {vr}{\code{##1}}}%
cannam@95 3557 \tablecheck{vtable}%
cannam@95 3558 }
cannam@95 3559 \def\tablecheck#1{%
cannam@95 3560 \ifnum \the\catcode`\^^M=\active
cannam@95 3561 \endgroup
cannam@95 3562 \errmessage{This command won't work in this context; perhaps the problem is
cannam@95 3563 that we are \inenvironment\thisenv}%
cannam@95 3564 \def\next{\doignore{#1}}%
cannam@95 3565 \else
cannam@95 3566 \let\next\tablex
cannam@95 3567 \fi
cannam@95 3568 \next
cannam@95 3569 }
cannam@95 3570 \def\tablex#1{%
cannam@95 3571 \def\itemindicate{#1}%
cannam@95 3572 \parsearg\tabley
cannam@95 3573 }
cannam@95 3574 \def\tabley#1{%
cannam@95 3575 {%
cannam@95 3576 \makevalueexpandable
cannam@95 3577 \edef\temp{\noexpand\tablez #1\space\space\space}%
cannam@95 3578 \expandafter
cannam@95 3579 }\temp \endtablez
cannam@95 3580 }
cannam@95 3581 \def\tablez #1 #2 #3 #4\endtablez{%
cannam@95 3582 \aboveenvbreak
cannam@95 3583 \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
cannam@95 3584 \ifnum 0#2>0 \tableindent=#2\mil \fi
cannam@95 3585 \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
cannam@95 3586 \itemmax=\tableindent
cannam@95 3587 \advance \itemmax by -\itemmargin
cannam@95 3588 \advance \leftskip by \tableindent
cannam@95 3589 \exdentamount=\tableindent
cannam@95 3590 \parindent = 0pt
cannam@95 3591 \parskip = \smallskipamount
cannam@95 3592 \ifdim \parskip=0pt \parskip=2pt \fi
cannam@95 3593 \let\item = \internalBitem
cannam@95 3594 \let\itemx = \internalBitemx
cannam@95 3595 }
cannam@95 3596 \def\Etable{\endgraf\afterenvbreak}
cannam@95 3597 \let\Eftable\Etable
cannam@95 3598 \let\Evtable\Etable
cannam@95 3599 \let\Eitemize\Etable
cannam@95 3600 \let\Eenumerate\Etable
cannam@95 3601
cannam@95 3602 % This is the counter used by @enumerate, which is really @itemize
cannam@95 3603
cannam@95 3604 \newcount \itemno
cannam@95 3605
cannam@95 3606 \envdef\itemize{\parsearg\doitemize}
cannam@95 3607
cannam@95 3608 \def\doitemize#1{%
cannam@95 3609 \aboveenvbreak
cannam@95 3610 \itemmax=\itemindent
cannam@95 3611 \advance\itemmax by -\itemmargin
cannam@95 3612 \advance\leftskip by \itemindent
cannam@95 3613 \exdentamount=\itemindent
cannam@95 3614 \parindent=0pt
cannam@95 3615 \parskip=\smallskipamount
cannam@95 3616 \ifdim\parskip=0pt \parskip=2pt \fi
cannam@95 3617 %
cannam@95 3618 % Try typesetting the item mark that if the document erroneously says
cannam@95 3619 % something like @itemize @samp (intending @table), there's an error
cannam@95 3620 % right away at the @itemize. It's not the best error message in the
cannam@95 3621 % world, but it's better than leaving it to the @item. This means if
cannam@95 3622 % the user wants an empty mark, they have to say @w{} not just @w.
cannam@95 3623 \def\itemcontents{#1}%
cannam@95 3624 \setbox0 = \hbox{\itemcontents}%
cannam@95 3625 %
cannam@95 3626 % @itemize with no arg is equivalent to @itemize @bullet.
cannam@95 3627 \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
cannam@95 3628 %
cannam@95 3629 \let\item=\itemizeitem
cannam@95 3630 }
cannam@95 3631
cannam@95 3632 % Definition of @item while inside @itemize and @enumerate.
cannam@95 3633 %
cannam@95 3634 \def\itemizeitem{%
cannam@95 3635 \advance\itemno by 1 % for enumerations
cannam@95 3636 {\let\par=\endgraf \smallbreak}% reasonable place to break
cannam@95 3637 {%
cannam@95 3638 % If the document has an @itemize directly after a section title, a
cannam@95 3639 % \nobreak will be last on the list, and \sectionheading will have
cannam@95 3640 % done a \vskip-\parskip. In that case, we don't want to zero
cannam@95 3641 % parskip, or the item text will crash with the heading. On the
cannam@95 3642 % other hand, when there is normal text preceding the item (as there
cannam@95 3643 % usually is), we do want to zero parskip, or there would be too much
cannam@95 3644 % space. In that case, we won't have a \nobreak before. At least
cannam@95 3645 % that's the theory.
cannam@95 3646 \ifnum\lastpenalty<10000 \parskip=0in \fi
cannam@95 3647 \noindent
cannam@95 3648 \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
cannam@95 3649 %
cannam@95 3650 \vadjust{\penalty 1200}}% not good to break after first line of item.
cannam@95 3651 \flushcr
cannam@95 3652 }
cannam@95 3653
cannam@95 3654 % \splitoff TOKENS\endmark defines \first to be the first token in
cannam@95 3655 % TOKENS, and \rest to be the remainder.
cannam@95 3656 %
cannam@95 3657 \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
cannam@95 3658
cannam@95 3659 % Allow an optional argument of an uppercase letter, lowercase letter,
cannam@95 3660 % or number, to specify the first label in the enumerated list. No
cannam@95 3661 % argument is the same as `1'.
cannam@95 3662 %
cannam@95 3663 \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
cannam@95 3664 \def\enumeratey #1 #2\endenumeratey{%
cannam@95 3665 % If we were given no argument, pretend we were given `1'.
cannam@95 3666 \def\thearg{#1}%
cannam@95 3667 \ifx\thearg\empty \def\thearg{1}\fi
cannam@95 3668 %
cannam@95 3669 % Detect if the argument is a single token. If so, it might be a
cannam@95 3670 % letter. Otherwise, the only valid thing it can be is a number.
cannam@95 3671 % (We will always have one token, because of the test we just made.
cannam@95 3672 % This is a good thing, since \splitoff doesn't work given nothing at
cannam@95 3673 % all -- the first parameter is undelimited.)
cannam@95 3674 \expandafter\splitoff\thearg\endmark
cannam@95 3675 \ifx\rest\empty
cannam@95 3676 % Only one token in the argument. It could still be anything.
cannam@95 3677 % A ``lowercase letter'' is one whose \lccode is nonzero.
cannam@95 3678 % An ``uppercase letter'' is one whose \lccode is both nonzero, and
cannam@95 3679 % not equal to itself.
cannam@95 3680 % Otherwise, we assume it's a number.
cannam@95 3681 %
cannam@95 3682 % We need the \relax at the end of the \ifnum lines to stop TeX from
cannam@95 3683 % continuing to look for a <number>.
cannam@95 3684 %
cannam@95 3685 \ifnum\lccode\expandafter`\thearg=0\relax
cannam@95 3686 \numericenumerate % a number (we hope)
cannam@95 3687 \else
cannam@95 3688 % It's a letter.
cannam@95 3689 \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
cannam@95 3690 \lowercaseenumerate % lowercase letter
cannam@95 3691 \else
cannam@95 3692 \uppercaseenumerate % uppercase letter
cannam@95 3693 \fi
cannam@95 3694 \fi
cannam@95 3695 \else
cannam@95 3696 % Multiple tokens in the argument. We hope it's a number.
cannam@95 3697 \numericenumerate
cannam@95 3698 \fi
cannam@95 3699 }
cannam@95 3700
cannam@95 3701 % An @enumerate whose labels are integers. The starting integer is
cannam@95 3702 % given in \thearg.
cannam@95 3703 %
cannam@95 3704 \def\numericenumerate{%
cannam@95 3705 \itemno = \thearg
cannam@95 3706 \startenumeration{\the\itemno}%
cannam@95 3707 }
cannam@95 3708
cannam@95 3709 % The starting (lowercase) letter is in \thearg.
cannam@95 3710 \def\lowercaseenumerate{%
cannam@95 3711 \itemno = \expandafter`\thearg
cannam@95 3712 \startenumeration{%
cannam@95 3713 % Be sure we're not beyond the end of the alphabet.
cannam@95 3714 \ifnum\itemno=0
cannam@95 3715 \errmessage{No more lowercase letters in @enumerate; get a bigger
cannam@95 3716 alphabet}%
cannam@95 3717 \fi
cannam@95 3718 \char\lccode\itemno
cannam@95 3719 }%
cannam@95 3720 }
cannam@95 3721
cannam@95 3722 % The starting (uppercase) letter is in \thearg.
cannam@95 3723 \def\uppercaseenumerate{%
cannam@95 3724 \itemno = \expandafter`\thearg
cannam@95 3725 \startenumeration{%
cannam@95 3726 % Be sure we're not beyond the end of the alphabet.
cannam@95 3727 \ifnum\itemno=0
cannam@95 3728 \errmessage{No more uppercase letters in @enumerate; get a bigger
cannam@95 3729 alphabet}
cannam@95 3730 \fi
cannam@95 3731 \char\uccode\itemno
cannam@95 3732 }%
cannam@95 3733 }
cannam@95 3734
cannam@95 3735 % Call \doitemize, adding a period to the first argument and supplying the
cannam@95 3736 % common last two arguments. Also subtract one from the initial value in
cannam@95 3737 % \itemno, since @item increments \itemno.
cannam@95 3738 %
cannam@95 3739 \def\startenumeration#1{%
cannam@95 3740 \advance\itemno by -1
cannam@95 3741 \doitemize{#1.}\flushcr
cannam@95 3742 }
cannam@95 3743
cannam@95 3744 % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
cannam@95 3745 % to @enumerate.
cannam@95 3746 %
cannam@95 3747 \def\alphaenumerate{\enumerate{a}}
cannam@95 3748 \def\capsenumerate{\enumerate{A}}
cannam@95 3749 \def\Ealphaenumerate{\Eenumerate}
cannam@95 3750 \def\Ecapsenumerate{\Eenumerate}
cannam@95 3751
cannam@95 3752
cannam@95 3753 % @multitable macros
cannam@95 3754 % Amy Hendrickson, 8/18/94, 3/6/96
cannam@95 3755 %
cannam@95 3756 % @multitable ... @end multitable will make as many columns as desired.
cannam@95 3757 % Contents of each column will wrap at width given in preamble. Width
cannam@95 3758 % can be specified either with sample text given in a template line,
cannam@95 3759 % or in percent of \hsize, the current width of text on page.
cannam@95 3760
cannam@95 3761 % Table can continue over pages but will only break between lines.
cannam@95 3762
cannam@95 3763 % To make preamble:
cannam@95 3764 %
cannam@95 3765 % Either define widths of columns in terms of percent of \hsize:
cannam@95 3766 % @multitable @columnfractions .25 .3 .45
cannam@95 3767 % @item ...
cannam@95 3768 %
cannam@95 3769 % Numbers following @columnfractions are the percent of the total
cannam@95 3770 % current hsize to be used for each column. You may use as many
cannam@95 3771 % columns as desired.
cannam@95 3772
cannam@95 3773
cannam@95 3774 % Or use a template:
cannam@95 3775 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
cannam@95 3776 % @item ...
cannam@95 3777 % using the widest term desired in each column.
cannam@95 3778
cannam@95 3779 % Each new table line starts with @item, each subsequent new column
cannam@95 3780 % starts with @tab. Empty columns may be produced by supplying @tab's
cannam@95 3781 % with nothing between them for as many times as empty columns are needed,
cannam@95 3782 % ie, @tab@tab@tab will produce two empty columns.
cannam@95 3783
cannam@95 3784 % @item, @tab do not need to be on their own lines, but it will not hurt
cannam@95 3785 % if they are.
cannam@95 3786
cannam@95 3787 % Sample multitable:
cannam@95 3788
cannam@95 3789 % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
cannam@95 3790 % @item first col stuff @tab second col stuff @tab third col
cannam@95 3791 % @item
cannam@95 3792 % first col stuff
cannam@95 3793 % @tab
cannam@95 3794 % second col stuff
cannam@95 3795 % @tab
cannam@95 3796 % third col
cannam@95 3797 % @item first col stuff @tab second col stuff
cannam@95 3798 % @tab Many paragraphs of text may be used in any column.
cannam@95 3799 %
cannam@95 3800 % They will wrap at the width determined by the template.
cannam@95 3801 % @item@tab@tab This will be in third column.
cannam@95 3802 % @end multitable
cannam@95 3803
cannam@95 3804 % Default dimensions may be reset by user.
cannam@95 3805 % @multitableparskip is vertical space between paragraphs in table.
cannam@95 3806 % @multitableparindent is paragraph indent in table.
cannam@95 3807 % @multitablecolmargin is horizontal space to be left between columns.
cannam@95 3808 % @multitablelinespace is space to leave between table items, baseline
cannam@95 3809 % to baseline.
cannam@95 3810 % 0pt means it depends on current normal line spacing.
cannam@95 3811 %
cannam@95 3812 \newskip\multitableparskip
cannam@95 3813 \newskip\multitableparindent
cannam@95 3814 \newdimen\multitablecolspace
cannam@95 3815 \newskip\multitablelinespace
cannam@95 3816 \multitableparskip=0pt
cannam@95 3817 \multitableparindent=6pt
cannam@95 3818 \multitablecolspace=12pt
cannam@95 3819 \multitablelinespace=0pt
cannam@95 3820
cannam@95 3821 % Macros used to set up halign preamble:
cannam@95 3822 %
cannam@95 3823 \let\endsetuptable\relax
cannam@95 3824 \def\xendsetuptable{\endsetuptable}
cannam@95 3825 \let\columnfractions\relax
cannam@95 3826 \def\xcolumnfractions{\columnfractions}
cannam@95 3827 \newif\ifsetpercent
cannam@95 3828
cannam@95 3829 % #1 is the @columnfraction, usually a decimal number like .5, but might
cannam@95 3830 % be just 1. We just use it, whatever it is.
cannam@95 3831 %
cannam@95 3832 \def\pickupwholefraction#1 {%
cannam@95 3833 \global\advance\colcount by 1
cannam@95 3834 \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
cannam@95 3835 \setuptable
cannam@95 3836 }
cannam@95 3837
cannam@95 3838 \newcount\colcount
cannam@95 3839 \def\setuptable#1{%
cannam@95 3840 \def\firstarg{#1}%
cannam@95 3841 \ifx\firstarg\xendsetuptable
cannam@95 3842 \let\go = \relax
cannam@95 3843 \else
cannam@95 3844 \ifx\firstarg\xcolumnfractions
cannam@95 3845 \global\setpercenttrue
cannam@95 3846 \else
cannam@95 3847 \ifsetpercent
cannam@95 3848 \let\go\pickupwholefraction
cannam@95 3849 \else
cannam@95 3850 \global\advance\colcount by 1
cannam@95 3851 \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
cannam@95 3852 % separator; typically that is always in the input, anyway.
cannam@95 3853 \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
cannam@95 3854 \fi
cannam@95 3855 \fi
cannam@95 3856 \ifx\go\pickupwholefraction
cannam@95 3857 % Put the argument back for the \pickupwholefraction call, so
cannam@95 3858 % we'll always have a period there to be parsed.
cannam@95 3859 \def\go{\pickupwholefraction#1}%
cannam@95 3860 \else
cannam@95 3861 \let\go = \setuptable
cannam@95 3862 \fi%
cannam@95 3863 \fi
cannam@95 3864 \go
cannam@95 3865 }
cannam@95 3866
cannam@95 3867 % multitable-only commands.
cannam@95 3868 %
cannam@95 3869 % @headitem starts a heading row, which we typeset in bold.
cannam@95 3870 % Assignments have to be global since we are inside the implicit group
cannam@95 3871 % of an alignment entry. \everycr resets \everytab so we don't have to
cannam@95 3872 % undo it ourselves.
cannam@95 3873 \def\headitemfont{\b}% for people to use in the template row; not changeable
cannam@95 3874 \def\headitem{%
cannam@95 3875 \checkenv\multitable
cannam@95 3876 \crcr
cannam@95 3877 \global\everytab={\bf}% can't use \headitemfont since the parsing differs
cannam@95 3878 \the\everytab % for the first item
cannam@95 3879 }%
cannam@95 3880 %
cannam@95 3881 % A \tab used to include \hskip1sp. But then the space in a template
cannam@95 3882 % line is not enough. That is bad. So let's go back to just `&' until
cannam@95 3883 % we again encounter the problem the 1sp was intended to solve.
cannam@95 3884 % --karl, nathan@acm.org, 20apr99.
cannam@95 3885 \def\tab{\checkenv\multitable &\the\everytab}%
cannam@95 3886
cannam@95 3887 % @multitable ... @end multitable definitions:
cannam@95 3888 %
cannam@95 3889 \newtoks\everytab % insert after every tab.
cannam@95 3890 %
cannam@95 3891 \envdef\multitable{%
cannam@95 3892 \vskip\parskip
cannam@95 3893 \startsavinginserts
cannam@95 3894 %
cannam@95 3895 % @item within a multitable starts a normal row.
cannam@95 3896 % We use \def instead of \let so that if one of the multitable entries
cannam@95 3897 % contains an @itemize, we don't choke on the \item (seen as \crcr aka
cannam@95 3898 % \endtemplate) expanding \doitemize.
cannam@95 3899 \def\item{\crcr}%
cannam@95 3900 %
cannam@95 3901 \tolerance=9500
cannam@95 3902 \hbadness=9500
cannam@95 3903 \setmultitablespacing
cannam@95 3904 \parskip=\multitableparskip
cannam@95 3905 \parindent=\multitableparindent
cannam@95 3906 \overfullrule=0pt
cannam@95 3907 \global\colcount=0
cannam@95 3908 %
cannam@95 3909 \everycr = {%
cannam@95 3910 \noalign{%
cannam@95 3911 \global\everytab={}%
cannam@95 3912 \global\colcount=0 % Reset the column counter.
cannam@95 3913 % Check for saved footnotes, etc.
cannam@95 3914 \checkinserts
cannam@95 3915 % Keeps underfull box messages off when table breaks over pages.
cannam@95 3916 %\filbreak
cannam@95 3917 % Maybe so, but it also creates really weird page breaks when the
cannam@95 3918 % table breaks over pages. Wouldn't \vfil be better? Wait until the
cannam@95 3919 % problem manifests itself, so it can be fixed for real --karl.
cannam@95 3920 }%
cannam@95 3921 }%
cannam@95 3922 %
cannam@95 3923 \parsearg\domultitable
cannam@95 3924 }
cannam@95 3925 \def\domultitable#1{%
cannam@95 3926 % To parse everything between @multitable and @item:
cannam@95 3927 \setuptable#1 \endsetuptable
cannam@95 3928 %
cannam@95 3929 % This preamble sets up a generic column definition, which will
cannam@95 3930 % be used as many times as user calls for columns.
cannam@95 3931 % \vtop will set a single line and will also let text wrap and
cannam@95 3932 % continue for many paragraphs if desired.
cannam@95 3933 \halign\bgroup &%
cannam@95 3934 \global\advance\colcount by 1
cannam@95 3935 \multistrut
cannam@95 3936 \vtop{%
cannam@95 3937 % Use the current \colcount to find the correct column width:
cannam@95 3938 \hsize=\expandafter\csname col\the\colcount\endcsname
cannam@95 3939 %
cannam@95 3940 % In order to keep entries from bumping into each other
cannam@95 3941 % we will add a \leftskip of \multitablecolspace to all columns after
cannam@95 3942 % the first one.
cannam@95 3943 %
cannam@95 3944 % If a template has been used, we will add \multitablecolspace
cannam@95 3945 % to the width of each template entry.
cannam@95 3946 %
cannam@95 3947 % If the user has set preamble in terms of percent of \hsize we will
cannam@95 3948 % use that dimension as the width of the column, and the \leftskip
cannam@95 3949 % will keep entries from bumping into each other. Table will start at
cannam@95 3950 % left margin and final column will justify at right margin.
cannam@95 3951 %
cannam@95 3952 % Make sure we don't inherit \rightskip from the outer environment.
cannam@95 3953 \rightskip=0pt
cannam@95 3954 \ifnum\colcount=1
cannam@95 3955 % The first column will be indented with the surrounding text.
cannam@95 3956 \advance\hsize by\leftskip
cannam@95 3957 \else
cannam@95 3958 \ifsetpercent \else
cannam@95 3959 % If user has not set preamble in terms of percent of \hsize
cannam@95 3960 % we will advance \hsize by \multitablecolspace.
cannam@95 3961 \advance\hsize by \multitablecolspace
cannam@95 3962 \fi
cannam@95 3963 % In either case we will make \leftskip=\multitablecolspace:
cannam@95 3964 \leftskip=\multitablecolspace
cannam@95 3965 \fi
cannam@95 3966 % Ignoring space at the beginning and end avoids an occasional spurious
cannam@95 3967 % blank line, when TeX decides to break the line at the space before the
cannam@95 3968 % box from the multistrut, so the strut ends up on a line by itself.
cannam@95 3969 % For example:
cannam@95 3970 % @multitable @columnfractions .11 .89
cannam@95 3971 % @item @code{#}
cannam@95 3972 % @tab Legal holiday which is valid in major parts of the whole country.
cannam@95 3973 % Is automatically provided with highlighting sequences respectively
cannam@95 3974 % marking characters.
cannam@95 3975 \noindent\ignorespaces##\unskip\multistrut
cannam@95 3976 }\cr
cannam@95 3977 }
cannam@95 3978 \def\Emultitable{%
cannam@95 3979 \crcr
cannam@95 3980 \egroup % end the \halign
cannam@95 3981 \global\setpercentfalse
cannam@95 3982 }
cannam@95 3983
cannam@95 3984 \def\setmultitablespacing{%
cannam@95 3985 \def\multistrut{\strut}% just use the standard line spacing
cannam@95 3986 %
cannam@95 3987 % Compute \multitablelinespace (if not defined by user) for use in
cannam@95 3988 % \multitableparskip calculation. We used define \multistrut based on
cannam@95 3989 % this, but (ironically) that caused the spacing to be off.
cannam@95 3990 % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
cannam@95 3991 \ifdim\multitablelinespace=0pt
cannam@95 3992 \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
cannam@95 3993 \global\advance\multitablelinespace by-\ht0
cannam@95 3994 \fi
cannam@95 3995 % Test to see if parskip is larger than space between lines of
cannam@95 3996 % table. If not, do nothing.
cannam@95 3997 % If so, set to same dimension as multitablelinespace.
cannam@95 3998 \ifdim\multitableparskip>\multitablelinespace
cannam@95 3999 \global\multitableparskip=\multitablelinespace
cannam@95 4000 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
cannam@95 4001 % than skip between lines in the table.
cannam@95 4002 \fi%
cannam@95 4003 \ifdim\multitableparskip=0pt
cannam@95 4004 \global\multitableparskip=\multitablelinespace
cannam@95 4005 \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
cannam@95 4006 % than skip between lines in the table.
cannam@95 4007 \fi}
cannam@95 4008
cannam@95 4009
cannam@95 4010 \message{conditionals,}
cannam@95 4011
cannam@95 4012 % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
cannam@95 4013 % @ifnotxml always succeed. They currently do nothing; we don't
cannam@95 4014 % attempt to check whether the conditionals are properly nested. But we
cannam@95 4015 % have to remember that they are conditionals, so that @end doesn't
cannam@95 4016 % attempt to close an environment group.
cannam@95 4017 %
cannam@95 4018 \def\makecond#1{%
cannam@95 4019 \expandafter\let\csname #1\endcsname = \relax
cannam@95 4020 \expandafter\let\csname iscond.#1\endcsname = 1
cannam@95 4021 }
cannam@95 4022 \makecond{iftex}
cannam@95 4023 \makecond{ifnotdocbook}
cannam@95 4024 \makecond{ifnothtml}
cannam@95 4025 \makecond{ifnotinfo}
cannam@95 4026 \makecond{ifnotplaintext}
cannam@95 4027 \makecond{ifnotxml}
cannam@95 4028
cannam@95 4029 % Ignore @ignore, @ifhtml, @ifinfo, and the like.
cannam@95 4030 %
cannam@95 4031 \def\direntry{\doignore{direntry}}
cannam@95 4032 \def\documentdescription{\doignore{documentdescription}}
cannam@95 4033 \def\docbook{\doignore{docbook}}
cannam@95 4034 \def\html{\doignore{html}}
cannam@95 4035 \def\ifdocbook{\doignore{ifdocbook}}
cannam@95 4036 \def\ifhtml{\doignore{ifhtml}}
cannam@95 4037 \def\ifinfo{\doignore{ifinfo}}
cannam@95 4038 \def\ifnottex{\doignore{ifnottex}}
cannam@95 4039 \def\ifplaintext{\doignore{ifplaintext}}
cannam@95 4040 \def\ifxml{\doignore{ifxml}}
cannam@95 4041 \def\ignore{\doignore{ignore}}
cannam@95 4042 \def\menu{\doignore{menu}}
cannam@95 4043 \def\xml{\doignore{xml}}
cannam@95 4044
cannam@95 4045 % Ignore text until a line `@end #1', keeping track of nested conditionals.
cannam@95 4046 %
cannam@95 4047 % A count to remember the depth of nesting.
cannam@95 4048 \newcount\doignorecount
cannam@95 4049
cannam@95 4050 \def\doignore#1{\begingroup
cannam@95 4051 % Scan in ``verbatim'' mode:
cannam@95 4052 \obeylines
cannam@95 4053 \catcode`\@ = \other
cannam@95 4054 \catcode`\{ = \other
cannam@95 4055 \catcode`\} = \other
cannam@95 4056 %
cannam@95 4057 % Make sure that spaces turn into tokens that match what \doignoretext wants.
cannam@95 4058 \spaceisspace
cannam@95 4059 %
cannam@95 4060 % Count number of #1's that we've seen.
cannam@95 4061 \doignorecount = 0
cannam@95 4062 %
cannam@95 4063 % Swallow text until we reach the matching `@end #1'.
cannam@95 4064 \dodoignore{#1}%
cannam@95 4065 }
cannam@95 4066
cannam@95 4067 { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
cannam@95 4068 \obeylines %
cannam@95 4069 %
cannam@95 4070 \gdef\dodoignore#1{%
cannam@95 4071 % #1 contains the command name as a string, e.g., `ifinfo'.
cannam@95 4072 %
cannam@95 4073 % Define a command to find the next `@end #1'.
cannam@95 4074 \long\def\doignoretext##1^^M@end #1{%
cannam@95 4075 \doignoretextyyy##1^^M@#1\_STOP_}%
cannam@95 4076 %
cannam@95 4077 % And this command to find another #1 command, at the beginning of a
cannam@95 4078 % line. (Otherwise, we would consider a line `@c @ifset', for
cannam@95 4079 % example, to count as an @ifset for nesting.)
cannam@95 4080 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
cannam@95 4081 %
cannam@95 4082 % And now expand that command.
cannam@95 4083 \doignoretext ^^M%
cannam@95 4084 }%
cannam@95 4085 }
cannam@95 4086
cannam@95 4087 \def\doignoreyyy#1{%
cannam@95 4088 \def\temp{#1}%
cannam@95 4089 \ifx\temp\empty % Nothing found.
cannam@95 4090 \let\next\doignoretextzzz
cannam@95 4091 \else % Found a nested condition, ...
cannam@95 4092 \advance\doignorecount by 1
cannam@95 4093 \let\next\doignoretextyyy % ..., look for another.
cannam@95 4094 % If we're here, #1 ends with ^^M\ifinfo (for example).
cannam@95 4095 \fi
cannam@95 4096 \next #1% the token \_STOP_ is present just after this macro.
cannam@95 4097 }
cannam@95 4098
cannam@95 4099 % We have to swallow the remaining "\_STOP_".
cannam@95 4100 %
cannam@95 4101 \def\doignoretextzzz#1{%
cannam@95 4102 \ifnum\doignorecount = 0 % We have just found the outermost @end.
cannam@95 4103 \let\next\enddoignore
cannam@95 4104 \else % Still inside a nested condition.
cannam@95 4105 \advance\doignorecount by -1
cannam@95 4106 \let\next\doignoretext % Look for the next @end.
cannam@95 4107 \fi
cannam@95 4108 \next
cannam@95 4109 }
cannam@95 4110
cannam@95 4111 % Finish off ignored text.
cannam@95 4112 { \obeylines%
cannam@95 4113 % Ignore anything after the last `@end #1'; this matters in verbatim
cannam@95 4114 % environments, where otherwise the newline after an ignored conditional
cannam@95 4115 % would result in a blank line in the output.
cannam@95 4116 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
cannam@95 4117 }
cannam@95 4118
cannam@95 4119
cannam@95 4120 % @set VAR sets the variable VAR to an empty value.
cannam@95 4121 % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
cannam@95 4122 %
cannam@95 4123 % Since we want to separate VAR from REST-OF-LINE (which might be
cannam@95 4124 % empty), we can't just use \parsearg; we have to insert a space of our
cannam@95 4125 % own to delimit the rest of the line, and then take it out again if we
cannam@95 4126 % didn't need it.
cannam@95 4127 % We rely on the fact that \parsearg sets \catcode`\ =10.
cannam@95 4128 %
cannam@95 4129 \parseargdef\set{\setyyy#1 \endsetyyy}
cannam@95 4130 \def\setyyy#1 #2\endsetyyy{%
cannam@95 4131 {%
cannam@95 4132 \makevalueexpandable
cannam@95 4133 \def\temp{#2}%
cannam@95 4134 \edef\next{\gdef\makecsname{SET#1}}%
cannam@95 4135 \ifx\temp\empty
cannam@95 4136 \next{}%
cannam@95 4137 \else
cannam@95 4138 \setzzz#2\endsetzzz
cannam@95 4139 \fi
cannam@95 4140 }%
cannam@95 4141 }
cannam@95 4142 % Remove the trailing space \setxxx inserted.
cannam@95 4143 \def\setzzz#1 \endsetzzz{\next{#1}}
cannam@95 4144
cannam@95 4145 % @clear VAR clears (i.e., unsets) the variable VAR.
cannam@95 4146 %
cannam@95 4147 \parseargdef\clear{%
cannam@95 4148 {%
cannam@95 4149 \makevalueexpandable
cannam@95 4150 \global\expandafter\let\csname SET#1\endcsname=\relax
cannam@95 4151 }%
cannam@95 4152 }
cannam@95 4153
cannam@95 4154 % @value{foo} gets the text saved in variable foo.
cannam@95 4155 \def\value{\begingroup\makevalueexpandable\valuexxx}
cannam@95 4156 \def\valuexxx#1{\expandablevalue{#1}\endgroup}
cannam@95 4157 {
cannam@95 4158 \catcode`\- = \active \catcode`\_ = \active
cannam@95 4159 %
cannam@95 4160 \gdef\makevalueexpandable{%
cannam@95 4161 \let\value = \expandablevalue
cannam@95 4162 % We don't want these characters active, ...
cannam@95 4163 \catcode`\-=\other \catcode`\_=\other
cannam@95 4164 % ..., but we might end up with active ones in the argument if
cannam@95 4165 % we're called from @code, as @code{@value{foo-bar_}}, though.
cannam@95 4166 % So \let them to their normal equivalents.
cannam@95 4167 \let-\realdash \let_\normalunderscore
cannam@95 4168 }
cannam@95 4169 }
cannam@95 4170
cannam@95 4171 % We have this subroutine so that we can handle at least some @value's
cannam@95 4172 % properly in indexes (we call \makevalueexpandable in \indexdummies).
cannam@95 4173 % The command has to be fully expandable (if the variable is set), since
cannam@95 4174 % the result winds up in the index file. This means that if the
cannam@95 4175 % variable's value contains other Texinfo commands, it's almost certain
cannam@95 4176 % it will fail (although perhaps we could fix that with sufficient work
cannam@95 4177 % to do a one-level expansion on the result, instead of complete).
cannam@95 4178 %
cannam@95 4179 \def\expandablevalue#1{%
cannam@95 4180 \expandafter\ifx\csname SET#1\endcsname\relax
cannam@95 4181 {[No value for ``#1'']}%
cannam@95 4182 \message{Variable `#1', used in @value, is not set.}%
cannam@95 4183 \else
cannam@95 4184 \csname SET#1\endcsname
cannam@95 4185 \fi
cannam@95 4186 }
cannam@95 4187
cannam@95 4188 % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
cannam@95 4189 % with @set.
cannam@95 4190 %
cannam@95 4191 % To get special treatment of `@end ifset,' call \makeond and the redefine.
cannam@95 4192 %
cannam@95 4193 \makecond{ifset}
cannam@95 4194 \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
cannam@95 4195 \def\doifset#1#2{%
cannam@95 4196 {%
cannam@95 4197 \makevalueexpandable
cannam@95 4198 \let\next=\empty
cannam@95 4199 \expandafter\ifx\csname SET#2\endcsname\relax
cannam@95 4200 #1% If not set, redefine \next.
cannam@95 4201 \fi
cannam@95 4202 \expandafter
cannam@95 4203 }\next
cannam@95 4204 }
cannam@95 4205 \def\ifsetfail{\doignore{ifset}}
cannam@95 4206
cannam@95 4207 % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
cannam@95 4208 % defined with @set, or has been undefined with @clear.
cannam@95 4209 %
cannam@95 4210 % The `\else' inside the `\doifset' parameter is a trick to reuse the
cannam@95 4211 % above code: if the variable is not set, do nothing, if it is set,
cannam@95 4212 % then redefine \next to \ifclearfail.
cannam@95 4213 %
cannam@95 4214 \makecond{ifclear}
cannam@95 4215 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
cannam@95 4216 \def\ifclearfail{\doignore{ifclear}}
cannam@95 4217
cannam@95 4218 % @dircategory CATEGORY -- specify a category of the dir file
cannam@95 4219 % which this file should belong to. Ignore this in TeX.
cannam@95 4220 \let\dircategory=\comment
cannam@95 4221
cannam@95 4222 % @defininfoenclose.
cannam@95 4223 \let\definfoenclose=\comment
cannam@95 4224
cannam@95 4225
cannam@95 4226 \message{indexing,}
cannam@95 4227 % Index generation facilities
cannam@95 4228
cannam@95 4229 % Define \newwrite to be identical to plain tex's \newwrite
cannam@95 4230 % except not \outer, so it can be used within macros and \if's.
cannam@95 4231 \edef\newwrite{\makecsname{ptexnewwrite}}
cannam@95 4232
cannam@95 4233 % \newindex {foo} defines an index named foo.
cannam@95 4234 % It automatically defines \fooindex such that
cannam@95 4235 % \fooindex ...rest of line... puts an entry in the index foo.
cannam@95 4236 % It also defines \fooindfile to be the number of the output channel for
cannam@95 4237 % the file that accumulates this index. The file's extension is foo.
cannam@95 4238 % The name of an index should be no more than 2 characters long
cannam@95 4239 % for the sake of vms.
cannam@95 4240 %
cannam@95 4241 \def\newindex#1{%
cannam@95 4242 \iflinks
cannam@95 4243 \expandafter\newwrite \csname#1indfile\endcsname
cannam@95 4244 \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
cannam@95 4245 \fi
cannam@95 4246 \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
cannam@95 4247 \noexpand\doindex{#1}}
cannam@95 4248 }
cannam@95 4249
cannam@95 4250 % @defindex foo == \newindex{foo}
cannam@95 4251 %
cannam@95 4252 \def\defindex{\parsearg\newindex}
cannam@95 4253
cannam@95 4254 % Define @defcodeindex, like @defindex except put all entries in @code.
cannam@95 4255 %
cannam@95 4256 \def\defcodeindex{\parsearg\newcodeindex}
cannam@95 4257 %
cannam@95 4258 \def\newcodeindex#1{%
cannam@95 4259 \iflinks
cannam@95 4260 \expandafter\newwrite \csname#1indfile\endcsname
cannam@95 4261 \openout \csname#1indfile\endcsname \jobname.#1
cannam@95 4262 \fi
cannam@95 4263 \expandafter\xdef\csname#1index\endcsname{%
cannam@95 4264 \noexpand\docodeindex{#1}}%
cannam@95 4265 }
cannam@95 4266
cannam@95 4267
cannam@95 4268 % @synindex foo bar makes index foo feed into index bar.
cannam@95 4269 % Do this instead of @defindex foo if you don't want it as a separate index.
cannam@95 4270 %
cannam@95 4271 % @syncodeindex foo bar similar, but put all entries made for index foo
cannam@95 4272 % inside @code.
cannam@95 4273 %
cannam@95 4274 \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
cannam@95 4275 \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
cannam@95 4276
cannam@95 4277 % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
cannam@95 4278 % #3 the target index (bar).
cannam@95 4279 \def\dosynindex#1#2#3{%
cannam@95 4280 % Only do \closeout if we haven't already done it, else we'll end up
cannam@95 4281 % closing the target index.
cannam@95 4282 \expandafter \ifx\csname donesynindex#2\endcsname \relax
cannam@95 4283 % The \closeout helps reduce unnecessary open files; the limit on the
cannam@95 4284 % Acorn RISC OS is a mere 16 files.
cannam@95 4285 \expandafter\closeout\csname#2indfile\endcsname
cannam@95 4286 \expandafter\let\csname donesynindex#2\endcsname = 1
cannam@95 4287 \fi
cannam@95 4288 % redefine \fooindfile:
cannam@95 4289 \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
cannam@95 4290 \expandafter\let\csname#2indfile\endcsname=\temp
cannam@95 4291 % redefine \fooindex:
cannam@95 4292 \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
cannam@95 4293 }
cannam@95 4294
cannam@95 4295 % Define \doindex, the driver for all \fooindex macros.
cannam@95 4296 % Argument #1 is generated by the calling \fooindex macro,
cannam@95 4297 % and it is "foo", the name of the index.
cannam@95 4298
cannam@95 4299 % \doindex just uses \parsearg; it calls \doind for the actual work.
cannam@95 4300 % This is because \doind is more useful to call from other macros.
cannam@95 4301
cannam@95 4302 % There is also \dosubind {index}{topic}{subtopic}
cannam@95 4303 % which makes an entry in a two-level index such as the operation index.
cannam@95 4304
cannam@95 4305 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
cannam@95 4306 \def\singleindexer #1{\doind{\indexname}{#1}}
cannam@95 4307
cannam@95 4308 % like the previous two, but they put @code around the argument.
cannam@95 4309 \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
cannam@95 4310 \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
cannam@95 4311
cannam@95 4312 % Take care of Texinfo commands that can appear in an index entry.
cannam@95 4313 % Since there are some commands we want to expand, and others we don't,
cannam@95 4314 % we have to laboriously prevent expansion for those that we don't.
cannam@95 4315 %
cannam@95 4316 \def\indexdummies{%
cannam@95 4317 \escapechar = `\\ % use backslash in output files.
cannam@95 4318 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
cannam@95 4319 \def\ {\realbackslash\space }%
cannam@95 4320 %
cannam@95 4321 % Need these unexpandable (because we define \tt as a dummy)
cannam@95 4322 % definitions when @{ or @} appear in index entry text. Also, more
cannam@95 4323 % complicated, when \tex is in effect and \{ is a \delimiter again.
cannam@95 4324 % We can't use \lbracecmd and \rbracecmd because texindex assumes
cannam@95 4325 % braces and backslashes are used only as delimiters. Perhaps we
cannam@95 4326 % should define @lbrace and @rbrace commands a la @comma.
cannam@95 4327 \def\{{{\tt\char123}}%
cannam@95 4328 \def\}{{\tt\char125}}%
cannam@95 4329 %
cannam@95 4330 % I don't entirely understand this, but when an index entry is
cannam@95 4331 % generated from a macro call, the \endinput which \scanmacro inserts
cannam@95 4332 % causes processing to be prematurely terminated. This is,
cannam@95 4333 % apparently, because \indexsorttmp is fully expanded, and \endinput
cannam@95 4334 % is an expandable command. The redefinition below makes \endinput
cannam@95 4335 % disappear altogether for that purpose -- although logging shows that
cannam@95 4336 % processing continues to some further point. On the other hand, it
cannam@95 4337 % seems \endinput does not hurt in the printed index arg, since that
cannam@95 4338 % is still getting written without apparent harm.
cannam@95 4339 %
cannam@95 4340 % Sample source (mac-idx3.tex, reported by Graham Percival to
cannam@95 4341 % help-texinfo, 22may06):
cannam@95 4342 % @macro funindex {WORD}
cannam@95 4343 % @findex xyz
cannam@95 4344 % @end macro
cannam@95 4345 % ...
cannam@95 4346 % @funindex commtest
cannam@95 4347 %
cannam@95 4348 % The above is not enough to reproduce the bug, but it gives the flavor.
cannam@95 4349 %
cannam@95 4350 % Sample whatsit resulting:
cannam@95 4351 % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
cannam@95 4352 %
cannam@95 4353 % So:
cannam@95 4354 \let\endinput = \empty
cannam@95 4355 %
cannam@95 4356 % Do the redefinitions.
cannam@95 4357 \commondummies
cannam@95 4358 }
cannam@95 4359
cannam@95 4360 % For the aux and toc files, @ is the escape character. So we want to
cannam@95 4361 % redefine everything using @ as the escape character (instead of
cannam@95 4362 % \realbackslash, still used for index files). When everything uses @,
cannam@95 4363 % this will be simpler.
cannam@95 4364 %
cannam@95 4365 \def\atdummies{%
cannam@95 4366 \def\@{@@}%
cannam@95 4367 \def\ {@ }%
cannam@95 4368 \let\{ = \lbraceatcmd
cannam@95 4369 \let\} = \rbraceatcmd
cannam@95 4370 %
cannam@95 4371 % Do the redefinitions.
cannam@95 4372 \commondummies
cannam@95 4373 \otherbackslash
cannam@95 4374 }
cannam@95 4375
cannam@95 4376 % Called from \indexdummies and \atdummies.
cannam@95 4377 %
cannam@95 4378 \def\commondummies{%
cannam@95 4379 %
cannam@95 4380 % \definedummyword defines \#1 as \string\#1\space, thus effectively
cannam@95 4381 % preventing its expansion. This is used only for control words,
cannam@95 4382 % not control letters, because the \space would be incorrect for
cannam@95 4383 % control characters, but is needed to separate the control word
cannam@95 4384 % from whatever follows.
cannam@95 4385 %
cannam@95 4386 % For control letters, we have \definedummyletter, which omits the
cannam@95 4387 % space.
cannam@95 4388 %
cannam@95 4389 % These can be used both for control words that take an argument and
cannam@95 4390 % those that do not. If it is followed by {arg} in the input, then
cannam@95 4391 % that will dutifully get written to the index (or wherever).
cannam@95 4392 %
cannam@95 4393 \def\definedummyword ##1{\def##1{\string##1\space}}%
cannam@95 4394 \def\definedummyletter##1{\def##1{\string##1}}%
cannam@95 4395 \let\definedummyaccent\definedummyletter
cannam@95 4396 %
cannam@95 4397 \commondummiesnofonts
cannam@95 4398 %
cannam@95 4399 \definedummyletter\_%
cannam@95 4400 \definedummyletter\-%
cannam@95 4401 %
cannam@95 4402 % Non-English letters.
cannam@95 4403 \definedummyword\AA
cannam@95 4404 \definedummyword\AE
cannam@95 4405 \definedummyword\DH
cannam@95 4406 \definedummyword\L
cannam@95 4407 \definedummyword\O
cannam@95 4408 \definedummyword\OE
cannam@95 4409 \definedummyword\TH
cannam@95 4410 \definedummyword\aa
cannam@95 4411 \definedummyword\ae
cannam@95 4412 \definedummyword\dh
cannam@95 4413 \definedummyword\exclamdown
cannam@95 4414 \definedummyword\l
cannam@95 4415 \definedummyword\o
cannam@95 4416 \definedummyword\oe
cannam@95 4417 \definedummyword\ordf
cannam@95 4418 \definedummyword\ordm
cannam@95 4419 \definedummyword\questiondown
cannam@95 4420 \definedummyword\ss
cannam@95 4421 \definedummyword\th
cannam@95 4422 %
cannam@95 4423 % Although these internal commands shouldn't show up, sometimes they do.
cannam@95 4424 \definedummyword\bf
cannam@95 4425 \definedummyword\gtr
cannam@95 4426 \definedummyword\hat
cannam@95 4427 \definedummyword\less
cannam@95 4428 \definedummyword\sf
cannam@95 4429 \definedummyword\sl
cannam@95 4430 \definedummyword\tclose
cannam@95 4431 \definedummyword\tt
cannam@95 4432 %
cannam@95 4433 \definedummyword\LaTeX
cannam@95 4434 \definedummyword\TeX
cannam@95 4435 %
cannam@95 4436 % Assorted special characters.
cannam@95 4437 \definedummyword\arrow
cannam@95 4438 \definedummyword\bullet
cannam@95 4439 \definedummyword\comma
cannam@95 4440 \definedummyword\copyright
cannam@95 4441 \definedummyword\registeredsymbol
cannam@95 4442 \definedummyword\dots
cannam@95 4443 \definedummyword\enddots
cannam@95 4444 \definedummyword\entrybreak
cannam@95 4445 \definedummyword\equiv
cannam@95 4446 \definedummyword\error
cannam@95 4447 \definedummyword\euro
cannam@95 4448 \definedummyword\expansion
cannam@95 4449 \definedummyword\geq
cannam@95 4450 \definedummyword\guillemetleft
cannam@95 4451 \definedummyword\guillemetright
cannam@95 4452 \definedummyword\guilsinglleft
cannam@95 4453 \definedummyword\guilsinglright
cannam@95 4454 \definedummyword\leq
cannam@95 4455 \definedummyword\minus
cannam@95 4456 \definedummyword\ogonek
cannam@95 4457 \definedummyword\pounds
cannam@95 4458 \definedummyword\point
cannam@95 4459 \definedummyword\print
cannam@95 4460 \definedummyword\quotedblbase
cannam@95 4461 \definedummyword\quotedblleft
cannam@95 4462 \definedummyword\quotedblright
cannam@95 4463 \definedummyword\quoteleft
cannam@95 4464 \definedummyword\quoteright
cannam@95 4465 \definedummyword\quotesinglbase
cannam@95 4466 \definedummyword\result
cannam@95 4467 \definedummyword\textdegree
cannam@95 4468 %
cannam@95 4469 % We want to disable all macros so that they are not expanded by \write.
cannam@95 4470 \macrolist
cannam@95 4471 %
cannam@95 4472 \normalturnoffactive
cannam@95 4473 %
cannam@95 4474 % Handle some cases of @value -- where it does not contain any
cannam@95 4475 % (non-fully-expandable) commands.
cannam@95 4476 \makevalueexpandable
cannam@95 4477 }
cannam@95 4478
cannam@95 4479 % \commondummiesnofonts: common to \commondummies and \indexnofonts.
cannam@95 4480 %
cannam@95 4481 \def\commondummiesnofonts{%
cannam@95 4482 % Control letters and accents.
cannam@95 4483 \definedummyletter\!%
cannam@95 4484 \definedummyaccent\"%
cannam@95 4485 \definedummyaccent\'%
cannam@95 4486 \definedummyletter\*%
cannam@95 4487 \definedummyaccent\,%
cannam@95 4488 \definedummyletter\.%
cannam@95 4489 \definedummyletter\/%
cannam@95 4490 \definedummyletter\:%
cannam@95 4491 \definedummyaccent\=%
cannam@95 4492 \definedummyletter\?%
cannam@95 4493 \definedummyaccent\^%
cannam@95 4494 \definedummyaccent\`%
cannam@95 4495 \definedummyaccent\~%
cannam@95 4496 \definedummyword\u
cannam@95 4497 \definedummyword\v
cannam@95 4498 \definedummyword\H
cannam@95 4499 \definedummyword\dotaccent
cannam@95 4500 \definedummyword\ogonek
cannam@95 4501 \definedummyword\ringaccent
cannam@95 4502 \definedummyword\tieaccent
cannam@95 4503 \definedummyword\ubaraccent
cannam@95 4504 \definedummyword\udotaccent
cannam@95 4505 \definedummyword\dotless
cannam@95 4506 %
cannam@95 4507 % Texinfo font commands.
cannam@95 4508 \definedummyword\b
cannam@95 4509 \definedummyword\i
cannam@95 4510 \definedummyword\r
cannam@95 4511 \definedummyword\sansserif
cannam@95 4512 \definedummyword\sc
cannam@95 4513 \definedummyword\slanted
cannam@95 4514 \definedummyword\t
cannam@95 4515 %
cannam@95 4516 % Commands that take arguments.
cannam@95 4517 \definedummyword\acronym
cannam@95 4518 \definedummyword\anchor
cannam@95 4519 \definedummyword\cite
cannam@95 4520 \definedummyword\code
cannam@95 4521 \definedummyword\command
cannam@95 4522 \definedummyword\dfn
cannam@95 4523 \definedummyword\dmn
cannam@95 4524 \definedummyword\email
cannam@95 4525 \definedummyword\emph
cannam@95 4526 \definedummyword\env
cannam@95 4527 \definedummyword\file
cannam@95 4528 \definedummyword\indicateurl
cannam@95 4529 \definedummyword\kbd
cannam@95 4530 \definedummyword\key
cannam@95 4531 \definedummyword\math
cannam@95 4532 \definedummyword\option
cannam@95 4533 \definedummyword\pxref
cannam@95 4534 \definedummyword\ref
cannam@95 4535 \definedummyword\samp
cannam@95 4536 \definedummyword\strong
cannam@95 4537 \definedummyword\tie
cannam@95 4538 \definedummyword\uref
cannam@95 4539 \definedummyword\url
cannam@95 4540 \definedummyword\var
cannam@95 4541 \definedummyword\verb
cannam@95 4542 \definedummyword\w
cannam@95 4543 \definedummyword\xref
cannam@95 4544 }
cannam@95 4545
cannam@95 4546 % \indexnofonts is used when outputting the strings to sort the index
cannam@95 4547 % by, and when constructing control sequence names. It eliminates all
cannam@95 4548 % control sequences and just writes whatever the best ASCII sort string
cannam@95 4549 % would be for a given command (usually its argument).
cannam@95 4550 %
cannam@95 4551 \def\indexnofonts{%
cannam@95 4552 % Accent commands should become @asis.
cannam@95 4553 \def\definedummyaccent##1{\let##1\asis}%
cannam@95 4554 % We can just ignore other control letters.
cannam@95 4555 \def\definedummyletter##1{\let##1\empty}%
cannam@95 4556 % All control words become @asis by default; overrides below.
cannam@95 4557 \let\definedummyword\definedummyaccent
cannam@95 4558 %
cannam@95 4559 \commondummiesnofonts
cannam@95 4560 %
cannam@95 4561 % Don't no-op \tt, since it isn't a user-level command
cannam@95 4562 % and is used in the definitions of the active chars like <, >, |, etc.
cannam@95 4563 % Likewise with the other plain tex font commands.
cannam@95 4564 %\let\tt=\asis
cannam@95 4565 %
cannam@95 4566 \def\ { }%
cannam@95 4567 \def\@{@}%
cannam@95 4568 \def\_{\normalunderscore}%
cannam@95 4569 \def\-{}% @- shouldn't affect sorting
cannam@95 4570 %
cannam@95 4571 % Unfortunately, texindex is not prepared to handle braces in the
cannam@95 4572 % content at all. So for index sorting, we map @{ and @} to strings
cannam@95 4573 % starting with |, since that ASCII character is between ASCII { and }.
cannam@95 4574 \def\{{|a}%
cannam@95 4575 \def\}{|b}%
cannam@95 4576 %
cannam@95 4577 % Non-English letters.
cannam@95 4578 \def\AA{AA}%
cannam@95 4579 \def\AE{AE}%
cannam@95 4580 \def\DH{DZZ}%
cannam@95 4581 \def\L{L}%
cannam@95 4582 \def\OE{OE}%
cannam@95 4583 \def\O{O}%
cannam@95 4584 \def\TH{ZZZ}%
cannam@95 4585 \def\aa{aa}%
cannam@95 4586 \def\ae{ae}%
cannam@95 4587 \def\dh{dzz}%
cannam@95 4588 \def\exclamdown{!}%
cannam@95 4589 \def\l{l}%
cannam@95 4590 \def\oe{oe}%
cannam@95 4591 \def\ordf{a}%
cannam@95 4592 \def\ordm{o}%
cannam@95 4593 \def\o{o}%
cannam@95 4594 \def\questiondown{?}%
cannam@95 4595 \def\ss{ss}%
cannam@95 4596 \def\th{zzz}%
cannam@95 4597 %
cannam@95 4598 \def\LaTeX{LaTeX}%
cannam@95 4599 \def\TeX{TeX}%
cannam@95 4600 %
cannam@95 4601 % Assorted special characters.
cannam@95 4602 % (The following {} will end up in the sort string, but that's ok.)
cannam@95 4603 \def\arrow{->}%
cannam@95 4604 \def\bullet{bullet}%
cannam@95 4605 \def\comma{,}%
cannam@95 4606 \def\copyright{copyright}%
cannam@95 4607 \def\dots{...}%
cannam@95 4608 \def\enddots{...}%
cannam@95 4609 \def\equiv{==}%
cannam@95 4610 \def\error{error}%
cannam@95 4611 \def\euro{euro}%
cannam@95 4612 \def\expansion{==>}%
cannam@95 4613 \def\geq{>=}%
cannam@95 4614 \def\guillemetleft{<<}%
cannam@95 4615 \def\guillemetright{>>}%
cannam@95 4616 \def\guilsinglleft{<}%
cannam@95 4617 \def\guilsinglright{>}%
cannam@95 4618 \def\leq{<=}%
cannam@95 4619 \def\minus{-}%
cannam@95 4620 \def\point{.}%
cannam@95 4621 \def\pounds{pounds}%
cannam@95 4622 \def\print{-|}%
cannam@95 4623 \def\quotedblbase{"}%
cannam@95 4624 \def\quotedblleft{"}%
cannam@95 4625 \def\quotedblright{"}%
cannam@95 4626 \def\quoteleft{`}%
cannam@95 4627 \def\quoteright{'}%
cannam@95 4628 \def\quotesinglbase{,}%
cannam@95 4629 \def\registeredsymbol{R}%
cannam@95 4630 \def\result{=>}%
cannam@95 4631 \def\textdegree{o}%
cannam@95 4632 %
cannam@95 4633 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
cannam@95 4634 \else \indexlquoteignore \fi
cannam@95 4635 %
cannam@95 4636 % We need to get rid of all macros, leaving only the arguments (if present).
cannam@95 4637 % Of course this is not nearly correct, but it is the best we can do for now.
cannam@95 4638 % makeinfo does not expand macros in the argument to @deffn, which ends up
cannam@95 4639 % writing an index entry, and texindex isn't prepared for an index sort entry
cannam@95 4640 % that starts with \.
cannam@95 4641 %
cannam@95 4642 % Since macro invocations are followed by braces, we can just redefine them
cannam@95 4643 % to take a single TeX argument. The case of a macro invocation that
cannam@95 4644 % goes to end-of-line is not handled.
cannam@95 4645 %
cannam@95 4646 \macrolist
cannam@95 4647 }
cannam@95 4648
cannam@95 4649 % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
cannam@95 4650 % ignore left quotes in the sort term.
cannam@95 4651 {\catcode`\`=\active
cannam@95 4652 \gdef\indexlquoteignore{\let`=\empty}}
cannam@95 4653
cannam@95 4654 \let\indexbackslash=0 %overridden during \printindex.
cannam@95 4655 \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
cannam@95 4656
cannam@95 4657 % Most index entries go through here, but \dosubind is the general case.
cannam@95 4658 % #1 is the index name, #2 is the entry text.
cannam@95 4659 \def\doind#1#2{\dosubind{#1}{#2}{}}
cannam@95 4660
cannam@95 4661 % Workhorse for all \fooindexes.
cannam@95 4662 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
cannam@95 4663 % empty if called from \doind, as we usually are (the main exception
cannam@95 4664 % is with most defuns, which call us directly).
cannam@95 4665 %
cannam@95 4666 \def\dosubind#1#2#3{%
cannam@95 4667 \iflinks
cannam@95 4668 {%
cannam@95 4669 % Store the main index entry text (including the third arg).
cannam@95 4670 \toks0 = {#2}%
cannam@95 4671 % If third arg is present, precede it with a space.
cannam@95 4672 \def\thirdarg{#3}%
cannam@95 4673 \ifx\thirdarg\empty \else
cannam@95 4674 \toks0 = \expandafter{\the\toks0 \space #3}%
cannam@95 4675 \fi
cannam@95 4676 %
cannam@95 4677 \edef\writeto{\csname#1indfile\endcsname}%
cannam@95 4678 %
cannam@95 4679 \safewhatsit\dosubindwrite
cannam@95 4680 }%
cannam@95 4681 \fi
cannam@95 4682 }
cannam@95 4683
cannam@95 4684 % Write the entry in \toks0 to the index file:
cannam@95 4685 %
cannam@95 4686 \def\dosubindwrite{%
cannam@95 4687 % Put the index entry in the margin if desired.
cannam@95 4688 \ifx\SETmarginindex\relax\else
cannam@95 4689 \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
cannam@95 4690 \fi
cannam@95 4691 %
cannam@95 4692 % Remember, we are within a group.
cannam@95 4693 \indexdummies % Must do this here, since \bf, etc expand at this stage
cannam@95 4694 \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
cannam@95 4695 % so it will be output as is; and it will print as backslash.
cannam@95 4696 %
cannam@95 4697 % Process the index entry with all font commands turned off, to
cannam@95 4698 % get the string to sort by.
cannam@95 4699 {\indexnofonts
cannam@95 4700 \edef\temp{\the\toks0}% need full expansion
cannam@95 4701 \xdef\indexsorttmp{\temp}%
cannam@95 4702 }%
cannam@95 4703 %
cannam@95 4704 % Set up the complete index entry, with both the sort key and
cannam@95 4705 % the original text, including any font commands. We write
cannam@95 4706 % three arguments to \entry to the .?? file (four in the
cannam@95 4707 % subentry case), texindex reduces to two when writing the .??s
cannam@95 4708 % sorted result.
cannam@95 4709 \edef\temp{%
cannam@95 4710 \write\writeto{%
cannam@95 4711 \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
cannam@95 4712 }%
cannam@95 4713 \temp
cannam@95 4714 }
cannam@95 4715
cannam@95 4716 % Take care of unwanted page breaks/skips around a whatsit:
cannam@95 4717 %
cannam@95 4718 % If a skip is the last thing on the list now, preserve it
cannam@95 4719 % by backing up by \lastskip, doing the \write, then inserting
cannam@95 4720 % the skip again. Otherwise, the whatsit generated by the
cannam@95 4721 % \write or \pdfdest will make \lastskip zero. The result is that
cannam@95 4722 % sequences like this:
cannam@95 4723 % @end defun
cannam@95 4724 % @tindex whatever
cannam@95 4725 % @defun ...
cannam@95 4726 % will have extra space inserted, because the \medbreak in the
cannam@95 4727 % start of the @defun won't see the skip inserted by the @end of
cannam@95 4728 % the previous defun.
cannam@95 4729 %
cannam@95 4730 % But don't do any of this if we're not in vertical mode. We
cannam@95 4731 % don't want to do a \vskip and prematurely end a paragraph.
cannam@95 4732 %
cannam@95 4733 % Avoid page breaks due to these extra skips, too.
cannam@95 4734 %
cannam@95 4735 % But wait, there is a catch there:
cannam@95 4736 % We'll have to check whether \lastskip is zero skip. \ifdim is not
cannam@95 4737 % sufficient for this purpose, as it ignores stretch and shrink parts
cannam@95 4738 % of the skip. The only way seems to be to check the textual
cannam@95 4739 % representation of the skip.
cannam@95 4740 %
cannam@95 4741 % The following is almost like \def\zeroskipmacro{0.0pt} except that
cannam@95 4742 % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
cannam@95 4743 %
cannam@95 4744 \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
cannam@95 4745 %
cannam@95 4746 \newskip\whatsitskip
cannam@95 4747 \newcount\whatsitpenalty
cannam@95 4748 %
cannam@95 4749 % ..., ready, GO:
cannam@95 4750 %
cannam@95 4751 \def\safewhatsit#1{\ifhmode
cannam@95 4752 #1%
cannam@95 4753 \else
cannam@95 4754 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
cannam@95 4755 \whatsitskip = \lastskip
cannam@95 4756 \edef\lastskipmacro{\the\lastskip}%
cannam@95 4757 \whatsitpenalty = \lastpenalty
cannam@95 4758 %
cannam@95 4759 % If \lastskip is nonzero, that means the last item was a
cannam@95 4760 % skip. And since a skip is discardable, that means this
cannam@95 4761 % -\whatsitskip glue we're inserting is preceded by a
cannam@95 4762 % non-discardable item, therefore it is not a potential
cannam@95 4763 % breakpoint, therefore no \nobreak needed.
cannam@95 4764 \ifx\lastskipmacro\zeroskipmacro
cannam@95 4765 \else
cannam@95 4766 \vskip-\whatsitskip
cannam@95 4767 \fi
cannam@95 4768 %
cannam@95 4769 #1%
cannam@95 4770 %
cannam@95 4771 \ifx\lastskipmacro\zeroskipmacro
cannam@95 4772 % If \lastskip was zero, perhaps the last item was a penalty, and
cannam@95 4773 % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
cannam@95 4774 % to re-insert the same penalty (values >10000 are used for various
cannam@95 4775 % signals); since we just inserted a non-discardable item, any
cannam@95 4776 % following glue (such as a \parskip) would be a breakpoint. For example:
cannam@95 4777 % @deffn deffn-whatever
cannam@95 4778 % @vindex index-whatever
cannam@95 4779 % Description.
cannam@95 4780 % would allow a break between the index-whatever whatsit
cannam@95 4781 % and the "Description." paragraph.
cannam@95 4782 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
cannam@95 4783 \else
cannam@95 4784 % On the other hand, if we had a nonzero \lastskip,
cannam@95 4785 % this make-up glue would be preceded by a non-discardable item
cannam@95 4786 % (the whatsit from the \write), so we must insert a \nobreak.
cannam@95 4787 \nobreak\vskip\whatsitskip
cannam@95 4788 \fi
cannam@95 4789 \fi}
cannam@95 4790
cannam@95 4791 % The index entry written in the file actually looks like
cannam@95 4792 % \entry {sortstring}{page}{topic}
cannam@95 4793 % or
cannam@95 4794 % \entry {sortstring}{page}{topic}{subtopic}
cannam@95 4795 % The texindex program reads in these files and writes files
cannam@95 4796 % containing these kinds of lines:
cannam@95 4797 % \initial {c}
cannam@95 4798 % before the first topic whose initial is c
cannam@95 4799 % \entry {topic}{pagelist}
cannam@95 4800 % for a topic that is used without subtopics
cannam@95 4801 % \primary {topic}
cannam@95 4802 % for the beginning of a topic that is used with subtopics
cannam@95 4803 % \secondary {subtopic}{pagelist}
cannam@95 4804 % for each subtopic.
cannam@95 4805
cannam@95 4806 % Define the user-accessible indexing commands
cannam@95 4807 % @findex, @vindex, @kindex, @cindex.
cannam@95 4808
cannam@95 4809 \def\findex {\fnindex}
cannam@95 4810 \def\kindex {\kyindex}
cannam@95 4811 \def\cindex {\cpindex}
cannam@95 4812 \def\vindex {\vrindex}
cannam@95 4813 \def\tindex {\tpindex}
cannam@95 4814 \def\pindex {\pgindex}
cannam@95 4815
cannam@95 4816 \def\cindexsub {\begingroup\obeylines\cindexsub}
cannam@95 4817 {\obeylines %
cannam@95 4818 \gdef\cindexsub "#1" #2^^M{\endgroup %
cannam@95 4819 \dosubind{cp}{#2}{#1}}}
cannam@95 4820
cannam@95 4821 % Define the macros used in formatting output of the sorted index material.
cannam@95 4822
cannam@95 4823 % @printindex causes a particular index (the ??s file) to get printed.
cannam@95 4824 % It does not print any chapter heading (usually an @unnumbered).
cannam@95 4825 %
cannam@95 4826 \parseargdef\printindex{\begingroup
cannam@95 4827 \dobreak \chapheadingskip{10000}%
cannam@95 4828 %
cannam@95 4829 \smallfonts \rm
cannam@95 4830 \tolerance = 9500
cannam@95 4831 \plainfrenchspacing
cannam@95 4832 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
cannam@95 4833 %
cannam@95 4834 % See if the index file exists and is nonempty.
cannam@95 4835 % Change catcode of @ here so that if the index file contains
cannam@95 4836 % \initial {@}
cannam@95 4837 % as its first line, TeX doesn't complain about mismatched braces
cannam@95 4838 % (because it thinks @} is a control sequence).
cannam@95 4839 \catcode`\@ = 11
cannam@95 4840 \openin 1 \jobname.#1s
cannam@95 4841 \ifeof 1
cannam@95 4842 % \enddoublecolumns gets confused if there is no text in the index,
cannam@95 4843 % and it loses the chapter title and the aux file entries for the
cannam@95 4844 % index. The easiest way to prevent this problem is to make sure
cannam@95 4845 % there is some text.
cannam@95 4846 \putwordIndexNonexistent
cannam@95 4847 \else
cannam@95 4848 %
cannam@95 4849 % If the index file exists but is empty, then \openin leaves \ifeof
cannam@95 4850 % false. We have to make TeX try to read something from the file, so
cannam@95 4851 % it can discover if there is anything in it.
cannam@95 4852 \read 1 to \temp
cannam@95 4853 \ifeof 1
cannam@95 4854 \putwordIndexIsEmpty
cannam@95 4855 \else
cannam@95 4856 % Index files are almost Texinfo source, but we use \ as the escape
cannam@95 4857 % character. It would be better to use @, but that's too big a change
cannam@95 4858 % to make right now.
cannam@95 4859 \def\indexbackslash{\backslashcurfont}%
cannam@95 4860 \catcode`\\ = 0
cannam@95 4861 \escapechar = `\\
cannam@95 4862 \begindoublecolumns
cannam@95 4863 \input \jobname.#1s
cannam@95 4864 \enddoublecolumns
cannam@95 4865 \fi
cannam@95 4866 \fi
cannam@95 4867 \closein 1
cannam@95 4868 \endgroup}
cannam@95 4869
cannam@95 4870 % These macros are used by the sorted index file itself.
cannam@95 4871 % Change them to control the appearance of the index.
cannam@95 4872
cannam@95 4873 \def\initial#1{{%
cannam@95 4874 % Some minor font changes for the special characters.
cannam@95 4875 \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
cannam@95 4876 %
cannam@95 4877 % Remove any glue we may have, we'll be inserting our own.
cannam@95 4878 \removelastskip
cannam@95 4879 %
cannam@95 4880 % We like breaks before the index initials, so insert a bonus.
cannam@95 4881 \nobreak
cannam@95 4882 \vskip 0pt plus 3\baselineskip
cannam@95 4883 \penalty 0
cannam@95 4884 \vskip 0pt plus -3\baselineskip
cannam@95 4885 %
cannam@95 4886 % Typeset the initial. Making this add up to a whole number of
cannam@95 4887 % baselineskips increases the chance of the dots lining up from column
cannam@95 4888 % to column. It still won't often be perfect, because of the stretch
cannam@95 4889 % we need before each entry, but it's better.
cannam@95 4890 %
cannam@95 4891 % No shrink because it confuses \balancecolumns.
cannam@95 4892 \vskip 1.67\baselineskip plus .5\baselineskip
cannam@95 4893 \leftline{\secbf #1}%
cannam@95 4894 % Do our best not to break after the initial.
cannam@95 4895 \nobreak
cannam@95 4896 \vskip .33\baselineskip plus .1\baselineskip
cannam@95 4897 }}
cannam@95 4898
cannam@95 4899 % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
cannam@95 4900 % then page number (#2) flushed to the right margin. It is used for index
cannam@95 4901 % and table of contents entries. The paragraph is indented by \leftskip.
cannam@95 4902 %
cannam@95 4903 % A straightforward implementation would start like this:
cannam@95 4904 % \def\entry#1#2{...
cannam@95 4905 % But this freezes the catcodes in the argument, and can cause problems to
cannam@95 4906 % @code, which sets - active. This problem was fixed by a kludge---
cannam@95 4907 % ``-'' was active throughout whole index, but this isn't really right.
cannam@95 4908 % The right solution is to prevent \entry from swallowing the whole text.
cannam@95 4909 % --kasal, 21nov03
cannam@95 4910 \def\entry{%
cannam@95 4911 \begingroup
cannam@95 4912 %
cannam@95 4913 % Start a new paragraph if necessary, so our assignments below can't
cannam@95 4914 % affect previous text.
cannam@95 4915 \par
cannam@95 4916 %
cannam@95 4917 % Do not fill out the last line with white space.
cannam@95 4918 \parfillskip = 0in
cannam@95 4919 %
cannam@95 4920 % No extra space above this paragraph.
cannam@95 4921 \parskip = 0in
cannam@95 4922 %
cannam@95 4923 % Do not prefer a separate line ending with a hyphen to fewer lines.
cannam@95 4924 \finalhyphendemerits = 0
cannam@95 4925 %
cannam@95 4926 % \hangindent is only relevant when the entry text and page number
cannam@95 4927 % don't both fit on one line. In that case, bob suggests starting the
cannam@95 4928 % dots pretty far over on the line. Unfortunately, a large
cannam@95 4929 % indentation looks wrong when the entry text itself is broken across
cannam@95 4930 % lines. So we use a small indentation and put up with long leaders.
cannam@95 4931 %
cannam@95 4932 % \hangafter is reset to 1 (which is the value we want) at the start
cannam@95 4933 % of each paragraph, so we need not do anything with that.
cannam@95 4934 \hangindent = 2em
cannam@95 4935 %
cannam@95 4936 % When the entry text needs to be broken, just fill out the first line
cannam@95 4937 % with blank space.
cannam@95 4938 \rightskip = 0pt plus1fil
cannam@95 4939 %
cannam@95 4940 % A bit of stretch before each entry for the benefit of balancing
cannam@95 4941 % columns.
cannam@95 4942 \vskip 0pt plus1pt
cannam@95 4943 %
cannam@95 4944 % When reading the text of entry, convert explicit line breaks
cannam@95 4945 % from @* into spaces. The user might give these in long section
cannam@95 4946 % titles, for instance.
cannam@95 4947 \def\*{\unskip\space\ignorespaces}%
cannam@95 4948 \def\entrybreak{\hfil\break}%
cannam@95 4949 %
cannam@95 4950 % Swallow the left brace of the text (first parameter):
cannam@95 4951 \afterassignment\doentry
cannam@95 4952 \let\temp =
cannam@95 4953 }
cannam@95 4954 \def\entrybreak{\unskip\space\ignorespaces}%
cannam@95 4955 \def\doentry{%
cannam@95 4956 \bgroup % Instead of the swallowed brace.
cannam@95 4957 \noindent
cannam@95 4958 \aftergroup\finishentry
cannam@95 4959 % And now comes the text of the entry.
cannam@95 4960 }
cannam@95 4961 \def\finishentry#1{%
cannam@95 4962 % #1 is the page number.
cannam@95 4963 %
cannam@95 4964 % The following is kludged to not output a line of dots in the index if
cannam@95 4965 % there are no page numbers. The next person who breaks this will be
cannam@95 4966 % cursed by a Unix daemon.
cannam@95 4967 \setbox\boxA = \hbox{#1}%
cannam@95 4968 \ifdim\wd\boxA = 0pt
cannam@95 4969 \ %
cannam@95 4970 \else
cannam@95 4971 %
cannam@95 4972 % If we must, put the page number on a line of its own, and fill out
cannam@95 4973 % this line with blank space. (The \hfil is overwhelmed with the
cannam@95 4974 % fill leaders glue in \indexdotfill if the page number does fit.)
cannam@95 4975 \hfil\penalty50
cannam@95 4976 \null\nobreak\indexdotfill % Have leaders before the page number.
cannam@95 4977 %
cannam@95 4978 % The `\ ' here is removed by the implicit \unskip that TeX does as
cannam@95 4979 % part of (the primitive) \par. Without it, a spurious underfull
cannam@95 4980 % \hbox ensues.
cannam@95 4981 \ifpdf
cannam@95 4982 \pdfgettoks#1.%
cannam@95 4983 \ \the\toksA
cannam@95 4984 \else
cannam@95 4985 \ #1%
cannam@95 4986 \fi
cannam@95 4987 \fi
cannam@95 4988 \par
cannam@95 4989 \endgroup
cannam@95 4990 }
cannam@95 4991
cannam@95 4992 % Like plain.tex's \dotfill, except uses up at least 1 em.
cannam@95 4993 \def\indexdotfill{\cleaders
cannam@95 4994 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
cannam@95 4995
cannam@95 4996 \def\primary #1{\line{#1\hfil}}
cannam@95 4997
cannam@95 4998 \newskip\secondaryindent \secondaryindent=0.5cm
cannam@95 4999 \def\secondary#1#2{{%
cannam@95 5000 \parfillskip=0in
cannam@95 5001 \parskip=0in
cannam@95 5002 \hangindent=1in
cannam@95 5003 \hangafter=1
cannam@95 5004 \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
cannam@95 5005 \ifpdf
cannam@95 5006 \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
cannam@95 5007 \else
cannam@95 5008 #2
cannam@95 5009 \fi
cannam@95 5010 \par
cannam@95 5011 }}
cannam@95 5012
cannam@95 5013 % Define two-column mode, which we use to typeset indexes.
cannam@95 5014 % Adapted from the TeXbook, page 416, which is to say,
cannam@95 5015 % the manmac.tex format used to print the TeXbook itself.
cannam@95 5016 \catcode`\@=11
cannam@95 5017
cannam@95 5018 \newbox\partialpage
cannam@95 5019 \newdimen\doublecolumnhsize
cannam@95 5020
cannam@95 5021 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
cannam@95 5022 % Grab any single-column material above us.
cannam@95 5023 \output = {%
cannam@95 5024 %
cannam@95 5025 % Here is a possibility not foreseen in manmac: if we accumulate a
cannam@95 5026 % whole lot of material, we might end up calling this \output
cannam@95 5027 % routine twice in a row (see the doublecol-lose test, which is
cannam@95 5028 % essentially a couple of indexes with @setchapternewpage off). In
cannam@95 5029 % that case we just ship out what is in \partialpage with the normal
cannam@95 5030 % output routine. Generally, \partialpage will be empty when this
cannam@95 5031 % runs and this will be a no-op. See the indexspread.tex test case.
cannam@95 5032 \ifvoid\partialpage \else
cannam@95 5033 \onepageout{\pagecontents\partialpage}%
cannam@95 5034 \fi
cannam@95 5035 %
cannam@95 5036 \global\setbox\partialpage = \vbox{%
cannam@95 5037 % Unvbox the main output page.
cannam@95 5038 \unvbox\PAGE
cannam@95 5039 \kern-\topskip \kern\baselineskip
cannam@95 5040 }%
cannam@95 5041 }%
cannam@95 5042 \eject % run that output routine to set \partialpage
cannam@95 5043 %
cannam@95 5044 % Use the double-column output routine for subsequent pages.
cannam@95 5045 \output = {\doublecolumnout}%
cannam@95 5046 %
cannam@95 5047 % Change the page size parameters. We could do this once outside this
cannam@95 5048 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
cannam@95 5049 % format, but then we repeat the same computation. Repeating a couple
cannam@95 5050 % of assignments once per index is clearly meaningless for the
cannam@95 5051 % execution time, so we may as well do it in one place.
cannam@95 5052 %
cannam@95 5053 % First we halve the line length, less a little for the gutter between
cannam@95 5054 % the columns. We compute the gutter based on the line length, so it
cannam@95 5055 % changes automatically with the paper format. The magic constant
cannam@95 5056 % below is chosen so that the gutter has the same value (well, +-<1pt)
cannam@95 5057 % as it did when we hard-coded it.
cannam@95 5058 %
cannam@95 5059 % We put the result in a separate register, \doublecolumhsize, so we
cannam@95 5060 % can restore it in \pagesofar, after \hsize itself has (potentially)
cannam@95 5061 % been clobbered.
cannam@95 5062 %
cannam@95 5063 \doublecolumnhsize = \hsize
cannam@95 5064 \advance\doublecolumnhsize by -.04154\hsize
cannam@95 5065 \divide\doublecolumnhsize by 2
cannam@95 5066 \hsize = \doublecolumnhsize
cannam@95 5067 %
cannam@95 5068 % Double the \vsize as well. (We don't need a separate register here,
cannam@95 5069 % since nobody clobbers \vsize.)
cannam@95 5070 \vsize = 2\vsize
cannam@95 5071 }
cannam@95 5072
cannam@95 5073 % The double-column output routine for all double-column pages except
cannam@95 5074 % the last.
cannam@95 5075 %
cannam@95 5076 \def\doublecolumnout{%
cannam@95 5077 \splittopskip=\topskip \splitmaxdepth=\maxdepth
cannam@95 5078 % Get the available space for the double columns -- the normal
cannam@95 5079 % (undoubled) page height minus any material left over from the
cannam@95 5080 % previous page.
cannam@95 5081 \dimen@ = \vsize
cannam@95 5082 \divide\dimen@ by 2
cannam@95 5083 \advance\dimen@ by -\ht\partialpage
cannam@95 5084 %
cannam@95 5085 % box0 will be the left-hand column, box2 the right.
cannam@95 5086 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
cannam@95 5087 \onepageout\pagesofar
cannam@95 5088 \unvbox255
cannam@95 5089 \penalty\outputpenalty
cannam@95 5090 }
cannam@95 5091 %
cannam@95 5092 % Re-output the contents of the output page -- any previous material,
cannam@95 5093 % followed by the two boxes we just split, in box0 and box2.
cannam@95 5094 \def\pagesofar{%
cannam@95 5095 \unvbox\partialpage
cannam@95 5096 %
cannam@95 5097 \hsize = \doublecolumnhsize
cannam@95 5098 \wd0=\hsize \wd2=\hsize
cannam@95 5099 \hbox to\pagewidth{\box0\hfil\box2}%
cannam@95 5100 }
cannam@95 5101 %
cannam@95 5102 % All done with double columns.
cannam@95 5103 \def\enddoublecolumns{%
cannam@95 5104 % The following penalty ensures that the page builder is exercised
cannam@95 5105 % _before_ we change the output routine. This is necessary in the
cannam@95 5106 % following situation:
cannam@95 5107 %
cannam@95 5108 % The last section of the index consists only of a single entry.
cannam@95 5109 % Before this section, \pagetotal is less than \pagegoal, so no
cannam@95 5110 % break occurs before the last section starts. However, the last
cannam@95 5111 % section, consisting of \initial and the single \entry, does not
cannam@95 5112 % fit on the page and has to be broken off. Without the following
cannam@95 5113 % penalty the page builder will not be exercised until \eject
cannam@95 5114 % below, and by that time we'll already have changed the output
cannam@95 5115 % routine to the \balancecolumns version, so the next-to-last
cannam@95 5116 % double-column page will be processed with \balancecolumns, which
cannam@95 5117 % is wrong: The two columns will go to the main vertical list, with
cannam@95 5118 % the broken-off section in the recent contributions. As soon as
cannam@95 5119 % the output routine finishes, TeX starts reconsidering the page
cannam@95 5120 % break. The two columns and the broken-off section both fit on the
cannam@95 5121 % page, because the two columns now take up only half of the page
cannam@95 5122 % goal. When TeX sees \eject from below which follows the final
cannam@95 5123 % section, it invokes the new output routine that we've set after
cannam@95 5124 % \balancecolumns below; \onepageout will try to fit the two columns
cannam@95 5125 % and the final section into the vbox of \pageheight (see
cannam@95 5126 % \pagebody), causing an overfull box.
cannam@95 5127 %
cannam@95 5128 % Note that glue won't work here, because glue does not exercise the
cannam@95 5129 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
cannam@95 5130 \penalty0
cannam@95 5131 %
cannam@95 5132 \output = {%
cannam@95 5133 % Split the last of the double-column material. Leave it on the
cannam@95 5134 % current page, no automatic page break.
cannam@95 5135 \balancecolumns
cannam@95 5136 %
cannam@95 5137 % If we end up splitting too much material for the current page,
cannam@95 5138 % though, there will be another page break right after this \output
cannam@95 5139 % invocation ends. Having called \balancecolumns once, we do not
cannam@95 5140 % want to call it again. Therefore, reset \output to its normal
cannam@95 5141 % definition right away. (We hope \balancecolumns will never be
cannam@95 5142 % called on to balance too much material, but if it is, this makes
cannam@95 5143 % the output somewhat more palatable.)
cannam@95 5144 \global\output = {\onepageout{\pagecontents\PAGE}}%
cannam@95 5145 }%
cannam@95 5146 \eject
cannam@95 5147 \endgroup % started in \begindoublecolumns
cannam@95 5148 %
cannam@95 5149 % \pagegoal was set to the doubled \vsize above, since we restarted
cannam@95 5150 % the current page. We're now back to normal single-column
cannam@95 5151 % typesetting, so reset \pagegoal to the normal \vsize (after the
cannam@95 5152 % \endgroup where \vsize got restored).
cannam@95 5153 \pagegoal = \vsize
cannam@95 5154 }
cannam@95 5155 %
cannam@95 5156 % Called at the end of the double column material.
cannam@95 5157 \def\balancecolumns{%
cannam@95 5158 \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
cannam@95 5159 \dimen@ = \ht0
cannam@95 5160 \advance\dimen@ by \topskip
cannam@95 5161 \advance\dimen@ by-\baselineskip
cannam@95 5162 \divide\dimen@ by 2 % target to split to
cannam@95 5163 %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
cannam@95 5164 \splittopskip = \topskip
cannam@95 5165 % Loop until we get a decent breakpoint.
cannam@95 5166 {%
cannam@95 5167 \vbadness = 10000
cannam@95 5168 \loop
cannam@95 5169 \global\setbox3 = \copy0
cannam@95 5170 \global\setbox1 = \vsplit3 to \dimen@
cannam@95 5171 \ifdim\ht3>\dimen@
cannam@95 5172 \global\advance\dimen@ by 1pt
cannam@95 5173 \repeat
cannam@95 5174 }%
cannam@95 5175 %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
cannam@95 5176 \setbox0=\vbox to\dimen@{\unvbox1}%
cannam@95 5177 \setbox2=\vbox to\dimen@{\unvbox3}%
cannam@95 5178 %
cannam@95 5179 \pagesofar
cannam@95 5180 }
cannam@95 5181 \catcode`\@ = \other
cannam@95 5182
cannam@95 5183
cannam@95 5184 \message{sectioning,}
cannam@95 5185 % Chapters, sections, etc.
cannam@95 5186
cannam@95 5187 % Let's start with @part.
cannam@95 5188 \outer\parseargdef\part{\partzzz{#1}}
cannam@95 5189 \def\partzzz#1{%
cannam@95 5190 \chapoddpage
cannam@95 5191 \null
cannam@95 5192 \vskip.3\vsize % move it down on the page a bit
cannam@95 5193 \begingroup
cannam@95 5194 \noindent \titlefonts\rmisbold #1\par % the text
cannam@95 5195 \let\lastnode=\empty % no node to associate with
cannam@95 5196 \writetocentry{part}{#1}{}% but put it in the toc
cannam@95 5197 \headingsoff % no headline or footline on the part page
cannam@95 5198 \chapoddpage
cannam@95 5199 \endgroup
cannam@95 5200 }
cannam@95 5201
cannam@95 5202 % \unnumberedno is an oxymoron. But we count the unnumbered
cannam@95 5203 % sections so that we can refer to them unambiguously in the pdf
cannam@95 5204 % outlines by their "section number". We avoid collisions with chapter
cannam@95 5205 % numbers by starting them at 10000. (If a document ever has 10000
cannam@95 5206 % chapters, we're in trouble anyway, I'm sure.)
cannam@95 5207 \newcount\unnumberedno \unnumberedno = 10000
cannam@95 5208 \newcount\chapno
cannam@95 5209 \newcount\secno \secno=0
cannam@95 5210 \newcount\subsecno \subsecno=0
cannam@95 5211 \newcount\subsubsecno \subsubsecno=0
cannam@95 5212
cannam@95 5213 % This counter is funny since it counts through charcodes of letters A, B, ...
cannam@95 5214 \newcount\appendixno \appendixno = `\@
cannam@95 5215 %
cannam@95 5216 % \def\appendixletter{\char\the\appendixno}
cannam@95 5217 % We do the following ugly conditional instead of the above simple
cannam@95 5218 % construct for the sake of pdftex, which needs the actual
cannam@95 5219 % letter in the expansion, not just typeset.
cannam@95 5220 %
cannam@95 5221 \def\appendixletter{%
cannam@95 5222 \ifnum\appendixno=`A A%
cannam@95 5223 \else\ifnum\appendixno=`B B%
cannam@95 5224 \else\ifnum\appendixno=`C C%
cannam@95 5225 \else\ifnum\appendixno=`D D%
cannam@95 5226 \else\ifnum\appendixno=`E E%
cannam@95 5227 \else\ifnum\appendixno=`F F%
cannam@95 5228 \else\ifnum\appendixno=`G G%
cannam@95 5229 \else\ifnum\appendixno=`H H%
cannam@95 5230 \else\ifnum\appendixno=`I I%
cannam@95 5231 \else\ifnum\appendixno=`J J%
cannam@95 5232 \else\ifnum\appendixno=`K K%
cannam@95 5233 \else\ifnum\appendixno=`L L%
cannam@95 5234 \else\ifnum\appendixno=`M M%
cannam@95 5235 \else\ifnum\appendixno=`N N%
cannam@95 5236 \else\ifnum\appendixno=`O O%
cannam@95 5237 \else\ifnum\appendixno=`P P%
cannam@95 5238 \else\ifnum\appendixno=`Q Q%
cannam@95 5239 \else\ifnum\appendixno=`R R%
cannam@95 5240 \else\ifnum\appendixno=`S S%
cannam@95 5241 \else\ifnum\appendixno=`T T%
cannam@95 5242 \else\ifnum\appendixno=`U U%
cannam@95 5243 \else\ifnum\appendixno=`V V%
cannam@95 5244 \else\ifnum\appendixno=`W W%
cannam@95 5245 \else\ifnum\appendixno=`X X%
cannam@95 5246 \else\ifnum\appendixno=`Y Y%
cannam@95 5247 \else\ifnum\appendixno=`Z Z%
cannam@95 5248 % The \the is necessary, despite appearances, because \appendixletter is
cannam@95 5249 % expanded while writing the .toc file. \char\appendixno is not
cannam@95 5250 % expandable, thus it is written literally, thus all appendixes come out
cannam@95 5251 % with the same letter (or @) in the toc without it.
cannam@95 5252 \else\char\the\appendixno
cannam@95 5253 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
cannam@95 5254 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
cannam@95 5255
cannam@95 5256 % Each @chapter defines these (using marks) as the number+name, number
cannam@95 5257 % and name of the chapter. Page headings and footings can use
cannam@95 5258 % these. @section does likewise.
cannam@95 5259 \def\thischapter{}
cannam@95 5260 \def\thischapternum{}
cannam@95 5261 \def\thischaptername{}
cannam@95 5262 \def\thissection{}
cannam@95 5263 \def\thissectionnum{}
cannam@95 5264 \def\thissectionname{}
cannam@95 5265
cannam@95 5266 \newcount\absseclevel % used to calculate proper heading level
cannam@95 5267 \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
cannam@95 5268
cannam@95 5269 % @raisesections: treat @section as chapter, @subsection as section, etc.
cannam@95 5270 \def\raisesections{\global\advance\secbase by -1}
cannam@95 5271 \let\up=\raisesections % original BFox name
cannam@95 5272
cannam@95 5273 % @lowersections: treat @chapter as section, @section as subsection, etc.
cannam@95 5274 \def\lowersections{\global\advance\secbase by 1}
cannam@95 5275 \let\down=\lowersections % original BFox name
cannam@95 5276
cannam@95 5277 % we only have subsub.
cannam@95 5278 \chardef\maxseclevel = 3
cannam@95 5279 %
cannam@95 5280 % A numbered section within an unnumbered changes to unnumbered too.
cannam@95 5281 % To achieve this, remember the "biggest" unnum. sec. we are currently in:
cannam@95 5282 \chardef\unnlevel = \maxseclevel
cannam@95 5283 %
cannam@95 5284 % Trace whether the current chapter is an appendix or not:
cannam@95 5285 % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
cannam@95 5286 \def\chapheadtype{N}
cannam@95 5287
cannam@95 5288 % Choose a heading macro
cannam@95 5289 % #1 is heading type
cannam@95 5290 % #2 is heading level
cannam@95 5291 % #3 is text for heading
cannam@95 5292 \def\genhead#1#2#3{%
cannam@95 5293 % Compute the abs. sec. level:
cannam@95 5294 \absseclevel=#2
cannam@95 5295 \advance\absseclevel by \secbase
cannam@95 5296 % Make sure \absseclevel doesn't fall outside the range:
cannam@95 5297 \ifnum \absseclevel < 0
cannam@95 5298 \absseclevel = 0
cannam@95 5299 \else
cannam@95 5300 \ifnum \absseclevel > 3
cannam@95 5301 \absseclevel = 3
cannam@95 5302 \fi
cannam@95 5303 \fi
cannam@95 5304 % The heading type:
cannam@95 5305 \def\headtype{#1}%
cannam@95 5306 \if \headtype U%
cannam@95 5307 \ifnum \absseclevel < \unnlevel
cannam@95 5308 \chardef\unnlevel = \absseclevel
cannam@95 5309 \fi
cannam@95 5310 \else
cannam@95 5311 % Check for appendix sections:
cannam@95 5312 \ifnum \absseclevel = 0
cannam@95 5313 \edef\chapheadtype{\headtype}%
cannam@95 5314 \else
cannam@95 5315 \if \headtype A\if \chapheadtype N%
cannam@95 5316 \errmessage{@appendix... within a non-appendix chapter}%
cannam@95 5317 \fi\fi
cannam@95 5318 \fi
cannam@95 5319 % Check for numbered within unnumbered:
cannam@95 5320 \ifnum \absseclevel > \unnlevel
cannam@95 5321 \def\headtype{U}%
cannam@95 5322 \else
cannam@95 5323 \chardef\unnlevel = 3
cannam@95 5324 \fi
cannam@95 5325 \fi
cannam@95 5326 % Now print the heading:
cannam@95 5327 \if \headtype U%
cannam@95 5328 \ifcase\absseclevel
cannam@95 5329 \unnumberedzzz{#3}%
cannam@95 5330 \or \unnumberedseczzz{#3}%
cannam@95 5331 \or \unnumberedsubseczzz{#3}%
cannam@95 5332 \or \unnumberedsubsubseczzz{#3}%
cannam@95 5333 \fi
cannam@95 5334 \else
cannam@95 5335 \if \headtype A%
cannam@95 5336 \ifcase\absseclevel
cannam@95 5337 \appendixzzz{#3}%
cannam@95 5338 \or \appendixsectionzzz{#3}%
cannam@95 5339 \or \appendixsubseczzz{#3}%
cannam@95 5340 \or \appendixsubsubseczzz{#3}%
cannam@95 5341 \fi
cannam@95 5342 \else
cannam@95 5343 \ifcase\absseclevel
cannam@95 5344 \chapterzzz{#3}%
cannam@95 5345 \or \seczzz{#3}%
cannam@95 5346 \or \numberedsubseczzz{#3}%
cannam@95 5347 \or \numberedsubsubseczzz{#3}%
cannam@95 5348 \fi
cannam@95 5349 \fi
cannam@95 5350 \fi
cannam@95 5351 \suppressfirstparagraphindent
cannam@95 5352 }
cannam@95 5353
cannam@95 5354 % an interface:
cannam@95 5355 \def\numhead{\genhead N}
cannam@95 5356 \def\apphead{\genhead A}
cannam@95 5357 \def\unnmhead{\genhead U}
cannam@95 5358
cannam@95 5359 % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
cannam@95 5360 % all lower-level sectioning counters to zero.
cannam@95 5361 %
cannam@95 5362 % Also set \chaplevelprefix, which we prepend to @float sequence numbers
cannam@95 5363 % (e.g., figures), q.v. By default (before any chapter), that is empty.
cannam@95 5364 \let\chaplevelprefix = \empty
cannam@95 5365 %
cannam@95 5366 \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
cannam@95 5367 \def\chapterzzz#1{%
cannam@95 5368 % section resetting is \global in case the chapter is in a group, such
cannam@95 5369 % as an @include file.
cannam@95 5370 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
cannam@95 5371 \global\advance\chapno by 1
cannam@95 5372 %
cannam@95 5373 % Used for \float.
cannam@95 5374 \gdef\chaplevelprefix{\the\chapno.}%
cannam@95 5375 \resetallfloatnos
cannam@95 5376 %
cannam@95 5377 % \putwordChapter can contain complex things in translations.
cannam@95 5378 \toks0=\expandafter{\putwordChapter}%
cannam@95 5379 \message{\the\toks0 \space \the\chapno}%
cannam@95 5380 %
cannam@95 5381 % Write the actual heading.
cannam@95 5382 \chapmacro{#1}{Ynumbered}{\the\chapno}%
cannam@95 5383 %
cannam@95 5384 % So @section and the like are numbered underneath this chapter.
cannam@95 5385 \global\let\section = \numberedsec
cannam@95 5386 \global\let\subsection = \numberedsubsec
cannam@95 5387 \global\let\subsubsection = \numberedsubsubsec
cannam@95 5388 }
cannam@95 5389
cannam@95 5390 \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
cannam@95 5391 %
cannam@95 5392 \def\appendixzzz#1{%
cannam@95 5393 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
cannam@95 5394 \global\advance\appendixno by 1
cannam@95 5395 \gdef\chaplevelprefix{\appendixletter.}%
cannam@95 5396 \resetallfloatnos
cannam@95 5397 %
cannam@95 5398 % \putwordAppendix can contain complex things in translations.
cannam@95 5399 \toks0=\expandafter{\putwordAppendix}%
cannam@95 5400 \message{\the\toks0 \space \appendixletter}%
cannam@95 5401 %
cannam@95 5402 \chapmacro{#1}{Yappendix}{\appendixletter}%
cannam@95 5403 %
cannam@95 5404 \global\let\section = \appendixsec
cannam@95 5405 \global\let\subsection = \appendixsubsec
cannam@95 5406 \global\let\subsubsection = \appendixsubsubsec
cannam@95 5407 }
cannam@95 5408
cannam@95 5409 % normally unnmhead0 calls unnumberedzzz:
cannam@95 5410 \outer\parseargdef\unnumbered{\unnmhead0{#1}}
cannam@95 5411 \def\unnumberedzzz#1{%
cannam@95 5412 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
cannam@95 5413 \global\advance\unnumberedno by 1
cannam@95 5414 %
cannam@95 5415 % Since an unnumbered has no number, no prefix for figures.
cannam@95 5416 \global\let\chaplevelprefix = \empty
cannam@95 5417 \resetallfloatnos
cannam@95 5418 %
cannam@95 5419 % This used to be simply \message{#1}, but TeX fully expands the
cannam@95 5420 % argument to \message. Therefore, if #1 contained @-commands, TeX
cannam@95 5421 % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
cannam@95 5422 % expanded @cite (which turns out to cause errors because \cite is meant
cannam@95 5423 % to be executed, not expanded).
cannam@95 5424 %
cannam@95 5425 % Anyway, we don't want the fully-expanded definition of @cite to appear
cannam@95 5426 % as a result of the \message, we just want `@cite' itself. We use
cannam@95 5427 % \the<toks register> to achieve this: TeX expands \the<toks> only once,
cannam@95 5428 % simply yielding the contents of <toks register>. (We also do this for
cannam@95 5429 % the toc entries.)
cannam@95 5430 \toks0 = {#1}%
cannam@95 5431 \message{(\the\toks0)}%
cannam@95 5432 %
cannam@95 5433 \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
cannam@95 5434 %
cannam@95 5435 \global\let\section = \unnumberedsec
cannam@95 5436 \global\let\subsection = \unnumberedsubsec
cannam@95 5437 \global\let\subsubsection = \unnumberedsubsubsec
cannam@95 5438 }
cannam@95 5439
cannam@95 5440 % @centerchap is like @unnumbered, but the heading is centered.
cannam@95 5441 \outer\parseargdef\centerchap{%
cannam@95 5442 % Well, we could do the following in a group, but that would break
cannam@95 5443 % an assumption that \chapmacro is called at the outermost level.
cannam@95 5444 % Thus we are safer this way: --kasal, 24feb04
cannam@95 5445 \let\centerparametersmaybe = \centerparameters
cannam@95 5446 \unnmhead0{#1}%
cannam@95 5447 \let\centerparametersmaybe = \relax
cannam@95 5448 }
cannam@95 5449
cannam@95 5450 % @top is like @unnumbered.
cannam@95 5451 \let\top\unnumbered
cannam@95 5452
cannam@95 5453 % Sections.
cannam@95 5454 %
cannam@95 5455 \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
cannam@95 5456 \def\seczzz#1{%
cannam@95 5457 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
cannam@95 5458 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
cannam@95 5459 }
cannam@95 5460
cannam@95 5461 % normally calls appendixsectionzzz:
cannam@95 5462 \outer\parseargdef\appendixsection{\apphead1{#1}}
cannam@95 5463 \def\appendixsectionzzz#1{%
cannam@95 5464 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
cannam@95 5465 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
cannam@95 5466 }
cannam@95 5467 \let\appendixsec\appendixsection
cannam@95 5468
cannam@95 5469 % normally calls unnumberedseczzz:
cannam@95 5470 \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
cannam@95 5471 \def\unnumberedseczzz#1{%
cannam@95 5472 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
cannam@95 5473 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
cannam@95 5474 }
cannam@95 5475
cannam@95 5476 % Subsections.
cannam@95 5477 %
cannam@95 5478 % normally calls numberedsubseczzz:
cannam@95 5479 \outer\parseargdef\numberedsubsec{\numhead2{#1}}
cannam@95 5480 \def\numberedsubseczzz#1{%
cannam@95 5481 \global\subsubsecno=0 \global\advance\subsecno by 1
cannam@95 5482 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
cannam@95 5483 }
cannam@95 5484
cannam@95 5485 % normally calls appendixsubseczzz:
cannam@95 5486 \outer\parseargdef\appendixsubsec{\apphead2{#1}}
cannam@95 5487 \def\appendixsubseczzz#1{%
cannam@95 5488 \global\subsubsecno=0 \global\advance\subsecno by 1
cannam@95 5489 \sectionheading{#1}{subsec}{Yappendix}%
cannam@95 5490 {\appendixletter.\the\secno.\the\subsecno}%
cannam@95 5491 }
cannam@95 5492
cannam@95 5493 % normally calls unnumberedsubseczzz:
cannam@95 5494 \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
cannam@95 5495 \def\unnumberedsubseczzz#1{%
cannam@95 5496 \global\subsubsecno=0 \global\advance\subsecno by 1
cannam@95 5497 \sectionheading{#1}{subsec}{Ynothing}%
cannam@95 5498 {\the\unnumberedno.\the\secno.\the\subsecno}%
cannam@95 5499 }
cannam@95 5500
cannam@95 5501 % Subsubsections.
cannam@95 5502 %
cannam@95 5503 % normally numberedsubsubseczzz:
cannam@95 5504 \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
cannam@95 5505 \def\numberedsubsubseczzz#1{%
cannam@95 5506 \global\advance\subsubsecno by 1
cannam@95 5507 \sectionheading{#1}{subsubsec}{Ynumbered}%
cannam@95 5508 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
cannam@95 5509 }
cannam@95 5510
cannam@95 5511 % normally appendixsubsubseczzz:
cannam@95 5512 \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
cannam@95 5513 \def\appendixsubsubseczzz#1{%
cannam@95 5514 \global\advance\subsubsecno by 1
cannam@95 5515 \sectionheading{#1}{subsubsec}{Yappendix}%
cannam@95 5516 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
cannam@95 5517 }
cannam@95 5518
cannam@95 5519 % normally unnumberedsubsubseczzz:
cannam@95 5520 \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
cannam@95 5521 \def\unnumberedsubsubseczzz#1{%
cannam@95 5522 \global\advance\subsubsecno by 1
cannam@95 5523 \sectionheading{#1}{subsubsec}{Ynothing}%
cannam@95 5524 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
cannam@95 5525 }
cannam@95 5526
cannam@95 5527 % These macros control what the section commands do, according
cannam@95 5528 % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
cannam@95 5529 % Define them by default for a numbered chapter.
cannam@95 5530 \let\section = \numberedsec
cannam@95 5531 \let\subsection = \numberedsubsec
cannam@95 5532 \let\subsubsection = \numberedsubsubsec
cannam@95 5533
cannam@95 5534 % Define @majorheading, @heading and @subheading
cannam@95 5535
cannam@95 5536 % NOTE on use of \vbox for chapter headings, section headings, and such:
cannam@95 5537 % 1) We use \vbox rather than the earlier \line to permit
cannam@95 5538 % overlong headings to fold.
cannam@95 5539 % 2) \hyphenpenalty is set to 10000 because hyphenation in a
cannam@95 5540 % heading is obnoxious; this forbids it.
cannam@95 5541 % 3) Likewise, headings look best if no \parindent is used, and
cannam@95 5542 % if justification is not attempted. Hence \raggedright.
cannam@95 5543
cannam@95 5544 \def\majorheading{%
cannam@95 5545 {\advance\chapheadingskip by 10pt \chapbreak }%
cannam@95 5546 \parsearg\chapheadingzzz
cannam@95 5547 }
cannam@95 5548
cannam@95 5549 \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
cannam@95 5550 \def\chapheadingzzz#1{%
cannam@95 5551 {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
cannam@95 5552 \parindent=0pt\ptexraggedright
cannam@95 5553 \rmisbold #1\hfill}}%
cannam@95 5554 \bigskip \par\penalty 200\relax
cannam@95 5555 \suppressfirstparagraphindent
cannam@95 5556 }
cannam@95 5557
cannam@95 5558 % @heading, @subheading, @subsubheading.
cannam@95 5559 \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
cannam@95 5560 \suppressfirstparagraphindent}
cannam@95 5561 \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
cannam@95 5562 \suppressfirstparagraphindent}
cannam@95 5563 \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
cannam@95 5564 \suppressfirstparagraphindent}
cannam@95 5565
cannam@95 5566 % These macros generate a chapter, section, etc. heading only
cannam@95 5567 % (including whitespace, linebreaking, etc. around it),
cannam@95 5568 % given all the information in convenient, parsed form.
cannam@95 5569
cannam@95 5570 % Args are the skip and penalty (usually negative)
cannam@95 5571 \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
cannam@95 5572
cannam@95 5573 % Parameter controlling skip before chapter headings (if needed)
cannam@95 5574 \newskip\chapheadingskip
cannam@95 5575
cannam@95 5576 % Define plain chapter starts, and page on/off switching for it.
cannam@95 5577 \def\chapbreak{\dobreak \chapheadingskip {-4000}}
cannam@95 5578 \def\chappager{\par\vfill\supereject}
cannam@95 5579 % Because \domark is called before \chapoddpage, the filler page will
cannam@95 5580 % get the headings for the next chapter, which is wrong. But we don't
cannam@95 5581 % care -- we just disable all headings on the filler page.
cannam@95 5582 \def\chapoddpage{%
cannam@95 5583 \chappager
cannam@95 5584 \ifodd\pageno \else
cannam@95 5585 \begingroup
cannam@95 5586 \headingsoff
cannam@95 5587 \null
cannam@95 5588 \chappager
cannam@95 5589 \endgroup
cannam@95 5590 \fi
cannam@95 5591 }
cannam@95 5592
cannam@95 5593 \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
cannam@95 5594
cannam@95 5595 \def\CHAPPAGoff{%
cannam@95 5596 \global\let\contentsalignmacro = \chappager
cannam@95 5597 \global\let\pchapsepmacro=\chapbreak
cannam@95 5598 \global\let\pagealignmacro=\chappager}
cannam@95 5599
cannam@95 5600 \def\CHAPPAGon{%
cannam@95 5601 \global\let\contentsalignmacro = \chappager
cannam@95 5602 \global\let\pchapsepmacro=\chappager
cannam@95 5603 \global\let\pagealignmacro=\chappager
cannam@95 5604 \global\def\HEADINGSon{\HEADINGSsingle}}
cannam@95 5605
cannam@95 5606 \def\CHAPPAGodd{%
cannam@95 5607 \global\let\contentsalignmacro = \chapoddpage
cannam@95 5608 \global\let\pchapsepmacro=\chapoddpage
cannam@95 5609 \global\let\pagealignmacro=\chapoddpage
cannam@95 5610 \global\def\HEADINGSon{\HEADINGSdouble}}
cannam@95 5611
cannam@95 5612 \CHAPPAGon
cannam@95 5613
cannam@95 5614 % Chapter opening.
cannam@95 5615 %
cannam@95 5616 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
cannam@95 5617 % Yappendix, Yomitfromtoc), #3 the chapter number.
cannam@95 5618 %
cannam@95 5619 % To test against our argument.
cannam@95 5620 \def\Ynothingkeyword{Ynothing}
cannam@95 5621 \def\Yomitfromtockeyword{Yomitfromtoc}
cannam@95 5622 \def\Yappendixkeyword{Yappendix}
cannam@95 5623 %
cannam@95 5624 \def\chapmacro#1#2#3{%
cannam@95 5625 % Insert the first mark before the heading break (see notes for \domark).
cannam@95 5626 \let\prevchapterdefs=\lastchapterdefs
cannam@95 5627 \let\prevsectiondefs=\lastsectiondefs
cannam@95 5628 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
cannam@95 5629 \gdef\thissection{}}%
cannam@95 5630 %
cannam@95 5631 \def\temptype{#2}%
cannam@95 5632 \ifx\temptype\Ynothingkeyword
cannam@95 5633 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
cannam@95 5634 \gdef\thischapter{\thischaptername}}%
cannam@95 5635 \else\ifx\temptype\Yomitfromtockeyword
cannam@95 5636 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
cannam@95 5637 \gdef\thischapter{}}%
cannam@95 5638 \else\ifx\temptype\Yappendixkeyword
cannam@95 5639 \toks0={#1}%
cannam@95 5640 \xdef\lastchapterdefs{%
cannam@95 5641 \gdef\noexpand\thischaptername{\the\toks0}%
cannam@95 5642 \gdef\noexpand\thischapternum{\appendixletter}%
cannam@95 5643 % \noexpand\putwordAppendix avoids expanding indigestible
cannam@95 5644 % commands in some of the translations.
cannam@95 5645 \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
cannam@95 5646 \noexpand\thischapternum:
cannam@95 5647 \noexpand\thischaptername}%
cannam@95 5648 }%
cannam@95 5649 \else
cannam@95 5650 \toks0={#1}%
cannam@95 5651 \xdef\lastchapterdefs{%
cannam@95 5652 \gdef\noexpand\thischaptername{\the\toks0}%
cannam@95 5653 \gdef\noexpand\thischapternum{\the\chapno}%
cannam@95 5654 % \noexpand\putwordChapter avoids expanding indigestible
cannam@95 5655 % commands in some of the translations.
cannam@95 5656 \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
cannam@95 5657 \noexpand\thischapternum:
cannam@95 5658 \noexpand\thischaptername}%
cannam@95 5659 }%
cannam@95 5660 \fi\fi\fi
cannam@95 5661 %
cannam@95 5662 % Output the mark. Pass it through \safewhatsit, to take care of
cannam@95 5663 % the preceding space.
cannam@95 5664 \safewhatsit\domark
cannam@95 5665 %
cannam@95 5666 % Insert the chapter heading break.
cannam@95 5667 \pchapsepmacro
cannam@95 5668 %
cannam@95 5669 % Now the second mark, after the heading break. No break points
cannam@95 5670 % between here and the heading.
cannam@95 5671 \let\prevchapterdefs=\lastchapterdefs
cannam@95 5672 \let\prevsectiondefs=\lastsectiondefs
cannam@95 5673 \domark
cannam@95 5674 %
cannam@95 5675 {%
cannam@95 5676 \chapfonts \rmisbold
cannam@95 5677 %
cannam@95 5678 % Have to define \lastsection before calling \donoderef, because the
cannam@95 5679 % xref code eventually uses it. On the other hand, it has to be called
cannam@95 5680 % after \pchapsepmacro, or the headline will change too soon.
cannam@95 5681 \gdef\lastsection{#1}%
cannam@95 5682 %
cannam@95 5683 % Only insert the separating space if we have a chapter/appendix
cannam@95 5684 % number, and don't print the unnumbered ``number''.
cannam@95 5685 \ifx\temptype\Ynothingkeyword
cannam@95 5686 \setbox0 = \hbox{}%
cannam@95 5687 \def\toctype{unnchap}%
cannam@95 5688 \else\ifx\temptype\Yomitfromtockeyword
cannam@95 5689 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
cannam@95 5690 \def\toctype{omit}%
cannam@95 5691 \else\ifx\temptype\Yappendixkeyword
cannam@95 5692 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
cannam@95 5693 \def\toctype{app}%
cannam@95 5694 \else
cannam@95 5695 \setbox0 = \hbox{#3\enspace}%
cannam@95 5696 \def\toctype{numchap}%
cannam@95 5697 \fi\fi\fi
cannam@95 5698 %
cannam@95 5699 % Write the toc entry for this chapter. Must come before the
cannam@95 5700 % \donoderef, because we include the current node name in the toc
cannam@95 5701 % entry, and \donoderef resets it to empty.
cannam@95 5702 \writetocentry{\toctype}{#1}{#3}%
cannam@95 5703 %
cannam@95 5704 % For pdftex, we have to write out the node definition (aka, make
cannam@95 5705 % the pdfdest) after any page break, but before the actual text has
cannam@95 5706 % been typeset. If the destination for the pdf outline is after the
cannam@95 5707 % text, then jumping from the outline may wind up with the text not
cannam@95 5708 % being visible, for instance under high magnification.
cannam@95 5709 \donoderef{#2}%
cannam@95 5710 %
cannam@95 5711 % Typeset the actual heading.
cannam@95 5712 \nobreak % Avoid page breaks at the interline glue.
cannam@95 5713 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
cannam@95 5714 \hangindent=\wd0 \centerparametersmaybe
cannam@95 5715 \unhbox0 #1\par}%
cannam@95 5716 }%
cannam@95 5717 \nobreak\bigskip % no page break after a chapter title
cannam@95 5718 \nobreak
cannam@95 5719 }
cannam@95 5720
cannam@95 5721 % @centerchap -- centered and unnumbered.
cannam@95 5722 \let\centerparametersmaybe = \relax
cannam@95 5723 \def\centerparameters{%
cannam@95 5724 \advance\rightskip by 3\rightskip
cannam@95 5725 \leftskip = \rightskip
cannam@95 5726 \parfillskip = 0pt
cannam@95 5727 }
cannam@95 5728
cannam@95 5729
cannam@95 5730 % I don't think this chapter style is supported any more, so I'm not
cannam@95 5731 % updating it with the new noderef stuff. We'll see. --karl, 11aug03.
cannam@95 5732 %
cannam@95 5733 \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
cannam@95 5734 %
cannam@95 5735 \def\unnchfopen #1{%
cannam@95 5736 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
cannam@95 5737 \parindent=0pt\ptexraggedright
cannam@95 5738 \rmisbold #1\hfill}}\bigskip \par\nobreak
cannam@95 5739 }
cannam@95 5740 \def\chfopen #1#2{\chapoddpage {\chapfonts
cannam@95 5741 \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
cannam@95 5742 \par\penalty 5000 %
cannam@95 5743 }
cannam@95 5744 \def\centerchfopen #1{%
cannam@95 5745 \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
cannam@95 5746 \parindent=0pt
cannam@95 5747 \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
cannam@95 5748 }
cannam@95 5749 \def\CHAPFopen{%
cannam@95 5750 \global\let\chapmacro=\chfopen
cannam@95 5751 \global\let\centerchapmacro=\centerchfopen}
cannam@95 5752
cannam@95 5753
cannam@95 5754 % Section titles. These macros combine the section number parts and
cannam@95 5755 % call the generic \sectionheading to do the printing.
cannam@95 5756 %
cannam@95 5757 \newskip\secheadingskip
cannam@95 5758 \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
cannam@95 5759
cannam@95 5760 % Subsection titles.
cannam@95 5761 \newskip\subsecheadingskip
cannam@95 5762 \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
cannam@95 5763
cannam@95 5764 % Subsubsection titles.
cannam@95 5765 \def\subsubsecheadingskip{\subsecheadingskip}
cannam@95 5766 \def\subsubsecheadingbreak{\subsecheadingbreak}
cannam@95 5767
cannam@95 5768
cannam@95 5769 % Print any size, any type, section title.
cannam@95 5770 %
cannam@95 5771 % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
cannam@95 5772 % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
cannam@95 5773 % section number.
cannam@95 5774 %
cannam@95 5775 \def\seckeyword{sec}
cannam@95 5776 %
cannam@95 5777 \def\sectionheading#1#2#3#4{%
cannam@95 5778 {%
cannam@95 5779 \checkenv{}% should not be in an environment.
cannam@95 5780 %
cannam@95 5781 % Switch to the right set of fonts.
cannam@95 5782 \csname #2fonts\endcsname \rmisbold
cannam@95 5783 %
cannam@95 5784 \def\sectionlevel{#2}%
cannam@95 5785 \def\temptype{#3}%
cannam@95 5786 %
cannam@95 5787 % Insert first mark before the heading break (see notes for \domark).
cannam@95 5788 \let\prevsectiondefs=\lastsectiondefs
cannam@95 5789 \ifx\temptype\Ynothingkeyword
cannam@95 5790 \ifx\sectionlevel\seckeyword
cannam@95 5791 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
cannam@95 5792 \gdef\thissection{\thissectionname}}%
cannam@95 5793 \fi
cannam@95 5794 \else\ifx\temptype\Yomitfromtockeyword
cannam@95 5795 % Don't redefine \thissection.
cannam@95 5796 \else\ifx\temptype\Yappendixkeyword
cannam@95 5797 \ifx\sectionlevel\seckeyword
cannam@95 5798 \toks0={#1}%
cannam@95 5799 \xdef\lastsectiondefs{%
cannam@95 5800 \gdef\noexpand\thissectionname{\the\toks0}%
cannam@95 5801 \gdef\noexpand\thissectionnum{#4}%
cannam@95 5802 % \noexpand\putwordSection avoids expanding indigestible
cannam@95 5803 % commands in some of the translations.
cannam@95 5804 \gdef\noexpand\thissection{\noexpand\putwordSection{}
cannam@95 5805 \noexpand\thissectionnum:
cannam@95 5806 \noexpand\thissectionname}%
cannam@95 5807 }%
cannam@95 5808 \fi
cannam@95 5809 \else
cannam@95 5810 \ifx\sectionlevel\seckeyword
cannam@95 5811 \toks0={#1}%
cannam@95 5812 \xdef\lastsectiondefs{%
cannam@95 5813 \gdef\noexpand\thissectionname{\the\toks0}%
cannam@95 5814 \gdef\noexpand\thissectionnum{#4}%
cannam@95 5815 % \noexpand\putwordSection avoids expanding indigestible
cannam@95 5816 % commands in some of the translations.
cannam@95 5817 \gdef\noexpand\thissection{\noexpand\putwordSection{}
cannam@95 5818 \noexpand\thissectionnum:
cannam@95 5819 \noexpand\thissectionname}%
cannam@95 5820 }%
cannam@95 5821 \fi
cannam@95 5822 \fi\fi\fi
cannam@95 5823 %
cannam@95 5824 % Go into vertical mode. Usually we'll already be there, but we
cannam@95 5825 % don't want the following whatsit to end up in a preceding paragraph
cannam@95 5826 % if the document didn't happen to have a blank line.
cannam@95 5827 \par
cannam@95 5828 %
cannam@95 5829 % Output the mark. Pass it through \safewhatsit, to take care of
cannam@95 5830 % the preceding space.
cannam@95 5831 \safewhatsit\domark
cannam@95 5832 %
cannam@95 5833 % Insert space above the heading.
cannam@95 5834 \csname #2headingbreak\endcsname
cannam@95 5835 %
cannam@95 5836 % Now the second mark, after the heading break. No break points
cannam@95 5837 % between here and the heading.
cannam@95 5838 \let\prevsectiondefs=\lastsectiondefs
cannam@95 5839 \domark
cannam@95 5840 %
cannam@95 5841 % Only insert the space after the number if we have a section number.
cannam@95 5842 \ifx\temptype\Ynothingkeyword
cannam@95 5843 \setbox0 = \hbox{}%
cannam@95 5844 \def\toctype{unn}%
cannam@95 5845 \gdef\lastsection{#1}%
cannam@95 5846 \else\ifx\temptype\Yomitfromtockeyword
cannam@95 5847 % for @headings -- no section number, don't include in toc,
cannam@95 5848 % and don't redefine \lastsection.
cannam@95 5849 \setbox0 = \hbox{}%
cannam@95 5850 \def\toctype{omit}%
cannam@95 5851 \let\sectionlevel=\empty
cannam@95 5852 \else\ifx\temptype\Yappendixkeyword
cannam@95 5853 \setbox0 = \hbox{#4\enspace}%
cannam@95 5854 \def\toctype{app}%
cannam@95 5855 \gdef\lastsection{#1}%
cannam@95 5856 \else
cannam@95 5857 \setbox0 = \hbox{#4\enspace}%
cannam@95 5858 \def\toctype{num}%
cannam@95 5859 \gdef\lastsection{#1}%
cannam@95 5860 \fi\fi\fi
cannam@95 5861 %
cannam@95 5862 % Write the toc entry (before \donoderef). See comments in \chapmacro.
cannam@95 5863 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
cannam@95 5864 %
cannam@95 5865 % Write the node reference (= pdf destination for pdftex).
cannam@95 5866 % Again, see comments in \chapmacro.
cannam@95 5867 \donoderef{#3}%
cannam@95 5868 %
cannam@95 5869 % Interline glue will be inserted when the vbox is completed.
cannam@95 5870 % That glue will be a valid breakpoint for the page, since it'll be
cannam@95 5871 % preceded by a whatsit (usually from the \donoderef, or from the
cannam@95 5872 % \writetocentry if there was no node). We don't want to allow that
cannam@95 5873 % break, since then the whatsits could end up on page n while the
cannam@95 5874 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
cannam@95 5875 \nobreak
cannam@95 5876 %
cannam@95 5877 % Output the actual section heading.
cannam@95 5878 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
cannam@95 5879 \hangindent=\wd0 % zero if no section number
cannam@95 5880 \unhbox0 #1}%
cannam@95 5881 }%
cannam@95 5882 % Add extra space after the heading -- half of whatever came above it.
cannam@95 5883 % Don't allow stretch, though.
cannam@95 5884 \kern .5 \csname #2headingskip\endcsname
cannam@95 5885 %
cannam@95 5886 % Do not let the kern be a potential breakpoint, as it would be if it
cannam@95 5887 % was followed by glue.
cannam@95 5888 \nobreak
cannam@95 5889 %
cannam@95 5890 % We'll almost certainly start a paragraph next, so don't let that
cannam@95 5891 % glue accumulate. (Not a breakpoint because it's preceded by a
cannam@95 5892 % discardable item.) However, when a paragraph is not started next
cannam@95 5893 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
cannam@95 5894 % or the negative glue will cause weirdly wrong output, typically
cannam@95 5895 % obscuring the section heading with something else.
cannam@95 5896 \vskip-\parskip
cannam@95 5897 %
cannam@95 5898 % This is so the last item on the main vertical list is a known
cannam@95 5899 % \penalty > 10000, so \startdefun, etc., can recognize the situation
cannam@95 5900 % and do the needful.
cannam@95 5901 \penalty 10001
cannam@95 5902 }
cannam@95 5903
cannam@95 5904
cannam@95 5905 \message{toc,}
cannam@95 5906 % Table of contents.
cannam@95 5907 \newwrite\tocfile
cannam@95 5908
cannam@95 5909 % Write an entry to the toc file, opening it if necessary.
cannam@95 5910 % Called from @chapter, etc.
cannam@95 5911 %
cannam@95 5912 % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
cannam@95 5913 % We append the current node name (if any) and page number as additional
cannam@95 5914 % arguments for the \{chap,sec,...}entry macros which will eventually
cannam@95 5915 % read this. The node name is used in the pdf outlines as the
cannam@95 5916 % destination to jump to.
cannam@95 5917 %
cannam@95 5918 % We open the .toc file for writing here instead of at @setfilename (or
cannam@95 5919 % any other fixed time) so that @contents can be anywhere in the document.
cannam@95 5920 % But if #1 is `omit', then we don't do anything. This is used for the
cannam@95 5921 % table of contents chapter openings themselves.
cannam@95 5922 %
cannam@95 5923 \newif\iftocfileopened
cannam@95 5924 \def\omitkeyword{omit}%
cannam@95 5925 %
cannam@95 5926 \def\writetocentry#1#2#3{%
cannam@95 5927 \edef\writetoctype{#1}%
cannam@95 5928 \ifx\writetoctype\omitkeyword \else
cannam@95 5929 \iftocfileopened\else
cannam@95 5930 \immediate\openout\tocfile = \jobname.toc
cannam@95 5931 \global\tocfileopenedtrue
cannam@95 5932 \fi
cannam@95 5933 %
cannam@95 5934 \iflinks
cannam@95 5935 {\atdummies
cannam@95 5936 \edef\temp{%
cannam@95 5937 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
cannam@95 5938 \temp
cannam@95 5939 }%
cannam@95 5940 \fi
cannam@95 5941 \fi
cannam@95 5942 %
cannam@95 5943 % Tell \shipout to create a pdf destination on each page, if we're
cannam@95 5944 % writing pdf. These are used in the table of contents. We can't
cannam@95 5945 % just write one on every page because the title pages are numbered
cannam@95 5946 % 1 and 2 (the page numbers aren't printed), and so are the first
cannam@95 5947 % two pages of the document. Thus, we'd have two destinations named
cannam@95 5948 % `1', and two named `2'.
cannam@95 5949 \ifpdf \global\pdfmakepagedesttrue \fi
cannam@95 5950 }
cannam@95 5951
cannam@95 5952
cannam@95 5953 % These characters do not print properly in the Computer Modern roman
cannam@95 5954 % fonts, so we must take special care. This is more or less redundant
cannam@95 5955 % with the Texinfo input format setup at the end of this file.
cannam@95 5956 %
cannam@95 5957 \def\activecatcodes{%
cannam@95 5958 \catcode`\"=\active
cannam@95 5959 \catcode`\$=\active
cannam@95 5960 \catcode`\<=\active
cannam@95 5961 \catcode`\>=\active
cannam@95 5962 \catcode`\\=\active
cannam@95 5963 \catcode`\^=\active
cannam@95 5964 \catcode`\_=\active
cannam@95 5965 \catcode`\|=\active
cannam@95 5966 \catcode`\~=\active
cannam@95 5967 }
cannam@95 5968
cannam@95 5969
cannam@95 5970 % Read the toc file, which is essentially Texinfo input.
cannam@95 5971 \def\readtocfile{%
cannam@95 5972 \setupdatafile
cannam@95 5973 \activecatcodes
cannam@95 5974 \input \tocreadfilename
cannam@95 5975 }
cannam@95 5976
cannam@95 5977 \newskip\contentsrightmargin \contentsrightmargin=1in
cannam@95 5978 \newcount\savepageno
cannam@95 5979 \newcount\lastnegativepageno \lastnegativepageno = -1
cannam@95 5980
cannam@95 5981 % Prepare to read what we've written to \tocfile.
cannam@95 5982 %
cannam@95 5983 \def\startcontents#1{%
cannam@95 5984 % If @setchapternewpage on, and @headings double, the contents should
cannam@95 5985 % start on an odd page, unlike chapters. Thus, we maintain
cannam@95 5986 % \contentsalignmacro in parallel with \pagealignmacro.
cannam@95 5987 % From: Torbjorn Granlund <tege@matematik.su.se>
cannam@95 5988 \contentsalignmacro
cannam@95 5989 \immediate\closeout\tocfile
cannam@95 5990 %
cannam@95 5991 % Don't need to put `Contents' or `Short Contents' in the headline.
cannam@95 5992 % It is abundantly clear what they are.
cannam@95 5993 \chapmacro{#1}{Yomitfromtoc}{}%
cannam@95 5994 %
cannam@95 5995 \savepageno = \pageno
cannam@95 5996 \begingroup % Set up to handle contents files properly.
cannam@95 5997 \raggedbottom % Worry more about breakpoints than the bottom.
cannam@95 5998 \advance\hsize by -\contentsrightmargin % Don't use the full line length.
cannam@95 5999 %
cannam@95 6000 % Roman numerals for page numbers.
cannam@95 6001 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
cannam@95 6002 }
cannam@95 6003
cannam@95 6004 % redefined for the two-volume lispref. We always output on
cannam@95 6005 % \jobname.toc even if this is redefined.
cannam@95 6006 %
cannam@95 6007 \def\tocreadfilename{\jobname.toc}
cannam@95 6008
cannam@95 6009 % Normal (long) toc.
cannam@95 6010 %
cannam@95 6011 \def\contents{%
cannam@95 6012 \startcontents{\putwordTOC}%
cannam@95 6013 \openin 1 \tocreadfilename\space
cannam@95 6014 \ifeof 1 \else
cannam@95 6015 \readtocfile
cannam@95 6016 \fi
cannam@95 6017 \vfill \eject
cannam@95 6018 \contentsalignmacro % in case @setchapternewpage odd is in effect
cannam@95 6019 \ifeof 1 \else
cannam@95 6020 \pdfmakeoutlines
cannam@95 6021 \fi
cannam@95 6022 \closein 1
cannam@95 6023 \endgroup
cannam@95 6024 \lastnegativepageno = \pageno
cannam@95 6025 \global\pageno = \savepageno
cannam@95 6026 }
cannam@95 6027
cannam@95 6028 % And just the chapters.
cannam@95 6029 \def\summarycontents{%
cannam@95 6030 \startcontents{\putwordShortTOC}%
cannam@95 6031 %
cannam@95 6032 \let\partentry = \shortpartentry
cannam@95 6033 \let\numchapentry = \shortchapentry
cannam@95 6034 \let\appentry = \shortchapentry
cannam@95 6035 \let\unnchapentry = \shortunnchapentry
cannam@95 6036 % We want a true roman here for the page numbers.
cannam@95 6037 \secfonts
cannam@95 6038 \let\rm=\shortcontrm \let\bf=\shortcontbf
cannam@95 6039 \let\sl=\shortcontsl \let\tt=\shortconttt
cannam@95 6040 \rm
cannam@95 6041 \hyphenpenalty = 10000
cannam@95 6042 \advance\baselineskip by 1pt % Open it up a little.
cannam@95 6043 \def\numsecentry##1##2##3##4{}
cannam@95 6044 \let\appsecentry = \numsecentry
cannam@95 6045 \let\unnsecentry = \numsecentry
cannam@95 6046 \let\numsubsecentry = \numsecentry
cannam@95 6047 \let\appsubsecentry = \numsecentry
cannam@95 6048 \let\unnsubsecentry = \numsecentry
cannam@95 6049 \let\numsubsubsecentry = \numsecentry
cannam@95 6050 \let\appsubsubsecentry = \numsecentry
cannam@95 6051 \let\unnsubsubsecentry = \numsecentry
cannam@95 6052 \openin 1 \tocreadfilename\space
cannam@95 6053 \ifeof 1 \else
cannam@95 6054 \readtocfile
cannam@95 6055 \fi
cannam@95 6056 \closein 1
cannam@95 6057 \vfill \eject
cannam@95 6058 \contentsalignmacro % in case @setchapternewpage odd is in effect
cannam@95 6059 \endgroup
cannam@95 6060 \lastnegativepageno = \pageno
cannam@95 6061 \global\pageno = \savepageno
cannam@95 6062 }
cannam@95 6063 \let\shortcontents = \summarycontents
cannam@95 6064
cannam@95 6065 % Typeset the label for a chapter or appendix for the short contents.
cannam@95 6066 % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
cannam@95 6067 %
cannam@95 6068 \def\shortchaplabel#1{%
cannam@95 6069 % This space should be enough, since a single number is .5em, and the
cannam@95 6070 % widest letter (M) is 1em, at least in the Computer Modern fonts.
cannam@95 6071 % But use \hss just in case.
cannam@95 6072 % (This space doesn't include the extra space that gets added after
cannam@95 6073 % the label; that gets put in by \shortchapentry above.)
cannam@95 6074 %
cannam@95 6075 % We'd like to right-justify chapter numbers, but that looks strange
cannam@95 6076 % with appendix letters. And right-justifying numbers and
cannam@95 6077 % left-justifying letters looks strange when there is less than 10
cannam@95 6078 % chapters. Have to read the whole toc once to know how many chapters
cannam@95 6079 % there are before deciding ...
cannam@95 6080 \hbox to 1em{#1\hss}%
cannam@95 6081 }
cannam@95 6082
cannam@95 6083 % These macros generate individual entries in the table of contents.
cannam@95 6084 % The first argument is the chapter or section name.
cannam@95 6085 % The last argument is the page number.
cannam@95 6086 % The arguments in between are the chapter number, section number, ...
cannam@95 6087
cannam@95 6088 % Parts, in the main contents. Replace the part number, which doesn't
cannam@95 6089 % exist, with an empty box. Let's hope all the numbers have the same width.
cannam@95 6090 % Also ignore the page number, which is conventionally not printed.
cannam@95 6091 \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
cannam@95 6092 \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
cannam@95 6093 %
cannam@95 6094 % Parts, in the short toc.
cannam@95 6095 \def\shortpartentry#1#2#3#4{%
cannam@95 6096 \penalty-300
cannam@95 6097 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
cannam@95 6098 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
cannam@95 6099 }
cannam@95 6100
cannam@95 6101 % Chapters, in the main contents.
cannam@95 6102 \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
cannam@95 6103 %
cannam@95 6104 % Chapters, in the short toc.
cannam@95 6105 % See comments in \dochapentry re vbox and related settings.
cannam@95 6106 \def\shortchapentry#1#2#3#4{%
cannam@95 6107 \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
cannam@95 6108 }
cannam@95 6109
cannam@95 6110 % Appendices, in the main contents.
cannam@95 6111 % Need the word Appendix, and a fixed-size box.
cannam@95 6112 %
cannam@95 6113 \def\appendixbox#1{%
cannam@95 6114 % We use M since it's probably the widest letter.
cannam@95 6115 \setbox0 = \hbox{\putwordAppendix{} M}%
cannam@95 6116 \hbox to \wd0{\putwordAppendix{} #1\hss}}
cannam@95 6117 %
cannam@95 6118 \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
cannam@95 6119
cannam@95 6120 % Unnumbered chapters.
cannam@95 6121 \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
cannam@95 6122 \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
cannam@95 6123
cannam@95 6124 % Sections.
cannam@95 6125 \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
cannam@95 6126 \let\appsecentry=\numsecentry
cannam@95 6127 \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
cannam@95 6128
cannam@95 6129 % Subsections.
cannam@95 6130 \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
cannam@95 6131 \let\appsubsecentry=\numsubsecentry
cannam@95 6132 \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
cannam@95 6133
cannam@95 6134 % And subsubsections.
cannam@95 6135 \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
cannam@95 6136 \let\appsubsubsecentry=\numsubsubsecentry
cannam@95 6137 \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
cannam@95 6138
cannam@95 6139 % This parameter controls the indentation of the various levels.
cannam@95 6140 % Same as \defaultparindent.
cannam@95 6141 \newdimen\tocindent \tocindent = 15pt
cannam@95 6142
cannam@95 6143 % Now for the actual typesetting. In all these, #1 is the text and #2 is the
cannam@95 6144 % page number.
cannam@95 6145 %
cannam@95 6146 % If the toc has to be broken over pages, we want it to be at chapters
cannam@95 6147 % if at all possible; hence the \penalty.
cannam@95 6148 \def\dochapentry#1#2{%
cannam@95 6149 \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
cannam@95 6150 \begingroup
cannam@95 6151 \chapentryfonts
cannam@95 6152 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
cannam@95 6153 \endgroup
cannam@95 6154 \nobreak\vskip .25\baselineskip plus.1\baselineskip
cannam@95 6155 }
cannam@95 6156
cannam@95 6157 \def\dosecentry#1#2{\begingroup
cannam@95 6158 \secentryfonts \leftskip=\tocindent
cannam@95 6159 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
cannam@95 6160 \endgroup}
cannam@95 6161
cannam@95 6162 \def\dosubsecentry#1#2{\begingroup
cannam@95 6163 \subsecentryfonts \leftskip=2\tocindent
cannam@95 6164 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
cannam@95 6165 \endgroup}
cannam@95 6166
cannam@95 6167 \def\dosubsubsecentry#1#2{\begingroup
cannam@95 6168 \subsubsecentryfonts \leftskip=3\tocindent
cannam@95 6169 \tocentry{#1}{\dopageno\bgroup#2\egroup}%
cannam@95 6170 \endgroup}
cannam@95 6171
cannam@95 6172 % We use the same \entry macro as for the index entries.
cannam@95 6173 \let\tocentry = \entry
cannam@95 6174
cannam@95 6175 % Space between chapter (or whatever) number and the title.
cannam@95 6176 \def\labelspace{\hskip1em \relax}
cannam@95 6177
cannam@95 6178 \def\dopageno#1{{\rm #1}}
cannam@95 6179 \def\doshortpageno#1{{\rm #1}}
cannam@95 6180
cannam@95 6181 \def\chapentryfonts{\secfonts \rm}
cannam@95 6182 \def\secentryfonts{\textfonts}
cannam@95 6183 \def\subsecentryfonts{\textfonts}
cannam@95 6184 \def\subsubsecentryfonts{\textfonts}
cannam@95 6185
cannam@95 6186
cannam@95 6187 \message{environments,}
cannam@95 6188 % @foo ... @end foo.
cannam@95 6189
cannam@95 6190 % @tex ... @end tex escapes into raw TeX temporarily.
cannam@95 6191 % One exception: @ is still an escape character, so that @end tex works.
cannam@95 6192 % But \@ or @@ will get a plain @ character.
cannam@95 6193
cannam@95 6194 \envdef\tex{%
cannam@95 6195 \setupmarkupstyle{tex}%
cannam@95 6196 \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
cannam@95 6197 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
cannam@95 6198 \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
cannam@95 6199 \catcode `\%=14
cannam@95 6200 \catcode `\+=\other
cannam@95 6201 \catcode `\"=\other
cannam@95 6202 \catcode `\|=\other
cannam@95 6203 \catcode `\<=\other
cannam@95 6204 \catcode `\>=\other
cannam@95 6205 \catcode`\`=\other
cannam@95 6206 \catcode`\'=\other
cannam@95 6207 \escapechar=`\\
cannam@95 6208 %
cannam@95 6209 % ' is active in math mode (mathcode"8000). So reset it, and all our
cannam@95 6210 % other math active characters (just in case), to plain's definitions.
cannam@95 6211 \mathactive
cannam@95 6212 %
cannam@95 6213 \let\b=\ptexb
cannam@95 6214 \let\bullet=\ptexbullet
cannam@95 6215 \let\c=\ptexc
cannam@95 6216 \let\,=\ptexcomma
cannam@95 6217 \let\.=\ptexdot
cannam@95 6218 \let\dots=\ptexdots
cannam@95 6219 \let\equiv=\ptexequiv
cannam@95 6220 \let\!=\ptexexclam
cannam@95 6221 \let\i=\ptexi
cannam@95 6222 \let\indent=\ptexindent
cannam@95 6223 \let\noindent=\ptexnoindent
cannam@95 6224 \let\{=\ptexlbrace
cannam@95 6225 \let\+=\tabalign
cannam@95 6226 \let\}=\ptexrbrace
cannam@95 6227 \let\/=\ptexslash
cannam@95 6228 \let\*=\ptexstar
cannam@95 6229 \let\t=\ptext
cannam@95 6230 \expandafter \let\csname top\endcsname=\ptextop % outer
cannam@95 6231 \let\frenchspacing=\plainfrenchspacing
cannam@95 6232 %
cannam@95 6233 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
cannam@95 6234 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
cannam@95 6235 \def\@{@}%
cannam@95 6236 }
cannam@95 6237 % There is no need to define \Etex.
cannam@95 6238
cannam@95 6239 % Define @lisp ... @end lisp.
cannam@95 6240 % @lisp environment forms a group so it can rebind things,
cannam@95 6241 % including the definition of @end lisp (which normally is erroneous).
cannam@95 6242
cannam@95 6243 % Amount to narrow the margins by for @lisp.
cannam@95 6244 \newskip\lispnarrowing \lispnarrowing=0.4in
cannam@95 6245
cannam@95 6246 % This is the definition that ^^M gets inside @lisp, @example, and other
cannam@95 6247 % such environments. \null is better than a space, since it doesn't
cannam@95 6248 % have any width.
cannam@95 6249 \def\lisppar{\null\endgraf}
cannam@95 6250
cannam@95 6251 % This space is always present above and below environments.
cannam@95 6252 \newskip\envskipamount \envskipamount = 0pt
cannam@95 6253
cannam@95 6254 % Make spacing and below environment symmetrical. We use \parskip here
cannam@95 6255 % to help in doing that, since in @example-like environments \parskip
cannam@95 6256 % is reset to zero; thus the \afterenvbreak inserts no space -- but the
cannam@95 6257 % start of the next paragraph will insert \parskip.
cannam@95 6258 %
cannam@95 6259 \def\aboveenvbreak{{%
cannam@95 6260 % =10000 instead of <10000 because of a special case in \itemzzz and
cannam@95 6261 % \sectionheading, q.v.
cannam@95 6262 \ifnum \lastpenalty=10000 \else
cannam@95 6263 \advance\envskipamount by \parskip
cannam@95 6264 \endgraf
cannam@95 6265 \ifdim\lastskip<\envskipamount
cannam@95 6266 \removelastskip
cannam@95 6267 % it's not a good place to break if the last penalty was \nobreak
cannam@95 6268 % or better ...
cannam@95 6269 \ifnum\lastpenalty<10000 \penalty-50 \fi
cannam@95 6270 \vskip\envskipamount
cannam@95 6271 \fi
cannam@95 6272 \fi
cannam@95 6273 }}
cannam@95 6274
cannam@95 6275 \let\afterenvbreak = \aboveenvbreak
cannam@95 6276
cannam@95 6277 % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
cannam@95 6278 % also clear it, so that its embedded environments do the narrowing again.
cannam@95 6279 \let\nonarrowing=\relax
cannam@95 6280
cannam@95 6281 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
cannam@95 6282 % environment contents.
cannam@95 6283 \font\circle=lcircle10
cannam@95 6284 \newdimen\circthick
cannam@95 6285 \newdimen\cartouter\newdimen\cartinner
cannam@95 6286 \newskip\normbskip\newskip\normpskip\newskip\normlskip
cannam@95 6287 \circthick=\fontdimen8\circle
cannam@95 6288 %
cannam@95 6289 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
cannam@95 6290 \def\ctr{{\hskip 6pt\circle\char'010}}
cannam@95 6291 \def\cbl{{\circle\char'012\hskip -6pt}}
cannam@95 6292 \def\cbr{{\hskip 6pt\circle\char'011}}
cannam@95 6293 \def\carttop{\hbox to \cartouter{\hskip\lskip
cannam@95 6294 \ctl\leaders\hrule height\circthick\hfil\ctr
cannam@95 6295 \hskip\rskip}}
cannam@95 6296 \def\cartbot{\hbox to \cartouter{\hskip\lskip
cannam@95 6297 \cbl\leaders\hrule height\circthick\hfil\cbr
cannam@95 6298 \hskip\rskip}}
cannam@95 6299 %
cannam@95 6300 \newskip\lskip\newskip\rskip
cannam@95 6301
cannam@95 6302 \envdef\cartouche{%
cannam@95 6303 \ifhmode\par\fi % can't be in the midst of a paragraph.
cannam@95 6304 \startsavinginserts
cannam@95 6305 \lskip=\leftskip \rskip=\rightskip
cannam@95 6306 \leftskip=0pt\rightskip=0pt % we want these *outside*.
cannam@95 6307 \cartinner=\hsize \advance\cartinner by-\lskip
cannam@95 6308 \advance\cartinner by-\rskip
cannam@95 6309 \cartouter=\hsize
cannam@95 6310 \advance\cartouter by 18.4pt % allow for 3pt kerns on either
cannam@95 6311 % side, and for 6pt waste from
cannam@95 6312 % each corner char, and rule thickness
cannam@95 6313 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
cannam@95 6314 % Flag to tell @lisp, etc., not to narrow margin.
cannam@95 6315 \let\nonarrowing = t%
cannam@95 6316 %
cannam@95 6317 % If this cartouche directly follows a sectioning command, we need the
cannam@95 6318 % \parskip glue (backspaced over by default) or the cartouche can
cannam@95 6319 % collide with the section heading.
cannam@95 6320 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
cannam@95 6321 %
cannam@95 6322 \vbox\bgroup
cannam@95 6323 \baselineskip=0pt\parskip=0pt\lineskip=0pt
cannam@95 6324 \carttop
cannam@95 6325 \hbox\bgroup
cannam@95 6326 \hskip\lskip
cannam@95 6327 \vrule\kern3pt
cannam@95 6328 \vbox\bgroup
cannam@95 6329 \kern3pt
cannam@95 6330 \hsize=\cartinner
cannam@95 6331 \baselineskip=\normbskip
cannam@95 6332 \lineskip=\normlskip
cannam@95 6333 \parskip=\normpskip
cannam@95 6334 \vskip -\parskip
cannam@95 6335 \comment % For explanation, see the end of def\group.
cannam@95 6336 }
cannam@95 6337 \def\Ecartouche{%
cannam@95 6338 \ifhmode\par\fi
cannam@95 6339 \kern3pt
cannam@95 6340 \egroup
cannam@95 6341 \kern3pt\vrule
cannam@95 6342 \hskip\rskip
cannam@95 6343 \egroup
cannam@95 6344 \cartbot
cannam@95 6345 \egroup
cannam@95 6346 \checkinserts
cannam@95 6347 }
cannam@95 6348
cannam@95 6349
cannam@95 6350 % This macro is called at the beginning of all the @example variants,
cannam@95 6351 % inside a group.
cannam@95 6352 \newdimen\nonfillparindent
cannam@95 6353 \def\nonfillstart{%
cannam@95 6354 \aboveenvbreak
cannam@95 6355 \hfuzz = 12pt % Don't be fussy
cannam@95 6356 \sepspaces % Make spaces be word-separators rather than space tokens.
cannam@95 6357 \let\par = \lisppar % don't ignore blank lines
cannam@95 6358 \obeylines % each line of input is a line of output
cannam@95 6359 \parskip = 0pt
cannam@95 6360 % Turn off paragraph indentation but redefine \indent to emulate
cannam@95 6361 % the normal \indent.
cannam@95 6362 \nonfillparindent=\parindent
cannam@95 6363 \parindent = 0pt
cannam@95 6364 \let\indent\nonfillindent
cannam@95 6365 %
cannam@95 6366 \emergencystretch = 0pt % don't try to avoid overfull boxes
cannam@95 6367 \ifx\nonarrowing\relax
cannam@95 6368 \advance \leftskip by \lispnarrowing
cannam@95 6369 \exdentamount=\lispnarrowing
cannam@95 6370 \else
cannam@95 6371 \let\nonarrowing = \relax
cannam@95 6372 \fi
cannam@95 6373 \let\exdent=\nofillexdent
cannam@95 6374 }
cannam@95 6375
cannam@95 6376 \begingroup
cannam@95 6377 \obeyspaces
cannam@95 6378 % We want to swallow spaces (but not other tokens) after the fake
cannam@95 6379 % @indent in our nonfill-environments, where spaces are normally
cannam@95 6380 % active and set to @tie, resulting in them not being ignored after
cannam@95 6381 % @indent.
cannam@95 6382 \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
cannam@95 6383 \gdef\nonfillindentcheck{%
cannam@95 6384 \ifx\temp %
cannam@95 6385 \expandafter\nonfillindentgobble%
cannam@95 6386 \else%
cannam@95 6387 \leavevmode\nonfillindentbox%
cannam@95 6388 \fi%
cannam@95 6389 }%
cannam@95 6390 \endgroup
cannam@95 6391 \def\nonfillindentgobble#1{\nonfillindent}
cannam@95 6392 \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
cannam@95 6393
cannam@95 6394 % If you want all examples etc. small: @set dispenvsize small.
cannam@95 6395 % If you want even small examples the full size: @set dispenvsize nosmall.
cannam@95 6396 % This affects the following displayed environments:
cannam@95 6397 % @example, @display, @format, @lisp
cannam@95 6398 %
cannam@95 6399 \def\smallword{small}
cannam@95 6400 \def\nosmallword{nosmall}
cannam@95 6401 \let\SETdispenvsize\relax
cannam@95 6402 \def\setnormaldispenv{%
cannam@95 6403 \ifx\SETdispenvsize\smallword
cannam@95 6404 % end paragraph for sake of leading, in case document has no blank
cannam@95 6405 % line. This is redundant with what happens in \aboveenvbreak, but
cannam@95 6406 % we need to do it before changing the fonts, and it's inconvenient
cannam@95 6407 % to change the fonts afterward.
cannam@95 6408 \ifnum \lastpenalty=10000 \else \endgraf \fi
cannam@95 6409 \smallexamplefonts \rm
cannam@95 6410 \fi
cannam@95 6411 }
cannam@95 6412 \def\setsmalldispenv{%
cannam@95 6413 \ifx\SETdispenvsize\nosmallword
cannam@95 6414 \else
cannam@95 6415 \ifnum \lastpenalty=10000 \else \endgraf \fi
cannam@95 6416 \smallexamplefonts \rm
cannam@95 6417 \fi
cannam@95 6418 }
cannam@95 6419
cannam@95 6420 % We often define two environments, @foo and @smallfoo.
cannam@95 6421 % Let's do it in one command. #1 is the env name, #2 the definition.
cannam@95 6422 \def\makedispenvdef#1#2{%
cannam@95 6423 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
cannam@95 6424 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
cannam@95 6425 \expandafter\let\csname E#1\endcsname \afterenvbreak
cannam@95 6426 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
cannam@95 6427 }
cannam@95 6428
cannam@95 6429 % Define two environment synonyms (#1 and #2) for an environment.
cannam@95 6430 \def\maketwodispenvdef#1#2#3{%
cannam@95 6431 \makedispenvdef{#1}{#3}%
cannam@95 6432 \makedispenvdef{#2}{#3}%
cannam@95 6433 }
cannam@95 6434 %
cannam@95 6435 % @lisp: indented, narrowed, typewriter font;
cannam@95 6436 % @example: same as @lisp.
cannam@95 6437 %
cannam@95 6438 % @smallexample and @smalllisp: use smaller fonts.
cannam@95 6439 % Originally contributed by Pavel@xerox.
cannam@95 6440 %
cannam@95 6441 \maketwodispenvdef{lisp}{example}{%
cannam@95 6442 \nonfillstart
cannam@95 6443 \tt\setupmarkupstyle{example}%
cannam@95 6444 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
cannam@95 6445 \gobble % eat return
cannam@95 6446 }
cannam@95 6447 % @display/@smalldisplay: same as @lisp except keep current font.
cannam@95 6448 %
cannam@95 6449 \makedispenvdef{display}{%
cannam@95 6450 \nonfillstart
cannam@95 6451 \gobble
cannam@95 6452 }
cannam@95 6453
cannam@95 6454 % @format/@smallformat: same as @display except don't narrow margins.
cannam@95 6455 %
cannam@95 6456 \makedispenvdef{format}{%
cannam@95 6457 \let\nonarrowing = t%
cannam@95 6458 \nonfillstart
cannam@95 6459 \gobble
cannam@95 6460 }
cannam@95 6461
cannam@95 6462 % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
cannam@95 6463 \envdef\flushleft{%
cannam@95 6464 \let\nonarrowing = t%
cannam@95 6465 \nonfillstart
cannam@95 6466 \gobble
cannam@95 6467 }
cannam@95 6468 \let\Eflushleft = \afterenvbreak
cannam@95 6469
cannam@95 6470 % @flushright.
cannam@95 6471 %
cannam@95 6472 \envdef\flushright{%
cannam@95 6473 \let\nonarrowing = t%
cannam@95 6474 \nonfillstart
cannam@95 6475 \advance\leftskip by 0pt plus 1fill\relax
cannam@95 6476 \gobble
cannam@95 6477 }
cannam@95 6478 \let\Eflushright = \afterenvbreak
cannam@95 6479
cannam@95 6480
cannam@95 6481 % @raggedright does more-or-less normal line breaking but no right
cannam@95 6482 % justification. From plain.tex.
cannam@95 6483 \envdef\raggedright{%
cannam@95 6484 \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
cannam@95 6485 }
cannam@95 6486 \let\Eraggedright\par
cannam@95 6487
cannam@95 6488 \envdef\raggedleft{%
cannam@95 6489 \parindent=0pt \leftskip0pt plus2em
cannam@95 6490 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
cannam@95 6491 \hbadness=10000 % Last line will usually be underfull, so turn off
cannam@95 6492 % badness reporting.
cannam@95 6493 }
cannam@95 6494 \let\Eraggedleft\par
cannam@95 6495
cannam@95 6496 \envdef\raggedcenter{%
cannam@95 6497 \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
cannam@95 6498 \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
cannam@95 6499 \hbadness=10000 % Last line will usually be underfull, so turn off
cannam@95 6500 % badness reporting.
cannam@95 6501 }
cannam@95 6502 \let\Eraggedcenter\par
cannam@95 6503
cannam@95 6504
cannam@95 6505 % @quotation does normal linebreaking (hence we can't use \nonfillstart)
cannam@95 6506 % and narrows the margins. We keep \parskip nonzero in general, since
cannam@95 6507 % we're doing normal filling. So, when using \aboveenvbreak and
cannam@95 6508 % \afterenvbreak, temporarily make \parskip 0.
cannam@95 6509 %
cannam@95 6510 \makedispenvdef{quotation}{\quotationstart}
cannam@95 6511 %
cannam@95 6512 \def\quotationstart{%
cannam@95 6513 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
cannam@95 6514 \parindent=0pt
cannam@95 6515 %
cannam@95 6516 % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
cannam@95 6517 \ifx\nonarrowing\relax
cannam@95 6518 \advance\leftskip by \lispnarrowing
cannam@95 6519 \advance\rightskip by \lispnarrowing
cannam@95 6520 \exdentamount = \lispnarrowing
cannam@95 6521 \else
cannam@95 6522 \let\nonarrowing = \relax
cannam@95 6523 \fi
cannam@95 6524 \parsearg\quotationlabel
cannam@95 6525 }
cannam@95 6526
cannam@95 6527 % We have retained a nonzero parskip for the environment, since we're
cannam@95 6528 % doing normal filling.
cannam@95 6529 %
cannam@95 6530 \def\Equotation{%
cannam@95 6531 \par
cannam@95 6532 \ifx\quotationauthor\thisisundefined\else
cannam@95 6533 % indent a bit.
cannam@95 6534 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
cannam@95 6535 \fi
cannam@95 6536 {\parskip=0pt \afterenvbreak}%
cannam@95 6537 }
cannam@95 6538 \def\Esmallquotation{\Equotation}
cannam@95 6539
cannam@95 6540 % If we're given an argument, typeset it in bold with a colon after.
cannam@95 6541 \def\quotationlabel#1{%
cannam@95 6542 \def\temp{#1}%
cannam@95 6543 \ifx\temp\empty \else
cannam@95 6544 {\bf #1: }%
cannam@95 6545 \fi
cannam@95 6546 }
cannam@95 6547
cannam@95 6548
cannam@95 6549 % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
cannam@95 6550 % If we want to allow any <char> as delimiter,
cannam@95 6551 % we need the curly braces so that makeinfo sees the @verb command, eg:
cannam@95 6552 % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
cannam@95 6553 %
cannam@95 6554 % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
cannam@95 6555 %
cannam@95 6556 % [Knuth] p.344; only we need to do the other characters Texinfo sets
cannam@95 6557 % active too. Otherwise, they get lost as the first character on a
cannam@95 6558 % verbatim line.
cannam@95 6559 \def\dospecials{%
cannam@95 6560 \do\ \do\\\do\{\do\}\do\$\do\&%
cannam@95 6561 \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
cannam@95 6562 \do\<\do\>\do\|\do\@\do+\do\"%
cannam@95 6563 % Don't do the quotes -- if we do, @set txicodequoteundirected and
cannam@95 6564 % @set txicodequotebacktick will not have effect on @verb and
cannam@95 6565 % @verbatim, and ?` and !` ligatures won't get disabled.
cannam@95 6566 %\do\`\do\'%
cannam@95 6567 }
cannam@95 6568 %
cannam@95 6569 % [Knuth] p. 380
cannam@95 6570 \def\uncatcodespecials{%
cannam@95 6571 \def\do##1{\catcode`##1=\other}\dospecials}
cannam@95 6572 %
cannam@95 6573 % Setup for the @verb command.
cannam@95 6574 %
cannam@95 6575 % Eight spaces for a tab
cannam@95 6576 \begingroup
cannam@95 6577 \catcode`\^^I=\active
cannam@95 6578 \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
cannam@95 6579 \endgroup
cannam@95 6580 %
cannam@95 6581 \def\setupverb{%
cannam@95 6582 \tt % easiest (and conventionally used) font for verbatim
cannam@95 6583 \def\par{\leavevmode\endgraf}%
cannam@95 6584 \setupmarkupstyle{verb}%
cannam@95 6585 \tabeightspaces
cannam@95 6586 % Respect line breaks,
cannam@95 6587 % print special symbols as themselves, and
cannam@95 6588 % make each space count
cannam@95 6589 % must do in this order:
cannam@95 6590 \obeylines \uncatcodespecials \sepspaces
cannam@95 6591 }
cannam@95 6592
cannam@95 6593 % Setup for the @verbatim environment
cannam@95 6594 %
cannam@95 6595 % Real tab expansion.
cannam@95 6596 \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
cannam@95 6597 %
cannam@95 6598 % We typeset each line of the verbatim in an \hbox, so we can handle
cannam@95 6599 % tabs. The \global is in case the verbatim line starts with an accent,
cannam@95 6600 % or some other command that starts with a begin-group. Otherwise, the
cannam@95 6601 % entire \verbbox would disappear at the corresponding end-group, before
cannam@95 6602 % it is typeset. Meanwhile, we can't have nested verbatim commands
cannam@95 6603 % (can we?), so the \global won't be overwriting itself.
cannam@95 6604 \newbox\verbbox
cannam@95 6605 \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
cannam@95 6606 %
cannam@95 6607 \begingroup
cannam@95 6608 \catcode`\^^I=\active
cannam@95 6609 \gdef\tabexpand{%
cannam@95 6610 \catcode`\^^I=\active
cannam@95 6611 \def^^I{\leavevmode\egroup
cannam@95 6612 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
cannam@95 6613 \divide\dimen\verbbox by\tabw
cannam@95 6614 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
cannam@95 6615 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
cannam@95 6616 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
cannam@95 6617 }%
cannam@95 6618 }
cannam@95 6619 \endgroup
cannam@95 6620
cannam@95 6621 % start the verbatim environment.
cannam@95 6622 \def\setupverbatim{%
cannam@95 6623 \let\nonarrowing = t%
cannam@95 6624 \nonfillstart
cannam@95 6625 \tt % easiest (and conventionally used) font for verbatim
cannam@95 6626 % The \leavevmode here is for blank lines. Otherwise, we would
cannam@95 6627 % never \starttabox and the \egroup would end verbatim mode.
cannam@95 6628 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
cannam@95 6629 \tabexpand
cannam@95 6630 \setupmarkupstyle{verbatim}%
cannam@95 6631 % Respect line breaks,
cannam@95 6632 % print special symbols as themselves, and
cannam@95 6633 % make each space count.
cannam@95 6634 % Must do in this order:
cannam@95 6635 \obeylines \uncatcodespecials \sepspaces
cannam@95 6636 \everypar{\starttabbox}%
cannam@95 6637 }
cannam@95 6638
cannam@95 6639 % Do the @verb magic: verbatim text is quoted by unique
cannam@95 6640 % delimiter characters. Before first delimiter expect a
cannam@95 6641 % right brace, after last delimiter expect closing brace:
cannam@95 6642 %
cannam@95 6643 % \def\doverb'{'<char>#1<char>'}'{#1}
cannam@95 6644 %
cannam@95 6645 % [Knuth] p. 382; only eat outer {}
cannam@95 6646 \begingroup
cannam@95 6647 \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
cannam@95 6648 \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
cannam@95 6649 \endgroup
cannam@95 6650 %
cannam@95 6651 \def\verb{\begingroup\setupverb\doverb}
cannam@95 6652 %
cannam@95 6653 %
cannam@95 6654 % Do the @verbatim magic: define the macro \doverbatim so that
cannam@95 6655 % the (first) argument ends when '@end verbatim' is reached, ie:
cannam@95 6656 %
cannam@95 6657 % \def\doverbatim#1@end verbatim{#1}
cannam@95 6658 %
cannam@95 6659 % For Texinfo it's a lot easier than for LaTeX,
cannam@95 6660 % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
cannam@95 6661 % we need not redefine '\', '{' and '}'.
cannam@95 6662 %
cannam@95 6663 % Inspired by LaTeX's verbatim command set [latex.ltx]
cannam@95 6664 %
cannam@95 6665 \begingroup
cannam@95 6666 \catcode`\ =\active
cannam@95 6667 \obeylines %
cannam@95 6668 % ignore everything up to the first ^^M, that's the newline at the end
cannam@95 6669 % of the @verbatim input line itself. Otherwise we get an extra blank
cannam@95 6670 % line in the output.
cannam@95 6671 \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
cannam@95 6672 % We really want {...\end verbatim} in the body of the macro, but
cannam@95 6673 % without the active space; thus we have to use \xdef and \gobble.
cannam@95 6674 \endgroup
cannam@95 6675 %
cannam@95 6676 \envdef\verbatim{%
cannam@95 6677 \setupverbatim\doverbatim
cannam@95 6678 }
cannam@95 6679 \let\Everbatim = \afterenvbreak
cannam@95 6680
cannam@95 6681
cannam@95 6682 % @verbatiminclude FILE - insert text of file in verbatim environment.
cannam@95 6683 %
cannam@95 6684 \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
cannam@95 6685 %
cannam@95 6686 \def\doverbatiminclude#1{%
cannam@95 6687 {%
cannam@95 6688 \makevalueexpandable
cannam@95 6689 \setupverbatim
cannam@95 6690 \indexnofonts % Allow `@@' and other weird things in file names.
cannam@95 6691 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
cannam@95 6692 \input #1
cannam@95 6693 \afterenvbreak
cannam@95 6694 }%
cannam@95 6695 }
cannam@95 6696
cannam@95 6697 % @copying ... @end copying.
cannam@95 6698 % Save the text away for @insertcopying later.
cannam@95 6699 %
cannam@95 6700 % We save the uninterpreted tokens, rather than creating a box.
cannam@95 6701 % Saving the text in a box would be much easier, but then all the
cannam@95 6702 % typesetting commands (@smallbook, font changes, etc.) have to be done
cannam@95 6703 % beforehand -- and a) we want @copying to be done first in the source
cannam@95 6704 % file; b) letting users define the frontmatter in as flexible order as
cannam@95 6705 % possible is very desirable.
cannam@95 6706 %
cannam@95 6707 \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
cannam@95 6708 \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
cannam@95 6709 %
cannam@95 6710 \def\insertcopying{%
cannam@95 6711 \begingroup
cannam@95 6712 \parindent = 0pt % paragraph indentation looks wrong on title page
cannam@95 6713 \scanexp\copyingtext
cannam@95 6714 \endgroup
cannam@95 6715 }
cannam@95 6716
cannam@95 6717
cannam@95 6718 \message{defuns,}
cannam@95 6719 % @defun etc.
cannam@95 6720
cannam@95 6721 \newskip\defbodyindent \defbodyindent=.4in
cannam@95 6722 \newskip\defargsindent \defargsindent=50pt
cannam@95 6723 \newskip\deflastargmargin \deflastargmargin=18pt
cannam@95 6724 \newcount\defunpenalty
cannam@95 6725
cannam@95 6726 % Start the processing of @deffn:
cannam@95 6727 \def\startdefun{%
cannam@95 6728 \ifnum\lastpenalty<10000
cannam@95 6729 \medbreak
cannam@95 6730 \defunpenalty=10003 % Will keep this @deffn together with the
cannam@95 6731 % following @def command, see below.
cannam@95 6732 \else
cannam@95 6733 % If there are two @def commands in a row, we'll have a \nobreak,
cannam@95 6734 % which is there to keep the function description together with its
cannam@95 6735 % header. But if there's nothing but headers, we need to allow a
cannam@95 6736 % break somewhere. Check specifically for penalty 10002, inserted
cannam@95 6737 % by \printdefunline, instead of 10000, since the sectioning
cannam@95 6738 % commands also insert a nobreak penalty, and we don't want to allow
cannam@95 6739 % a break between a section heading and a defun.
cannam@95 6740 %
cannam@95 6741 % As a further refinement, we avoid "club" headers by signalling
cannam@95 6742 % with penalty of 10003 after the very first @deffn in the
cannam@95 6743 % sequence (see above), and penalty of 10002 after any following
cannam@95 6744 % @def command.
cannam@95 6745 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
cannam@95 6746 %
cannam@95 6747 % Similarly, after a section heading, do not allow a break.
cannam@95 6748 % But do insert the glue.
cannam@95 6749 \medskip % preceded by discardable penalty, so not a breakpoint
cannam@95 6750 \fi
cannam@95 6751 %
cannam@95 6752 \parindent=0in
cannam@95 6753 \advance\leftskip by \defbodyindent
cannam@95 6754 \exdentamount=\defbodyindent
cannam@95 6755 }
cannam@95 6756
cannam@95 6757 \def\dodefunx#1{%
cannam@95 6758 % First, check whether we are in the right environment:
cannam@95 6759 \checkenv#1%
cannam@95 6760 %
cannam@95 6761 % As above, allow line break if we have multiple x headers in a row.
cannam@95 6762 % It's not a great place, though.
cannam@95 6763 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
cannam@95 6764 %
cannam@95 6765 % And now, it's time to reuse the body of the original defun:
cannam@95 6766 \expandafter\gobbledefun#1%
cannam@95 6767 }
cannam@95 6768 \def\gobbledefun#1\startdefun{}
cannam@95 6769
cannam@95 6770 % \printdefunline \deffnheader{text}
cannam@95 6771 %
cannam@95 6772 \def\printdefunline#1#2{%
cannam@95 6773 \begingroup
cannam@95 6774 % call \deffnheader:
cannam@95 6775 #1#2 \endheader
cannam@95 6776 % common ending:
cannam@95 6777 \interlinepenalty = 10000
cannam@95 6778 \advance\rightskip by 0pt plus 1fil\relax
cannam@95 6779 \endgraf
cannam@95 6780 \nobreak\vskip -\parskip
cannam@95 6781 \penalty\defunpenalty % signal to \startdefun and \dodefunx
cannam@95 6782 % Some of the @defun-type tags do not enable magic parentheses,
cannam@95 6783 % rendering the following check redundant. But we don't optimize.
cannam@95 6784 \checkparencounts
cannam@95 6785 \endgroup
cannam@95 6786 }
cannam@95 6787
cannam@95 6788 \def\Edefun{\endgraf\medbreak}
cannam@95 6789
cannam@95 6790 % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
cannam@95 6791 % the only thing remaining is to define \deffnheader.
cannam@95 6792 %
cannam@95 6793 \def\makedefun#1{%
cannam@95 6794 \expandafter\let\csname E#1\endcsname = \Edefun
cannam@95 6795 \edef\temp{\noexpand\domakedefun
cannam@95 6796 \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
cannam@95 6797 \temp
cannam@95 6798 }
cannam@95 6799
cannam@95 6800 % \domakedefun \deffn \deffnx \deffnheader
cannam@95 6801 %
cannam@95 6802 % Define \deffn and \deffnx, without parameters.
cannam@95 6803 % \deffnheader has to be defined explicitly.
cannam@95 6804 %
cannam@95 6805 \def\domakedefun#1#2#3{%
cannam@95 6806 \envdef#1{%
cannam@95 6807 \startdefun
cannam@95 6808 \doingtypefnfalse % distinguish typed functions from all else
cannam@95 6809 \parseargusing\activeparens{\printdefunline#3}%
cannam@95 6810 }%
cannam@95 6811 \def#2{\dodefunx#1}%
cannam@95 6812 \def#3%
cannam@95 6813 }
cannam@95 6814
cannam@95 6815 \newif\ifdoingtypefn % doing typed function?
cannam@95 6816 \newif\ifrettypeownline % typeset return type on its own line?
cannam@95 6817
cannam@95 6818 % @deftypefnnewline on|off says whether the return type of typed functions
cannam@95 6819 % are printed on their own line. This affects @deftypefn, @deftypefun,
cannam@95 6820 % @deftypeop, and @deftypemethod.
cannam@95 6821 %
cannam@95 6822 \parseargdef\deftypefnnewline{%
cannam@95 6823 \def\temp{#1}%
cannam@95 6824 \ifx\temp\onword
cannam@95 6825 \expandafter\let\csname SETtxideftypefnnl\endcsname
cannam@95 6826 = \empty
cannam@95 6827 \else\ifx\temp\offword
cannam@95 6828 \expandafter\let\csname SETtxideftypefnnl\endcsname
cannam@95 6829 = \relax
cannam@95 6830 \else
cannam@95 6831 \errhelp = \EMsimple
cannam@95 6832 \errmessage{Unknown @txideftypefnnl value `\temp',
cannam@95 6833 must be on|off}%
cannam@95 6834 \fi\fi
cannam@95 6835 }
cannam@95 6836
cannam@95 6837 % Untyped functions:
cannam@95 6838
cannam@95 6839 % @deffn category name args
cannam@95 6840 \makedefun{deffn}{\deffngeneral{}}
cannam@95 6841
cannam@95 6842 % @deffn category class name args
cannam@95 6843 \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
cannam@95 6844
cannam@95 6845 % \defopon {category on}class name args
cannam@95 6846 \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
cannam@95 6847
cannam@95 6848 % \deffngeneral {subind}category name args
cannam@95 6849 %
cannam@95 6850 \def\deffngeneral#1#2 #3 #4\endheader{%
cannam@95 6851 % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
cannam@95 6852 \dosubind{fn}{\code{#3}}{#1}%
cannam@95 6853 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
cannam@95 6854 }
cannam@95 6855
cannam@95 6856 % Typed functions:
cannam@95 6857
cannam@95 6858 % @deftypefn category type name args
cannam@95 6859 \makedefun{deftypefn}{\deftypefngeneral{}}
cannam@95 6860
cannam@95 6861 % @deftypeop category class type name args
cannam@95 6862 \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
cannam@95 6863
cannam@95 6864 % \deftypeopon {category on}class type name args
cannam@95 6865 \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
cannam@95 6866
cannam@95 6867 % \deftypefngeneral {subind}category type name args
cannam@95 6868 %
cannam@95 6869 \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
cannam@95 6870 \dosubind{fn}{\code{#4}}{#1}%
cannam@95 6871 \doingtypefntrue
cannam@95 6872 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
cannam@95 6873 }
cannam@95 6874
cannam@95 6875 % Typed variables:
cannam@95 6876
cannam@95 6877 % @deftypevr category type var args
cannam@95 6878 \makedefun{deftypevr}{\deftypecvgeneral{}}
cannam@95 6879
cannam@95 6880 % @deftypecv category class type var args
cannam@95 6881 \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
cannam@95 6882
cannam@95 6883 % \deftypecvof {category of}class type var args
cannam@95 6884 \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
cannam@95 6885
cannam@95 6886 % \deftypecvgeneral {subind}category type var args
cannam@95 6887 %
cannam@95 6888 \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
cannam@95 6889 \dosubind{vr}{\code{#4}}{#1}%
cannam@95 6890 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
cannam@95 6891 }
cannam@95 6892
cannam@95 6893 % Untyped variables:
cannam@95 6894
cannam@95 6895 % @defvr category var args
cannam@95 6896 \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
cannam@95 6897
cannam@95 6898 % @defcv category class var args
cannam@95 6899 \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
cannam@95 6900
cannam@95 6901 % \defcvof {category of}class var args
cannam@95 6902 \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
cannam@95 6903
cannam@95 6904 % Types:
cannam@95 6905
cannam@95 6906 % @deftp category name args
cannam@95 6907 \makedefun{deftp}#1 #2 #3\endheader{%
cannam@95 6908 \doind{tp}{\code{#2}}%
cannam@95 6909 \defname{#1}{}{#2}\defunargs{#3\unskip}%
cannam@95 6910 }
cannam@95 6911
cannam@95 6912 % Remaining @defun-like shortcuts:
cannam@95 6913 \makedefun{defun}{\deffnheader{\putwordDeffunc} }
cannam@95 6914 \makedefun{defmac}{\deffnheader{\putwordDefmac} }
cannam@95 6915 \makedefun{defspec}{\deffnheader{\putwordDefspec} }
cannam@95 6916 \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
cannam@95 6917 \makedefun{defvar}{\defvrheader{\putwordDefvar} }
cannam@95 6918 \makedefun{defopt}{\defvrheader{\putwordDefopt} }
cannam@95 6919 \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
cannam@95 6920 \makedefun{defmethod}{\defopon\putwordMethodon}
cannam@95 6921 \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
cannam@95 6922 \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
cannam@95 6923 \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
cannam@95 6924
cannam@95 6925 % \defname, which formats the name of the @def (not the args).
cannam@95 6926 % #1 is the category, such as "Function".
cannam@95 6927 % #2 is the return type, if any.
cannam@95 6928 % #3 is the function name.
cannam@95 6929 %
cannam@95 6930 % We are followed by (but not passed) the arguments, if any.
cannam@95 6931 %
cannam@95 6932 \def\defname#1#2#3{%
cannam@95 6933 \par
cannam@95 6934 % Get the values of \leftskip and \rightskip as they were outside the @def...
cannam@95 6935 \advance\leftskip by -\defbodyindent
cannam@95 6936 %
cannam@95 6937 % Determine if we are typesetting the return type of a typed function
cannam@95 6938 % on a line by itself.
cannam@95 6939 \rettypeownlinefalse
cannam@95 6940 \ifdoingtypefn % doing a typed function specifically?
cannam@95 6941 % then check user option for putting return type on its own line:
cannam@95 6942 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
cannam@95 6943 \rettypeownlinetrue
cannam@95 6944 \fi
cannam@95 6945 \fi
cannam@95 6946 %
cannam@95 6947 % How we'll format the category name. Putting it in brackets helps
cannam@95 6948 % distinguish it from the body text that may end up on the next line
cannam@95 6949 % just below it.
cannam@95 6950 \def\temp{#1}%
cannam@95 6951 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
cannam@95 6952 %
cannam@95 6953 % Figure out line sizes for the paragraph shape. We'll always have at
cannam@95 6954 % least two.
cannam@95 6955 \tempnum = 2
cannam@95 6956 %
cannam@95 6957 % The first line needs space for \box0; but if \rightskip is nonzero,
cannam@95 6958 % we need only space for the part of \box0 which exceeds it:
cannam@95 6959 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
cannam@95 6960 %
cannam@95 6961 % If doing a return type on its own line, we'll have another line.
cannam@95 6962 \ifrettypeownline
cannam@95 6963 \advance\tempnum by 1
cannam@95 6964 \def\maybeshapeline{0in \hsize}%
cannam@95 6965 \else
cannam@95 6966 \def\maybeshapeline{}%
cannam@95 6967 \fi
cannam@95 6968 %
cannam@95 6969 % The continuations:
cannam@95 6970 \dimen2=\hsize \advance\dimen2 by -\defargsindent
cannam@95 6971 %
cannam@95 6972 % The final paragraph shape:
cannam@95 6973 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
cannam@95 6974 %
cannam@95 6975 % Put the category name at the right margin.
cannam@95 6976 \noindent
cannam@95 6977 \hbox to 0pt{%
cannam@95 6978 \hfil\box0 \kern-\hsize
cannam@95 6979 % \hsize has to be shortened this way:
cannam@95 6980 \kern\leftskip
cannam@95 6981 % Intentionally do not respect \rightskip, since we need the space.
cannam@95 6982 }%
cannam@95 6983 %
cannam@95 6984 % Allow all lines to be underfull without complaint:
cannam@95 6985 \tolerance=10000 \hbadness=10000
cannam@95 6986 \exdentamount=\defbodyindent
cannam@95 6987 {%
cannam@95 6988 % defun fonts. We use typewriter by default (used to be bold) because:
cannam@95 6989 % . we're printing identifiers, they should be in tt in principle.
cannam@95 6990 % . in languages with many accents, such as Czech or French, it's
cannam@95 6991 % common to leave accents off identifiers. The result looks ok in
cannam@95 6992 % tt, but exceedingly strange in rm.
cannam@95 6993 % . we don't want -- and --- to be treated as ligatures.
cannam@95 6994 % . this still does not fix the ?` and !` ligatures, but so far no
cannam@95 6995 % one has made identifiers using them :).
cannam@95 6996 \df \tt
cannam@95 6997 \def\temp{#2}% text of the return type
cannam@95 6998 \ifx\temp\empty\else
cannam@95 6999 \tclose{\temp}% typeset the return type
cannam@95 7000 \ifrettypeownline
cannam@95 7001 % put return type on its own line; prohibit line break following:
cannam@95 7002 \hfil\vadjust{\nobreak}\break
cannam@95 7003 \else
cannam@95 7004 \space % type on same line, so just followed by a space
cannam@95 7005 \fi
cannam@95 7006 \fi % no return type
cannam@95 7007 #3% output function name
cannam@95 7008 }%
cannam@95 7009 {\rm\enskip}% hskip 0.5 em of \tenrm
cannam@95 7010 %
cannam@95 7011 \boldbrax
cannam@95 7012 % arguments will be output next, if any.
cannam@95 7013 }
cannam@95 7014
cannam@95 7015 % Print arguments in slanted roman (not ttsl), inconsistently with using
cannam@95 7016 % tt for the name. This is because literal text is sometimes needed in
cannam@95 7017 % the argument list (groff manual), and ttsl and tt are not very
cannam@95 7018 % distinguishable. Prevent hyphenation at `-' chars.
cannam@95 7019 %
cannam@95 7020 \def\defunargs#1{%
cannam@95 7021 % use sl by default (not ttsl),
cannam@95 7022 % tt for the names.
cannam@95 7023 \df \sl \hyphenchar\font=0
cannam@95 7024 %
cannam@95 7025 % On the other hand, if an argument has two dashes (for instance), we
cannam@95 7026 % want a way to get ttsl. Let's try @var for that.
cannam@95 7027 \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
cannam@95 7028 #1%
cannam@95 7029 \sl\hyphenchar\font=45
cannam@95 7030 }
cannam@95 7031
cannam@95 7032 % We want ()&[] to print specially on the defun line.
cannam@95 7033 %
cannam@95 7034 \def\activeparens{%
cannam@95 7035 \catcode`\(=\active \catcode`\)=\active
cannam@95 7036 \catcode`\[=\active \catcode`\]=\active
cannam@95 7037 \catcode`\&=\active
cannam@95 7038 }
cannam@95 7039
cannam@95 7040 % Make control sequences which act like normal parenthesis chars.
cannam@95 7041 \let\lparen = ( \let\rparen = )
cannam@95 7042
cannam@95 7043 % Be sure that we always have a definition for `(', etc. For example,
cannam@95 7044 % if the fn name has parens in it, \boldbrax will not be in effect yet,
cannam@95 7045 % so TeX would otherwise complain about undefined control sequence.
cannam@95 7046 {
cannam@95 7047 \activeparens
cannam@95 7048 \global\let(=\lparen \global\let)=\rparen
cannam@95 7049 \global\let[=\lbrack \global\let]=\rbrack
cannam@95 7050 \global\let& = \&
cannam@95 7051
cannam@95 7052 \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
cannam@95 7053 \gdef\magicamp{\let&=\amprm}
cannam@95 7054 }
cannam@95 7055
cannam@95 7056 \newcount\parencount
cannam@95 7057
cannam@95 7058 % If we encounter &foo, then turn on ()-hacking afterwards
cannam@95 7059 \newif\ifampseen
cannam@95 7060 \def\amprm#1 {\ampseentrue{\bf\&#1 }}
cannam@95 7061
cannam@95 7062 \def\parenfont{%
cannam@95 7063 \ifampseen
cannam@95 7064 % At the first level, print parens in roman,
cannam@95 7065 % otherwise use the default font.
cannam@95 7066 \ifnum \parencount=1 \rm \fi
cannam@95 7067 \else
cannam@95 7068 % The \sf parens (in \boldbrax) actually are a little bolder than
cannam@95 7069 % the contained text. This is especially needed for [ and ] .
cannam@95 7070 \sf
cannam@95 7071 \fi
cannam@95 7072 }
cannam@95 7073 \def\infirstlevel#1{%
cannam@95 7074 \ifampseen
cannam@95 7075 \ifnum\parencount=1
cannam@95 7076 #1%
cannam@95 7077 \fi
cannam@95 7078 \fi
cannam@95 7079 }
cannam@95 7080 \def\bfafterword#1 {#1 \bf}
cannam@95 7081
cannam@95 7082 \def\opnr{%
cannam@95 7083 \global\advance\parencount by 1
cannam@95 7084 {\parenfont(}%
cannam@95 7085 \infirstlevel \bfafterword
cannam@95 7086 }
cannam@95 7087 \def\clnr{%
cannam@95 7088 {\parenfont)}%
cannam@95 7089 \infirstlevel \sl
cannam@95 7090 \global\advance\parencount by -1
cannam@95 7091 }
cannam@95 7092
cannam@95 7093 \newcount\brackcount
cannam@95 7094 \def\lbrb{%
cannam@95 7095 \global\advance\brackcount by 1
cannam@95 7096 {\bf[}%
cannam@95 7097 }
cannam@95 7098 \def\rbrb{%
cannam@95 7099 {\bf]}%
cannam@95 7100 \global\advance\brackcount by -1
cannam@95 7101 }
cannam@95 7102
cannam@95 7103 \def\checkparencounts{%
cannam@95 7104 \ifnum\parencount=0 \else \badparencount \fi
cannam@95 7105 \ifnum\brackcount=0 \else \badbrackcount \fi
cannam@95 7106 }
cannam@95 7107 % these should not use \errmessage; the glibc manual, at least, actually
cannam@95 7108 % has such constructs (when documenting function pointers).
cannam@95 7109 \def\badparencount{%
cannam@95 7110 \message{Warning: unbalanced parentheses in @def...}%
cannam@95 7111 \global\parencount=0
cannam@95 7112 }
cannam@95 7113 \def\badbrackcount{%
cannam@95 7114 \message{Warning: unbalanced square brackets in @def...}%
cannam@95 7115 \global\brackcount=0
cannam@95 7116 }
cannam@95 7117
cannam@95 7118
cannam@95 7119 \message{macros,}
cannam@95 7120 % @macro.
cannam@95 7121
cannam@95 7122 % To do this right we need a feature of e-TeX, \scantokens,
cannam@95 7123 % which we arrange to emulate with a temporary file in ordinary TeX.
cannam@95 7124 \ifx\eTeXversion\thisisundefined
cannam@95 7125 \newwrite\macscribble
cannam@95 7126 \def\scantokens#1{%
cannam@95 7127 \toks0={#1}%
cannam@95 7128 \immediate\openout\macscribble=\jobname.tmp
cannam@95 7129 \immediate\write\macscribble{\the\toks0}%
cannam@95 7130 \immediate\closeout\macscribble
cannam@95 7131 \input \jobname.tmp
cannam@95 7132 }
cannam@95 7133 \fi
cannam@95 7134
cannam@95 7135 \def\scanmacro#1{\begingroup
cannam@95 7136 \newlinechar`\^^M
cannam@95 7137 \let\xeatspaces\eatspaces
cannam@95 7138 %
cannam@95 7139 % Undo catcode changes of \startcontents and \doprintindex
cannam@95 7140 % When called from @insertcopying or (short)caption, we need active
cannam@95 7141 % backslash to get it printed correctly. Previously, we had
cannam@95 7142 % \catcode`\\=\other instead. We'll see whether a problem appears
cannam@95 7143 % with macro expansion. --kasal, 19aug04
cannam@95 7144 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
cannam@95 7145 %
cannam@95 7146 % ... and for \example:
cannam@95 7147 \spaceisspace
cannam@95 7148 %
cannam@95 7149 % The \empty here causes a following catcode 5 newline to be eaten as
cannam@95 7150 % part of reading whitespace after a control sequence. It does not
cannam@95 7151 % eat a catcode 13 newline. There's no good way to handle the two
cannam@95 7152 % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
cannam@95 7153 % would then have different behavior). See the Macro Details node in
cannam@95 7154 % the manual for the workaround we recommend for macros and
cannam@95 7155 % line-oriented commands.
cannam@95 7156 %
cannam@95 7157 \scantokens{#1\empty}%
cannam@95 7158 \endgroup}
cannam@95 7159
cannam@95 7160 \def\scanexp#1{%
cannam@95 7161 \edef\temp{\noexpand\scanmacro{#1}}%
cannam@95 7162 \temp
cannam@95 7163 }
cannam@95 7164
cannam@95 7165 \newcount\paramno % Count of parameters
cannam@95 7166 \newtoks\macname % Macro name
cannam@95 7167 \newif\ifrecursive % Is it recursive?
cannam@95 7168
cannam@95 7169 % List of all defined macros in the form
cannam@95 7170 % \definedummyword\macro1\definedummyword\macro2...
cannam@95 7171 % Currently is also contains all @aliases; the list can be split
cannam@95 7172 % if there is a need.
cannam@95 7173 \def\macrolist{}
cannam@95 7174
cannam@95 7175 % Add the macro to \macrolist
cannam@95 7176 \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
cannam@95 7177 \def\addtomacrolistxxx#1{%
cannam@95 7178 \toks0 = \expandafter{\macrolist\definedummyword#1}%
cannam@95 7179 \xdef\macrolist{\the\toks0}%
cannam@95 7180 }
cannam@95 7181
cannam@95 7182 % Utility routines.
cannam@95 7183 % This does \let #1 = #2, with \csnames; that is,
cannam@95 7184 % \let \csname#1\endcsname = \csname#2\endcsname
cannam@95 7185 % (except of course we have to play expansion games).
cannam@95 7186 %
cannam@95 7187 \def\cslet#1#2{%
cannam@95 7188 \expandafter\let
cannam@95 7189 \csname#1\expandafter\endcsname
cannam@95 7190 \csname#2\endcsname
cannam@95 7191 }
cannam@95 7192
cannam@95 7193 % Trim leading and trailing spaces off a string.
cannam@95 7194 % Concepts from aro-bend problem 15 (see CTAN).
cannam@95 7195 {\catcode`\@=11
cannam@95 7196 \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
cannam@95 7197 \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
cannam@95 7198 \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
cannam@95 7199 \def\unbrace#1{#1}
cannam@95 7200 \unbrace{\gdef\trim@@@ #1 } #2@{#1}
cannam@95 7201 }
cannam@95 7202
cannam@95 7203 % Trim a single trailing ^^M off a string.
cannam@95 7204 {\catcode`\^^M=\other \catcode`\Q=3%
cannam@95 7205 \gdef\eatcr #1{\eatcra #1Q^^MQ}%
cannam@95 7206 \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
cannam@95 7207 \gdef\eatcrb#1Q#2Q{#1}%
cannam@95 7208 }
cannam@95 7209
cannam@95 7210 % Macro bodies are absorbed as an argument in a context where
cannam@95 7211 % all characters are catcode 10, 11 or 12, except \ which is active
cannam@95 7212 % (as in normal texinfo). It is necessary to change the definition of \
cannam@95 7213 % to recognize macro arguments; this is the job of \mbodybackslash.
cannam@95 7214 %
cannam@95 7215 % Non-ASCII encodings make 8-bit characters active, so un-activate
cannam@95 7216 % them to avoid their expansion. Must do this non-globally, to
cannam@95 7217 % confine the change to the current group.
cannam@95 7218 %
cannam@95 7219 % It's necessary to have hard CRs when the macro is executed. This is
cannam@95 7220 % done by making ^^M (\endlinechar) catcode 12 when reading the macro
cannam@95 7221 % body, and then making it the \newlinechar in \scanmacro.
cannam@95 7222 %
cannam@95 7223 \def\scanctxt{% used as subroutine
cannam@95 7224 \catcode`\"=\other
cannam@95 7225 \catcode`\+=\other
cannam@95 7226 \catcode`\<=\other
cannam@95 7227 \catcode`\>=\other
cannam@95 7228 \catcode`\@=\other
cannam@95 7229 \catcode`\^=\other
cannam@95 7230 \catcode`\_=\other
cannam@95 7231 \catcode`\|=\other
cannam@95 7232 \catcode`\~=\other
cannam@95 7233 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
cannam@95 7234 }
cannam@95 7235
cannam@95 7236 \def\scanargctxt{% used for copying and captions, not macros.
cannam@95 7237 \scanctxt
cannam@95 7238 \catcode`\\=\other
cannam@95 7239 \catcode`\^^M=\other
cannam@95 7240 }
cannam@95 7241
cannam@95 7242 \def\macrobodyctxt{% used for @macro definitions
cannam@95 7243 \scanctxt
cannam@95 7244 \catcode`\{=\other
cannam@95 7245 \catcode`\}=\other
cannam@95 7246 \catcode`\^^M=\other
cannam@95 7247 \usembodybackslash
cannam@95 7248 }
cannam@95 7249
cannam@95 7250 \def\macroargctxt{% used when scanning invocations
cannam@95 7251 \scanctxt
cannam@95 7252 \catcode`\\=0
cannam@95 7253 }
cannam@95 7254 % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes"
cannam@95 7255 % for the single characters \ { }. Thus, we end up with the "commands"
cannam@95 7256 % that would be written @\ @{ @} in a Texinfo document.
cannam@95 7257 %
cannam@95 7258 % We already have @{ and @}. For @\, we define it here, and only for
cannam@95 7259 % this purpose, to produce a typewriter backslash (so, the @\ that we
cannam@95 7260 % define for @math can't be used with @macro calls):
cannam@95 7261 %
cannam@95 7262 \def\\{\normalbackslash}%
cannam@95 7263 %
cannam@95 7264 % We would like to do this for \, too, since that is what makeinfo does.
cannam@95 7265 % But it is not possible, because Texinfo already has a command @, for a
cannam@95 7266 % cedilla accent. Documents must use @comma{} instead.
cannam@95 7267 %
cannam@95 7268 % \anythingelse will almost certainly be an error of some kind.
cannam@95 7269
cannam@95 7270
cannam@95 7271 % \mbodybackslash is the definition of \ in @macro bodies.
cannam@95 7272 % It maps \foo\ => \csname macarg.foo\endcsname => #N
cannam@95 7273 % where N is the macro parameter number.
cannam@95 7274 % We define \csname macarg.\endcsname to be \realbackslash, so
cannam@95 7275 % \\ in macro replacement text gets you a backslash.
cannam@95 7276 %
cannam@95 7277 {\catcode`@=0 @catcode`@\=@active
cannam@95 7278 @gdef@usembodybackslash{@let\=@mbodybackslash}
cannam@95 7279 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
cannam@95 7280 }
cannam@95 7281 \expandafter\def\csname macarg.\endcsname{\realbackslash}
cannam@95 7282
cannam@95 7283 \def\margbackslash#1{\char`\#1 }
cannam@95 7284
cannam@95 7285 \def\macro{\recursivefalse\parsearg\macroxxx}
cannam@95 7286 \def\rmacro{\recursivetrue\parsearg\macroxxx}
cannam@95 7287
cannam@95 7288 \def\macroxxx#1{%
cannam@95 7289 \getargs{#1}% now \macname is the macname and \argl the arglist
cannam@95 7290 \ifx\argl\empty % no arguments
cannam@95 7291 \paramno=0\relax
cannam@95 7292 \else
cannam@95 7293 \expandafter\parsemargdef \argl;%
cannam@95 7294 \if\paramno>256\relax
cannam@95 7295 \ifx\eTeXversion\thisisundefined
cannam@95 7296 \errhelp = \EMsimple
cannam@95 7297 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
cannam@95 7298 \fi
cannam@95 7299 \fi
cannam@95 7300 \fi
cannam@95 7301 \if1\csname ismacro.\the\macname\endcsname
cannam@95 7302 \message{Warning: redefining \the\macname}%
cannam@95 7303 \else
cannam@95 7304 \expandafter\ifx\csname \the\macname\endcsname \relax
cannam@95 7305 \else \errmessage{Macro name \the\macname\space already defined}\fi
cannam@95 7306 \global\cslet{macsave.\the\macname}{\the\macname}%
cannam@95 7307 \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
cannam@95 7308 \addtomacrolist{\the\macname}%
cannam@95 7309 \fi
cannam@95 7310 \begingroup \macrobodyctxt
cannam@95 7311 \ifrecursive \expandafter\parsermacbody
cannam@95 7312 \else \expandafter\parsemacbody
cannam@95 7313 \fi}
cannam@95 7314
cannam@95 7315 \parseargdef\unmacro{%
cannam@95 7316 \if1\csname ismacro.#1\endcsname
cannam@95 7317 \global\cslet{#1}{macsave.#1}%
cannam@95 7318 \global\expandafter\let \csname ismacro.#1\endcsname=0%
cannam@95 7319 % Remove the macro name from \macrolist:
cannam@95 7320 \begingroup
cannam@95 7321 \expandafter\let\csname#1\endcsname \relax
cannam@95 7322 \let\definedummyword\unmacrodo
cannam@95 7323 \xdef\macrolist{\macrolist}%
cannam@95 7324 \endgroup
cannam@95 7325 \else
cannam@95 7326 \errmessage{Macro #1 not defined}%
cannam@95 7327 \fi
cannam@95 7328 }
cannam@95 7329
cannam@95 7330 % Called by \do from \dounmacro on each macro. The idea is to omit any
cannam@95 7331 % macro definitions that have been changed to \relax.
cannam@95 7332 %
cannam@95 7333 \def\unmacrodo#1{%
cannam@95 7334 \ifx #1\relax
cannam@95 7335 % remove this
cannam@95 7336 \else
cannam@95 7337 \noexpand\definedummyword \noexpand#1%
cannam@95 7338 \fi
cannam@95 7339 }
cannam@95 7340
cannam@95 7341 % This makes use of the obscure feature that if the last token of a
cannam@95 7342 % <parameter list> is #, then the preceding argument is delimited by
cannam@95 7343 % an opening brace, and that opening brace is not consumed.
cannam@95 7344 \def\getargs#1{\getargsxxx#1{}}
cannam@95 7345 \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
cannam@95 7346 \def\getmacname#1 #2\relax{\macname={#1}}
cannam@95 7347 \def\getmacargs#1{\def\argl{#1}}
cannam@95 7348
cannam@95 7349 % For macro processing make @ a letter so that we can make Texinfo private macro names.
cannam@95 7350 \edef\texiatcatcode{\the\catcode`\@}
cannam@95 7351 \catcode `@=11\relax
cannam@95 7352
cannam@95 7353 % Parse the optional {params} list. Set up \paramno and \paramlist
cannam@95 7354 % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH
cannam@95 7355 % in the params list to some hook where the argument si to be expanded. If
cannam@95 7356 % there are less than 10 arguments that hook is to be replaced by ##N where N
cannam@95 7357 % is the position in that list, that is to say the macro arguments are to be
cannam@95 7358 % defined `a la TeX in the macro body.
cannam@95 7359 %
cannam@95 7360 % That gets used by \mbodybackslash (above).
cannam@95 7361 %
cannam@95 7362 % We need to get `macro parameter char #' into several definitions.
cannam@95 7363 % The technique used is stolen from LaTeX: let \hash be something
cannam@95 7364 % unexpandable, insert that wherever you need a #, and then redefine
cannam@95 7365 % it to # just before using the token list produced.
cannam@95 7366 %
cannam@95 7367 % The same technique is used to protect \eatspaces till just before
cannam@95 7368 % the macro is used.
cannam@95 7369 %
cannam@95 7370 % If there are 10 or more arguments, a different technique is used, where the
cannam@95 7371 % hook remains in the body, and when macro is to be expanded the body is
cannam@95 7372 % processed again to replace the arguments.
cannam@95 7373 %
cannam@95 7374 % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
cannam@95 7375 % argument N value and then \edef the body (nothing else will expand because of
cannam@95 7376 % the catcode regime underwhich the body was input).
cannam@95 7377 %
cannam@95 7378 % If you compile with TeX (not eTeX), and you have macros with 10 or more
cannam@95 7379 % arguments, you need that no macro has more than 256 arguments, otherwise an
cannam@95 7380 % error is produced.
cannam@95 7381 \def\parsemargdef#1;{%
cannam@95 7382 \paramno=0\def\paramlist{}%
cannam@95 7383 \let\hash\relax
cannam@95 7384 \let\xeatspaces\relax
cannam@95 7385 \parsemargdefxxx#1,;,%
cannam@95 7386 % In case that there are 10 or more arguments we parse again the arguments
cannam@95 7387 % list to set new definitions for the \macarg.BLAH macros corresponding to
cannam@95 7388 % each BLAH argument. It was anyhow needed to parse already once this list
cannam@95 7389 % in order to count the arguments, and as macros with at most 9 arguments
cannam@95 7390 % are by far more frequent than macro with 10 or more arguments, defining
cannam@95 7391 % twice the \macarg.BLAH macros does not cost too much processing power.
cannam@95 7392 \ifnum\paramno<10\relax\else
cannam@95 7393 \paramno0\relax
cannam@95 7394 \parsemmanyargdef@@#1,;,% 10 or more arguments
cannam@95 7395 \fi
cannam@95 7396 }
cannam@95 7397 \def\parsemargdefxxx#1,{%
cannam@95 7398 \if#1;\let\next=\relax
cannam@95 7399 \else \let\next=\parsemargdefxxx
cannam@95 7400 \advance\paramno by 1
cannam@95 7401 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
cannam@95 7402 {\xeatspaces{\hash\the\paramno}}%
cannam@95 7403 \edef\paramlist{\paramlist\hash\the\paramno,}%
cannam@95 7404 \fi\next}
cannam@95 7405
cannam@95 7406 \def\parsemmanyargdef@@#1,{%
cannam@95 7407 \if#1;\let\next=\relax
cannam@95 7408 \else
cannam@95 7409 \let\next=\parsemmanyargdef@@
cannam@95 7410 \edef\tempb{\eatspaces{#1}}%
cannam@95 7411 \expandafter\def\expandafter\tempa
cannam@95 7412 \expandafter{\csname macarg.\tempb\endcsname}%
cannam@95 7413 % Note that we need some extra \noexpand\noexpand, this is because we
cannam@95 7414 % don't want \the to be expanded in the \parsermacbody as it uses an
cannam@95 7415 % \xdef .
cannam@95 7416 \expandafter\edef\tempa
cannam@95 7417 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
cannam@95 7418 \advance\paramno by 1\relax
cannam@95 7419 \fi\next}
cannam@95 7420
cannam@95 7421 % These two commands read recursive and nonrecursive macro bodies.
cannam@95 7422 % (They're different since rec and nonrec macros end differently.)
cannam@95 7423 %
cannam@95 7424
cannam@95 7425 \catcode `\@\texiatcatcode
cannam@95 7426 \long\def\parsemacbody#1@end macro%
cannam@95 7427 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
cannam@95 7428 \long\def\parsermacbody#1@end rmacro%
cannam@95 7429 {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
cannam@95 7430 \catcode `\@=11\relax
cannam@95 7431
cannam@95 7432 \let\endargs@\relax
cannam@95 7433 \let\nil@\relax
cannam@95 7434 \def\nilm@{\nil@}%
cannam@95 7435 \long\def\nillm@{\nil@}%
cannam@95 7436
cannam@95 7437 % This macro is expanded during the Texinfo macro expansion, not during its
cannam@95 7438 % definition. It gets all the arguments values and assigns them to macros
cannam@95 7439 % macarg.ARGNAME
cannam@95 7440 %
cannam@95 7441 % #1 is the macro name
cannam@95 7442 % #2 is the list of argument names
cannam@95 7443 % #3 is the list of argument values
cannam@95 7444 \def\getargvals@#1#2#3{%
cannam@95 7445 \def\macargdeflist@{}%
cannam@95 7446 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
cannam@95 7447 \def\paramlist{#2,\nil@}%
cannam@95 7448 \def\macroname{#1}%
cannam@95 7449 \begingroup
cannam@95 7450 \macroargctxt
cannam@95 7451 \def\argvaluelist{#3,\nil@}%
cannam@95 7452 \def\@tempa{#3}%
cannam@95 7453 \ifx\@tempa\empty
cannam@95 7454 \setemptyargvalues@
cannam@95 7455 \else
cannam@95 7456 \getargvals@@
cannam@95 7457 \fi
cannam@95 7458 }
cannam@95 7459
cannam@95 7460 %
cannam@95 7461 \def\getargvals@@{%
cannam@95 7462 \ifx\paramlist\nilm@
cannam@95 7463 % Some sanity check needed here that \argvaluelist is also empty.
cannam@95 7464 \ifx\argvaluelist\nillm@
cannam@95 7465 \else
cannam@95 7466 \errhelp = \EMsimple
cannam@95 7467 \errmessage{Too many arguments in macro `\macroname'!}%
cannam@95 7468 \fi
cannam@95 7469 \let\next\macargexpandinbody@
cannam@95 7470 \else
cannam@95 7471 \ifx\argvaluelist\nillm@
cannam@95 7472 % No more arguments values passed to macro. Set remaining named-arg
cannam@95 7473 % macros to empty.
cannam@95 7474 \let\next\setemptyargvalues@
cannam@95 7475 \else
cannam@95 7476 % pop current arg name into \@tempb
cannam@95 7477 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
cannam@95 7478 \expandafter\@tempa\expandafter{\paramlist}%
cannam@95 7479 % pop current argument value into \@tempc
cannam@95 7480 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
cannam@95 7481 \expandafter\@tempa\expandafter{\argvaluelist}%
cannam@95 7482 % Here \@tempb is the current arg name and \@tempc is the current arg value.
cannam@95 7483 % First place the new argument macro definition into \@tempd
cannam@95 7484 \expandafter\macname\expandafter{\@tempc}%
cannam@95 7485 \expandafter\let\csname macarg.\@tempb\endcsname\relax
cannam@95 7486 \expandafter\def\expandafter\@tempe\expandafter{%
cannam@95 7487 \csname macarg.\@tempb\endcsname}%
cannam@95 7488 \edef\@tempd{\long\def\@tempe{\the\macname}}%
cannam@95 7489 \push@\@tempd\macargdeflist@
cannam@95 7490 \let\next\getargvals@@
cannam@95 7491 \fi
cannam@95 7492 \fi
cannam@95 7493 \next
cannam@95 7494 }
cannam@95 7495
cannam@95 7496 \def\push@#1#2{%
cannam@95 7497 \expandafter\expandafter\expandafter\def
cannam@95 7498 \expandafter\expandafter\expandafter#2%
cannam@95 7499 \expandafter\expandafter\expandafter{%
cannam@95 7500 \expandafter#1#2}%
cannam@95 7501 }
cannam@95 7502
cannam@95 7503 % Replace arguments by their values in the macro body, and place the result
cannam@95 7504 % in macro \@tempa
cannam@95 7505 \def\macvalstoargs@{%
cannam@95 7506 % To do this we use the property that token registers that are \the'ed
cannam@95 7507 % within an \edef expand only once. So we are going to place all argument
cannam@95 7508 % values into respective token registers.
cannam@95 7509 %
cannam@95 7510 % First we save the token context, and initialize argument numbering.
cannam@95 7511 \begingroup
cannam@95 7512 \paramno0\relax
cannam@95 7513 % Then, for each argument number #N, we place the corresponding argument
cannam@95 7514 % value into a new token list register \toks#N
cannam@95 7515 \expandafter\putargsintokens@\saveparamlist@,;,%
cannam@95 7516 % Then, we expand the body so that argument are replaced by their
cannam@95 7517 % values. The trick for values not to be expanded themselves is that they
cannam@95 7518 % are within tokens and that tokens expand only once in an \edef .
cannam@95 7519 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
cannam@95 7520 % Now we restore the token stack pointer to free the token list registers
cannam@95 7521 % which we have used, but we make sure that expanded body is saved after
cannam@95 7522 % group.
cannam@95 7523 \expandafter
cannam@95 7524 \endgroup
cannam@95 7525 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
cannam@95 7526 }
cannam@95 7527
cannam@95 7528 \def\macargexpandinbody@{%
cannam@95 7529 %% Define the named-macro outside of this group and then close this group.
cannam@95 7530 \expandafter
cannam@95 7531 \endgroup
cannam@95 7532 \macargdeflist@
cannam@95 7533 % First the replace in body the macro arguments by their values, the result
cannam@95 7534 % is in \@tempa .
cannam@95 7535 \macvalstoargs@
cannam@95 7536 % Then we point at the \norecurse or \gobble (for recursive) macro value
cannam@95 7537 % with \@tempb .
cannam@95 7538 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
cannam@95 7539 % Depending on whether it is recursive or not, we need some tailing
cannam@95 7540 % \egroup .
cannam@95 7541 \ifx\@tempb\gobble
cannam@95 7542 \let\@tempc\relax
cannam@95 7543 \else
cannam@95 7544 \let\@tempc\egroup
cannam@95 7545 \fi
cannam@95 7546 % And now we do the real job:
cannam@95 7547 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
cannam@95 7548 \@tempd
cannam@95 7549 }
cannam@95 7550
cannam@95 7551 \def\putargsintokens@#1,{%
cannam@95 7552 \if#1;\let\next\relax
cannam@95 7553 \else
cannam@95 7554 \let\next\putargsintokens@
cannam@95 7555 % First we allocate the new token list register, and give it a temporary
cannam@95 7556 % alias \@tempb .
cannam@95 7557 \toksdef\@tempb\the\paramno
cannam@95 7558 % Then we place the argument value into that token list register.
cannam@95 7559 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
cannam@95 7560 \expandafter\@tempb\expandafter{\@tempa}%
cannam@95 7561 \advance\paramno by 1\relax
cannam@95 7562 \fi
cannam@95 7563 \next
cannam@95 7564 }
cannam@95 7565
cannam@95 7566 % Save the token stack pointer into macro #1
cannam@95 7567 \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
cannam@95 7568 % Restore the token stack pointer from number in macro #1
cannam@95 7569 \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
cannam@95 7570 % newtoks that can be used non \outer .
cannam@95 7571 \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
cannam@95 7572
cannam@95 7573 % Tailing missing arguments are set to empty
cannam@95 7574 \def\setemptyargvalues@{%
cannam@95 7575 \ifx\paramlist\nilm@
cannam@95 7576 \let\next\macargexpandinbody@
cannam@95 7577 \else
cannam@95 7578 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
cannam@95 7579 \let\next\setemptyargvalues@
cannam@95 7580 \fi
cannam@95 7581 \next
cannam@95 7582 }
cannam@95 7583
cannam@95 7584 \def\setemptyargvaluesparser@#1,#2\endargs@{%
cannam@95 7585 \expandafter\def\expandafter\@tempa\expandafter{%
cannam@95 7586 \expandafter\def\csname macarg.#1\endcsname{}}%
cannam@95 7587 \push@\@tempa\macargdeflist@
cannam@95 7588 \def\paramlist{#2}%
cannam@95 7589 }
cannam@95 7590
cannam@95 7591 % #1 is the element target macro
cannam@95 7592 % #2 is the list macro
cannam@95 7593 % #3,#4\endargs@ is the list value
cannam@95 7594 \def\pop@#1#2#3,#4\endargs@{%
cannam@95 7595 \def#1{#3}%
cannam@95 7596 \def#2{#4}%
cannam@95 7597 }
cannam@95 7598 \long\def\longpop@#1#2#3,#4\endargs@{%
cannam@95 7599 \long\def#1{#3}%
cannam@95 7600 \long\def#2{#4}%
cannam@95 7601 }
cannam@95 7602
cannam@95 7603 % This defines a Texinfo @macro. There are eight cases: recursive and
cannam@95 7604 % nonrecursive macros of zero, one, up to nine, and many arguments.
cannam@95 7605 % Much magic with \expandafter here.
cannam@95 7606 % \xdef is used so that macro definitions will survive the file
cannam@95 7607 % they're defined in; @include reads the file inside a group.
cannam@95 7608 %
cannam@95 7609 \def\defmacro{%
cannam@95 7610 \let\hash=##% convert placeholders to macro parameter chars
cannam@95 7611 \ifrecursive
cannam@95 7612 \ifcase\paramno
cannam@95 7613 % 0
cannam@95 7614 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7615 \noexpand\scanmacro{\temp}}%
cannam@95 7616 \or % 1
cannam@95 7617 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7618 \bgroup\noexpand\macroargctxt
cannam@95 7619 \noexpand\braceorline
cannam@95 7620 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
cannam@95 7621 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
cannam@95 7622 \egroup\noexpand\scanmacro{\temp}}%
cannam@95 7623 \else
cannam@95 7624 \ifnum\paramno<10\relax % at most 9
cannam@95 7625 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7626 \bgroup\noexpand\macroargctxt
cannam@95 7627 \noexpand\csname\the\macname xx\endcsname}%
cannam@95 7628 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
cannam@95 7629 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
cannam@95 7630 \expandafter\expandafter
cannam@95 7631 \expandafter\xdef
cannam@95 7632 \expandafter\expandafter
cannam@95 7633 \csname\the\macname xxx\endcsname
cannam@95 7634 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
cannam@95 7635 \else % 10 or more
cannam@95 7636 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7637 \noexpand\getargvals@{\the\macname}{\argl}%
cannam@95 7638 }%
cannam@95 7639 \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
cannam@95 7640 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
cannam@95 7641 \fi
cannam@95 7642 \fi
cannam@95 7643 \else
cannam@95 7644 \ifcase\paramno
cannam@95 7645 % 0
cannam@95 7646 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7647 \noexpand\norecurse{\the\macname}%
cannam@95 7648 \noexpand\scanmacro{\temp}\egroup}%
cannam@95 7649 \or % 1
cannam@95 7650 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7651 \bgroup\noexpand\macroargctxt
cannam@95 7652 \noexpand\braceorline
cannam@95 7653 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
cannam@95 7654 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
cannam@95 7655 \egroup
cannam@95 7656 \noexpand\norecurse{\the\macname}%
cannam@95 7657 \noexpand\scanmacro{\temp}\egroup}%
cannam@95 7658 \else % at most 9
cannam@95 7659 \ifnum\paramno<10\relax
cannam@95 7660 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7661 \bgroup\noexpand\macroargctxt
cannam@95 7662 \expandafter\noexpand\csname\the\macname xx\endcsname}%
cannam@95 7663 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
cannam@95 7664 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
cannam@95 7665 \expandafter\expandafter
cannam@95 7666 \expandafter\xdef
cannam@95 7667 \expandafter\expandafter
cannam@95 7668 \csname\the\macname xxx\endcsname
cannam@95 7669 \paramlist{%
cannam@95 7670 \egroup
cannam@95 7671 \noexpand\norecurse{\the\macname}%
cannam@95 7672 \noexpand\scanmacro{\temp}\egroup}%
cannam@95 7673 \else % 10 or more:
cannam@95 7674 \expandafter\xdef\csname\the\macname\endcsname{%
cannam@95 7675 \noexpand\getargvals@{\the\macname}{\argl}%
cannam@95 7676 }%
cannam@95 7677 \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
cannam@95 7678 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
cannam@95 7679 \fi
cannam@95 7680 \fi
cannam@95 7681 \fi}
cannam@95 7682
cannam@95 7683 \catcode `\@\texiatcatcode\relax
cannam@95 7684
cannam@95 7685 \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
cannam@95 7686
cannam@95 7687 % \braceorline decides whether the next nonwhitespace character is a
cannam@95 7688 % {. If so it reads up to the closing }, if not, it reads the whole
cannam@95 7689 % line. Whatever was read is then fed to the next control sequence
cannam@95 7690 % as an argument (by \parsebrace or \parsearg).
cannam@95 7691 %
cannam@95 7692 \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
cannam@95 7693 \def\braceorlinexxx{%
cannam@95 7694 \ifx\nchar\bgroup\else
cannam@95 7695 \expandafter\parsearg
cannam@95 7696 \fi \macnamexxx}
cannam@95 7697
cannam@95 7698
cannam@95 7699 % @alias.
cannam@95 7700 % We need some trickery to remove the optional spaces around the equal
cannam@95 7701 % sign. Make them active and then expand them all to nothing.
cannam@95 7702 %
cannam@95 7703 \def\alias{\parseargusing\obeyspaces\aliasxxx}
cannam@95 7704 \def\aliasxxx #1{\aliasyyy#1\relax}
cannam@95 7705 \def\aliasyyy #1=#2\relax{%
cannam@95 7706 {%
cannam@95 7707 \expandafter\let\obeyedspace=\empty
cannam@95 7708 \addtomacrolist{#1}%
cannam@95 7709 \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
cannam@95 7710 }%
cannam@95 7711 \next
cannam@95 7712 }
cannam@95 7713
cannam@95 7714
cannam@95 7715 \message{cross references,}
cannam@95 7716
cannam@95 7717 \newwrite\auxfile
cannam@95 7718 \newif\ifhavexrefs % True if xref values are known.
cannam@95 7719 \newif\ifwarnedxrefs % True if we warned once that they aren't known.
cannam@95 7720
cannam@95 7721 % @inforef is relatively simple.
cannam@95 7722 \def\inforef #1{\inforefzzz #1,,,,**}
cannam@95 7723 \def\inforefzzz #1,#2,#3,#4**{%
cannam@95 7724 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
cannam@95 7725 node \samp{\ignorespaces#1{}}}
cannam@95 7726
cannam@95 7727 % @node's only job in TeX is to define \lastnode, which is used in
cannam@95 7728 % cross-references. The @node line might or might not have commas, and
cannam@95 7729 % might or might not have spaces before the first comma, like:
cannam@95 7730 % @node foo , bar , ...
cannam@95 7731 % We don't want such trailing spaces in the node name.
cannam@95 7732 %
cannam@95 7733 \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
cannam@95 7734 %
cannam@95 7735 % also remove a trailing comma, in case of something like this:
cannam@95 7736 % @node Help-Cross, , , Cross-refs
cannam@95 7737 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
cannam@95 7738 \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
cannam@95 7739
cannam@95 7740 \let\nwnode=\node
cannam@95 7741 \let\lastnode=\empty
cannam@95 7742
cannam@95 7743 % Write a cross-reference definition for the current node. #1 is the
cannam@95 7744 % type (Ynumbered, Yappendix, Ynothing).
cannam@95 7745 %
cannam@95 7746 \def\donoderef#1{%
cannam@95 7747 \ifx\lastnode\empty\else
cannam@95 7748 \setref{\lastnode}{#1}%
cannam@95 7749 \global\let\lastnode=\empty
cannam@95 7750 \fi
cannam@95 7751 }
cannam@95 7752
cannam@95 7753 % @anchor{NAME} -- define xref target at arbitrary point.
cannam@95 7754 %
cannam@95 7755 \newcount\savesfregister
cannam@95 7756 %
cannam@95 7757 \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
cannam@95 7758 \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
cannam@95 7759 \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
cannam@95 7760
cannam@95 7761 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
cannam@95 7762 % anchor), which consists of three parts:
cannam@95 7763 % 1) NAME-title - the current sectioning name taken from \lastsection,
cannam@95 7764 % or the anchor name.
cannam@95 7765 % 2) NAME-snt - section number and type, passed as the SNT arg, or
cannam@95 7766 % empty for anchors.
cannam@95 7767 % 3) NAME-pg - the page number.
cannam@95 7768 %
cannam@95 7769 % This is called from \donoderef, \anchor, and \dofloat. In the case of
cannam@95 7770 % floats, there is an additional part, which is not written here:
cannam@95 7771 % 4) NAME-lof - the text as it should appear in a @listoffloats.
cannam@95 7772 %
cannam@95 7773 \def\setref#1#2{%
cannam@95 7774 \pdfmkdest{#1}%
cannam@95 7775 \iflinks
cannam@95 7776 {%
cannam@95 7777 \atdummies % preserve commands, but don't expand them
cannam@95 7778 \edef\writexrdef##1##2{%
cannam@95 7779 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
cannam@95 7780 ##1}{##2}}% these are parameters of \writexrdef
cannam@95 7781 }%
cannam@95 7782 \toks0 = \expandafter{\lastsection}%
cannam@95 7783 \immediate \writexrdef{title}{\the\toks0 }%
cannam@95 7784 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
cannam@95 7785 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
cannam@95 7786 }%
cannam@95 7787 \fi
cannam@95 7788 }
cannam@95 7789
cannam@95 7790 % @xrefautosectiontitle on|off says whether @section(ing) names are used
cannam@95 7791 % automatically in xrefs, if the third arg is not explicitly specified.
cannam@95 7792 % This was provided as a "secret" @set xref-automatic-section-title
cannam@95 7793 % variable, now it's official.
cannam@95 7794 %
cannam@95 7795 \parseargdef\xrefautomaticsectiontitle{%
cannam@95 7796 \def\temp{#1}%
cannam@95 7797 \ifx\temp\onword
cannam@95 7798 \expandafter\let\csname SETxref-automatic-section-title\endcsname
cannam@95 7799 = \empty
cannam@95 7800 \else\ifx\temp\offword
cannam@95 7801 \expandafter\let\csname SETxref-automatic-section-title\endcsname
cannam@95 7802 = \relax
cannam@95 7803 \else
cannam@95 7804 \errhelp = \EMsimple
cannam@95 7805 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
cannam@95 7806 must be on|off}%
cannam@95 7807 \fi\fi
cannam@95 7808 }
cannam@95 7809
cannam@95 7810
cannam@95 7811 % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
cannam@95 7812 % the node name, #2 the name of the Info cross-reference, #3 the printed
cannam@95 7813 % node name, #4 the name of the Info file, #5 the name of the printed
cannam@95 7814 % manual. All but the node name can be omitted.
cannam@95 7815 %
cannam@95 7816 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
cannam@95 7817 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
cannam@95 7818 \def\ref#1{\xrefX[#1,,,,,,,]}
cannam@95 7819 %
cannam@95 7820 \newbox\topbox
cannam@95 7821 \newbox\printedrefnamebox
cannam@95 7822 \newbox\printedmanualbox
cannam@95 7823 %
cannam@95 7824 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
cannam@95 7825 \unsepspaces
cannam@95 7826 %
cannam@95 7827 \def\printedrefname{\ignorespaces #3}%
cannam@95 7828 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
cannam@95 7829 %
cannam@95 7830 \def\printedmanual{\ignorespaces #5}%
cannam@95 7831 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
cannam@95 7832 %
cannam@95 7833 % If the printed reference name (arg #3) was not explicitly given in
cannam@95 7834 % the @xref, figure out what we want to use.
cannam@95 7835 \ifdim \wd\printedrefnamebox = 0pt
cannam@95 7836 % No printed node name was explicitly given.
cannam@95 7837 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
cannam@95 7838 % Not auto section-title: use node name inside the square brackets.
cannam@95 7839 \def\printedrefname{\ignorespaces #1}%
cannam@95 7840 \else
cannam@95 7841 % Auto section-title: use chapter/section title inside
cannam@95 7842 % the square brackets if we have it.
cannam@95 7843 \ifdim \wd\printedmanualbox > 0pt
cannam@95 7844 % It is in another manual, so we don't have it; use node name.
cannam@95 7845 \def\printedrefname{\ignorespaces #1}%
cannam@95 7846 \else
cannam@95 7847 \ifhavexrefs
cannam@95 7848 % We (should) know the real title if we have the xref values.
cannam@95 7849 \def\printedrefname{\refx{#1-title}{}}%
cannam@95 7850 \else
cannam@95 7851 % Otherwise just copy the Info node name.
cannam@95 7852 \def\printedrefname{\ignorespaces #1}%
cannam@95 7853 \fi%
cannam@95 7854 \fi
cannam@95 7855 \fi
cannam@95 7856 \fi
cannam@95 7857 %
cannam@95 7858 % Make link in pdf output.
cannam@95 7859 \ifpdf
cannam@95 7860 {\indexnofonts
cannam@95 7861 \turnoffactive
cannam@95 7862 \makevalueexpandable
cannam@95 7863 % This expands tokens, so do it after making catcode changes, so _
cannam@95 7864 % etc. don't get their TeX definitions.
cannam@95 7865 \getfilename{#4}%
cannam@95 7866 %
cannam@95 7867 \edef\pdfxrefdest{#1}%
cannam@95 7868 \txiescapepdf\pdfxrefdest
cannam@95 7869 %
cannam@95 7870 \leavevmode
cannam@95 7871 \startlink attr{/Border [0 0 0]}%
cannam@95 7872 \ifnum\filenamelength>0
cannam@95 7873 goto file{\the\filename.pdf} name{\pdfxrefdest}%
cannam@95 7874 \else
cannam@95 7875 goto name{\pdfmkpgn{\pdfxrefdest}}%
cannam@95 7876 \fi
cannam@95 7877 }%
cannam@95 7878 \setcolor{\linkcolor}%
cannam@95 7879 \fi
cannam@95 7880 %
cannam@95 7881 % Float references are printed completely differently: "Figure 1.2"
cannam@95 7882 % instead of "[somenode], p.3". We distinguish them by the
cannam@95 7883 % LABEL-title being set to a magic string.
cannam@95 7884 {%
cannam@95 7885 % Have to otherify everything special to allow the \csname to
cannam@95 7886 % include an _ in the xref name, etc.
cannam@95 7887 \indexnofonts
cannam@95 7888 \turnoffactive
cannam@95 7889 \expandafter\global\expandafter\let\expandafter\Xthisreftitle
cannam@95 7890 \csname XR#1-title\endcsname
cannam@95 7891 }%
cannam@95 7892 \iffloat\Xthisreftitle
cannam@95 7893 % If the user specified the print name (third arg) to the ref,
cannam@95 7894 % print it instead of our usual "Figure 1.2".
cannam@95 7895 \ifdim\wd\printedrefnamebox = 0pt
cannam@95 7896 \refx{#1-snt}{}%
cannam@95 7897 \else
cannam@95 7898 \printedrefname
cannam@95 7899 \fi
cannam@95 7900 %
cannam@95 7901 % if the user also gave the printed manual name (fifth arg), append
cannam@95 7902 % "in MANUALNAME".
cannam@95 7903 \ifdim \wd\printedmanualbox > 0pt
cannam@95 7904 \space \putwordin{} \cite{\printedmanual}%
cannam@95 7905 \fi
cannam@95 7906 \else
cannam@95 7907 % node/anchor (non-float) references.
cannam@95 7908 %
cannam@95 7909 % If we use \unhbox to print the node names, TeX does not insert
cannam@95 7910 % empty discretionaries after hyphens, which means that it will not
cannam@95 7911 % find a line break at a hyphen in a node names. Since some manuals
cannam@95 7912 % are best written with fairly long node names, containing hyphens,
cannam@95 7913 % this is a loss. Therefore, we give the text of the node name
cannam@95 7914 % again, so it is as if TeX is seeing it for the first time.
cannam@95 7915 %
cannam@95 7916 % Cross-manual reference. Only include the "Section ``foo'' in" if
cannam@95 7917 % the foo is neither missing or Top. Thus, @xref{,,,foo,The Foo Manual}
cannam@95 7918 % outputs simply "see The Foo Manual".
cannam@95 7919 \ifdim \wd\printedmanualbox > 0pt
cannam@95 7920 % What is the 7sp about? The idea is that we also want to omit
cannam@95 7921 % the Section part if we would be printing "Top", since they are
cannam@95 7922 % clearly trying to refer to the whole manual. But, this being
cannam@95 7923 % TeX, we can't easily compare strings while ignoring the possible
cannam@95 7924 % spaces before and after in the input. By adding the arbitrary
cannam@95 7925 % 7sp, we make it much less likely that a real node name would
cannam@95 7926 % happen to have the same width as "Top" (e.g., in a monospaced font).
cannam@95 7927 % I hope it will never happen in practice.
cannam@95 7928 %
cannam@95 7929 % For the same basic reason, we retypeset the "Top" at every
cannam@95 7930 % reference, since the current font is indeterminate.
cannam@95 7931 %
cannam@95 7932 \setbox\topbox = \hbox{Top\kern7sp}%
cannam@95 7933 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
cannam@95 7934 \ifdim \wd2 > 7sp
cannam@95 7935 \ifdim \wd2 = \wd\topbox \else
cannam@95 7936 \putwordSection{} ``\printedrefname'' \putwordin{}\space
cannam@95 7937 \fi
cannam@95 7938 \fi
cannam@95 7939 \cite{\printedmanual}%
cannam@95 7940 \else
cannam@95 7941 % Reference in this manual.
cannam@95 7942 %
cannam@95 7943 % _ (for example) has to be the character _ for the purposes of the
cannam@95 7944 % control sequence corresponding to the node, but it has to expand
cannam@95 7945 % into the usual \leavevmode...\vrule stuff for purposes of
cannam@95 7946 % printing. So we \turnoffactive for the \refx-snt, back on for the
cannam@95 7947 % printing, back off for the \refx-pg.
cannam@95 7948 {\turnoffactive
cannam@95 7949 % Only output a following space if the -snt ref is nonempty; for
cannam@95 7950 % @unnumbered and @anchor, it won't be.
cannam@95 7951 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
cannam@95 7952 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
cannam@95 7953 }%
cannam@95 7954 % output the `[mynode]' via the macro below so it can be overridden.
cannam@95 7955 \xrefprintnodename\printedrefname
cannam@95 7956 %
cannam@95 7957 % But we always want a comma and a space:
cannam@95 7958 ,\space
cannam@95 7959 %
cannam@95 7960 % output the `page 3'.
cannam@95 7961 \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
cannam@95 7962 \fi
cannam@95 7963 \fi
cannam@95 7964 \endlink
cannam@95 7965 \endgroup}
cannam@95 7966
cannam@95 7967 % This macro is called from \xrefX for the `[nodename]' part of xref
cannam@95 7968 % output. It's a separate macro only so it can be changed more easily,
cannam@95 7969 % since square brackets don't work well in some documents. Particularly
cannam@95 7970 % one that Bob is working on :).
cannam@95 7971 %
cannam@95 7972 \def\xrefprintnodename#1{[#1]}
cannam@95 7973
cannam@95 7974 % Things referred to by \setref.
cannam@95 7975 %
cannam@95 7976 \def\Ynothing{}
cannam@95 7977 \def\Yomitfromtoc{}
cannam@95 7978 \def\Ynumbered{%
cannam@95 7979 \ifnum\secno=0
cannam@95 7980 \putwordChapter@tie \the\chapno
cannam@95 7981 \else \ifnum\subsecno=0
cannam@95 7982 \putwordSection@tie \the\chapno.\the\secno
cannam@95 7983 \else \ifnum\subsubsecno=0
cannam@95 7984 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
cannam@95 7985 \else
cannam@95 7986 \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
cannam@95 7987 \fi\fi\fi
cannam@95 7988 }
cannam@95 7989 \def\Yappendix{%
cannam@95 7990 \ifnum\secno=0
cannam@95 7991 \putwordAppendix@tie @char\the\appendixno{}%
cannam@95 7992 \else \ifnum\subsecno=0
cannam@95 7993 \putwordSection@tie @char\the\appendixno.\the\secno
cannam@95 7994 \else \ifnum\subsubsecno=0
cannam@95 7995 \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
cannam@95 7996 \else
cannam@95 7997 \putwordSection@tie
cannam@95 7998 @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
cannam@95 7999 \fi\fi\fi
cannam@95 8000 }
cannam@95 8001
cannam@95 8002 % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
cannam@95 8003 % If its value is nonempty, SUFFIX is output afterward.
cannam@95 8004 %
cannam@95 8005 \def\refx#1#2{%
cannam@95 8006 {%
cannam@95 8007 \indexnofonts
cannam@95 8008 \otherbackslash
cannam@95 8009 \expandafter\global\expandafter\let\expandafter\thisrefX
cannam@95 8010 \csname XR#1\endcsname
cannam@95 8011 }%
cannam@95 8012 \ifx\thisrefX\relax
cannam@95 8013 % If not defined, say something at least.
cannam@95 8014 \angleleft un\-de\-fined\angleright
cannam@95 8015 \iflinks
cannam@95 8016 \ifhavexrefs
cannam@95 8017 {\toks0 = {#1}% avoid expansion of possibly-complex value
cannam@95 8018 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
cannam@95 8019 \else
cannam@95 8020 \ifwarnedxrefs\else
cannam@95 8021 \global\warnedxrefstrue
cannam@95 8022 \message{Cross reference values unknown; you must run TeX again.}%
cannam@95 8023 \fi
cannam@95 8024 \fi
cannam@95 8025 \fi
cannam@95 8026 \else
cannam@95 8027 % It's defined, so just use it.
cannam@95 8028 \thisrefX
cannam@95 8029 \fi
cannam@95 8030 #2% Output the suffix in any case.
cannam@95 8031 }
cannam@95 8032
cannam@95 8033 % This is the macro invoked by entries in the aux file. Usually it's
cannam@95 8034 % just a \def (we prepend XR to the control sequence name to avoid
cannam@95 8035 % collisions). But if this is a float type, we have more work to do.
cannam@95 8036 %
cannam@95 8037 \def\xrdef#1#2{%
cannam@95 8038 {% The node name might contain 8-bit characters, which in our current
cannam@95 8039 % implementation are changed to commands like @'e. Don't let these
cannam@95 8040 % mess up the control sequence name.
cannam@95 8041 \indexnofonts
cannam@95 8042 \turnoffactive
cannam@95 8043 \xdef\safexrefname{#1}%
cannam@95 8044 }%
cannam@95 8045 %
cannam@95 8046 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
cannam@95 8047 %
cannam@95 8048 % Was that xref control sequence that we just defined for a float?
cannam@95 8049 \expandafter\iffloat\csname XR\safexrefname\endcsname
cannam@95 8050 % it was a float, and we have the (safe) float type in \iffloattype.
cannam@95 8051 \expandafter\let\expandafter\floatlist
cannam@95 8052 \csname floatlist\iffloattype\endcsname
cannam@95 8053 %
cannam@95 8054 % Is this the first time we've seen this float type?
cannam@95 8055 \expandafter\ifx\floatlist\relax
cannam@95 8056 \toks0 = {\do}% yes, so just \do
cannam@95 8057 \else
cannam@95 8058 % had it before, so preserve previous elements in list.
cannam@95 8059 \toks0 = \expandafter{\floatlist\do}%
cannam@95 8060 \fi
cannam@95 8061 %
cannam@95 8062 % Remember this xref in the control sequence \floatlistFLOATTYPE,
cannam@95 8063 % for later use in \listoffloats.
cannam@95 8064 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
cannam@95 8065 {\safexrefname}}%
cannam@95 8066 \fi
cannam@95 8067 }
cannam@95 8068
cannam@95 8069 % Read the last existing aux file, if any. No error if none exists.
cannam@95 8070 %
cannam@95 8071 \def\tryauxfile{%
cannam@95 8072 \openin 1 \jobname.aux
cannam@95 8073 \ifeof 1 \else
cannam@95 8074 \readdatafile{aux}%
cannam@95 8075 \global\havexrefstrue
cannam@95 8076 \fi
cannam@95 8077 \closein 1
cannam@95 8078 }
cannam@95 8079
cannam@95 8080 \def\setupdatafile{%
cannam@95 8081 \catcode`\^^@=\other
cannam@95 8082 \catcode`\^^A=\other
cannam@95 8083 \catcode`\^^B=\other
cannam@95 8084 \catcode`\^^C=\other
cannam@95 8085 \catcode`\^^D=\other
cannam@95 8086 \catcode`\^^E=\other
cannam@95 8087 \catcode`\^^F=\other
cannam@95 8088 \catcode`\^^G=\other
cannam@95 8089 \catcode`\^^H=\other
cannam@95 8090 \catcode`\^^K=\other
cannam@95 8091 \catcode`\^^L=\other
cannam@95 8092 \catcode`\^^N=\other
cannam@95 8093 \catcode`\^^P=\other
cannam@95 8094 \catcode`\^^Q=\other
cannam@95 8095 \catcode`\^^R=\other
cannam@95 8096 \catcode`\^^S=\other
cannam@95 8097 \catcode`\^^T=\other
cannam@95 8098 \catcode`\^^U=\other
cannam@95 8099 \catcode`\^^V=\other
cannam@95 8100 \catcode`\^^W=\other
cannam@95 8101 \catcode`\^^X=\other
cannam@95 8102 \catcode`\^^Z=\other
cannam@95 8103 \catcode`\^^[=\other
cannam@95 8104 \catcode`\^^\=\other
cannam@95 8105 \catcode`\^^]=\other
cannam@95 8106 \catcode`\^^^=\other
cannam@95 8107 \catcode`\^^_=\other
cannam@95 8108 % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
cannam@95 8109 % in xref tags, i.e., node names. But since ^^e4 notation isn't
cannam@95 8110 % supported in the main text, it doesn't seem desirable. Furthermore,
cannam@95 8111 % that is not enough: for node names that actually contain a ^
cannam@95 8112 % character, we would end up writing a line like this: 'xrdef {'hat
cannam@95 8113 % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
cannam@95 8114 % argument, and \hat is not an expandable control sequence. It could
cannam@95 8115 % all be worked out, but why? Either we support ^^ or we don't.
cannam@95 8116 %
cannam@95 8117 % The other change necessary for this was to define \auxhat:
cannam@95 8118 % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
cannam@95 8119 % and then to call \auxhat in \setq.
cannam@95 8120 %
cannam@95 8121 \catcode`\^=\other
cannam@95 8122 %
cannam@95 8123 % Special characters. Should be turned off anyway, but...
cannam@95 8124 \catcode`\~=\other
cannam@95 8125 \catcode`\[=\other
cannam@95 8126 \catcode`\]=\other
cannam@95 8127 \catcode`\"=\other
cannam@95 8128 \catcode`\_=\other
cannam@95 8129 \catcode`\|=\other
cannam@95 8130 \catcode`\<=\other
cannam@95 8131 \catcode`\>=\other
cannam@95 8132 \catcode`\$=\other
cannam@95 8133 \catcode`\#=\other
cannam@95 8134 \catcode`\&=\other
cannam@95 8135 \catcode`\%=\other
cannam@95 8136 \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
cannam@95 8137 %
cannam@95 8138 % This is to support \ in node names and titles, since the \
cannam@95 8139 % characters end up in a \csname. It's easier than
cannam@95 8140 % leaving it active and making its active definition an actual \
cannam@95 8141 % character. What I don't understand is why it works in the *value*
cannam@95 8142 % of the xrdef. Seems like it should be a catcode12 \, and that
cannam@95 8143 % should not typeset properly. But it works, so I'm moving on for
cannam@95 8144 % now. --karl, 15jan04.
cannam@95 8145 \catcode`\\=\other
cannam@95 8146 %
cannam@95 8147 % Make the characters 128-255 be printing characters.
cannam@95 8148 {%
cannam@95 8149 \count1=128
cannam@95 8150 \def\loop{%
cannam@95 8151 \catcode\count1=\other
cannam@95 8152 \advance\count1 by 1
cannam@95 8153 \ifnum \count1<256 \loop \fi
cannam@95 8154 }%
cannam@95 8155 }%
cannam@95 8156 %
cannam@95 8157 % @ is our escape character in .aux files, and we need braces.
cannam@95 8158 \catcode`\{=1
cannam@95 8159 \catcode`\}=2
cannam@95 8160 \catcode`\@=0
cannam@95 8161 }
cannam@95 8162
cannam@95 8163 \def\readdatafile#1{%
cannam@95 8164 \begingroup
cannam@95 8165 \setupdatafile
cannam@95 8166 \input\jobname.#1
cannam@95 8167 \endgroup}
cannam@95 8168
cannam@95 8169
cannam@95 8170 \message{insertions,}
cannam@95 8171 % including footnotes.
cannam@95 8172
cannam@95 8173 \newcount \footnoteno
cannam@95 8174
cannam@95 8175 % The trailing space in the following definition for supereject is
cannam@95 8176 % vital for proper filling; pages come out unaligned when you do a
cannam@95 8177 % pagealignmacro call if that space before the closing brace is
cannam@95 8178 % removed. (Generally, numeric constants should always be followed by a
cannam@95 8179 % space to prevent strange expansion errors.)
cannam@95 8180 \def\supereject{\par\penalty -20000\footnoteno =0 }
cannam@95 8181
cannam@95 8182 % @footnotestyle is meaningful for Info output only.
cannam@95 8183 \let\footnotestyle=\comment
cannam@95 8184
cannam@95 8185 {\catcode `\@=11
cannam@95 8186 %
cannam@95 8187 % Auto-number footnotes. Otherwise like plain.
cannam@95 8188 \gdef\footnote{%
cannam@95 8189 \let\indent=\ptexindent
cannam@95 8190 \let\noindent=\ptexnoindent
cannam@95 8191 \global\advance\footnoteno by \@ne
cannam@95 8192 \edef\thisfootno{$^{\the\footnoteno}$}%
cannam@95 8193 %
cannam@95 8194 % In case the footnote comes at the end of a sentence, preserve the
cannam@95 8195 % extra spacing after we do the footnote number.
cannam@95 8196 \let\@sf\empty
cannam@95 8197 \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
cannam@95 8198 %
cannam@95 8199 % Remove inadvertent blank space before typesetting the footnote number.
cannam@95 8200 \unskip
cannam@95 8201 \thisfootno\@sf
cannam@95 8202 \dofootnote
cannam@95 8203 }%
cannam@95 8204
cannam@95 8205 % Don't bother with the trickery in plain.tex to not require the
cannam@95 8206 % footnote text as a parameter. Our footnotes don't need to be so general.
cannam@95 8207 %
cannam@95 8208 % Oh yes, they do; otherwise, @ifset (and anything else that uses
cannam@95 8209 % \parseargline) fails inside footnotes because the tokens are fixed when
cannam@95 8210 % the footnote is read. --karl, 16nov96.
cannam@95 8211 %
cannam@95 8212 \gdef\dofootnote{%
cannam@95 8213 \insert\footins\bgroup
cannam@95 8214 % We want to typeset this text as a normal paragraph, even if the
cannam@95 8215 % footnote reference occurs in (for example) a display environment.
cannam@95 8216 % So reset some parameters.
cannam@95 8217 \hsize=\pagewidth
cannam@95 8218 \interlinepenalty\interfootnotelinepenalty
cannam@95 8219 \splittopskip\ht\strutbox % top baseline for broken footnotes
cannam@95 8220 \splitmaxdepth\dp\strutbox
cannam@95 8221 \floatingpenalty\@MM
cannam@95 8222 \leftskip\z@skip
cannam@95 8223 \rightskip\z@skip
cannam@95 8224 \spaceskip\z@skip
cannam@95 8225 \xspaceskip\z@skip
cannam@95 8226 \parindent\defaultparindent
cannam@95 8227 %
cannam@95 8228 \smallfonts \rm
cannam@95 8229 %
cannam@95 8230 % Because we use hanging indentation in footnotes, a @noindent appears
cannam@95 8231 % to exdent this text, so make it be a no-op. makeinfo does not use
cannam@95 8232 % hanging indentation so @noindent can still be needed within footnote
cannam@95 8233 % text after an @example or the like (not that this is good style).
cannam@95 8234 \let\noindent = \relax
cannam@95 8235 %
cannam@95 8236 % Hang the footnote text off the number. Use \everypar in case the
cannam@95 8237 % footnote extends for more than one paragraph.
cannam@95 8238 \everypar = {\hang}%
cannam@95 8239 \textindent{\thisfootno}%
cannam@95 8240 %
cannam@95 8241 % Don't crash into the line above the footnote text. Since this
cannam@95 8242 % expands into a box, it must come within the paragraph, lest it
cannam@95 8243 % provide a place where TeX can split the footnote.
cannam@95 8244 \footstrut
cannam@95 8245 %
cannam@95 8246 % Invoke rest of plain TeX footnote routine.
cannam@95 8247 \futurelet\next\fo@t
cannam@95 8248 }
cannam@95 8249 }%end \catcode `\@=11
cannam@95 8250
cannam@95 8251 % In case a @footnote appears in a vbox, save the footnote text and create
cannam@95 8252 % the real \insert just after the vbox finished. Otherwise, the insertion
cannam@95 8253 % would be lost.
cannam@95 8254 % Similarly, if a @footnote appears inside an alignment, save the footnote
cannam@95 8255 % text to a box and make the \insert when a row of the table is finished.
cannam@95 8256 % And the same can be done for other insert classes. --kasal, 16nov03.
cannam@95 8257
cannam@95 8258 % Replace the \insert primitive by a cheating macro.
cannam@95 8259 % Deeper inside, just make sure that the saved insertions are not spilled
cannam@95 8260 % out prematurely.
cannam@95 8261 %
cannam@95 8262 \def\startsavinginserts{%
cannam@95 8263 \ifx \insert\ptexinsert
cannam@95 8264 \let\insert\saveinsert
cannam@95 8265 \else
cannam@95 8266 \let\checkinserts\relax
cannam@95 8267 \fi
cannam@95 8268 }
cannam@95 8269
cannam@95 8270 % This \insert replacement works for both \insert\footins{foo} and
cannam@95 8271 % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
cannam@95 8272 %
cannam@95 8273 \def\saveinsert#1{%
cannam@95 8274 \edef\next{\noexpand\savetobox \makeSAVEname#1}%
cannam@95 8275 \afterassignment\next
cannam@95 8276 % swallow the left brace
cannam@95 8277 \let\temp =
cannam@95 8278 }
cannam@95 8279 \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
cannam@95 8280 \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
cannam@95 8281
cannam@95 8282 \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
cannam@95 8283
cannam@95 8284 \def\placesaveins#1{%
cannam@95 8285 \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
cannam@95 8286 {\box#1}%
cannam@95 8287 }
cannam@95 8288
cannam@95 8289 % eat @SAVE -- beware, all of them have catcode \other:
cannam@95 8290 {
cannam@95 8291 \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
cannam@95 8292 \gdef\gobblesave @SAVE{}
cannam@95 8293 }
cannam@95 8294
cannam@95 8295 % initialization:
cannam@95 8296 \def\newsaveins #1{%
cannam@95 8297 \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
cannam@95 8298 \next
cannam@95 8299 }
cannam@95 8300 \def\newsaveinsX #1{%
cannam@95 8301 \csname newbox\endcsname #1%
cannam@95 8302 \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
cannam@95 8303 \checksaveins #1}%
cannam@95 8304 }
cannam@95 8305
cannam@95 8306 % initialize:
cannam@95 8307 \let\checkinserts\empty
cannam@95 8308 \newsaveins\footins
cannam@95 8309 \newsaveins\margin
cannam@95 8310
cannam@95 8311
cannam@95 8312 % @image. We use the macros from epsf.tex to support this.
cannam@95 8313 % If epsf.tex is not installed and @image is used, we complain.
cannam@95 8314 %
cannam@95 8315 % Check for and read epsf.tex up front. If we read it only at @image
cannam@95 8316 % time, we might be inside a group, and then its definitions would get
cannam@95 8317 % undone and the next image would fail.
cannam@95 8318 \openin 1 = epsf.tex
cannam@95 8319 \ifeof 1 \else
cannam@95 8320 % Do not bother showing banner with epsf.tex v2.7k (available in
cannam@95 8321 % doc/epsf.tex and on ctan).
cannam@95 8322 \def\epsfannounce{\toks0 = }%
cannam@95 8323 \input epsf.tex
cannam@95 8324 \fi
cannam@95 8325 \closein 1
cannam@95 8326 %
cannam@95 8327 % We will only complain once about lack of epsf.tex.
cannam@95 8328 \newif\ifwarnednoepsf
cannam@95 8329 \newhelp\noepsfhelp{epsf.tex must be installed for images to
cannam@95 8330 work. It is also included in the Texinfo distribution, or you can get
cannam@95 8331 it from ftp://tug.org/tex/epsf.tex.}
cannam@95 8332 %
cannam@95 8333 \def\image#1{%
cannam@95 8334 \ifx\epsfbox\thisisundefined
cannam@95 8335 \ifwarnednoepsf \else
cannam@95 8336 \errhelp = \noepsfhelp
cannam@95 8337 \errmessage{epsf.tex not found, images will be ignored}%
cannam@95 8338 \global\warnednoepsftrue
cannam@95 8339 \fi
cannam@95 8340 \else
cannam@95 8341 \imagexxx #1,,,,,\finish
cannam@95 8342 \fi
cannam@95 8343 }
cannam@95 8344 %
cannam@95 8345 % Arguments to @image:
cannam@95 8346 % #1 is (mandatory) image filename; we tack on .eps extension.
cannam@95 8347 % #2 is (optional) width, #3 is (optional) height.
cannam@95 8348 % #4 is (ignored optional) html alt text.
cannam@95 8349 % #5 is (ignored optional) extension.
cannam@95 8350 % #6 is just the usual extra ignored arg for parsing stuff.
cannam@95 8351 \newif\ifimagevmode
cannam@95 8352 \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
cannam@95 8353 \catcode`\^^M = 5 % in case we're inside an example
cannam@95 8354 \normalturnoffactive % allow _ et al. in names
cannam@95 8355 % If the image is by itself, center it.
cannam@95 8356 \ifvmode
cannam@95 8357 \imagevmodetrue
cannam@95 8358 \else \ifx\centersub\centerV
cannam@95 8359 % for @center @image, we need a vbox so we can have our vertical space
cannam@95 8360 \imagevmodetrue
cannam@95 8361 \vbox\bgroup % vbox has better behavior than vtop herev
cannam@95 8362 \fi\fi
cannam@95 8363 %
cannam@95 8364 \ifimagevmode
cannam@95 8365 \nobreak\medskip
cannam@95 8366 % Usually we'll have text after the image which will insert
cannam@95 8367 % \parskip glue, so insert it here too to equalize the space
cannam@95 8368 % above and below.
cannam@95 8369 \nobreak\vskip\parskip
cannam@95 8370 \nobreak
cannam@95 8371 \fi
cannam@95 8372 %
cannam@95 8373 % Leave vertical mode so that indentation from an enclosing
cannam@95 8374 % environment such as @quotation is respected.
cannam@95 8375 % However, if we're at the top level, we don't want the
cannam@95 8376 % normal paragraph indentation.
cannam@95 8377 % On the other hand, if we are in the case of @center @image, we don't
cannam@95 8378 % want to start a paragraph, which will create a hsize-width box and
cannam@95 8379 % eradicate the centering.
cannam@95 8380 \ifx\centersub\centerV\else \noindent \fi
cannam@95 8381 %
cannam@95 8382 % Output the image.
cannam@95 8383 \ifpdf
cannam@95 8384 \dopdfimage{#1}{#2}{#3}%
cannam@95 8385 \else
cannam@95 8386 % \epsfbox itself resets \epsf?size at each figure.
cannam@95 8387 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
cannam@95 8388 \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
cannam@95 8389 \epsfbox{#1.eps}%
cannam@95 8390 \fi
cannam@95 8391 %
cannam@95 8392 \ifimagevmode
cannam@95 8393 \medskip % space after a standalone image
cannam@95 8394 \fi
cannam@95 8395 \ifx\centersub\centerV \egroup \fi
cannam@95 8396 \endgroup}
cannam@95 8397
cannam@95 8398
cannam@95 8399 % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
cannam@95 8400 % etc. We don't actually implement floating yet, we always include the
cannam@95 8401 % float "here". But it seemed the best name for the future.
cannam@95 8402 %
cannam@95 8403 \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
cannam@95 8404
cannam@95 8405 % There may be a space before second and/or third parameter; delete it.
cannam@95 8406 \def\eatcommaspace#1, {#1,}
cannam@95 8407
cannam@95 8408 % #1 is the optional FLOATTYPE, the text label for this float, typically
cannam@95 8409 % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
cannam@95 8410 % this float will not be numbered and cannot be referred to.
cannam@95 8411 %
cannam@95 8412 % #2 is the optional xref label. Also must be present for the float to
cannam@95 8413 % be referable.
cannam@95 8414 %
cannam@95 8415 % #3 is the optional positioning argument; for now, it is ignored. It
cannam@95 8416 % will somehow specify the positions allowed to float to (here, top, bottom).
cannam@95 8417 %
cannam@95 8418 % We keep a separate counter for each FLOATTYPE, which we reset at each
cannam@95 8419 % chapter-level command.
cannam@95 8420 \let\resetallfloatnos=\empty
cannam@95 8421 %
cannam@95 8422 \def\dofloat#1,#2,#3,#4\finish{%
cannam@95 8423 \let\thiscaption=\empty
cannam@95 8424 \let\thisshortcaption=\empty
cannam@95 8425 %
cannam@95 8426 % don't lose footnotes inside @float.
cannam@95 8427 %
cannam@95 8428 % BEWARE: when the floats start float, we have to issue warning whenever an
cannam@95 8429 % insert appears inside a float which could possibly float. --kasal, 26may04
cannam@95 8430 %
cannam@95 8431 \startsavinginserts
cannam@95 8432 %
cannam@95 8433 % We can't be used inside a paragraph.
cannam@95 8434 \par
cannam@95 8435 %
cannam@95 8436 \vtop\bgroup
cannam@95 8437 \def\floattype{#1}%
cannam@95 8438 \def\floatlabel{#2}%
cannam@95 8439 \def\floatloc{#3}% we do nothing with this yet.
cannam@95 8440 %
cannam@95 8441 \ifx\floattype\empty
cannam@95 8442 \let\safefloattype=\empty
cannam@95 8443 \else
cannam@95 8444 {%
cannam@95 8445 % the floattype might have accents or other special characters,
cannam@95 8446 % but we need to use it in a control sequence name.
cannam@95 8447 \indexnofonts
cannam@95 8448 \turnoffactive
cannam@95 8449 \xdef\safefloattype{\floattype}%
cannam@95 8450 }%
cannam@95 8451 \fi
cannam@95 8452 %
cannam@95 8453 % If label is given but no type, we handle that as the empty type.
cannam@95 8454 \ifx\floatlabel\empty \else
cannam@95 8455 % We want each FLOATTYPE to be numbered separately (Figure 1,
cannam@95 8456 % Table 1, Figure 2, ...). (And if no label, no number.)
cannam@95 8457 %
cannam@95 8458 \expandafter\getfloatno\csname\safefloattype floatno\endcsname
cannam@95 8459 \global\advance\floatno by 1
cannam@95 8460 %
cannam@95 8461 {%
cannam@95 8462 % This magic value for \lastsection is output by \setref as the
cannam@95 8463 % XREFLABEL-title value. \xrefX uses it to distinguish float
cannam@95 8464 % labels (which have a completely different output format) from
cannam@95 8465 % node and anchor labels. And \xrdef uses it to construct the
cannam@95 8466 % lists of floats.
cannam@95 8467 %
cannam@95 8468 \edef\lastsection{\floatmagic=\safefloattype}%
cannam@95 8469 \setref{\floatlabel}{Yfloat}%
cannam@95 8470 }%
cannam@95 8471 \fi
cannam@95 8472 %
cannam@95 8473 % start with \parskip glue, I guess.
cannam@95 8474 \vskip\parskip
cannam@95 8475 %
cannam@95 8476 % Don't suppress indentation if a float happens to start a section.
cannam@95 8477 \restorefirstparagraphindent
cannam@95 8478 }
cannam@95 8479
cannam@95 8480 % we have these possibilities:
cannam@95 8481 % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
cannam@95 8482 % @float Foo,lbl & no caption: Foo 1.1
cannam@95 8483 % @float Foo & @caption{Cap}: Foo: Cap
cannam@95 8484 % @float Foo & no caption: Foo
cannam@95 8485 % @float ,lbl & Caption{Cap}: 1.1: Cap
cannam@95 8486 % @float ,lbl & no caption: 1.1
cannam@95 8487 % @float & @caption{Cap}: Cap
cannam@95 8488 % @float & no caption:
cannam@95 8489 %
cannam@95 8490 \def\Efloat{%
cannam@95 8491 \let\floatident = \empty
cannam@95 8492 %
cannam@95 8493 % In all cases, if we have a float type, it comes first.
cannam@95 8494 \ifx\floattype\empty \else \def\floatident{\floattype}\fi
cannam@95 8495 %
cannam@95 8496 % If we have an xref label, the number comes next.
cannam@95 8497 \ifx\floatlabel\empty \else
cannam@95 8498 \ifx\floattype\empty \else % if also had float type, need tie first.
cannam@95 8499 \appendtomacro\floatident{\tie}%
cannam@95 8500 \fi
cannam@95 8501 % the number.
cannam@95 8502 \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
cannam@95 8503 \fi
cannam@95 8504 %
cannam@95 8505 % Start the printed caption with what we've constructed in
cannam@95 8506 % \floatident, but keep it separate; we need \floatident again.
cannam@95 8507 \let\captionline = \floatident
cannam@95 8508 %
cannam@95 8509 \ifx\thiscaption\empty \else
cannam@95 8510 \ifx\floatident\empty \else
cannam@95 8511 \appendtomacro\captionline{: }% had ident, so need a colon between
cannam@95 8512 \fi
cannam@95 8513 %
cannam@95 8514 % caption text.
cannam@95 8515 \appendtomacro\captionline{\scanexp\thiscaption}%
cannam@95 8516 \fi
cannam@95 8517 %
cannam@95 8518 % If we have anything to print, print it, with space before.
cannam@95 8519 % Eventually this needs to become an \insert.
cannam@95 8520 \ifx\captionline\empty \else
cannam@95 8521 \vskip.5\parskip
cannam@95 8522 \captionline
cannam@95 8523 %
cannam@95 8524 % Space below caption.
cannam@95 8525 \vskip\parskip
cannam@95 8526 \fi
cannam@95 8527 %
cannam@95 8528 % If have an xref label, write the list of floats info. Do this
cannam@95 8529 % after the caption, to avoid chance of it being a breakpoint.
cannam@95 8530 \ifx\floatlabel\empty \else
cannam@95 8531 % Write the text that goes in the lof to the aux file as
cannam@95 8532 % \floatlabel-lof. Besides \floatident, we include the short
cannam@95 8533 % caption if specified, else the full caption if specified, else nothing.
cannam@95 8534 {%
cannam@95 8535 \atdummies
cannam@95 8536 %
cannam@95 8537 % since we read the caption text in the macro world, where ^^M
cannam@95 8538 % is turned into a normal character, we have to scan it back, so
cannam@95 8539 % we don't write the literal three characters "^^M" into the aux file.
cannam@95 8540 \scanexp{%
cannam@95 8541 \xdef\noexpand\gtemp{%
cannam@95 8542 \ifx\thisshortcaption\empty
cannam@95 8543 \thiscaption
cannam@95 8544 \else
cannam@95 8545 \thisshortcaption
cannam@95 8546 \fi
cannam@95 8547 }%
cannam@95 8548 }%
cannam@95 8549 \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
cannam@95 8550 \ifx\gtemp\empty \else : \gtemp \fi}}%
cannam@95 8551 }%
cannam@95 8552 \fi
cannam@95 8553 \egroup % end of \vtop
cannam@95 8554 %
cannam@95 8555 % place the captured inserts
cannam@95 8556 %
cannam@95 8557 % BEWARE: when the floats start floating, we have to issue warning
cannam@95 8558 % whenever an insert appears inside a float which could possibly
cannam@95 8559 % float. --kasal, 26may04
cannam@95 8560 %
cannam@95 8561 \checkinserts
cannam@95 8562 }
cannam@95 8563
cannam@95 8564 % Append the tokens #2 to the definition of macro #1, not expanding either.
cannam@95 8565 %
cannam@95 8566 \def\appendtomacro#1#2{%
cannam@95 8567 \expandafter\def\expandafter#1\expandafter{#1#2}%
cannam@95 8568 }
cannam@95 8569
cannam@95 8570 % @caption, @shortcaption
cannam@95 8571 %
cannam@95 8572 \def\caption{\docaption\thiscaption}
cannam@95 8573 \def\shortcaption{\docaption\thisshortcaption}
cannam@95 8574 \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
cannam@95 8575 \def\defcaption#1#2{\egroup \def#1{#2}}
cannam@95 8576
cannam@95 8577 % The parameter is the control sequence identifying the counter we are
cannam@95 8578 % going to use. Create it if it doesn't exist and assign it to \floatno.
cannam@95 8579 \def\getfloatno#1{%
cannam@95 8580 \ifx#1\relax
cannam@95 8581 % Haven't seen this figure type before.
cannam@95 8582 \csname newcount\endcsname #1%
cannam@95 8583 %
cannam@95 8584 % Remember to reset this floatno at the next chap.
cannam@95 8585 \expandafter\gdef\expandafter\resetallfloatnos
cannam@95 8586 \expandafter{\resetallfloatnos #1=0 }%
cannam@95 8587 \fi
cannam@95 8588 \let\floatno#1%
cannam@95 8589 }
cannam@95 8590
cannam@95 8591 % \setref calls this to get the XREFLABEL-snt value. We want an @xref
cannam@95 8592 % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
cannam@95 8593 % first read the @float command.
cannam@95 8594 %
cannam@95 8595 \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
cannam@95 8596
cannam@95 8597 % Magic string used for the XREFLABEL-title value, so \xrefX can
cannam@95 8598 % distinguish floats from other xref types.
cannam@95 8599 \def\floatmagic{!!float!!}
cannam@95 8600
cannam@95 8601 % #1 is the control sequence we are passed; we expand into a conditional
cannam@95 8602 % which is true if #1 represents a float ref. That is, the magic
cannam@95 8603 % \lastsection value which we \setref above.
cannam@95 8604 %
cannam@95 8605 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
cannam@95 8606 %
cannam@95 8607 % #1 is (maybe) the \floatmagic string. If so, #2 will be the
cannam@95 8608 % (safe) float type for this float. We set \iffloattype to #2.
cannam@95 8609 %
cannam@95 8610 \def\doiffloat#1=#2=#3\finish{%
cannam@95 8611 \def\temp{#1}%
cannam@95 8612 \def\iffloattype{#2}%
cannam@95 8613 \ifx\temp\floatmagic
cannam@95 8614 }
cannam@95 8615
cannam@95 8616 % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
cannam@95 8617 %
cannam@95 8618 \parseargdef\listoffloats{%
cannam@95 8619 \def\floattype{#1}% floattype
cannam@95 8620 {%
cannam@95 8621 % the floattype might have accents or other special characters,
cannam@95 8622 % but we need to use it in a control sequence name.
cannam@95 8623 \indexnofonts
cannam@95 8624 \turnoffactive
cannam@95 8625 \xdef\safefloattype{\floattype}%
cannam@95 8626 }%
cannam@95 8627 %
cannam@95 8628 % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
cannam@95 8629 \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
cannam@95 8630 \ifhavexrefs
cannam@95 8631 % if the user said @listoffloats foo but never @float foo.
cannam@95 8632 \message{\linenumber No `\safefloattype' floats to list.}%
cannam@95 8633 \fi
cannam@95 8634 \else
cannam@95 8635 \begingroup
cannam@95 8636 \leftskip=\tocindent % indent these entries like a toc
cannam@95 8637 \let\do=\listoffloatsdo
cannam@95 8638 \csname floatlist\safefloattype\endcsname
cannam@95 8639 \endgroup
cannam@95 8640 \fi
cannam@95 8641 }
cannam@95 8642
cannam@95 8643 % This is called on each entry in a list of floats. We're passed the
cannam@95 8644 % xref label, in the form LABEL-title, which is how we save it in the
cannam@95 8645 % aux file. We strip off the -title and look up \XRLABEL-lof, which
cannam@95 8646 % has the text we're supposed to typeset here.
cannam@95 8647 %
cannam@95 8648 % Figures without xref labels will not be included in the list (since
cannam@95 8649 % they won't appear in the aux file).
cannam@95 8650 %
cannam@95 8651 \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
cannam@95 8652 \def\listoffloatsdoentry#1-title\finish{{%
cannam@95 8653 % Can't fully expand XR#1-lof because it can contain anything. Just
cannam@95 8654 % pass the control sequence. On the other hand, XR#1-pg is just the
cannam@95 8655 % page number, and we want to fully expand that so we can get a link
cannam@95 8656 % in pdf output.
cannam@95 8657 \toksA = \expandafter{\csname XR#1-lof\endcsname}%
cannam@95 8658 %
cannam@95 8659 % use the same \entry macro we use to generate the TOC and index.
cannam@95 8660 \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
cannam@95 8661 \writeentry
cannam@95 8662 }}
cannam@95 8663
cannam@95 8664
cannam@95 8665 \message{localization,}
cannam@95 8666
cannam@95 8667 % For single-language documents, @documentlanguage is usually given very
cannam@95 8668 % early, just after @documentencoding. Single argument is the language
cannam@95 8669 % (de) or locale (de_DE) abbreviation.
cannam@95 8670 %
cannam@95 8671 {
cannam@95 8672 \catcode`\_ = \active
cannam@95 8673 \globaldefs=1
cannam@95 8674 \parseargdef\documentlanguage{\begingroup
cannam@95 8675 \let_=\normalunderscore % normal _ character for filenames
cannam@95 8676 \tex % read txi-??.tex file in plain TeX.
cannam@95 8677 % Read the file by the name they passed if it exists.
cannam@95 8678 \openin 1 txi-#1.tex
cannam@95 8679 \ifeof 1
cannam@95 8680 \documentlanguagetrywithoutunderscore{#1_\finish}%
cannam@95 8681 \else
cannam@95 8682 \globaldefs = 1 % everything in the txi-LL files needs to persist
cannam@95 8683 \input txi-#1.tex
cannam@95 8684 \fi
cannam@95 8685 \closein 1
cannam@95 8686 \endgroup % end raw TeX
cannam@95 8687 \endgroup}
cannam@95 8688 %
cannam@95 8689 % If they passed de_DE, and txi-de_DE.tex doesn't exist,
cannam@95 8690 % try txi-de.tex.
cannam@95 8691 %
cannam@95 8692 \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
cannam@95 8693 \openin 1 txi-#1.tex
cannam@95 8694 \ifeof 1
cannam@95 8695 \errhelp = \nolanghelp
cannam@95 8696 \errmessage{Cannot read language file txi-#1.tex}%
cannam@95 8697 \else
cannam@95 8698 \globaldefs = 1 % everything in the txi-LL files needs to persist
cannam@95 8699 \input txi-#1.tex
cannam@95 8700 \fi
cannam@95 8701 \closein 1
cannam@95 8702 }
cannam@95 8703 }% end of special _ catcode
cannam@95 8704 %
cannam@95 8705 \newhelp\nolanghelp{The given language definition file cannot be found or
cannam@95 8706 is empty. Maybe you need to install it? Putting it in the current
cannam@95 8707 directory should work if nowhere else does.}
cannam@95 8708
cannam@95 8709 % This macro is called from txi-??.tex files; the first argument is the
cannam@95 8710 % \language name to set (without the "\lang@" prefix), the second and
cannam@95 8711 % third args are \{left,right}hyphenmin.
cannam@95 8712 %
cannam@95 8713 % The language names to pass are determined when the format is built.
cannam@95 8714 % See the etex.log file created at that time, e.g.,
cannam@95 8715 % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
cannam@95 8716 %
cannam@95 8717 % With TeX Live 2008, etex now includes hyphenation patterns for all
cannam@95 8718 % available languages. This means we can support hyphenation in
cannam@95 8719 % Texinfo, at least to some extent. (This still doesn't solve the
cannam@95 8720 % accented characters problem.)
cannam@95 8721 %
cannam@95 8722 \catcode`@=11
cannam@95 8723 \def\txisetlanguage#1#2#3{%
cannam@95 8724 % do not set the language if the name is undefined in the current TeX.
cannam@95 8725 \expandafter\ifx\csname lang@#1\endcsname \relax
cannam@95 8726 \message{no patterns for #1}%
cannam@95 8727 \else
cannam@95 8728 \global\language = \csname lang@#1\endcsname
cannam@95 8729 \fi
cannam@95 8730 % but there is no harm in adjusting the hyphenmin values regardless.
cannam@95 8731 \global\lefthyphenmin = #2\relax
cannam@95 8732 \global\righthyphenmin = #3\relax
cannam@95 8733 }
cannam@95 8734
cannam@95 8735 % Helpers for encodings.
cannam@95 8736 % Set the catcode of characters 128 through 255 to the specified number.
cannam@95 8737 %
cannam@95 8738 \def\setnonasciicharscatcode#1{%
cannam@95 8739 \count255=128
cannam@95 8740 \loop\ifnum\count255<256
cannam@95 8741 \global\catcode\count255=#1\relax
cannam@95 8742 \advance\count255 by 1
cannam@95 8743 \repeat
cannam@95 8744 }
cannam@95 8745
cannam@95 8746 \def\setnonasciicharscatcodenonglobal#1{%
cannam@95 8747 \count255=128
cannam@95 8748 \loop\ifnum\count255<256
cannam@95 8749 \catcode\count255=#1\relax
cannam@95 8750 \advance\count255 by 1
cannam@95 8751 \repeat
cannam@95 8752 }
cannam@95 8753
cannam@95 8754 % @documentencoding sets the definition of non-ASCII characters
cannam@95 8755 % according to the specified encoding.
cannam@95 8756 %
cannam@95 8757 \parseargdef\documentencoding{%
cannam@95 8758 % Encoding being declared for the document.
cannam@95 8759 \def\declaredencoding{\csname #1.enc\endcsname}%
cannam@95 8760 %
cannam@95 8761 % Supported encodings: names converted to tokens in order to be able
cannam@95 8762 % to compare them with \ifx.
cannam@95 8763 \def\ascii{\csname US-ASCII.enc\endcsname}%
cannam@95 8764 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
cannam@95 8765 \def\latone{\csname ISO-8859-1.enc\endcsname}%
cannam@95 8766 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
cannam@95 8767 \def\utfeight{\csname UTF-8.enc\endcsname}%
cannam@95 8768 %
cannam@95 8769 \ifx \declaredencoding \ascii
cannam@95 8770 \asciichardefs
cannam@95 8771 %
cannam@95 8772 \else \ifx \declaredencoding \lattwo
cannam@95 8773 \setnonasciicharscatcode\active
cannam@95 8774 \lattwochardefs
cannam@95 8775 %
cannam@95 8776 \else \ifx \declaredencoding \latone
cannam@95 8777 \setnonasciicharscatcode\active
cannam@95 8778 \latonechardefs
cannam@95 8779 %
cannam@95 8780 \else \ifx \declaredencoding \latnine
cannam@95 8781 \setnonasciicharscatcode\active
cannam@95 8782 \latninechardefs
cannam@95 8783 %
cannam@95 8784 \else \ifx \declaredencoding \utfeight
cannam@95 8785 \setnonasciicharscatcode\active
cannam@95 8786 \utfeightchardefs
cannam@95 8787 %
cannam@95 8788 \else
cannam@95 8789 \message{Unknown document encoding #1, ignoring.}%
cannam@95 8790 %
cannam@95 8791 \fi % utfeight
cannam@95 8792 \fi % latnine
cannam@95 8793 \fi % latone
cannam@95 8794 \fi % lattwo
cannam@95 8795 \fi % ascii
cannam@95 8796 }
cannam@95 8797
cannam@95 8798 % A message to be logged when using a character that isn't available
cannam@95 8799 % the default font encoding (OT1).
cannam@95 8800 %
cannam@95 8801 \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
cannam@95 8802
cannam@95 8803 % Take account of \c (plain) vs. \, (Texinfo) difference.
cannam@95 8804 \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
cannam@95 8805
cannam@95 8806 % First, make active non-ASCII characters in order for them to be
cannam@95 8807 % correctly categorized when TeX reads the replacement text of
cannam@95 8808 % macros containing the character definitions.
cannam@95 8809 \setnonasciicharscatcode\active
cannam@95 8810 %
cannam@95 8811 % Latin1 (ISO-8859-1) character definitions.
cannam@95 8812 \def\latonechardefs{%
cannam@95 8813 \gdef^^a0{\tie}
cannam@95 8814 \gdef^^a1{\exclamdown}
cannam@95 8815 \gdef^^a2{\missingcharmsg{CENT SIGN}}
cannam@95 8816 \gdef^^a3{{\pounds}}
cannam@95 8817 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
cannam@95 8818 \gdef^^a5{\missingcharmsg{YEN SIGN}}
cannam@95 8819 \gdef^^a6{\missingcharmsg{BROKEN BAR}}
cannam@95 8820 \gdef^^a7{\S}
cannam@95 8821 \gdef^^a8{\"{}}
cannam@95 8822 \gdef^^a9{\copyright}
cannam@95 8823 \gdef^^aa{\ordf}
cannam@95 8824 \gdef^^ab{\guillemetleft}
cannam@95 8825 \gdef^^ac{$\lnot$}
cannam@95 8826 \gdef^^ad{\-}
cannam@95 8827 \gdef^^ae{\registeredsymbol}
cannam@95 8828 \gdef^^af{\={}}
cannam@95 8829 %
cannam@95 8830 \gdef^^b0{\textdegree}
cannam@95 8831 \gdef^^b1{$\pm$}
cannam@95 8832 \gdef^^b2{$^2$}
cannam@95 8833 \gdef^^b3{$^3$}
cannam@95 8834 \gdef^^b4{\'{}}
cannam@95 8835 \gdef^^b5{$\mu$}
cannam@95 8836 \gdef^^b6{\P}
cannam@95 8837 %
cannam@95 8838 \gdef^^b7{$^.$}
cannam@95 8839 \gdef^^b8{\cedilla\ }
cannam@95 8840 \gdef^^b9{$^1$}
cannam@95 8841 \gdef^^ba{\ordm}
cannam@95 8842 %
cannam@95 8843 \gdef^^bb{\guillemetright}
cannam@95 8844 \gdef^^bc{$1\over4$}
cannam@95 8845 \gdef^^bd{$1\over2$}
cannam@95 8846 \gdef^^be{$3\over4$}
cannam@95 8847 \gdef^^bf{\questiondown}
cannam@95 8848 %
cannam@95 8849 \gdef^^c0{\`A}
cannam@95 8850 \gdef^^c1{\'A}
cannam@95 8851 \gdef^^c2{\^A}
cannam@95 8852 \gdef^^c3{\~A}
cannam@95 8853 \gdef^^c4{\"A}
cannam@95 8854 \gdef^^c5{\ringaccent A}
cannam@95 8855 \gdef^^c6{\AE}
cannam@95 8856 \gdef^^c7{\cedilla C}
cannam@95 8857 \gdef^^c8{\`E}
cannam@95 8858 \gdef^^c9{\'E}
cannam@95 8859 \gdef^^ca{\^E}
cannam@95 8860 \gdef^^cb{\"E}
cannam@95 8861 \gdef^^cc{\`I}
cannam@95 8862 \gdef^^cd{\'I}
cannam@95 8863 \gdef^^ce{\^I}
cannam@95 8864 \gdef^^cf{\"I}
cannam@95 8865 %
cannam@95 8866 \gdef^^d0{\DH}
cannam@95 8867 \gdef^^d1{\~N}
cannam@95 8868 \gdef^^d2{\`O}
cannam@95 8869 \gdef^^d3{\'O}
cannam@95 8870 \gdef^^d4{\^O}
cannam@95 8871 \gdef^^d5{\~O}
cannam@95 8872 \gdef^^d6{\"O}
cannam@95 8873 \gdef^^d7{$\times$}
cannam@95 8874 \gdef^^d8{\O}
cannam@95 8875 \gdef^^d9{\`U}
cannam@95 8876 \gdef^^da{\'U}
cannam@95 8877 \gdef^^db{\^U}
cannam@95 8878 \gdef^^dc{\"U}
cannam@95 8879 \gdef^^dd{\'Y}
cannam@95 8880 \gdef^^de{\TH}
cannam@95 8881 \gdef^^df{\ss}
cannam@95 8882 %
cannam@95 8883 \gdef^^e0{\`a}
cannam@95 8884 \gdef^^e1{\'a}
cannam@95 8885 \gdef^^e2{\^a}
cannam@95 8886 \gdef^^e3{\~a}
cannam@95 8887 \gdef^^e4{\"a}
cannam@95 8888 \gdef^^e5{\ringaccent a}
cannam@95 8889 \gdef^^e6{\ae}
cannam@95 8890 \gdef^^e7{\cedilla c}
cannam@95 8891 \gdef^^e8{\`e}
cannam@95 8892 \gdef^^e9{\'e}
cannam@95 8893 \gdef^^ea{\^e}
cannam@95 8894 \gdef^^eb{\"e}
cannam@95 8895 \gdef^^ec{\`{\dotless i}}
cannam@95 8896 \gdef^^ed{\'{\dotless i}}
cannam@95 8897 \gdef^^ee{\^{\dotless i}}
cannam@95 8898 \gdef^^ef{\"{\dotless i}}
cannam@95 8899 %
cannam@95 8900 \gdef^^f0{\dh}
cannam@95 8901 \gdef^^f1{\~n}
cannam@95 8902 \gdef^^f2{\`o}
cannam@95 8903 \gdef^^f3{\'o}
cannam@95 8904 \gdef^^f4{\^o}
cannam@95 8905 \gdef^^f5{\~o}
cannam@95 8906 \gdef^^f6{\"o}
cannam@95 8907 \gdef^^f7{$\div$}
cannam@95 8908 \gdef^^f8{\o}
cannam@95 8909 \gdef^^f9{\`u}
cannam@95 8910 \gdef^^fa{\'u}
cannam@95 8911 \gdef^^fb{\^u}
cannam@95 8912 \gdef^^fc{\"u}
cannam@95 8913 \gdef^^fd{\'y}
cannam@95 8914 \gdef^^fe{\th}
cannam@95 8915 \gdef^^ff{\"y}
cannam@95 8916 }
cannam@95 8917
cannam@95 8918 % Latin9 (ISO-8859-15) encoding character definitions.
cannam@95 8919 \def\latninechardefs{%
cannam@95 8920 % Encoding is almost identical to Latin1.
cannam@95 8921 \latonechardefs
cannam@95 8922 %
cannam@95 8923 \gdef^^a4{\euro}
cannam@95 8924 \gdef^^a6{\v S}
cannam@95 8925 \gdef^^a8{\v s}
cannam@95 8926 \gdef^^b4{\v Z}
cannam@95 8927 \gdef^^b8{\v z}
cannam@95 8928 \gdef^^bc{\OE}
cannam@95 8929 \gdef^^bd{\oe}
cannam@95 8930 \gdef^^be{\"Y}
cannam@95 8931 }
cannam@95 8932
cannam@95 8933 % Latin2 (ISO-8859-2) character definitions.
cannam@95 8934 \def\lattwochardefs{%
cannam@95 8935 \gdef^^a0{\tie}
cannam@95 8936 \gdef^^a1{\ogonek{A}}
cannam@95 8937 \gdef^^a2{\u{}}
cannam@95 8938 \gdef^^a3{\L}
cannam@95 8939 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
cannam@95 8940 \gdef^^a5{\v L}
cannam@95 8941 \gdef^^a6{\'S}
cannam@95 8942 \gdef^^a7{\S}
cannam@95 8943 \gdef^^a8{\"{}}
cannam@95 8944 \gdef^^a9{\v S}
cannam@95 8945 \gdef^^aa{\cedilla S}
cannam@95 8946 \gdef^^ab{\v T}
cannam@95 8947 \gdef^^ac{\'Z}
cannam@95 8948 \gdef^^ad{\-}
cannam@95 8949 \gdef^^ae{\v Z}
cannam@95 8950 \gdef^^af{\dotaccent Z}
cannam@95 8951 %
cannam@95 8952 \gdef^^b0{\textdegree}
cannam@95 8953 \gdef^^b1{\ogonek{a}}
cannam@95 8954 \gdef^^b2{\ogonek{ }}
cannam@95 8955 \gdef^^b3{\l}
cannam@95 8956 \gdef^^b4{\'{}}
cannam@95 8957 \gdef^^b5{\v l}
cannam@95 8958 \gdef^^b6{\'s}
cannam@95 8959 \gdef^^b7{\v{}}
cannam@95 8960 \gdef^^b8{\cedilla\ }
cannam@95 8961 \gdef^^b9{\v s}
cannam@95 8962 \gdef^^ba{\cedilla s}
cannam@95 8963 \gdef^^bb{\v t}
cannam@95 8964 \gdef^^bc{\'z}
cannam@95 8965 \gdef^^bd{\H{}}
cannam@95 8966 \gdef^^be{\v z}
cannam@95 8967 \gdef^^bf{\dotaccent z}
cannam@95 8968 %
cannam@95 8969 \gdef^^c0{\'R}
cannam@95 8970 \gdef^^c1{\'A}
cannam@95 8971 \gdef^^c2{\^A}
cannam@95 8972 \gdef^^c3{\u A}
cannam@95 8973 \gdef^^c4{\"A}
cannam@95 8974 \gdef^^c5{\'L}
cannam@95 8975 \gdef^^c6{\'C}
cannam@95 8976 \gdef^^c7{\cedilla C}
cannam@95 8977 \gdef^^c8{\v C}
cannam@95 8978 \gdef^^c9{\'E}
cannam@95 8979 \gdef^^ca{\ogonek{E}}
cannam@95 8980 \gdef^^cb{\"E}
cannam@95 8981 \gdef^^cc{\v E}
cannam@95 8982 \gdef^^cd{\'I}
cannam@95 8983 \gdef^^ce{\^I}
cannam@95 8984 \gdef^^cf{\v D}
cannam@95 8985 %
cannam@95 8986 \gdef^^d0{\DH}
cannam@95 8987 \gdef^^d1{\'N}
cannam@95 8988 \gdef^^d2{\v N}
cannam@95 8989 \gdef^^d3{\'O}
cannam@95 8990 \gdef^^d4{\^O}
cannam@95 8991 \gdef^^d5{\H O}
cannam@95 8992 \gdef^^d6{\"O}
cannam@95 8993 \gdef^^d7{$\times$}
cannam@95 8994 \gdef^^d8{\v R}
cannam@95 8995 \gdef^^d9{\ringaccent U}
cannam@95 8996 \gdef^^da{\'U}
cannam@95 8997 \gdef^^db{\H U}
cannam@95 8998 \gdef^^dc{\"U}
cannam@95 8999 \gdef^^dd{\'Y}
cannam@95 9000 \gdef^^de{\cedilla T}
cannam@95 9001 \gdef^^df{\ss}
cannam@95 9002 %
cannam@95 9003 \gdef^^e0{\'r}
cannam@95 9004 \gdef^^e1{\'a}
cannam@95 9005 \gdef^^e2{\^a}
cannam@95 9006 \gdef^^e3{\u a}
cannam@95 9007 \gdef^^e4{\"a}
cannam@95 9008 \gdef^^e5{\'l}
cannam@95 9009 \gdef^^e6{\'c}
cannam@95 9010 \gdef^^e7{\cedilla c}
cannam@95 9011 \gdef^^e8{\v c}
cannam@95 9012 \gdef^^e9{\'e}
cannam@95 9013 \gdef^^ea{\ogonek{e}}
cannam@95 9014 \gdef^^eb{\"e}
cannam@95 9015 \gdef^^ec{\v e}
cannam@95 9016 \gdef^^ed{\'{\dotless{i}}}
cannam@95 9017 \gdef^^ee{\^{\dotless{i}}}
cannam@95 9018 \gdef^^ef{\v d}
cannam@95 9019 %
cannam@95 9020 \gdef^^f0{\dh}
cannam@95 9021 \gdef^^f1{\'n}
cannam@95 9022 \gdef^^f2{\v n}
cannam@95 9023 \gdef^^f3{\'o}
cannam@95 9024 \gdef^^f4{\^o}
cannam@95 9025 \gdef^^f5{\H o}
cannam@95 9026 \gdef^^f6{\"o}
cannam@95 9027 \gdef^^f7{$\div$}
cannam@95 9028 \gdef^^f8{\v r}
cannam@95 9029 \gdef^^f9{\ringaccent u}
cannam@95 9030 \gdef^^fa{\'u}
cannam@95 9031 \gdef^^fb{\H u}
cannam@95 9032 \gdef^^fc{\"u}
cannam@95 9033 \gdef^^fd{\'y}
cannam@95 9034 \gdef^^fe{\cedilla t}
cannam@95 9035 \gdef^^ff{\dotaccent{}}
cannam@95 9036 }
cannam@95 9037
cannam@95 9038 % UTF-8 character definitions.
cannam@95 9039 %
cannam@95 9040 % This code to support UTF-8 is based on LaTeX's utf8.def, with some
cannam@95 9041 % changes for Texinfo conventions. It is included here under the GPL by
cannam@95 9042 % permission from Frank Mittelbach and the LaTeX team.
cannam@95 9043 %
cannam@95 9044 \newcount\countUTFx
cannam@95 9045 \newcount\countUTFy
cannam@95 9046 \newcount\countUTFz
cannam@95 9047
cannam@95 9048 \gdef\UTFviiiTwoOctets#1#2{\expandafter
cannam@95 9049 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
cannam@95 9050 %
cannam@95 9051 \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
cannam@95 9052 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
cannam@95 9053 %
cannam@95 9054 \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
cannam@95 9055 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
cannam@95 9056
cannam@95 9057 \gdef\UTFviiiDefined#1{%
cannam@95 9058 \ifx #1\relax
cannam@95 9059 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
cannam@95 9060 \else
cannam@95 9061 \expandafter #1%
cannam@95 9062 \fi
cannam@95 9063 }
cannam@95 9064
cannam@95 9065 \begingroup
cannam@95 9066 \catcode`\~13
cannam@95 9067 \catcode`\"12
cannam@95 9068
cannam@95 9069 \def\UTFviiiLoop{%
cannam@95 9070 \global\catcode\countUTFx\active
cannam@95 9071 \uccode`\~\countUTFx
cannam@95 9072 \uppercase\expandafter{\UTFviiiTmp}%
cannam@95 9073 \advance\countUTFx by 1
cannam@95 9074 \ifnum\countUTFx < \countUTFy
cannam@95 9075 \expandafter\UTFviiiLoop
cannam@95 9076 \fi}
cannam@95 9077
cannam@95 9078 \countUTFx = "C2
cannam@95 9079 \countUTFy = "E0
cannam@95 9080 \def\UTFviiiTmp{%
cannam@95 9081 \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
cannam@95 9082 \UTFviiiLoop
cannam@95 9083
cannam@95 9084 \countUTFx = "E0
cannam@95 9085 \countUTFy = "F0
cannam@95 9086 \def\UTFviiiTmp{%
cannam@95 9087 \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
cannam@95 9088 \UTFviiiLoop
cannam@95 9089
cannam@95 9090 \countUTFx = "F0
cannam@95 9091 \countUTFy = "F4
cannam@95 9092 \def\UTFviiiTmp{%
cannam@95 9093 \xdef~{\noexpand\UTFviiiFourOctets\string~}}
cannam@95 9094 \UTFviiiLoop
cannam@95 9095 \endgroup
cannam@95 9096
cannam@95 9097 \begingroup
cannam@95 9098 \catcode`\"=12
cannam@95 9099 \catcode`\<=12
cannam@95 9100 \catcode`\.=12
cannam@95 9101 \catcode`\,=12
cannam@95 9102 \catcode`\;=12
cannam@95 9103 \catcode`\!=12
cannam@95 9104 \catcode`\~=13
cannam@95 9105
cannam@95 9106 \gdef\DeclareUnicodeCharacter#1#2{%
cannam@95 9107 \countUTFz = "#1\relax
cannam@95 9108 %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
cannam@95 9109 \begingroup
cannam@95 9110 \parseXMLCharref
cannam@95 9111 \def\UTFviiiTwoOctets##1##2{%
cannam@95 9112 \csname u8:##1\string ##2\endcsname}%
cannam@95 9113 \def\UTFviiiThreeOctets##1##2##3{%
cannam@95 9114 \csname u8:##1\string ##2\string ##3\endcsname}%
cannam@95 9115 \def\UTFviiiFourOctets##1##2##3##4{%
cannam@95 9116 \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
cannam@95 9117 \expandafter\expandafter\expandafter\expandafter
cannam@95 9118 \expandafter\expandafter\expandafter
cannam@95 9119 \gdef\UTFviiiTmp{#2}%
cannam@95 9120 \endgroup}
cannam@95 9121
cannam@95 9122 \gdef\parseXMLCharref{%
cannam@95 9123 \ifnum\countUTFz < "A0\relax
cannam@95 9124 \errhelp = \EMsimple
cannam@95 9125 \errmessage{Cannot define Unicode char value < 00A0}%
cannam@95 9126 \else\ifnum\countUTFz < "800\relax
cannam@95 9127 \parseUTFviiiA,%
cannam@95 9128 \parseUTFviiiB C\UTFviiiTwoOctets.,%
cannam@95 9129 \else\ifnum\countUTFz < "10000\relax
cannam@95 9130 \parseUTFviiiA;%
cannam@95 9131 \parseUTFviiiA,%
cannam@95 9132 \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
cannam@95 9133 \else
cannam@95 9134 \parseUTFviiiA;%
cannam@95 9135 \parseUTFviiiA,%
cannam@95 9136 \parseUTFviiiA!%
cannam@95 9137 \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
cannam@95 9138 \fi\fi\fi
cannam@95 9139 }
cannam@95 9140
cannam@95 9141 \gdef\parseUTFviiiA#1{%
cannam@95 9142 \countUTFx = \countUTFz
cannam@95 9143 \divide\countUTFz by 64
cannam@95 9144 \countUTFy = \countUTFz
cannam@95 9145 \multiply\countUTFz by 64
cannam@95 9146 \advance\countUTFx by -\countUTFz
cannam@95 9147 \advance\countUTFx by 128
cannam@95 9148 \uccode `#1\countUTFx
cannam@95 9149 \countUTFz = \countUTFy}
cannam@95 9150
cannam@95 9151 \gdef\parseUTFviiiB#1#2#3#4{%
cannam@95 9152 \advance\countUTFz by "#10\relax
cannam@95 9153 \uccode `#3\countUTFz
cannam@95 9154 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
cannam@95 9155 \endgroup
cannam@95 9156
cannam@95 9157 \def\utfeightchardefs{%
cannam@95 9158 \DeclareUnicodeCharacter{00A0}{\tie}
cannam@95 9159 \DeclareUnicodeCharacter{00A1}{\exclamdown}
cannam@95 9160 \DeclareUnicodeCharacter{00A3}{\pounds}
cannam@95 9161 \DeclareUnicodeCharacter{00A8}{\"{ }}
cannam@95 9162 \DeclareUnicodeCharacter{00A9}{\copyright}
cannam@95 9163 \DeclareUnicodeCharacter{00AA}{\ordf}
cannam@95 9164 \DeclareUnicodeCharacter{00AB}{\guillemetleft}
cannam@95 9165 \DeclareUnicodeCharacter{00AD}{\-}
cannam@95 9166 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
cannam@95 9167 \DeclareUnicodeCharacter{00AF}{\={ }}
cannam@95 9168
cannam@95 9169 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
cannam@95 9170 \DeclareUnicodeCharacter{00B4}{\'{ }}
cannam@95 9171 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
cannam@95 9172 \DeclareUnicodeCharacter{00BA}{\ordm}
cannam@95 9173 \DeclareUnicodeCharacter{00BB}{\guillemetright}
cannam@95 9174 \DeclareUnicodeCharacter{00BF}{\questiondown}
cannam@95 9175
cannam@95 9176 \DeclareUnicodeCharacter{00C0}{\`A}
cannam@95 9177 \DeclareUnicodeCharacter{00C1}{\'A}
cannam@95 9178 \DeclareUnicodeCharacter{00C2}{\^A}
cannam@95 9179 \DeclareUnicodeCharacter{00C3}{\~A}
cannam@95 9180 \DeclareUnicodeCharacter{00C4}{\"A}
cannam@95 9181 \DeclareUnicodeCharacter{00C5}{\AA}
cannam@95 9182 \DeclareUnicodeCharacter{00C6}{\AE}
cannam@95 9183 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
cannam@95 9184 \DeclareUnicodeCharacter{00C8}{\`E}
cannam@95 9185 \DeclareUnicodeCharacter{00C9}{\'E}
cannam@95 9186 \DeclareUnicodeCharacter{00CA}{\^E}
cannam@95 9187 \DeclareUnicodeCharacter{00CB}{\"E}
cannam@95 9188 \DeclareUnicodeCharacter{00CC}{\`I}
cannam@95 9189 \DeclareUnicodeCharacter{00CD}{\'I}
cannam@95 9190 \DeclareUnicodeCharacter{00CE}{\^I}
cannam@95 9191 \DeclareUnicodeCharacter{00CF}{\"I}
cannam@95 9192
cannam@95 9193 \DeclareUnicodeCharacter{00D0}{\DH}
cannam@95 9194 \DeclareUnicodeCharacter{00D1}{\~N}
cannam@95 9195 \DeclareUnicodeCharacter{00D2}{\`O}
cannam@95 9196 \DeclareUnicodeCharacter{00D3}{\'O}
cannam@95 9197 \DeclareUnicodeCharacter{00D4}{\^O}
cannam@95 9198 \DeclareUnicodeCharacter{00D5}{\~O}
cannam@95 9199 \DeclareUnicodeCharacter{00D6}{\"O}
cannam@95 9200 \DeclareUnicodeCharacter{00D8}{\O}
cannam@95 9201 \DeclareUnicodeCharacter{00D9}{\`U}
cannam@95 9202 \DeclareUnicodeCharacter{00DA}{\'U}
cannam@95 9203 \DeclareUnicodeCharacter{00DB}{\^U}
cannam@95 9204 \DeclareUnicodeCharacter{00DC}{\"U}
cannam@95 9205 \DeclareUnicodeCharacter{00DD}{\'Y}
cannam@95 9206 \DeclareUnicodeCharacter{00DE}{\TH}
cannam@95 9207 \DeclareUnicodeCharacter{00DF}{\ss}
cannam@95 9208
cannam@95 9209 \DeclareUnicodeCharacter{00E0}{\`a}
cannam@95 9210 \DeclareUnicodeCharacter{00E1}{\'a}
cannam@95 9211 \DeclareUnicodeCharacter{00E2}{\^a}
cannam@95 9212 \DeclareUnicodeCharacter{00E3}{\~a}
cannam@95 9213 \DeclareUnicodeCharacter{00E4}{\"a}
cannam@95 9214 \DeclareUnicodeCharacter{00E5}{\aa}
cannam@95 9215 \DeclareUnicodeCharacter{00E6}{\ae}
cannam@95 9216 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
cannam@95 9217 \DeclareUnicodeCharacter{00E8}{\`e}
cannam@95 9218 \DeclareUnicodeCharacter{00E9}{\'e}
cannam@95 9219 \DeclareUnicodeCharacter{00EA}{\^e}
cannam@95 9220 \DeclareUnicodeCharacter{00EB}{\"e}
cannam@95 9221 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
cannam@95 9222 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
cannam@95 9223 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
cannam@95 9224 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
cannam@95 9225
cannam@95 9226 \DeclareUnicodeCharacter{00F0}{\dh}
cannam@95 9227 \DeclareUnicodeCharacter{00F1}{\~n}
cannam@95 9228 \DeclareUnicodeCharacter{00F2}{\`o}
cannam@95 9229 \DeclareUnicodeCharacter{00F3}{\'o}
cannam@95 9230 \DeclareUnicodeCharacter{00F4}{\^o}
cannam@95 9231 \DeclareUnicodeCharacter{00F5}{\~o}
cannam@95 9232 \DeclareUnicodeCharacter{00F6}{\"o}
cannam@95 9233 \DeclareUnicodeCharacter{00F8}{\o}
cannam@95 9234 \DeclareUnicodeCharacter{00F9}{\`u}
cannam@95 9235 \DeclareUnicodeCharacter{00FA}{\'u}
cannam@95 9236 \DeclareUnicodeCharacter{00FB}{\^u}
cannam@95 9237 \DeclareUnicodeCharacter{00FC}{\"u}
cannam@95 9238 \DeclareUnicodeCharacter{00FD}{\'y}
cannam@95 9239 \DeclareUnicodeCharacter{00FE}{\th}
cannam@95 9240 \DeclareUnicodeCharacter{00FF}{\"y}
cannam@95 9241
cannam@95 9242 \DeclareUnicodeCharacter{0100}{\=A}
cannam@95 9243 \DeclareUnicodeCharacter{0101}{\=a}
cannam@95 9244 \DeclareUnicodeCharacter{0102}{\u{A}}
cannam@95 9245 \DeclareUnicodeCharacter{0103}{\u{a}}
cannam@95 9246 \DeclareUnicodeCharacter{0104}{\ogonek{A}}
cannam@95 9247 \DeclareUnicodeCharacter{0105}{\ogonek{a}}
cannam@95 9248 \DeclareUnicodeCharacter{0106}{\'C}
cannam@95 9249 \DeclareUnicodeCharacter{0107}{\'c}
cannam@95 9250 \DeclareUnicodeCharacter{0108}{\^C}
cannam@95 9251 \DeclareUnicodeCharacter{0109}{\^c}
cannam@95 9252 \DeclareUnicodeCharacter{0118}{\ogonek{E}}
cannam@95 9253 \DeclareUnicodeCharacter{0119}{\ogonek{e}}
cannam@95 9254 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
cannam@95 9255 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
cannam@95 9256 \DeclareUnicodeCharacter{010C}{\v{C}}
cannam@95 9257 \DeclareUnicodeCharacter{010D}{\v{c}}
cannam@95 9258 \DeclareUnicodeCharacter{010E}{\v{D}}
cannam@95 9259
cannam@95 9260 \DeclareUnicodeCharacter{0112}{\=E}
cannam@95 9261 \DeclareUnicodeCharacter{0113}{\=e}
cannam@95 9262 \DeclareUnicodeCharacter{0114}{\u{E}}
cannam@95 9263 \DeclareUnicodeCharacter{0115}{\u{e}}
cannam@95 9264 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
cannam@95 9265 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
cannam@95 9266 \DeclareUnicodeCharacter{011A}{\v{E}}
cannam@95 9267 \DeclareUnicodeCharacter{011B}{\v{e}}
cannam@95 9268 \DeclareUnicodeCharacter{011C}{\^G}
cannam@95 9269 \DeclareUnicodeCharacter{011D}{\^g}
cannam@95 9270 \DeclareUnicodeCharacter{011E}{\u{G}}
cannam@95 9271 \DeclareUnicodeCharacter{011F}{\u{g}}
cannam@95 9272
cannam@95 9273 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
cannam@95 9274 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
cannam@95 9275 \DeclareUnicodeCharacter{0124}{\^H}
cannam@95 9276 \DeclareUnicodeCharacter{0125}{\^h}
cannam@95 9277 \DeclareUnicodeCharacter{0128}{\~I}
cannam@95 9278 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
cannam@95 9279 \DeclareUnicodeCharacter{012A}{\=I}
cannam@95 9280 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
cannam@95 9281 \DeclareUnicodeCharacter{012C}{\u{I}}
cannam@95 9282 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
cannam@95 9283
cannam@95 9284 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
cannam@95 9285 \DeclareUnicodeCharacter{0131}{\dotless{i}}
cannam@95 9286 \DeclareUnicodeCharacter{0132}{IJ}
cannam@95 9287 \DeclareUnicodeCharacter{0133}{ij}
cannam@95 9288 \DeclareUnicodeCharacter{0134}{\^J}
cannam@95 9289 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
cannam@95 9290 \DeclareUnicodeCharacter{0139}{\'L}
cannam@95 9291 \DeclareUnicodeCharacter{013A}{\'l}
cannam@95 9292
cannam@95 9293 \DeclareUnicodeCharacter{0141}{\L}
cannam@95 9294 \DeclareUnicodeCharacter{0142}{\l}
cannam@95 9295 \DeclareUnicodeCharacter{0143}{\'N}
cannam@95 9296 \DeclareUnicodeCharacter{0144}{\'n}
cannam@95 9297 \DeclareUnicodeCharacter{0147}{\v{N}}
cannam@95 9298 \DeclareUnicodeCharacter{0148}{\v{n}}
cannam@95 9299 \DeclareUnicodeCharacter{014C}{\=O}
cannam@95 9300 \DeclareUnicodeCharacter{014D}{\=o}
cannam@95 9301 \DeclareUnicodeCharacter{014E}{\u{O}}
cannam@95 9302 \DeclareUnicodeCharacter{014F}{\u{o}}
cannam@95 9303
cannam@95 9304 \DeclareUnicodeCharacter{0150}{\H{O}}
cannam@95 9305 \DeclareUnicodeCharacter{0151}{\H{o}}
cannam@95 9306 \DeclareUnicodeCharacter{0152}{\OE}
cannam@95 9307 \DeclareUnicodeCharacter{0153}{\oe}
cannam@95 9308 \DeclareUnicodeCharacter{0154}{\'R}
cannam@95 9309 \DeclareUnicodeCharacter{0155}{\'r}
cannam@95 9310 \DeclareUnicodeCharacter{0158}{\v{R}}
cannam@95 9311 \DeclareUnicodeCharacter{0159}{\v{r}}
cannam@95 9312 \DeclareUnicodeCharacter{015A}{\'S}
cannam@95 9313 \DeclareUnicodeCharacter{015B}{\'s}
cannam@95 9314 \DeclareUnicodeCharacter{015C}{\^S}
cannam@95 9315 \DeclareUnicodeCharacter{015D}{\^s}
cannam@95 9316 \DeclareUnicodeCharacter{015E}{\cedilla{S}}
cannam@95 9317 \DeclareUnicodeCharacter{015F}{\cedilla{s}}
cannam@95 9318
cannam@95 9319 \DeclareUnicodeCharacter{0160}{\v{S}}
cannam@95 9320 \DeclareUnicodeCharacter{0161}{\v{s}}
cannam@95 9321 \DeclareUnicodeCharacter{0162}{\cedilla{t}}
cannam@95 9322 \DeclareUnicodeCharacter{0163}{\cedilla{T}}
cannam@95 9323 \DeclareUnicodeCharacter{0164}{\v{T}}
cannam@95 9324
cannam@95 9325 \DeclareUnicodeCharacter{0168}{\~U}
cannam@95 9326 \DeclareUnicodeCharacter{0169}{\~u}
cannam@95 9327 \DeclareUnicodeCharacter{016A}{\=U}
cannam@95 9328 \DeclareUnicodeCharacter{016B}{\=u}
cannam@95 9329 \DeclareUnicodeCharacter{016C}{\u{U}}
cannam@95 9330 \DeclareUnicodeCharacter{016D}{\u{u}}
cannam@95 9331 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
cannam@95 9332 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
cannam@95 9333
cannam@95 9334 \DeclareUnicodeCharacter{0170}{\H{U}}
cannam@95 9335 \DeclareUnicodeCharacter{0171}{\H{u}}
cannam@95 9336 \DeclareUnicodeCharacter{0174}{\^W}
cannam@95 9337 \DeclareUnicodeCharacter{0175}{\^w}
cannam@95 9338 \DeclareUnicodeCharacter{0176}{\^Y}
cannam@95 9339 \DeclareUnicodeCharacter{0177}{\^y}
cannam@95 9340 \DeclareUnicodeCharacter{0178}{\"Y}
cannam@95 9341 \DeclareUnicodeCharacter{0179}{\'Z}
cannam@95 9342 \DeclareUnicodeCharacter{017A}{\'z}
cannam@95 9343 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
cannam@95 9344 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
cannam@95 9345 \DeclareUnicodeCharacter{017D}{\v{Z}}
cannam@95 9346 \DeclareUnicodeCharacter{017E}{\v{z}}
cannam@95 9347
cannam@95 9348 \DeclareUnicodeCharacter{01C4}{D\v{Z}}
cannam@95 9349 \DeclareUnicodeCharacter{01C5}{D\v{z}}
cannam@95 9350 \DeclareUnicodeCharacter{01C6}{d\v{z}}
cannam@95 9351 \DeclareUnicodeCharacter{01C7}{LJ}
cannam@95 9352 \DeclareUnicodeCharacter{01C8}{Lj}
cannam@95 9353 \DeclareUnicodeCharacter{01C9}{lj}
cannam@95 9354 \DeclareUnicodeCharacter{01CA}{NJ}
cannam@95 9355 \DeclareUnicodeCharacter{01CB}{Nj}
cannam@95 9356 \DeclareUnicodeCharacter{01CC}{nj}
cannam@95 9357 \DeclareUnicodeCharacter{01CD}{\v{A}}
cannam@95 9358 \DeclareUnicodeCharacter{01CE}{\v{a}}
cannam@95 9359 \DeclareUnicodeCharacter{01CF}{\v{I}}
cannam@95 9360
cannam@95 9361 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
cannam@95 9362 \DeclareUnicodeCharacter{01D1}{\v{O}}
cannam@95 9363 \DeclareUnicodeCharacter{01D2}{\v{o}}
cannam@95 9364 \DeclareUnicodeCharacter{01D3}{\v{U}}
cannam@95 9365 \DeclareUnicodeCharacter{01D4}{\v{u}}
cannam@95 9366
cannam@95 9367 \DeclareUnicodeCharacter{01E2}{\={\AE}}
cannam@95 9368 \DeclareUnicodeCharacter{01E3}{\={\ae}}
cannam@95 9369 \DeclareUnicodeCharacter{01E6}{\v{G}}
cannam@95 9370 \DeclareUnicodeCharacter{01E7}{\v{g}}
cannam@95 9371 \DeclareUnicodeCharacter{01E8}{\v{K}}
cannam@95 9372 \DeclareUnicodeCharacter{01E9}{\v{k}}
cannam@95 9373
cannam@95 9374 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
cannam@95 9375 \DeclareUnicodeCharacter{01F1}{DZ}
cannam@95 9376 \DeclareUnicodeCharacter{01F2}{Dz}
cannam@95 9377 \DeclareUnicodeCharacter{01F3}{dz}
cannam@95 9378 \DeclareUnicodeCharacter{01F4}{\'G}
cannam@95 9379 \DeclareUnicodeCharacter{01F5}{\'g}
cannam@95 9380 \DeclareUnicodeCharacter{01F8}{\`N}
cannam@95 9381 \DeclareUnicodeCharacter{01F9}{\`n}
cannam@95 9382 \DeclareUnicodeCharacter{01FC}{\'{\AE}}
cannam@95 9383 \DeclareUnicodeCharacter{01FD}{\'{\ae}}
cannam@95 9384 \DeclareUnicodeCharacter{01FE}{\'{\O}}
cannam@95 9385 \DeclareUnicodeCharacter{01FF}{\'{\o}}
cannam@95 9386
cannam@95 9387 \DeclareUnicodeCharacter{021E}{\v{H}}
cannam@95 9388 \DeclareUnicodeCharacter{021F}{\v{h}}
cannam@95 9389
cannam@95 9390 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
cannam@95 9391 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
cannam@95 9392 \DeclareUnicodeCharacter{0228}{\cedilla{E}}
cannam@95 9393 \DeclareUnicodeCharacter{0229}{\cedilla{e}}
cannam@95 9394 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
cannam@95 9395 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
cannam@95 9396
cannam@95 9397 \DeclareUnicodeCharacter{0232}{\=Y}
cannam@95 9398 \DeclareUnicodeCharacter{0233}{\=y}
cannam@95 9399 \DeclareUnicodeCharacter{0237}{\dotless{j}}
cannam@95 9400
cannam@95 9401 \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
cannam@95 9402
cannam@95 9403 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
cannam@95 9404 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
cannam@95 9405 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
cannam@95 9406 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
cannam@95 9407 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
cannam@95 9408 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
cannam@95 9409 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
cannam@95 9410 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
cannam@95 9411 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
cannam@95 9412 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
cannam@95 9413 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
cannam@95 9414 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
cannam@95 9415
cannam@95 9416 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
cannam@95 9417 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
cannam@95 9418
cannam@95 9419 \DeclareUnicodeCharacter{1E20}{\=G}
cannam@95 9420 \DeclareUnicodeCharacter{1E21}{\=g}
cannam@95 9421 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
cannam@95 9422 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
cannam@95 9423 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
cannam@95 9424 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
cannam@95 9425 \DeclareUnicodeCharacter{1E26}{\"H}
cannam@95 9426 \DeclareUnicodeCharacter{1E27}{\"h}
cannam@95 9427
cannam@95 9428 \DeclareUnicodeCharacter{1E30}{\'K}
cannam@95 9429 \DeclareUnicodeCharacter{1E31}{\'k}
cannam@95 9430 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
cannam@95 9431 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
cannam@95 9432 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
cannam@95 9433 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
cannam@95 9434 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
cannam@95 9435 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
cannam@95 9436 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
cannam@95 9437 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
cannam@95 9438 \DeclareUnicodeCharacter{1E3E}{\'M}
cannam@95 9439 \DeclareUnicodeCharacter{1E3F}{\'m}
cannam@95 9440
cannam@95 9441 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
cannam@95 9442 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
cannam@95 9443 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
cannam@95 9444 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
cannam@95 9445 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
cannam@95 9446 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
cannam@95 9447 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
cannam@95 9448 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
cannam@95 9449 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
cannam@95 9450 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
cannam@95 9451
cannam@95 9452 \DeclareUnicodeCharacter{1E54}{\'P}
cannam@95 9453 \DeclareUnicodeCharacter{1E55}{\'p}
cannam@95 9454 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
cannam@95 9455 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
cannam@95 9456 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
cannam@95 9457 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
cannam@95 9458 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
cannam@95 9459 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
cannam@95 9460 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
cannam@95 9461 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
cannam@95 9462
cannam@95 9463 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
cannam@95 9464 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
cannam@95 9465 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
cannam@95 9466 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
cannam@95 9467 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
cannam@95 9468 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
cannam@95 9469 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
cannam@95 9470 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
cannam@95 9471 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
cannam@95 9472 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
cannam@95 9473
cannam@95 9474 \DeclareUnicodeCharacter{1E7C}{\~V}
cannam@95 9475 \DeclareUnicodeCharacter{1E7D}{\~v}
cannam@95 9476 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
cannam@95 9477 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
cannam@95 9478
cannam@95 9479 \DeclareUnicodeCharacter{1E80}{\`W}
cannam@95 9480 \DeclareUnicodeCharacter{1E81}{\`w}
cannam@95 9481 \DeclareUnicodeCharacter{1E82}{\'W}
cannam@95 9482 \DeclareUnicodeCharacter{1E83}{\'w}
cannam@95 9483 \DeclareUnicodeCharacter{1E84}{\"W}
cannam@95 9484 \DeclareUnicodeCharacter{1E85}{\"w}
cannam@95 9485 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
cannam@95 9486 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
cannam@95 9487 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
cannam@95 9488 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
cannam@95 9489 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
cannam@95 9490 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
cannam@95 9491 \DeclareUnicodeCharacter{1E8C}{\"X}
cannam@95 9492 \DeclareUnicodeCharacter{1E8D}{\"x}
cannam@95 9493 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
cannam@95 9494 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
cannam@95 9495
cannam@95 9496 \DeclareUnicodeCharacter{1E90}{\^Z}
cannam@95 9497 \DeclareUnicodeCharacter{1E91}{\^z}
cannam@95 9498 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
cannam@95 9499 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
cannam@95 9500 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
cannam@95 9501 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
cannam@95 9502 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
cannam@95 9503 \DeclareUnicodeCharacter{1E97}{\"t}
cannam@95 9504 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
cannam@95 9505 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
cannam@95 9506
cannam@95 9507 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
cannam@95 9508 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
cannam@95 9509
cannam@95 9510 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
cannam@95 9511 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
cannam@95 9512 \DeclareUnicodeCharacter{1EBC}{\~E}
cannam@95 9513 \DeclareUnicodeCharacter{1EBD}{\~e}
cannam@95 9514
cannam@95 9515 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
cannam@95 9516 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
cannam@95 9517 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
cannam@95 9518 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
cannam@95 9519
cannam@95 9520 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
cannam@95 9521 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
cannam@95 9522
cannam@95 9523 \DeclareUnicodeCharacter{1EF2}{\`Y}
cannam@95 9524 \DeclareUnicodeCharacter{1EF3}{\`y}
cannam@95 9525 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
cannam@95 9526
cannam@95 9527 \DeclareUnicodeCharacter{1EF8}{\~Y}
cannam@95 9528 \DeclareUnicodeCharacter{1EF9}{\~y}
cannam@95 9529
cannam@95 9530 \DeclareUnicodeCharacter{2013}{--}
cannam@95 9531 \DeclareUnicodeCharacter{2014}{---}
cannam@95 9532 \DeclareUnicodeCharacter{2018}{\quoteleft}
cannam@95 9533 \DeclareUnicodeCharacter{2019}{\quoteright}
cannam@95 9534 \DeclareUnicodeCharacter{201A}{\quotesinglbase}
cannam@95 9535 \DeclareUnicodeCharacter{201C}{\quotedblleft}
cannam@95 9536 \DeclareUnicodeCharacter{201D}{\quotedblright}
cannam@95 9537 \DeclareUnicodeCharacter{201E}{\quotedblbase}
cannam@95 9538 \DeclareUnicodeCharacter{2022}{\bullet}
cannam@95 9539 \DeclareUnicodeCharacter{2026}{\dots}
cannam@95 9540 \DeclareUnicodeCharacter{2039}{\guilsinglleft}
cannam@95 9541 \DeclareUnicodeCharacter{203A}{\guilsinglright}
cannam@95 9542 \DeclareUnicodeCharacter{20AC}{\euro}
cannam@95 9543
cannam@95 9544 \DeclareUnicodeCharacter{2192}{\expansion}
cannam@95 9545 \DeclareUnicodeCharacter{21D2}{\result}
cannam@95 9546
cannam@95 9547 \DeclareUnicodeCharacter{2212}{\minus}
cannam@95 9548 \DeclareUnicodeCharacter{2217}{\point}
cannam@95 9549 \DeclareUnicodeCharacter{2261}{\equiv}
cannam@95 9550 }% end of \utfeightchardefs
cannam@95 9551
cannam@95 9552
cannam@95 9553 % US-ASCII character definitions.
cannam@95 9554 \def\asciichardefs{% nothing need be done
cannam@95 9555 \relax
cannam@95 9556 }
cannam@95 9557
cannam@95 9558 % Make non-ASCII characters printable again for compatibility with
cannam@95 9559 % existing Texinfo documents that may use them, even without declaring a
cannam@95 9560 % document encoding.
cannam@95 9561 %
cannam@95 9562 \setnonasciicharscatcode \other
cannam@95 9563
cannam@95 9564
cannam@95 9565 \message{formatting,}
cannam@95 9566
cannam@95 9567 \newdimen\defaultparindent \defaultparindent = 15pt
cannam@95 9568
cannam@95 9569 \chapheadingskip = 15pt plus 4pt minus 2pt
cannam@95 9570 \secheadingskip = 12pt plus 3pt minus 2pt
cannam@95 9571 \subsecheadingskip = 9pt plus 2pt minus 2pt
cannam@95 9572
cannam@95 9573 % Prevent underfull vbox error messages.
cannam@95 9574 \vbadness = 10000
cannam@95 9575
cannam@95 9576 % Don't be very finicky about underfull hboxes, either.
cannam@95 9577 \hbadness = 6666
cannam@95 9578
cannam@95 9579 % Following George Bush, get rid of widows and orphans.
cannam@95 9580 \widowpenalty=10000
cannam@95 9581 \clubpenalty=10000
cannam@95 9582
cannam@95 9583 % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
cannam@95 9584 % using an old version of TeX, don't do anything. We want the amount of
cannam@95 9585 % stretch added to depend on the line length, hence the dependence on
cannam@95 9586 % \hsize. We call this whenever the paper size is set.
cannam@95 9587 %
cannam@95 9588 \def\setemergencystretch{%
cannam@95 9589 \ifx\emergencystretch\thisisundefined
cannam@95 9590 % Allow us to assign to \emergencystretch anyway.
cannam@95 9591 \def\emergencystretch{\dimen0}%
cannam@95 9592 \else
cannam@95 9593 \emergencystretch = .15\hsize
cannam@95 9594 \fi
cannam@95 9595 }
cannam@95 9596
cannam@95 9597 % Parameters in order: 1) textheight; 2) textwidth;
cannam@95 9598 % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
cannam@95 9599 % 7) physical page height; 8) physical page width.
cannam@95 9600 %
cannam@95 9601 % We also call \setleading{\textleading}, so the caller should define
cannam@95 9602 % \textleading. The caller should also set \parskip.
cannam@95 9603 %
cannam@95 9604 \def\internalpagesizes#1#2#3#4#5#6#7#8{%
cannam@95 9605 \voffset = #3\relax
cannam@95 9606 \topskip = #6\relax
cannam@95 9607 \splittopskip = \topskip
cannam@95 9608 %
cannam@95 9609 \vsize = #1\relax
cannam@95 9610 \advance\vsize by \topskip
cannam@95 9611 \outervsize = \vsize
cannam@95 9612 \advance\outervsize by 2\topandbottommargin
cannam@95 9613 \pageheight = \vsize
cannam@95 9614 %
cannam@95 9615 \hsize = #2\relax
cannam@95 9616 \outerhsize = \hsize
cannam@95 9617 \advance\outerhsize by 0.5in
cannam@95 9618 \pagewidth = \hsize
cannam@95 9619 %
cannam@95 9620 \normaloffset = #4\relax
cannam@95 9621 \bindingoffset = #5\relax
cannam@95 9622 %
cannam@95 9623 \ifpdf
cannam@95 9624 \pdfpageheight #7\relax
cannam@95 9625 \pdfpagewidth #8\relax
cannam@95 9626 % if we don't reset these, they will remain at "1 true in" of
cannam@95 9627 % whatever layout pdftex was dumped with.
cannam@95 9628 \pdfhorigin = 1 true in
cannam@95 9629 \pdfvorigin = 1 true in
cannam@95 9630 \fi
cannam@95 9631 %
cannam@95 9632 \setleading{\textleading}
cannam@95 9633 %
cannam@95 9634 \parindent = \defaultparindent
cannam@95 9635 \setemergencystretch
cannam@95 9636 }
cannam@95 9637
cannam@95 9638 % @letterpaper (the default).
cannam@95 9639 \def\letterpaper{{\globaldefs = 1
cannam@95 9640 \parskip = 3pt plus 2pt minus 1pt
cannam@95 9641 \textleading = 13.2pt
cannam@95 9642 %
cannam@95 9643 % If page is nothing but text, make it come out even.
cannam@95 9644 \internalpagesizes{607.2pt}{6in}% that's 46 lines
cannam@95 9645 {\voffset}{.25in}%
cannam@95 9646 {\bindingoffset}{36pt}%
cannam@95 9647 {11in}{8.5in}%
cannam@95 9648 }}
cannam@95 9649
cannam@95 9650 % Use @smallbook to reset parameters for 7x9.25 trim size.
cannam@95 9651 \def\smallbook{{\globaldefs = 1
cannam@95 9652 \parskip = 2pt plus 1pt
cannam@95 9653 \textleading = 12pt
cannam@95 9654 %
cannam@95 9655 \internalpagesizes{7.5in}{5in}%
cannam@95 9656 {-.2in}{0in}%
cannam@95 9657 {\bindingoffset}{16pt}%
cannam@95 9658 {9.25in}{7in}%
cannam@95 9659 %
cannam@95 9660 \lispnarrowing = 0.3in
cannam@95 9661 \tolerance = 700
cannam@95 9662 \hfuzz = 1pt
cannam@95 9663 \contentsrightmargin = 0pt
cannam@95 9664 \defbodyindent = .5cm
cannam@95 9665 }}
cannam@95 9666
cannam@95 9667 % Use @smallerbook to reset parameters for 6x9 trim size.
cannam@95 9668 % (Just testing, parameters still in flux.)
cannam@95 9669 \def\smallerbook{{\globaldefs = 1
cannam@95 9670 \parskip = 1.5pt plus 1pt
cannam@95 9671 \textleading = 12pt
cannam@95 9672 %
cannam@95 9673 \internalpagesizes{7.4in}{4.8in}%
cannam@95 9674 {-.2in}{-.4in}%
cannam@95 9675 {0pt}{14pt}%
cannam@95 9676 {9in}{6in}%
cannam@95 9677 %
cannam@95 9678 \lispnarrowing = 0.25in
cannam@95 9679 \tolerance = 700
cannam@95 9680 \hfuzz = 1pt
cannam@95 9681 \contentsrightmargin = 0pt
cannam@95 9682 \defbodyindent = .4cm
cannam@95 9683 }}
cannam@95 9684
cannam@95 9685 % Use @afourpaper to print on European A4 paper.
cannam@95 9686 \def\afourpaper{{\globaldefs = 1
cannam@95 9687 \parskip = 3pt plus 2pt minus 1pt
cannam@95 9688 \textleading = 13.2pt
cannam@95 9689 %
cannam@95 9690 % Double-side printing via postscript on Laserjet 4050
cannam@95 9691 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
cannam@95 9692 % To change the settings for a different printer or situation, adjust
cannam@95 9693 % \normaloffset until the front-side and back-side texts align. Then
cannam@95 9694 % do the same for \bindingoffset. You can set these for testing in
cannam@95 9695 % your texinfo source file like this:
cannam@95 9696 % @tex
cannam@95 9697 % \global\normaloffset = -6mm
cannam@95 9698 % \global\bindingoffset = 10mm
cannam@95 9699 % @end tex
cannam@95 9700 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
cannam@95 9701 {\voffset}{\hoffset}%
cannam@95 9702 {\bindingoffset}{44pt}%
cannam@95 9703 {297mm}{210mm}%
cannam@95 9704 %
cannam@95 9705 \tolerance = 700
cannam@95 9706 \hfuzz = 1pt
cannam@95 9707 \contentsrightmargin = 0pt
cannam@95 9708 \defbodyindent = 5mm
cannam@95 9709 }}
cannam@95 9710
cannam@95 9711 % Use @afivepaper to print on European A5 paper.
cannam@95 9712 % From romildo@urano.iceb.ufop.br, 2 July 2000.
cannam@95 9713 % He also recommends making @example and @lisp be small.
cannam@95 9714 \def\afivepaper{{\globaldefs = 1
cannam@95 9715 \parskip = 2pt plus 1pt minus 0.1pt
cannam@95 9716 \textleading = 12.5pt
cannam@95 9717 %
cannam@95 9718 \internalpagesizes{160mm}{120mm}%
cannam@95 9719 {\voffset}{\hoffset}%
cannam@95 9720 {\bindingoffset}{8pt}%
cannam@95 9721 {210mm}{148mm}%
cannam@95 9722 %
cannam@95 9723 \lispnarrowing = 0.2in
cannam@95 9724 \tolerance = 800
cannam@95 9725 \hfuzz = 1.2pt
cannam@95 9726 \contentsrightmargin = 0pt
cannam@95 9727 \defbodyindent = 2mm
cannam@95 9728 \tableindent = 12mm
cannam@95 9729 }}
cannam@95 9730
cannam@95 9731 % A specific text layout, 24x15cm overall, intended for A4 paper.
cannam@95 9732 \def\afourlatex{{\globaldefs = 1
cannam@95 9733 \afourpaper
cannam@95 9734 \internalpagesizes{237mm}{150mm}%
cannam@95 9735 {\voffset}{4.6mm}%
cannam@95 9736 {\bindingoffset}{7mm}%
cannam@95 9737 {297mm}{210mm}%
cannam@95 9738 %
cannam@95 9739 % Must explicitly reset to 0 because we call \afourpaper.
cannam@95 9740 \globaldefs = 0
cannam@95 9741 }}
cannam@95 9742
cannam@95 9743 % Use @afourwide to print on A4 paper in landscape format.
cannam@95 9744 \def\afourwide{{\globaldefs = 1
cannam@95 9745 \afourpaper
cannam@95 9746 \internalpagesizes{241mm}{165mm}%
cannam@95 9747 {\voffset}{-2.95mm}%
cannam@95 9748 {\bindingoffset}{7mm}%
cannam@95 9749 {297mm}{210mm}%
cannam@95 9750 \globaldefs = 0
cannam@95 9751 }}
cannam@95 9752
cannam@95 9753 % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
cannam@95 9754 % Perhaps we should allow setting the margins, \topskip, \parskip,
cannam@95 9755 % and/or leading, also. Or perhaps we should compute them somehow.
cannam@95 9756 %
cannam@95 9757 \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
cannam@95 9758 \def\pagesizesyyy#1,#2,#3\finish{{%
cannam@95 9759 \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
cannam@95 9760 \globaldefs = 1
cannam@95 9761 %
cannam@95 9762 \parskip = 3pt plus 2pt minus 1pt
cannam@95 9763 \setleading{\textleading}%
cannam@95 9764 %
cannam@95 9765 \dimen0 = #1\relax
cannam@95 9766 \advance\dimen0 by \voffset
cannam@95 9767 %
cannam@95 9768 \dimen2 = \hsize
cannam@95 9769 \advance\dimen2 by \normaloffset
cannam@95 9770 %
cannam@95 9771 \internalpagesizes{#1}{\hsize}%
cannam@95 9772 {\voffset}{\normaloffset}%
cannam@95 9773 {\bindingoffset}{44pt}%
cannam@95 9774 {\dimen0}{\dimen2}%
cannam@95 9775 }}
cannam@95 9776
cannam@95 9777 % Set default to letter.
cannam@95 9778 %
cannam@95 9779 \letterpaper
cannam@95 9780
cannam@95 9781
cannam@95 9782 \message{and turning on texinfo input format.}
cannam@95 9783
cannam@95 9784 \def^^L{\par} % remove \outer, so ^L can appear in an @comment
cannam@95 9785
cannam@95 9786 % DEL is a comment character, in case @c does not suffice.
cannam@95 9787 \catcode`\^^? = 14
cannam@95 9788
cannam@95 9789 % Define macros to output various characters with catcode for normal text.
cannam@95 9790 \catcode`\"=\other \def\normaldoublequote{"}
cannam@95 9791 \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
cannam@95 9792 \catcode`\+=\other \def\normalplus{+}
cannam@95 9793 \catcode`\<=\other \def\normalless{<}
cannam@95 9794 \catcode`\>=\other \def\normalgreater{>}
cannam@95 9795 \catcode`\^=\other \def\normalcaret{^}
cannam@95 9796 \catcode`\_=\other \def\normalunderscore{_}
cannam@95 9797 \catcode`\|=\other \def\normalverticalbar{|}
cannam@95 9798 \catcode`\~=\other \def\normaltilde{~}
cannam@95 9799
cannam@95 9800 % This macro is used to make a character print one way in \tt
cannam@95 9801 % (where it can probably be output as-is), and another way in other fonts,
cannam@95 9802 % where something hairier probably needs to be done.
cannam@95 9803 %
cannam@95 9804 % #1 is what to print if we are indeed using \tt; #2 is what to print
cannam@95 9805 % otherwise. Since all the Computer Modern typewriter fonts have zero
cannam@95 9806 % interword stretch (and shrink), and it is reasonable to expect all
cannam@95 9807 % typewriter fonts to have this, we can check that font parameter.
cannam@95 9808 %
cannam@95 9809 \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
cannam@95 9810
cannam@95 9811 % Same as above, but check for italic font. Actually this also catches
cannam@95 9812 % non-italic slanted fonts since it is impossible to distinguish them from
cannam@95 9813 % italic fonts. But since this is only used by $ and it uses \sl anyway
cannam@95 9814 % this is not a problem.
cannam@95 9815 \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
cannam@95 9816
cannam@95 9817 % Turn off all special characters except @
cannam@95 9818 % (and those which the user can use as if they were ordinary).
cannam@95 9819 % Most of these we simply print from the \tt font, but for some, we can
cannam@95 9820 % use math or other variants that look better in normal text.
cannam@95 9821
cannam@95 9822 \catcode`\"=\active
cannam@95 9823 \def\activedoublequote{{\tt\char34}}
cannam@95 9824 \let"=\activedoublequote
cannam@95 9825 \catcode`\~=\active
cannam@95 9826 \def~{{\tt\char126}}
cannam@95 9827 \chardef\hat=`\^
cannam@95 9828 \catcode`\^=\active
cannam@95 9829 \def^{{\tt \hat}}
cannam@95 9830
cannam@95 9831 \catcode`\_=\active
cannam@95 9832 \def_{\ifusingtt\normalunderscore\_}
cannam@95 9833 \let\realunder=_
cannam@95 9834 % Subroutine for the previous macro.
cannam@95 9835 \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
cannam@95 9836
cannam@95 9837 \catcode`\|=\active
cannam@95 9838 \def|{{\tt\char124}}
cannam@95 9839 \chardef \less=`\<
cannam@95 9840 \catcode`\<=\active
cannam@95 9841 \def<{{\tt \less}}
cannam@95 9842 \chardef \gtr=`\>
cannam@95 9843 \catcode`\>=\active
cannam@95 9844 \def>{{\tt \gtr}}
cannam@95 9845 \catcode`\+=\active
cannam@95 9846 \def+{{\tt \char 43}}
cannam@95 9847 \catcode`\$=\active
cannam@95 9848 \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
cannam@95 9849
cannam@95 9850 % If a .fmt file is being used, characters that might appear in a file
cannam@95 9851 % name cannot be active until we have parsed the command line.
cannam@95 9852 % So turn them off again, and have \everyjob (or @setfilename) turn them on.
cannam@95 9853 % \otherifyactive is called near the end of this file.
cannam@95 9854 \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
cannam@95 9855
cannam@95 9856 % Used sometimes to turn off (effectively) the active characters even after
cannam@95 9857 % parsing them.
cannam@95 9858 \def\turnoffactive{%
cannam@95 9859 \normalturnoffactive
cannam@95 9860 \otherbackslash
cannam@95 9861 }
cannam@95 9862
cannam@95 9863 \catcode`\@=0
cannam@95 9864
cannam@95 9865 % \backslashcurfont outputs one backslash character in current font,
cannam@95 9866 % as in \char`\\.
cannam@95 9867 \global\chardef\backslashcurfont=`\\
cannam@95 9868 \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
cannam@95 9869
cannam@95 9870 % \realbackslash is an actual character `\' with catcode other, and
cannam@95 9871 % \doublebackslash is two of them (for the pdf outlines).
cannam@95 9872 {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
cannam@95 9873
cannam@95 9874 % In texinfo, backslash is an active character; it prints the backslash
cannam@95 9875 % in fixed width font.
cannam@95 9876 \catcode`\\=\active % @ for escape char from now on.
cannam@95 9877
cannam@95 9878 % The story here is that in math mode, the \char of \backslashcurfont
cannam@95 9879 % ends up printing the roman \ from the math symbol font (because \char
cannam@95 9880 % in math mode uses the \mathcode, and plain.tex sets
cannam@95 9881 % \mathcode`\\="026E). It seems better for @backslashchar{} to always
cannam@95 9882 % print a typewriter backslash, hence we use an explicit \mathchar,
cannam@95 9883 % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
cannam@95 9884 % ignored family value; char position "5C). We can't use " for the
cannam@95 9885 % usual hex value because it has already been made active.
cannam@95 9886 @def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
cannam@95 9887 @let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
cannam@95 9888
cannam@95 9889 % On startup, @fixbackslash assigns:
cannam@95 9890 % @let \ = @normalbackslash
cannam@95 9891 % \rawbackslash defines an active \ to do \backslashcurfont.
cannam@95 9892 % \otherbackslash defines an active \ to be a literal `\' character with
cannam@95 9893 % catcode other. We switch back and forth between these.
cannam@95 9894 @gdef@rawbackslash{@let\=@backslashcurfont}
cannam@95 9895 @gdef@otherbackslash{@let\=@realbackslash}
cannam@95 9896
cannam@95 9897 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
cannam@95 9898 % the literal character `\'.
cannam@95 9899 %
cannam@95 9900 @def@normalturnoffactive{%
cannam@95 9901 @let"=@normaldoublequote
cannam@95 9902 @let$=@normaldollar %$ font-lock fix
cannam@95 9903 @let+=@normalplus
cannam@95 9904 @let<=@normalless
cannam@95 9905 @let>=@normalgreater
cannam@95 9906 @let\=@normalbackslash
cannam@95 9907 @let^=@normalcaret
cannam@95 9908 @let_=@normalunderscore
cannam@95 9909 @let|=@normalverticalbar
cannam@95 9910 @let~=@normaltilde
cannam@95 9911 @markupsetuplqdefault
cannam@95 9912 @markupsetuprqdefault
cannam@95 9913 @unsepspaces
cannam@95 9914 }
cannam@95 9915
cannam@95 9916 % Make _ and + \other characters, temporarily.
cannam@95 9917 % This is canceled by @fixbackslash.
cannam@95 9918 @otherifyactive
cannam@95 9919
cannam@95 9920 % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
cannam@95 9921 % That is what \eatinput is for; after that, the `\' should revert to printing
cannam@95 9922 % a backslash.
cannam@95 9923 %
cannam@95 9924 @gdef@eatinput input texinfo{@fixbackslash}
cannam@95 9925 @global@let\ = @eatinput
cannam@95 9926
cannam@95 9927 % On the other hand, perhaps the file did not have a `\input texinfo'. Then
cannam@95 9928 % the first `\' in the file would cause an error. This macro tries to fix
cannam@95 9929 % that, assuming it is called before the first `\' could plausibly occur.
cannam@95 9930 % Also turn back on active characters that might appear in the input
cannam@95 9931 % file name, in case not using a pre-dumped format.
cannam@95 9932 %
cannam@95 9933 @gdef@fixbackslash{%
cannam@95 9934 @ifx\@eatinput @let\ = @normalbackslash @fi
cannam@95 9935 @catcode`+=@active
cannam@95 9936 @catcode`@_=@active
cannam@95 9937 }
cannam@95 9938
cannam@95 9939 % Say @foo, not \foo, in error messages.
cannam@95 9940 @escapechar = `@@
cannam@95 9941
cannam@95 9942 % These (along with & and #) are made active for url-breaking, so need
cannam@95 9943 % active definitions as the normal characters.
cannam@95 9944 @def@normaldot{.}
cannam@95 9945 @def@normalquest{?}
cannam@95 9946 @def@normalslash{/}
cannam@95 9947
cannam@95 9948 % These look ok in all fonts, so just make them not special.
cannam@95 9949 % @hashchar{} gets its own user-level command, because of #line.
cannam@95 9950 @catcode`@& = @other @def@normalamp{&}
cannam@95 9951 @catcode`@# = @other @def@normalhash{#}
cannam@95 9952 @catcode`@% = @other @def@normalpercent{%}
cannam@95 9953
cannam@95 9954 @let @hashchar = @normalhash
cannam@95 9955
cannam@95 9956 @c Finally, make ` and ' active, so that txicodequoteundirected and
cannam@95 9957 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
cannam@95 9958 @c don't make ` and ' active, @code will not get them as active chars.
cannam@95 9959 @c Do this last of all since we use ` in the previous @catcode assignments.
cannam@95 9960 @catcode`@'=@active
cannam@95 9961 @catcode`@`=@active
cannam@95 9962 @markupsetuplqdefault
cannam@95 9963 @markupsetuprqdefault
cannam@95 9964
cannam@95 9965 @c Local variables:
cannam@95 9966 @c eval: (add-hook 'write-file-hooks 'time-stamp)
cannam@95 9967 @c page-delimiter: "^\\\\message"
cannam@95 9968 @c time-stamp-start: "def\\\\texinfoversion{"
cannam@95 9969 @c time-stamp-format: "%:y-%02m-%02d.%02H"
cannam@95 9970 @c time-stamp-end: "}"
cannam@95 9971 @c End:
cannam@95 9972
cannam@95 9973 @c vim:sw=2:
cannam@95 9974
cannam@95 9975 @ignore
cannam@95 9976 arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
cannam@95 9977 @end ignore