cannam@167: % texinfo.tex -- TeX macros to handle Texinfo files. cannam@167: % cannam@167: % Load plain if necessary, i.e., if running under initex. cannam@167: \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi cannam@167: % cannam@167: \def\texinfoversion{2013-02-01.11} cannam@167: % cannam@167: % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, cannam@167: % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, cannam@167: % 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. cannam@167: % cannam@167: % This texinfo.tex file is free software: you can redistribute it and/or cannam@167: % modify it under the terms of the GNU General Public License as cannam@167: % published by the Free Software Foundation, either version 3 of the cannam@167: % License, or (at your option) any later version. cannam@167: % cannam@167: % This texinfo.tex file is distributed in the hope that it will be cannam@167: % useful, but WITHOUT ANY WARRANTY; without even the implied warranty cannam@167: % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU cannam@167: % General Public License for more details. cannam@167: % cannam@167: % You should have received a copy of the GNU General Public License cannam@167: % along with this program. If not, see . cannam@167: % cannam@167: % As a special exception, when this file is read by TeX when processing cannam@167: % a Texinfo source document, you may use the result without cannam@167: % restriction. This Exception is an additional permission under section 7 cannam@167: % of the GNU General Public License, version 3 ("GPLv3"). cannam@167: % cannam@167: % Please try the latest version of texinfo.tex before submitting bug cannam@167: % reports; you can get the latest version from: cannam@167: % http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or cannam@167: % http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or cannam@167: % http://www.gnu.org/software/texinfo/ (the Texinfo home page) cannam@167: % The texinfo.tex in any given distribution could well be out cannam@167: % of date, so if that's what you're using, please check. cannam@167: % cannam@167: % Send bug reports to bug-texinfo@gnu.org. Please include including a cannam@167: % complete document in each bug report with which we can reproduce the cannam@167: % problem. Patches are, of course, greatly appreciated. cannam@167: % cannam@167: % To process a Texinfo manual with TeX, it's most reliable to use the cannam@167: % texi2dvi shell script that comes with the distribution. For a simple cannam@167: % manual foo.texi, however, you can get away with this: cannam@167: % tex foo.texi cannam@167: % texindex foo.?? cannam@167: % tex foo.texi cannam@167: % tex foo.texi cannam@167: % dvips foo.dvi -o # or whatever; this makes foo.ps. cannam@167: % The extra TeX runs get the cross-reference information correct. cannam@167: % Sometimes one run after texindex suffices, and sometimes you need more cannam@167: % than two; texi2dvi does it as many times as necessary. cannam@167: % cannam@167: % It is possible to adapt texinfo.tex for other languages, to some cannam@167: % extent. You can get the existing language-specific files from the cannam@167: % full Texinfo distribution. cannam@167: % cannam@167: % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. cannam@167: cannam@167: cannam@167: \message{Loading texinfo [version \texinfoversion]:} cannam@167: cannam@167: % If in a .fmt file, print the version number cannam@167: % and turn on active characters that we couldn't do earlier because cannam@167: % they might have appeared in the input file name. cannam@167: \everyjob{\message{[Texinfo version \texinfoversion]}% cannam@167: \catcode`+=\active \catcode`\_=\active} cannam@167: cannam@167: \chardef\other=12 cannam@167: cannam@167: % We never want plain's \outer definition of \+ in Texinfo. cannam@167: % For @tex, we can use \tabalign. cannam@167: \let\+ = \relax cannam@167: cannam@167: % Save some plain tex macros whose names we will redefine. cannam@167: \let\ptexb=\b cannam@167: \let\ptexbullet=\bullet cannam@167: \let\ptexc=\c cannam@167: \let\ptexcomma=\, cannam@167: \let\ptexdot=\. cannam@167: \let\ptexdots=\dots cannam@167: \let\ptexend=\end cannam@167: \let\ptexequiv=\equiv cannam@167: \let\ptexexclam=\! cannam@167: \let\ptexfootnote=\footnote cannam@167: \let\ptexgtr=> cannam@167: \let\ptexhat=^ cannam@167: \let\ptexi=\i cannam@167: \let\ptexindent=\indent cannam@167: \let\ptexinsert=\insert cannam@167: \let\ptexlbrace=\{ cannam@167: \let\ptexless=< cannam@167: \let\ptexnewwrite\newwrite cannam@167: \let\ptexnoindent=\noindent cannam@167: \let\ptexplus=+ cannam@167: \let\ptexraggedright=\raggedright cannam@167: \let\ptexrbrace=\} cannam@167: \let\ptexslash=\/ cannam@167: \let\ptexstar=\* cannam@167: \let\ptext=\t cannam@167: \let\ptextop=\top cannam@167: {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode cannam@167: cannam@167: % If this character appears in an error message or help string, it cannam@167: % starts a new line in the output. cannam@167: \newlinechar = `^^J cannam@167: cannam@167: % Use TeX 3.0's \inputlineno to get the line number, for better error cannam@167: % messages, but if we're using an old version of TeX, don't do anything. cannam@167: % cannam@167: \ifx\inputlineno\thisisundefined cannam@167: \let\linenumber = \empty % Pre-3.0. cannam@167: \else cannam@167: \def\linenumber{l.\the\inputlineno:\space} cannam@167: \fi cannam@167: cannam@167: % Set up fixed words for English if not already set. cannam@167: \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi cannam@167: \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi cannam@167: \ifx\putworderror\undefined \gdef\putworderror{error}\fi cannam@167: \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi cannam@167: \ifx\putwordin\undefined \gdef\putwordin{in}\fi cannam@167: \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi cannam@167: \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi cannam@167: \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi cannam@167: \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi cannam@167: \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi cannam@167: \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi cannam@167: \ifx\putwordof\undefined \gdef\putwordof{of}\fi cannam@167: \ifx\putwordon\undefined \gdef\putwordon{on}\fi cannam@167: \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi cannam@167: \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi cannam@167: \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi cannam@167: \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi cannam@167: \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi cannam@167: \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi cannam@167: \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi cannam@167: % cannam@167: \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi cannam@167: \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi cannam@167: \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi cannam@167: \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi cannam@167: \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi cannam@167: \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi cannam@167: \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi cannam@167: \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi cannam@167: \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi cannam@167: \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi cannam@167: \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi cannam@167: \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi cannam@167: % cannam@167: \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi cannam@167: \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi cannam@167: \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi cannam@167: \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi cannam@167: \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi cannam@167: cannam@167: % Since the category of space is not known, we have to be careful. cannam@167: \chardef\spacecat = 10 cannam@167: \def\spaceisspace{\catcode`\ =\spacecat} cannam@167: cannam@167: % sometimes characters are active, so we need control sequences. cannam@167: \chardef\ampChar = `\& cannam@167: \chardef\colonChar = `\: cannam@167: \chardef\commaChar = `\, cannam@167: \chardef\dashChar = `\- cannam@167: \chardef\dotChar = `\. cannam@167: \chardef\exclamChar= `\! cannam@167: \chardef\hashChar = `\# cannam@167: \chardef\lquoteChar= `\` cannam@167: \chardef\questChar = `\? cannam@167: \chardef\rquoteChar= `\' cannam@167: \chardef\semiChar = `\; cannam@167: \chardef\slashChar = `\/ cannam@167: \chardef\underChar = `\_ cannam@167: cannam@167: % Ignore a token. cannam@167: % cannam@167: \def\gobble#1{} cannam@167: cannam@167: % The following is used inside several \edef's. cannam@167: \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} cannam@167: cannam@167: % Hyphenation fixes. cannam@167: \hyphenation{ cannam@167: Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script cannam@167: ap-pen-dix bit-map bit-maps cannam@167: data-base data-bases eshell fall-ing half-way long-est man-u-script cannam@167: man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm cannam@167: par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces cannam@167: spell-ing spell-ings cannam@167: stand-alone strong-est time-stamp time-stamps which-ever white-space cannam@167: wide-spread wrap-around cannam@167: } cannam@167: cannam@167: % Margin to add to right of even pages, to left of odd pages. cannam@167: \newdimen\bindingoffset cannam@167: \newdimen\normaloffset cannam@167: \newdimen\pagewidth \newdimen\pageheight cannam@167: cannam@167: % For a final copy, take out the rectangles cannam@167: % that mark overfull boxes (in case you have decided cannam@167: % that the text looks ok even though it passes the margin). cannam@167: % cannam@167: \def\finalout{\overfullrule=0pt } cannam@167: cannam@167: % Sometimes it is convenient to have everything in the transcript file cannam@167: % and nothing on the terminal. We don't just call \tracingall here, cannam@167: % since that produces some useless output on the terminal. We also make cannam@167: % some effort to order the tracing commands to reduce output in the log cannam@167: % file; cf. trace.sty in LaTeX. cannam@167: % cannam@167: \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% cannam@167: \def\loggingall{% cannam@167: \tracingstats2 cannam@167: \tracingpages1 cannam@167: \tracinglostchars2 % 2 gives us more in etex cannam@167: \tracingparagraphs1 cannam@167: \tracingoutput1 cannam@167: \tracingmacros2 cannam@167: \tracingrestores1 cannam@167: \showboxbreadth\maxdimen \showboxdepth\maxdimen cannam@167: \ifx\eTeXversion\thisisundefined\else % etex gives us more logging cannam@167: \tracingscantokens1 cannam@167: \tracingifs1 cannam@167: \tracinggroups1 cannam@167: \tracingnesting2 cannam@167: \tracingassigns1 cannam@167: \fi cannam@167: \tracingcommands3 % 3 gives us more in etex cannam@167: \errorcontextlines16 cannam@167: }% cannam@167: cannam@167: % @errormsg{MSG}. Do the index-like expansions on MSG, but if things cannam@167: % aren't perfect, it's not the end of the world, being an error message, cannam@167: % after all. cannam@167: % cannam@167: \def\errormsg{\begingroup \indexnofonts \doerrormsg} cannam@167: \def\doerrormsg#1{\errmessage{#1}} cannam@167: cannam@167: % add check for \lastpenalty to plain's definitions. If the last thing cannam@167: % we did was a \nobreak, we don't want to insert more space. cannam@167: % cannam@167: \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount cannam@167: \removelastskip\penalty-50\smallskip\fi\fi} cannam@167: \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount cannam@167: \removelastskip\penalty-100\medskip\fi\fi} cannam@167: \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount cannam@167: \removelastskip\penalty-200\bigskip\fi\fi} cannam@167: cannam@167: % Do @cropmarks to get crop marks. cannam@167: % cannam@167: \newif\ifcropmarks cannam@167: \let\cropmarks = \cropmarkstrue cannam@167: % cannam@167: % Dimensions to add cropmarks at corners. cannam@167: % Added by P. A. MacKay, 12 Nov. 1986 cannam@167: % cannam@167: \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines cannam@167: \newdimen\cornerlong \cornerlong=1pc cannam@167: \newdimen\cornerthick \cornerthick=.3pt cannam@167: \newdimen\topandbottommargin \topandbottommargin=.75in cannam@167: cannam@167: % Output a mark which sets \thischapter, \thissection and \thiscolor. cannam@167: % We dump everything together because we only have one kind of mark. cannam@167: % This works because we only use \botmark / \topmark, not \firstmark. cannam@167: % cannam@167: % A mark contains a subexpression of the \ifcase ... \fi construct. cannam@167: % \get*marks macros below extract the needed part using \ifcase. cannam@167: % cannam@167: % Another complication is to let the user choose whether \thischapter cannam@167: % (\thissection) refers to the chapter (section) in effect at the top cannam@167: % of a page, or that at the bottom of a page. The solution is cannam@167: % described on page 260 of The TeXbook. It involves outputting two cannam@167: % marks for the sectioning macros, one before the section break, and cannam@167: % one after. I won't pretend I can describe this better than DEK... cannam@167: \def\domark{% cannam@167: \toks0=\expandafter{\lastchapterdefs}% cannam@167: \toks2=\expandafter{\lastsectiondefs}% cannam@167: \toks4=\expandafter{\prevchapterdefs}% cannam@167: \toks6=\expandafter{\prevsectiondefs}% cannam@167: \toks8=\expandafter{\lastcolordefs}% cannam@167: \mark{% cannam@167: \the\toks0 \the\toks2 cannam@167: \noexpand\or \the\toks4 \the\toks6 cannam@167: \noexpand\else \the\toks8 cannam@167: }% cannam@167: } cannam@167: % \topmark doesn't work for the very first chapter (after the title cannam@167: % page or the contents), so we use \firstmark there -- this gets us cannam@167: % the mark with the chapter defs, unless the user sneaks in, e.g., cannam@167: % @setcolor (or @url, or @link, etc.) between @contents and the very cannam@167: % first @chapter. cannam@167: \def\gettopheadingmarks{% cannam@167: \ifcase0\topmark\fi cannam@167: \ifx\thischapter\empty \ifcase0\firstmark\fi \fi cannam@167: } cannam@167: \def\getbottomheadingmarks{\ifcase1\botmark\fi} cannam@167: \def\getcolormarks{\ifcase2\topmark\fi} cannam@167: cannam@167: % Avoid "undefined control sequence" errors. cannam@167: \def\lastchapterdefs{} cannam@167: \def\lastsectiondefs{} cannam@167: \def\prevchapterdefs{} cannam@167: \def\prevsectiondefs{} cannam@167: \def\lastcolordefs{} cannam@167: cannam@167: % Main output routine. cannam@167: \chardef\PAGE = 255 cannam@167: \output = {\onepageout{\pagecontents\PAGE}} cannam@167: cannam@167: \newbox\headlinebox cannam@167: \newbox\footlinebox cannam@167: cannam@167: % \onepageout takes a vbox as an argument. Note that \pagecontents cannam@167: % does insertions, but you have to call it yourself. cannam@167: \def\onepageout#1{% cannam@167: \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi cannam@167: % cannam@167: \ifodd\pageno \advance\hoffset by \bindingoffset cannam@167: \else \advance\hoffset by -\bindingoffset\fi cannam@167: % cannam@167: % Do this outside of the \shipout so @code etc. will be expanded in cannam@167: % the headline as they should be, not taken literally (outputting ''code). cannam@167: \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi cannam@167: \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% cannam@167: \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi cannam@167: \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% cannam@167: % cannam@167: {% cannam@167: % Have to do this stuff outside the \shipout because we want it to cannam@167: % take effect in \write's, yet the group defined by the \vbox ends cannam@167: % before the \shipout runs. cannam@167: % cannam@167: \indexdummies % don't expand commands in the output. cannam@167: \normalturnoffactive % \ in index entries must not stay \, e.g., if cannam@167: % the page break happens to be in the middle of an example. cannam@167: % We don't want .vr (or whatever) entries like this: cannam@167: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} cannam@167: % "\acronym" won't work when it's read back in; cannam@167: % it needs to be cannam@167: % {\code {{\tt \backslashcurfont }acronym} cannam@167: \shipout\vbox{% cannam@167: % Do this early so pdf references go to the beginning of the page. cannam@167: \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi cannam@167: % cannam@167: \ifcropmarks \vbox to \outervsize\bgroup cannam@167: \hsize = \outerhsize cannam@167: \vskip-\topandbottommargin cannam@167: \vtop to0pt{% cannam@167: \line{\ewtop\hfil\ewtop}% cannam@167: \nointerlineskip cannam@167: \line{% cannam@167: \vbox{\moveleft\cornerthick\nstop}% cannam@167: \hfill cannam@167: \vbox{\moveright\cornerthick\nstop}% cannam@167: }% cannam@167: \vss}% cannam@167: \vskip\topandbottommargin cannam@167: \line\bgroup cannam@167: \hfil % center the page within the outer (page) hsize. cannam@167: \ifodd\pageno\hskip\bindingoffset\fi cannam@167: \vbox\bgroup cannam@167: \fi cannam@167: % cannam@167: \unvbox\headlinebox cannam@167: \pagebody{#1}% cannam@167: \ifdim\ht\footlinebox > 0pt cannam@167: % Only leave this space if the footline is nonempty. cannam@167: % (We lessened \vsize for it in \oddfootingyyy.) cannam@167: % The \baselineskip=24pt in plain's \makefootline has no effect. cannam@167: \vskip 24pt cannam@167: \unvbox\footlinebox cannam@167: \fi cannam@167: % cannam@167: \ifcropmarks cannam@167: \egroup % end of \vbox\bgroup cannam@167: \hfil\egroup % end of (centering) \line\bgroup cannam@167: \vskip\topandbottommargin plus1fill minus1fill cannam@167: \boxmaxdepth = \cornerthick cannam@167: \vbox to0pt{\vss cannam@167: \line{% cannam@167: \vbox{\moveleft\cornerthick\nsbot}% cannam@167: \hfill cannam@167: \vbox{\moveright\cornerthick\nsbot}% cannam@167: }% cannam@167: \nointerlineskip cannam@167: \line{\ewbot\hfil\ewbot}% cannam@167: }% cannam@167: \egroup % \vbox from first cropmarks clause cannam@167: \fi cannam@167: }% end of \shipout\vbox cannam@167: }% end of group with \indexdummies cannam@167: \advancepageno cannam@167: \ifnum\outputpenalty>-20000 \else\dosupereject\fi cannam@167: } cannam@167: cannam@167: \newinsert\margin \dimen\margin=\maxdimen cannam@167: cannam@167: \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} cannam@167: {\catcode`\@ =11 cannam@167: \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi cannam@167: % marginal hacks, juha@viisa.uucp (Juha Takala) cannam@167: \ifvoid\margin\else % marginal info is present cannam@167: \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi cannam@167: \dimen@=\dp#1\relax \unvbox#1\relax cannam@167: \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi cannam@167: \ifr@ggedbottom \kern-\dimen@ \vfil \fi} cannam@167: } cannam@167: cannam@167: % Here are the rules for the cropmarks. Note that they are cannam@167: % offset so that the space between them is truly \outerhsize or \outervsize cannam@167: % (P. A. MacKay, 12 November, 1986) cannam@167: % cannam@167: \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} cannam@167: \def\nstop{\vbox cannam@167: {\hrule height\cornerthick depth\cornerlong width\cornerthick}} cannam@167: \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} cannam@167: \def\nsbot{\vbox cannam@167: {\hrule height\cornerlong depth\cornerthick width\cornerthick}} cannam@167: cannam@167: % Parse an argument, then pass it to #1. The argument is the rest of cannam@167: % the input line (except we remove a trailing comment). #1 should be a cannam@167: % macro which expects an ordinary undelimited TeX argument. cannam@167: % cannam@167: \def\parsearg{\parseargusing{}} cannam@167: \def\parseargusing#1#2{% cannam@167: \def\argtorun{#2}% cannam@167: \begingroup cannam@167: \obeylines cannam@167: \spaceisspace cannam@167: #1% cannam@167: \parseargline\empty% Insert the \empty token, see \finishparsearg below. cannam@167: } cannam@167: cannam@167: {\obeylines % cannam@167: \gdef\parseargline#1^^M{% cannam@167: \endgroup % End of the group started in \parsearg. cannam@167: \argremovecomment #1\comment\ArgTerm% cannam@167: }% cannam@167: } cannam@167: cannam@167: % First remove any @comment, then any @c comment. cannam@167: \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} cannam@167: \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} cannam@167: cannam@167: % Each occurrence of `\^^M' or `\^^M' is replaced by a single space. cannam@167: % cannam@167: % \argremovec might leave us with trailing space, e.g., cannam@167: % @end itemize @c foo cannam@167: % This space token undergoes the same procedure and is eventually removed cannam@167: % by \finishparsearg. cannam@167: % cannam@167: \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} cannam@167: \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} cannam@167: \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% cannam@167: \def\temp{#3}% cannam@167: \ifx\temp\empty cannam@167: % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp: cannam@167: \let\temp\finishparsearg cannam@167: \else cannam@167: \let\temp\argcheckspaces cannam@167: \fi cannam@167: % Put the space token in: cannam@167: \temp#1 #3\ArgTerm cannam@167: } cannam@167: cannam@167: % If a _delimited_ argument is enclosed in braces, they get stripped; so cannam@167: % to get _exactly_ the rest of the line, we had to prevent such situation. cannam@167: % We prepended an \empty token at the very beginning and we expand it now, cannam@167: % just before passing the control to \argtorun. cannam@167: % (Similarly, we have to think about #3 of \argcheckspacesY above: it is cannam@167: % either the null string, or it ends with \^^M---thus there is no danger cannam@167: % that a pair of braces would be stripped. cannam@167: % cannam@167: % But first, we have to remove the trailing space token. cannam@167: % cannam@167: \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}} cannam@167: cannam@167: % \parseargdef\foo{...} cannam@167: % is roughly equivalent to cannam@167: % \def\foo{\parsearg\Xfoo} cannam@167: % \def\Xfoo#1{...} cannam@167: % cannam@167: % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my cannam@167: % favourite TeX trick. --kasal, 16nov03 cannam@167: cannam@167: \def\parseargdef#1{% cannam@167: \expandafter \doparseargdef \csname\string#1\endcsname #1% cannam@167: } cannam@167: \def\doparseargdef#1#2{% cannam@167: \def#2{\parsearg#1}% cannam@167: \def#1##1% cannam@167: } cannam@167: cannam@167: % Several utility definitions with active space: cannam@167: { cannam@167: \obeyspaces cannam@167: \gdef\obeyedspace{ } cannam@167: cannam@167: % Make each space character in the input produce a normal interword cannam@167: % space in the output. Don't allow a line break at this space, as this cannam@167: % is used only in environments like @example, where each line of input cannam@167: % should produce a line of output anyway. cannam@167: % cannam@167: \gdef\sepspaces{\obeyspaces\let =\tie} cannam@167: cannam@167: % If an index command is used in an @example environment, any spaces cannam@167: % therein should become regular spaces in the raw index file, not the cannam@167: % expansion of \tie (\leavevmode \penalty \@M \ ). cannam@167: \gdef\unsepspaces{\let =\space} cannam@167: } cannam@167: cannam@167: cannam@167: \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} cannam@167: cannam@167: % Define the framework for environments in texinfo.tex. It's used like this: cannam@167: % cannam@167: % \envdef\foo{...} cannam@167: % \def\Efoo{...} cannam@167: % cannam@167: % It's the responsibility of \envdef to insert \begingroup before the cannam@167: % actual body; @end closes the group after calling \Efoo. \envdef also cannam@167: % defines \thisenv, so the current environment is known; @end checks cannam@167: % whether the environment name matches. The \checkenv macro can also be cannam@167: % used to check whether the current environment is the one expected. cannam@167: % cannam@167: % Non-false conditionals (@iftex, @ifset) don't fit into this, so they cannam@167: % are not treated as environments; they don't open a group. (The cannam@167: % implementation of @end takes care not to call \endgroup in this cannam@167: % special case.) cannam@167: cannam@167: cannam@167: % At run-time, environments start with this: cannam@167: \def\startenvironment#1{\begingroup\def\thisenv{#1}} cannam@167: % initialize cannam@167: \let\thisenv\empty cannam@167: cannam@167: % ... but they get defined via ``\envdef\foo{...}'': cannam@167: \long\def\envdef#1#2{\def#1{\startenvironment#1#2}} cannam@167: \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} cannam@167: cannam@167: % Check whether we're in the right environment: cannam@167: \def\checkenv#1{% cannam@167: \def\temp{#1}% cannam@167: \ifx\thisenv\temp cannam@167: \else cannam@167: \badenverr cannam@167: \fi cannam@167: } cannam@167: cannam@167: % Environment mismatch, #1 expected: cannam@167: \def\badenverr{% cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{This command can appear only \inenvironment\temp, cannam@167: not \inenvironment\thisenv}% cannam@167: } cannam@167: \def\inenvironment#1{% cannam@167: \ifx#1\empty cannam@167: outside of any environment% cannam@167: \else cannam@167: in environment \expandafter\string#1% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @end foo executes the definition of \Efoo. cannam@167: % But first, it executes a specialized version of \checkenv cannam@167: % cannam@167: \parseargdef\end{% cannam@167: \if 1\csname iscond.#1\endcsname cannam@167: \else cannam@167: % The general wording of \badenverr may not be ideal. cannam@167: \expandafter\checkenv\csname#1\endcsname cannam@167: \csname E#1\endcsname cannam@167: \endgroup cannam@167: \fi cannam@167: } cannam@167: cannam@167: \newhelp\EMsimple{Press RETURN to continue.} cannam@167: cannam@167: cannam@167: % Be sure we're in horizontal mode when doing a tie, since we make space cannam@167: % equivalent to this in @example-like environments. Otherwise, a space cannam@167: % at the beginning of a line will start with \penalty -- and cannam@167: % since \penalty is valid in vertical mode, we'd end up putting the cannam@167: % penalty on the vertical list instead of in the new paragraph. cannam@167: {\catcode`@ = 11 cannam@167: % Avoid using \@M directly, because that causes trouble cannam@167: % if the definition is written into an index file. cannam@167: \global\let\tiepenalty = \@M cannam@167: \gdef\tie{\leavevmode\penalty\tiepenalty\ } cannam@167: } cannam@167: cannam@167: % @: forces normal size whitespace following. cannam@167: \def\:{\spacefactor=1000 } cannam@167: cannam@167: % @* forces a line break. cannam@167: \def\*{\unskip\hfil\break\hbox{}\ignorespaces} cannam@167: cannam@167: % @/ allows a line break. cannam@167: \let\/=\allowbreak cannam@167: cannam@167: % @. is an end-of-sentence period. cannam@167: \def\.{.\spacefactor=\endofsentencespacefactor\space} cannam@167: cannam@167: % @! is an end-of-sentence bang. cannam@167: \def\!{!\spacefactor=\endofsentencespacefactor\space} cannam@167: cannam@167: % @? is an end-of-sentence query. cannam@167: \def\?{?\spacefactor=\endofsentencespacefactor\space} cannam@167: cannam@167: % @frenchspacing on|off says whether to put extra space after punctuation. cannam@167: % cannam@167: \def\onword{on} cannam@167: \def\offword{off} cannam@167: % cannam@167: \parseargdef\frenchspacing{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\onword \plainfrenchspacing cannam@167: \else\ifx\temp\offword \plainnonfrenchspacing cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % @w prevents a word break. Without the \leavevmode, @w at the cannam@167: % beginning of a paragraph, when TeX is still in vertical mode, would cannam@167: % produce a whole line of output instead of starting the paragraph. cannam@167: \def\w#1{\leavevmode\hbox{#1}} cannam@167: cannam@167: % @group ... @end group forces ... to be all on one page, by enclosing cannam@167: % it in a TeX vbox. We use \vtop instead of \vbox to construct the box cannam@167: % to keep its height that of a normal line. According to the rules for cannam@167: % \topskip (p.114 of the TeXbook), the glue inserted is cannam@167: % max (\topskip - \ht (first item), 0). If that height is large, cannam@167: % therefore, no glue is inserted, and the space between the headline and cannam@167: % the text is small, which looks bad. cannam@167: % cannam@167: % Another complication is that the group might be very large. This can cannam@167: % cause the glue on the previous page to be unduly stretched, because it cannam@167: % does not have much material. In this case, it's better to add an cannam@167: % explicit \vfill so that the extra space is at the bottom. The cannam@167: % threshold for doing this is if the group is more than \vfilllimit cannam@167: % percent of a page (\vfilllimit can be changed inside of @tex). cannam@167: % cannam@167: \newbox\groupbox cannam@167: \def\vfilllimit{0.7} cannam@167: % cannam@167: \envdef\group{% cannam@167: \ifnum\catcode`\^^M=\active \else cannam@167: \errhelp = \groupinvalidhelp cannam@167: \errmessage{@group invalid in context where filling is enabled}% cannam@167: \fi cannam@167: \startsavinginserts cannam@167: % cannam@167: \setbox\groupbox = \vtop\bgroup cannam@167: % Do @comment since we are called inside an environment such as cannam@167: % @example, where each end-of-line in the input causes an cannam@167: % end-of-line in the output. We don't want the end-of-line after cannam@167: % the `@group' to put extra space in the output. Since @group cannam@167: % should appear on a line by itself (according to the Texinfo cannam@167: % manual), we don't worry about eating any user text. cannam@167: \comment cannam@167: } cannam@167: % cannam@167: % The \vtop produces a box with normal height and large depth; thus, TeX puts cannam@167: % \baselineskip glue before it, and (when the next line of text is done) cannam@167: % \lineskip glue after it. Thus, space below is not quite equal to space cannam@167: % above. But it's pretty close. cannam@167: \def\Egroup{% cannam@167: % To get correct interline space between the last line of the group cannam@167: % and the first line afterwards, we have to propagate \prevdepth. cannam@167: \endgraf % Not \par, as it may have been set to \lisppar. cannam@167: \global\dimen1 = \prevdepth cannam@167: \egroup % End the \vtop. cannam@167: % \dimen0 is the vertical size of the group's box. cannam@167: \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox cannam@167: % \dimen2 is how much space is left on the page (more or less). cannam@167: \dimen2 = \pageheight \advance\dimen2 by -\pagetotal cannam@167: % if the group doesn't fit on the current page, and it's a big big cannam@167: % group, force a page break. cannam@167: \ifdim \dimen0 > \dimen2 cannam@167: \ifdim \pagetotal < \vfilllimit\pageheight cannam@167: \page cannam@167: \fi cannam@167: \fi cannam@167: \box\groupbox cannam@167: \prevdepth = \dimen1 cannam@167: \checkinserts cannam@167: } cannam@167: % cannam@167: % TeX puts in an \escapechar (i.e., `@') at the beginning of the help cannam@167: % message, so this ends up printing `@group can only ...'. cannam@167: % cannam@167: \newhelp\groupinvalidhelp{% cannam@167: group can only be used in environments such as @example,^^J% cannam@167: where each line of input produces a line of output.} cannam@167: cannam@167: % @need space-in-mils cannam@167: % forces a page break if there is not space-in-mils remaining. cannam@167: cannam@167: \newdimen\mil \mil=0.001in cannam@167: cannam@167: \parseargdef\need{% cannam@167: % Ensure vertical mode, so we don't make a big box in the middle of a cannam@167: % paragraph. cannam@167: \par cannam@167: % cannam@167: % If the @need value is less than one line space, it's useless. cannam@167: \dimen0 = #1\mil cannam@167: \dimen2 = \ht\strutbox cannam@167: \advance\dimen2 by \dp\strutbox cannam@167: \ifdim\dimen0 > \dimen2 cannam@167: % cannam@167: % Do a \strut just to make the height of this box be normal, so the cannam@167: % normal leading is inserted relative to the preceding line. cannam@167: % And a page break here is fine. cannam@167: \vtop to #1\mil{\strut\vfil}% cannam@167: % cannam@167: % TeX does not even consider page breaks if a penalty added to the cannam@167: % main vertical list is 10000 or more. But in order to see if the cannam@167: % empty box we just added fits on the page, we must make it consider cannam@167: % page breaks. On the other hand, we don't want to actually break the cannam@167: % page after the empty box. So we use a penalty of 9999. cannam@167: % cannam@167: % There is an extremely small chance that TeX will actually break the cannam@167: % page at this \penalty, if there are no other feasible breakpoints in cannam@167: % sight. (If the user is using lots of big @group commands, which cannam@167: % almost-but-not-quite fill up a page, TeX will have a hard time doing cannam@167: % good page breaking, for example.) However, I could not construct an cannam@167: % example where a page broke at this \penalty; if it happens in a real cannam@167: % document, then we can reconsider our strategy. cannam@167: \penalty9999 cannam@167: % cannam@167: % Back up by the size of the box, whether we did a page break or not. cannam@167: \kern -#1\mil cannam@167: % cannam@167: % Do not allow a page break right after this kern. cannam@167: \nobreak cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @br forces paragraph break (and is undocumented). cannam@167: cannam@167: \let\br = \par cannam@167: cannam@167: % @page forces the start of a new page. cannam@167: % cannam@167: \def\page{\par\vfill\supereject} cannam@167: cannam@167: % @exdent text.... cannam@167: % outputs text on separate line in roman font, starting at standard page margin cannam@167: cannam@167: % This records the amount of indent in the innermost environment. cannam@167: % That's how much \exdent should take out. cannam@167: \newskip\exdentamount cannam@167: cannam@167: % This defn is used inside fill environments such as @defun. cannam@167: \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} cannam@167: cannam@167: % This defn is used inside nofill environments such as @example. cannam@167: \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount cannam@167: \leftline{\hskip\leftskip{\rm#1}}}} cannam@167: cannam@167: % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current cannam@167: % paragraph. For more general purposes, use the \margin insertion cannam@167: % class. WHICH is `l' or `r'. Not documented, written for gawk manual. cannam@167: % cannam@167: \newskip\inmarginspacing \inmarginspacing=1cm cannam@167: \def\strutdepth{\dp\strutbox} cannam@167: % cannam@167: \def\doinmargin#1#2{\strut\vadjust{% cannam@167: \nobreak cannam@167: \kern-\strutdepth cannam@167: \vtop to \strutdepth{% cannam@167: \baselineskip=\strutdepth cannam@167: \vss cannam@167: % if you have multiple lines of stuff to put here, you'll need to cannam@167: % make the vbox yourself of the appropriate size. cannam@167: \ifx#1l% cannam@167: \llap{\ignorespaces #2\hskip\inmarginspacing}% cannam@167: \else cannam@167: \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% cannam@167: \fi cannam@167: \null cannam@167: }% cannam@167: }} cannam@167: \def\inleftmargin{\doinmargin l} cannam@167: \def\inrightmargin{\doinmargin r} cannam@167: % cannam@167: % @inmargin{TEXT [, RIGHT-TEXT]} cannam@167: % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; cannam@167: % else use TEXT for both). cannam@167: % cannam@167: \def\inmargin#1{\parseinmargin #1,,\finish} cannam@167: \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. cannam@167: \setbox0 = \hbox{\ignorespaces #2}% cannam@167: \ifdim\wd0 > 0pt cannam@167: \def\lefttext{#1}% have both texts cannam@167: \def\righttext{#2}% cannam@167: \else cannam@167: \def\lefttext{#1}% have only one text cannam@167: \def\righttext{#1}% cannam@167: \fi cannam@167: % cannam@167: \ifodd\pageno cannam@167: \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin cannam@167: \else cannam@167: \def\temp{\inleftmargin\lefttext}% cannam@167: \fi cannam@167: \temp cannam@167: } cannam@167: cannam@167: % @| inserts a changebar to the left of the current line. It should cannam@167: % surround any changed text. This approach does *not* work if the cannam@167: % change spans more than two lines of output. To handle that, we would cannam@167: % have adopt a much more difficult approach (putting marks into the main cannam@167: % vertical list for the beginning and end of each change). This command cannam@167: % is not documented, not supported, and doesn't work. cannam@167: % cannam@167: \def\|{% cannam@167: % \vadjust can only be used in horizontal mode. cannam@167: \leavevmode cannam@167: % cannam@167: % Append this vertical mode material after the current line in the output. cannam@167: \vadjust{% cannam@167: % We want to insert a rule with the height and depth of the current cannam@167: % leading; that is exactly what \strutbox is supposed to record. cannam@167: \vskip-\baselineskip cannam@167: % cannam@167: % \vadjust-items are inserted at the left edge of the type. So cannam@167: % the \llap here moves out into the left-hand margin. cannam@167: \llap{% cannam@167: % cannam@167: % For a thicker or thinner bar, change the `1pt'. cannam@167: \vrule height\baselineskip width1pt cannam@167: % cannam@167: % This is the space between the bar and the text. cannam@167: \hskip 12pt cannam@167: }% cannam@167: }% cannam@167: } cannam@167: cannam@167: % @include FILE -- \input text of FILE. cannam@167: % cannam@167: \def\include{\parseargusing\filenamecatcodes\includezzz} cannam@167: \def\includezzz#1{% cannam@167: \pushthisfilestack cannam@167: \def\thisfile{#1}% cannam@167: {% cannam@167: \makevalueexpandable % we want to expand any @value in FILE. cannam@167: \turnoffactive % and allow special characters in the expansion cannam@167: \indexnofonts % Allow `@@' and other weird things in file names. cannam@167: \wlog{texinfo.tex: doing @include of #1^^J}% cannam@167: \edef\temp{\noexpand\input #1 }% cannam@167: % cannam@167: % This trickery is to read FILE outside of a group, in case it makes cannam@167: % definitions, etc. cannam@167: \expandafter cannam@167: }\temp cannam@167: \popthisfilestack cannam@167: } cannam@167: \def\filenamecatcodes{% cannam@167: \catcode`\\=\other cannam@167: \catcode`~=\other cannam@167: \catcode`^=\other cannam@167: \catcode`_=\other cannam@167: \catcode`|=\other cannam@167: \catcode`<=\other cannam@167: \catcode`>=\other cannam@167: \catcode`+=\other cannam@167: \catcode`-=\other cannam@167: \catcode`\`=\other cannam@167: \catcode`\'=\other cannam@167: } cannam@167: cannam@167: \def\pushthisfilestack{% cannam@167: \expandafter\pushthisfilestackX\popthisfilestack\StackTerm cannam@167: } cannam@167: \def\pushthisfilestackX{% cannam@167: \expandafter\pushthisfilestackY\thisfile\StackTerm cannam@167: } cannam@167: \def\pushthisfilestackY #1\StackTerm #2\StackTerm {% cannam@167: \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% cannam@167: } cannam@167: cannam@167: \def\popthisfilestack{\errthisfilestackempty} cannam@167: \def\errthisfilestackempty{\errmessage{Internal error: cannam@167: the stack of filenames is empty.}} cannam@167: % cannam@167: \def\thisfile{} cannam@167: cannam@167: % @center line cannam@167: % outputs that line, centered. cannam@167: % cannam@167: \parseargdef\center{% cannam@167: \ifhmode cannam@167: \let\centersub\centerH cannam@167: \else cannam@167: \let\centersub\centerV cannam@167: \fi cannam@167: \centersub{\hfil \ignorespaces#1\unskip \hfil}% cannam@167: \let\centersub\relax % don't let the definition persist, just in case cannam@167: } cannam@167: \def\centerH#1{{% cannam@167: \hfil\break cannam@167: \advance\hsize by -\leftskip cannam@167: \advance\hsize by -\rightskip cannam@167: \line{#1}% cannam@167: \break cannam@167: }} cannam@167: % cannam@167: \newcount\centerpenalty cannam@167: \def\centerV#1{% cannam@167: % The idea here is the same as in \startdefun, \cartouche, etc.: if cannam@167: % @center is the first thing after a section heading, we need to wipe cannam@167: % out the negative parskip inserted by \sectionheading, but still cannam@167: % prevent a page break here. cannam@167: \centerpenalty = \lastpenalty cannam@167: \ifnum\centerpenalty>10000 \vskip\parskip \fi cannam@167: \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi cannam@167: \line{\kern\leftskip #1\kern\rightskip}% cannam@167: } cannam@167: cannam@167: % @sp n outputs n lines of vertical space cannam@167: % cannam@167: \parseargdef\sp{\vskip #1\baselineskip} cannam@167: cannam@167: % @comment ...line which is ignored... cannam@167: % @c is the same as @comment cannam@167: % @ignore ... @end ignore is another way to write a comment cannam@167: % cannam@167: \def\comment{\begingroup \catcode`\^^M=\other% cannam@167: \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% cannam@167: \commentxxx} cannam@167: {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} cannam@167: % cannam@167: \let\c=\comment cannam@167: cannam@167: % @paragraphindent NCHARS cannam@167: % We'll use ems for NCHARS, close enough. cannam@167: % NCHARS can also be the word `asis' or `none'. cannam@167: % We cannot feasibly implement @paragraphindent asis, though. cannam@167: % cannam@167: \def\asisword{asis} % no translation, these are keywords cannam@167: \def\noneword{none} cannam@167: % cannam@167: \parseargdef\paragraphindent{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\asisword cannam@167: \else cannam@167: \ifx\temp\noneword cannam@167: \defaultparindent = 0pt cannam@167: \else cannam@167: \defaultparindent = #1em cannam@167: \fi cannam@167: \fi cannam@167: \parindent = \defaultparindent cannam@167: } cannam@167: cannam@167: % @exampleindent NCHARS cannam@167: % We'll use ems for NCHARS like @paragraphindent. cannam@167: % It seems @exampleindent asis isn't necessary, but cannam@167: % I preserve it to make it similar to @paragraphindent. cannam@167: \parseargdef\exampleindent{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\asisword cannam@167: \else cannam@167: \ifx\temp\noneword cannam@167: \lispnarrowing = 0pt cannam@167: \else cannam@167: \lispnarrowing = #1em cannam@167: \fi cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @firstparagraphindent WORD cannam@167: % If WORD is `none', then suppress indentation of the first paragraph cannam@167: % after a section heading. If WORD is `insert', then do indent at such cannam@167: % paragraphs. cannam@167: % cannam@167: % The paragraph indentation is suppressed or not by calling cannam@167: % \suppressfirstparagraphindent, which the sectioning commands do. cannam@167: % We switch the definition of this back and forth according to WORD. cannam@167: % By default, we suppress indentation. cannam@167: % cannam@167: \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} cannam@167: \def\insertword{insert} cannam@167: % cannam@167: \parseargdef\firstparagraphindent{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\noneword cannam@167: \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent cannam@167: \else\ifx\temp\insertword cannam@167: \let\suppressfirstparagraphindent = \relax cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @firstparagraphindent option `\temp'}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % Here is how we actually suppress indentation. Redefine \everypar to cannam@167: % \kern backwards by \parindent, and then reset itself to empty. cannam@167: % cannam@167: % We also make \indent itself not actually do anything until the next cannam@167: % paragraph. cannam@167: % cannam@167: \gdef\dosuppressfirstparagraphindent{% cannam@167: \gdef\indent{% cannam@167: \restorefirstparagraphindent cannam@167: \indent cannam@167: }% cannam@167: \gdef\noindent{% cannam@167: \restorefirstparagraphindent cannam@167: \noindent cannam@167: }% cannam@167: \global\everypar = {% cannam@167: \kern -\parindent cannam@167: \restorefirstparagraphindent cannam@167: }% cannam@167: } cannam@167: cannam@167: \gdef\restorefirstparagraphindent{% cannam@167: \global \let \indent = \ptexindent cannam@167: \global \let \noindent = \ptexnoindent cannam@167: \global \everypar = {}% cannam@167: } cannam@167: cannam@167: cannam@167: % @refill is a no-op. cannam@167: \let\refill=\relax cannam@167: cannam@167: % If working on a large document in chapters, it is convenient to cannam@167: % be able to disable indexing, cross-referencing, and contents, for test runs. cannam@167: % This is done with @novalidate (before @setfilename). cannam@167: % cannam@167: \newif\iflinks \linkstrue % by default we want the aux files. cannam@167: \let\novalidate = \linksfalse cannam@167: cannam@167: % @setfilename is done at the beginning of every texinfo file. cannam@167: % So open here the files we need to have open while reading the input. cannam@167: % This makes it possible to make a .fmt file for texinfo. cannam@167: \def\setfilename{% cannam@167: \fixbackslash % Turn off hack to swallow `\input texinfo'. cannam@167: \iflinks cannam@167: \tryauxfile cannam@167: % Open the new aux file. TeX will close it automatically at exit. cannam@167: \immediate\openout\auxfile=\jobname.aux cannam@167: \fi % \openindices needs to do some work in any case. cannam@167: \openindices cannam@167: \let\setfilename=\comment % Ignore extra @setfilename cmds. cannam@167: % cannam@167: % If texinfo.cnf is present on the system, read it. cannam@167: % Useful for site-wide @afourpaper, etc. cannam@167: \openin 1 texinfo.cnf cannam@167: \ifeof 1 \else \input texinfo.cnf \fi cannam@167: \closein 1 cannam@167: % cannam@167: \comment % Ignore the actual filename. cannam@167: } cannam@167: cannam@167: % Called from \setfilename. cannam@167: % cannam@167: \def\openindices{% cannam@167: \newindex{cp}% cannam@167: \newcodeindex{fn}% cannam@167: \newcodeindex{vr}% cannam@167: \newcodeindex{tp}% cannam@167: \newcodeindex{ky}% cannam@167: \newcodeindex{pg}% cannam@167: } cannam@167: cannam@167: % @bye. cannam@167: \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} cannam@167: cannam@167: cannam@167: \message{pdf,} cannam@167: % adobe `portable' document format cannam@167: \newcount\tempnum cannam@167: \newcount\lnkcount cannam@167: \newtoks\filename cannam@167: \newcount\filenamelength cannam@167: \newcount\pgn cannam@167: \newtoks\toksA cannam@167: \newtoks\toksB cannam@167: \newtoks\toksC cannam@167: \newtoks\toksD cannam@167: \newbox\boxA cannam@167: \newcount\countA cannam@167: \newif\ifpdf cannam@167: \newif\ifpdfmakepagedest cannam@167: cannam@167: % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 cannam@167: % can be set). So we test for \relax and 0 as well as being undefined. cannam@167: \ifx\pdfoutput\thisisundefined cannam@167: \else cannam@167: \ifx\pdfoutput\relax cannam@167: \else cannam@167: \ifcase\pdfoutput cannam@167: \else cannam@167: \pdftrue cannam@167: \fi cannam@167: \fi cannam@167: \fi cannam@167: cannam@167: % PDF uses PostScript string constants for the names of xref targets, cannam@167: % for display in the outlines, and in other places. Thus, we have to cannam@167: % double any backslashes. Otherwise, a name like "\node" will be cannam@167: % interpreted as a newline (\n), followed by o, d, e. Not good. cannam@167: % cannam@167: % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and cannam@167: % related messages. The final outcome is that it is up to the TeX user cannam@167: % to double the backslashes and otherwise make the string valid, so cannam@167: % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to cannam@167: % do this reliably, so we use it. cannam@167: cannam@167: % #1 is a control sequence in which to do the replacements, cannam@167: % which we \xdef. cannam@167: \def\txiescapepdf#1{% cannam@167: \ifx\pdfescapestring\thisisundefined cannam@167: % No primitive available; should we give a warning or log? cannam@167: % Many times it won't matter. cannam@167: \else cannam@167: % The expandable \pdfescapestring primitive escapes parentheses, cannam@167: % backslashes, and other special chars. cannam@167: \xdef#1{\pdfescapestring{#1}}% cannam@167: \fi cannam@167: } cannam@167: cannam@167: \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images cannam@167: with PDF output, and none of those formats could be found. (.eps cannot cannam@167: be supported due to the design of the PDF format; use regular TeX (DVI cannam@167: output) for that.)} cannam@167: cannam@167: \ifpdf cannam@167: % cannam@167: % Color manipulation macros based on pdfcolor.tex, cannam@167: % except using rgb instead of cmyk; the latter is said to render as a cannam@167: % very dark gray on-screen and a very dark halftone in print, instead cannam@167: % of actual black. cannam@167: \def\rgbDarkRed{0.50 0.09 0.12} cannam@167: \def\rgbBlack{0 0 0} cannam@167: % cannam@167: % k sets the color for filling (usual text, etc.); cannam@167: % K sets the color for stroking (thin rules, e.g., normal _'s). cannam@167: \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}} cannam@167: % cannam@167: % Set color, and create a mark which defines \thiscolor accordingly, cannam@167: % so that \makeheadline knows which color to restore. cannam@167: \def\setcolor#1{% cannam@167: \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}% cannam@167: \domark cannam@167: \pdfsetcolor{#1}% cannam@167: } cannam@167: % cannam@167: \def\maincolor{\rgbBlack} cannam@167: \pdfsetcolor{\maincolor} cannam@167: \edef\thiscolor{\maincolor} cannam@167: \def\lastcolordefs{} cannam@167: % cannam@167: \def\makefootline{% cannam@167: \baselineskip24pt cannam@167: \line{\pdfsetcolor{\maincolor}\the\footline}% cannam@167: } cannam@167: % cannam@167: \def\makeheadline{% cannam@167: \vbox to 0pt{% cannam@167: \vskip-22.5pt cannam@167: \line{% cannam@167: \vbox to8.5pt{}% cannam@167: % Extract \thiscolor definition from the marks. cannam@167: \getcolormarks cannam@167: % Typeset the headline with \maincolor, then restore the color. cannam@167: \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}% cannam@167: }% cannam@167: \vss cannam@167: }% cannam@167: \nointerlineskip cannam@167: } cannam@167: % cannam@167: % cannam@167: \pdfcatalog{/PageMode /UseOutlines} cannam@167: % cannam@167: % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). cannam@167: \def\dopdfimage#1#2#3{% cannam@167: \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% cannam@167: \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% cannam@167: % cannam@167: % pdftex (and the PDF format) support .pdf, .png, .jpg (among cannam@167: % others). Let's try in that order, PDF first since if cannam@167: % someone has a scalable image, presumably better to use that than a cannam@167: % bitmap. cannam@167: \let\pdfimgext=\empty cannam@167: \begingroup cannam@167: \openin 1 #1.pdf \ifeof 1 cannam@167: \openin 1 #1.PDF \ifeof 1 cannam@167: \openin 1 #1.png \ifeof 1 cannam@167: \openin 1 #1.jpg \ifeof 1 cannam@167: \openin 1 #1.jpeg \ifeof 1 cannam@167: \openin 1 #1.JPG \ifeof 1 cannam@167: \errhelp = \nopdfimagehelp cannam@167: \errmessage{Could not find image file #1 for pdf}% cannam@167: \else \gdef\pdfimgext{JPG}% cannam@167: \fi cannam@167: \else \gdef\pdfimgext{jpeg}% cannam@167: \fi cannam@167: \else \gdef\pdfimgext{jpg}% cannam@167: \fi cannam@167: \else \gdef\pdfimgext{png}% cannam@167: \fi cannam@167: \else \gdef\pdfimgext{PDF}% cannam@167: \fi cannam@167: \else \gdef\pdfimgext{pdf}% cannam@167: \fi cannam@167: \closein 1 cannam@167: \endgroup cannam@167: % cannam@167: % without \immediate, ancient pdftex seg faults when the same image is cannam@167: % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) cannam@167: \ifnum\pdftexversion < 14 cannam@167: \immediate\pdfimage cannam@167: \else cannam@167: \immediate\pdfximage cannam@167: \fi cannam@167: \ifdim \wd0 >0pt width \pdfimagewidth \fi cannam@167: \ifdim \wd2 >0pt height \pdfimageheight \fi cannam@167: \ifnum\pdftexversion<13 cannam@167: #1.\pdfimgext cannam@167: \else cannam@167: {#1.\pdfimgext}% cannam@167: \fi cannam@167: \ifnum\pdftexversion < 14 \else cannam@167: \pdfrefximage \pdflastximage cannam@167: \fi} cannam@167: % cannam@167: \def\pdfmkdest#1{{% cannam@167: % We have to set dummies so commands such as @code, and characters cannam@167: % such as \, aren't expanded when present in a section title. cannam@167: \indexnofonts cannam@167: \turnoffactive cannam@167: \makevalueexpandable cannam@167: \def\pdfdestname{#1}% cannam@167: \txiescapepdf\pdfdestname cannam@167: \safewhatsit{\pdfdest name{\pdfdestname} xyz}% cannam@167: }} cannam@167: % cannam@167: % used to mark target names; must be expandable. cannam@167: \def\pdfmkpgn#1{#1} cannam@167: % cannam@167: % by default, use a color that is dark enough to print on paper as cannam@167: % nearly black, but still distinguishable for online viewing. cannam@167: \def\urlcolor{\rgbDarkRed} cannam@167: \def\linkcolor{\rgbDarkRed} cannam@167: \def\endlink{\setcolor{\maincolor}\pdfendlink} cannam@167: % cannam@167: % Adding outlines to PDF; macros for calculating structure of outlines cannam@167: % come from Petr Olsak cannam@167: \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% cannam@167: \else \csname#1\endcsname \fi} cannam@167: \def\advancenumber#1{\tempnum=\expnumber{#1}\relax cannam@167: \advance\tempnum by 1 cannam@167: \expandafter\xdef\csname#1\endcsname{\the\tempnum}} cannam@167: % cannam@167: % #1 is the section text, which is what will be displayed in the cannam@167: % outline by the pdf viewer. #2 is the pdf expression for the number cannam@167: % of subentries (or empty, for subsubsections). #3 is the node text, cannam@167: % which might be empty if this toc entry had no corresponding node. cannam@167: % #4 is the page number cannam@167: % cannam@167: \def\dopdfoutline#1#2#3#4{% cannam@167: % Generate a link to the node text if that exists; else, use the cannam@167: % page number. We could generate a destination for the section cannam@167: % text in the case where a section has no node, but it doesn't cannam@167: % seem worth the trouble, since most documents are normally structured. cannam@167: \edef\pdfoutlinedest{#3}% cannam@167: \ifx\pdfoutlinedest\empty cannam@167: \def\pdfoutlinedest{#4}% cannam@167: \else cannam@167: \txiescapepdf\pdfoutlinedest cannam@167: \fi cannam@167: % cannam@167: % Also escape PDF chars in the display string. cannam@167: \edef\pdfoutlinetext{#1}% cannam@167: \txiescapepdf\pdfoutlinetext cannam@167: % cannam@167: \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% cannam@167: } cannam@167: % cannam@167: \def\pdfmakeoutlines{% cannam@167: \begingroup cannam@167: % Read toc silently, to get counts of subentries for \pdfoutline. cannam@167: \def\partentry##1##2##3##4{}% ignore parts in the outlines cannam@167: \def\numchapentry##1##2##3##4{% cannam@167: \def\thischapnum{##2}% cannam@167: \def\thissecnum{0}% cannam@167: \def\thissubsecnum{0}% cannam@167: }% cannam@167: \def\numsecentry##1##2##3##4{% cannam@167: \advancenumber{chap\thischapnum}% cannam@167: \def\thissecnum{##2}% cannam@167: \def\thissubsecnum{0}% cannam@167: }% cannam@167: \def\numsubsecentry##1##2##3##4{% cannam@167: \advancenumber{sec\thissecnum}% cannam@167: \def\thissubsecnum{##2}% cannam@167: }% cannam@167: \def\numsubsubsecentry##1##2##3##4{% cannam@167: \advancenumber{subsec\thissubsecnum}% cannam@167: }% cannam@167: \def\thischapnum{0}% cannam@167: \def\thissecnum{0}% cannam@167: \def\thissubsecnum{0}% cannam@167: % cannam@167: % use \def rather than \let here because we redefine \chapentry et cannam@167: % al. a second time, below. cannam@167: \def\appentry{\numchapentry}% cannam@167: \def\appsecentry{\numsecentry}% cannam@167: \def\appsubsecentry{\numsubsecentry}% cannam@167: \def\appsubsubsecentry{\numsubsubsecentry}% cannam@167: \def\unnchapentry{\numchapentry}% cannam@167: \def\unnsecentry{\numsecentry}% cannam@167: \def\unnsubsecentry{\numsubsecentry}% cannam@167: \def\unnsubsubsecentry{\numsubsubsecentry}% cannam@167: \readdatafile{toc}% cannam@167: % cannam@167: % Read toc second time, this time actually producing the outlines. cannam@167: % The `-' means take the \expnumber as the absolute number of cannam@167: % subentries, which we calculated on our first read of the .toc above. cannam@167: % cannam@167: % We use the node names as the destinations. cannam@167: \def\numchapentry##1##2##3##4{% cannam@167: \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% cannam@167: \def\numsecentry##1##2##3##4{% cannam@167: \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% cannam@167: \def\numsubsecentry##1##2##3##4{% cannam@167: \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% cannam@167: \def\numsubsubsecentry##1##2##3##4{% count is always zero cannam@167: \dopdfoutline{##1}{}{##3}{##4}}% cannam@167: % cannam@167: % PDF outlines are displayed using system fonts, instead of cannam@167: % document fonts. Therefore we cannot use special characters, cannam@167: % since the encoding is unknown. For example, the eogonek from cannam@167: % Latin 2 (0xea) gets translated to a | character. Info from cannam@167: % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. cannam@167: % cannam@167: % TODO this right, we have to translate 8-bit characters to cannam@167: % their "best" equivalent, based on the @documentencoding. Too cannam@167: % much work for too little return. Just use the ASCII equivalents cannam@167: % we use for the index sort strings. cannam@167: % cannam@167: \indexnofonts cannam@167: \setupdatafile cannam@167: % We can have normal brace characters in the PDF outlines, unlike cannam@167: % Texinfo index files. So set that up. cannam@167: \def\{{\lbracecharliteral}% cannam@167: \def\}{\rbracecharliteral}% cannam@167: \catcode`\\=\active \otherbackslash cannam@167: \input \tocreadfilename cannam@167: \endgroup cannam@167: } cannam@167: {\catcode`[=1 \catcode`]=2 cannam@167: \catcode`{=\other \catcode`}=\other cannam@167: \gdef\lbracecharliteral[{]% cannam@167: \gdef\rbracecharliteral[}]% cannam@167: ] cannam@167: % cannam@167: \def\skipspaces#1{\def\PP{#1}\def\D{|}% cannam@167: \ifx\PP\D\let\nextsp\relax cannam@167: \else\let\nextsp\skipspaces cannam@167: \addtokens{\filename}{\PP}% cannam@167: \advance\filenamelength by 1 cannam@167: \fi cannam@167: \nextsp} cannam@167: \def\getfilename#1{% cannam@167: \filenamelength=0 cannam@167: % If we don't expand the argument now, \skipspaces will get cannam@167: % snagged on things like "@value{foo}". cannam@167: \edef\temp{#1}% cannam@167: \expandafter\skipspaces\temp|\relax cannam@167: } cannam@167: \ifnum\pdftexversion < 14 cannam@167: \let \startlink \pdfannotlink cannam@167: \else cannam@167: \let \startlink \pdfstartlink cannam@167: \fi cannam@167: % make a live url in pdf output. cannam@167: \def\pdfurl#1{% cannam@167: \begingroup cannam@167: % it seems we really need yet another set of dummies; have not cannam@167: % tried to figure out what each command should do in the context cannam@167: % of @url. for now, just make @/ a no-op, that's the only one cannam@167: % people have actually reported a problem with. cannam@167: % cannam@167: \normalturnoffactive cannam@167: \def\@{@}% cannam@167: \let\/=\empty cannam@167: \makevalueexpandable cannam@167: % do we want to go so far as to use \indexnofonts instead of just cannam@167: % special-casing \var here? cannam@167: \def\var##1{##1}% cannam@167: % cannam@167: \leavevmode\setcolor{\urlcolor}% cannam@167: \startlink attr{/Border [0 0 0]}% cannam@167: user{/Subtype /Link /A << /S /URI /URI (#1) >>}% cannam@167: \endgroup} cannam@167: \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} cannam@167: \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} cannam@167: \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} cannam@167: \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} cannam@167: \def\maketoks{% cannam@167: \expandafter\poptoks\the\toksA|ENDTOKS|\relax cannam@167: \ifx\first0\adn0 cannam@167: \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 cannam@167: \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 cannam@167: \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 cannam@167: \else cannam@167: \ifnum0=\countA\else\makelink\fi cannam@167: \ifx\first.\let\next=\done\else cannam@167: \let\next=\maketoks cannam@167: \addtokens{\toksB}{\the\toksD} cannam@167: \ifx\first,\addtokens{\toksB}{\space}\fi cannam@167: \fi cannam@167: \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi cannam@167: \next} cannam@167: \def\makelink{\addtokens{\toksB}% cannam@167: {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} cannam@167: \def\pdflink#1{% cannam@167: \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} cannam@167: \setcolor{\linkcolor}#1\endlink} cannam@167: \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} cannam@167: \else cannam@167: % non-pdf mode cannam@167: \let\pdfmkdest = \gobble cannam@167: \let\pdfurl = \gobble cannam@167: \let\endlink = \relax cannam@167: \let\setcolor = \gobble cannam@167: \let\pdfsetcolor = \gobble cannam@167: \let\pdfmakeoutlines = \relax cannam@167: \fi % \ifx\pdfoutput cannam@167: cannam@167: cannam@167: \message{fonts,} cannam@167: cannam@167: % Change the current font style to #1, remembering it in \curfontstyle. cannam@167: % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in cannam@167: % italics, not bold italics. cannam@167: % cannam@167: \def\setfontstyle#1{% cannam@167: \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. cannam@167: \csname ten#1\endcsname % change the current font cannam@167: } cannam@167: cannam@167: % Select #1 fonts with the current style. cannam@167: % cannam@167: \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} cannam@167: cannam@167: \def\rm{\fam=0 \setfontstyle{rm}} cannam@167: \def\it{\fam=\itfam \setfontstyle{it}} cannam@167: \def\sl{\fam=\slfam \setfontstyle{sl}} cannam@167: \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} cannam@167: \def\tt{\fam=\ttfam \setfontstyle{tt}} cannam@167: cannam@167: % Unfortunately, we have to override this for titles and the like, since cannam@167: % in those cases "rm" is bold. Sigh. cannam@167: \def\rmisbold{\rm\def\curfontstyle{bf}} cannam@167: cannam@167: % Texinfo sort of supports the sans serif font style, which plain TeX does not. cannam@167: % So we set up a \sf. cannam@167: \newfam\sffam cannam@167: \def\sf{\fam=\sffam \setfontstyle{sf}} cannam@167: \let\li = \sf % Sometimes we call it \li, not \sf. cannam@167: cannam@167: % We don't need math for this font style. cannam@167: \def\ttsl{\setfontstyle{ttsl}} cannam@167: cannam@167: cannam@167: % Set the baselineskip to #1, and the lineskip and strut size cannam@167: % correspondingly. There is no deep meaning behind these magic numbers cannam@167: % used as factors; they just match (closely enough) what Knuth defined. cannam@167: % cannam@167: \def\lineskipfactor{.08333} cannam@167: \def\strutheightpercent{.70833} cannam@167: \def\strutdepthpercent {.29167} cannam@167: % cannam@167: % can get a sort of poor man's double spacing by redefining this. cannam@167: \def\baselinefactor{1} cannam@167: % cannam@167: \newdimen\textleading cannam@167: \def\setleading#1{% cannam@167: \dimen0 = #1\relax cannam@167: \normalbaselineskip = \baselinefactor\dimen0 cannam@167: \normallineskip = \lineskipfactor\normalbaselineskip cannam@167: \normalbaselines cannam@167: \setbox\strutbox =\hbox{% cannam@167: \vrule width0pt height\strutheightpercent\baselineskip cannam@167: depth \strutdepthpercent \baselineskip cannam@167: }% cannam@167: } cannam@167: cannam@167: % PDF CMaps. See also LaTeX's t1.cmap. cannam@167: % cannam@167: % do nothing with this by default. cannam@167: \expandafter\let\csname cmapOT1\endcsname\gobble cannam@167: \expandafter\let\csname cmapOT1IT\endcsname\gobble cannam@167: \expandafter\let\csname cmapOT1TT\endcsname\gobble cannam@167: cannam@167: % if we are producing pdf, and we have \pdffontattr, then define cmaps. cannam@167: % (\pdffontattr was introduced many years ago, but people still run cannam@167: % older pdftex's; it's easy to conditionalize, so we do.) cannam@167: \ifpdf \ifx\pdffontattr\thisisundefined \else cannam@167: \begingroup cannam@167: \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. cannam@167: \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap cannam@167: %%DocumentNeededResources: ProcSet (CIDInit) cannam@167: %%IncludeResource: ProcSet (CIDInit) cannam@167: %%BeginResource: CMap (TeX-OT1-0) cannam@167: %%Title: (TeX-OT1-0 TeX OT1 0) cannam@167: %%Version: 1.000 cannam@167: %%EndComments cannam@167: /CIDInit /ProcSet findresource begin cannam@167: 12 dict begin cannam@167: begincmap cannam@167: /CIDSystemInfo cannam@167: << /Registry (TeX) cannam@167: /Ordering (OT1) cannam@167: /Supplement 0 cannam@167: >> def cannam@167: /CMapName /TeX-OT1-0 def cannam@167: /CMapType 2 def cannam@167: 1 begincodespacerange cannam@167: <00> <7F> cannam@167: endcodespacerange cannam@167: 8 beginbfrange cannam@167: <00> <01> <0393> cannam@167: <09> <0A> <03A8> cannam@167: <23> <26> <0023> cannam@167: <28> <3B> <0028> cannam@167: <3F> <5B> <003F> cannam@167: <5D> <5E> <005D> cannam@167: <61> <7A> <0061> cannam@167: <7B> <7C> <2013> cannam@167: endbfrange cannam@167: 40 beginbfchar cannam@167: <02> <0398> cannam@167: <03> <039B> cannam@167: <04> <039E> cannam@167: <05> <03A0> cannam@167: <06> <03A3> cannam@167: <07> <03D2> cannam@167: <08> <03A6> cannam@167: <0B> <00660066> cannam@167: <0C> <00660069> cannam@167: <0D> <0066006C> cannam@167: <0E> <006600660069> cannam@167: <0F> <00660066006C> cannam@167: <10> <0131> cannam@167: <11> <0237> cannam@167: <12> <0060> cannam@167: <13> <00B4> cannam@167: <14> <02C7> cannam@167: <15> <02D8> cannam@167: <16> <00AF> cannam@167: <17> <02DA> cannam@167: <18> <00B8> cannam@167: <19> <00DF> cannam@167: <1A> <00E6> cannam@167: <1B> <0153> cannam@167: <1C> <00F8> cannam@167: <1D> <00C6> cannam@167: <1E> <0152> cannam@167: <1F> <00D8> cannam@167: <21> <0021> cannam@167: <22> <201D> cannam@167: <27> <2019> cannam@167: <3C> <00A1> cannam@167: <3D> <003D> cannam@167: <3E> <00BF> cannam@167: <5C> <201C> cannam@167: <5F> <02D9> cannam@167: <60> <2018> cannam@167: <7D> <02DD> cannam@167: <7E> <007E> cannam@167: <7F> <00A8> cannam@167: endbfchar cannam@167: endcmap cannam@167: CMapName currentdict /CMap defineresource pop cannam@167: end cannam@167: end cannam@167: %%EndResource cannam@167: %%EOF cannam@167: }\endgroup cannam@167: \expandafter\edef\csname cmapOT1\endcsname#1{% cannam@167: \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% cannam@167: }% cannam@167: % cannam@167: % \cmapOT1IT cannam@167: \begingroup cannam@167: \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. cannam@167: \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap cannam@167: %%DocumentNeededResources: ProcSet (CIDInit) cannam@167: %%IncludeResource: ProcSet (CIDInit) cannam@167: %%BeginResource: CMap (TeX-OT1IT-0) cannam@167: %%Title: (TeX-OT1IT-0 TeX OT1IT 0) cannam@167: %%Version: 1.000 cannam@167: %%EndComments cannam@167: /CIDInit /ProcSet findresource begin cannam@167: 12 dict begin cannam@167: begincmap cannam@167: /CIDSystemInfo cannam@167: << /Registry (TeX) cannam@167: /Ordering (OT1IT) cannam@167: /Supplement 0 cannam@167: >> def cannam@167: /CMapName /TeX-OT1IT-0 def cannam@167: /CMapType 2 def cannam@167: 1 begincodespacerange cannam@167: <00> <7F> cannam@167: endcodespacerange cannam@167: 8 beginbfrange cannam@167: <00> <01> <0393> cannam@167: <09> <0A> <03A8> cannam@167: <25> <26> <0025> cannam@167: <28> <3B> <0028> cannam@167: <3F> <5B> <003F> cannam@167: <5D> <5E> <005D> cannam@167: <61> <7A> <0061> cannam@167: <7B> <7C> <2013> cannam@167: endbfrange cannam@167: 42 beginbfchar cannam@167: <02> <0398> cannam@167: <03> <039B> cannam@167: <04> <039E> cannam@167: <05> <03A0> cannam@167: <06> <03A3> cannam@167: <07> <03D2> cannam@167: <08> <03A6> cannam@167: <0B> <00660066> cannam@167: <0C> <00660069> cannam@167: <0D> <0066006C> cannam@167: <0E> <006600660069> cannam@167: <0F> <00660066006C> cannam@167: <10> <0131> cannam@167: <11> <0237> cannam@167: <12> <0060> cannam@167: <13> <00B4> cannam@167: <14> <02C7> cannam@167: <15> <02D8> cannam@167: <16> <00AF> cannam@167: <17> <02DA> cannam@167: <18> <00B8> cannam@167: <19> <00DF> cannam@167: <1A> <00E6> cannam@167: <1B> <0153> cannam@167: <1C> <00F8> cannam@167: <1D> <00C6> cannam@167: <1E> <0152> cannam@167: <1F> <00D8> cannam@167: <21> <0021> cannam@167: <22> <201D> cannam@167: <23> <0023> cannam@167: <24> <00A3> cannam@167: <27> <2019> cannam@167: <3C> <00A1> cannam@167: <3D> <003D> cannam@167: <3E> <00BF> cannam@167: <5C> <201C> cannam@167: <5F> <02D9> cannam@167: <60> <2018> cannam@167: <7D> <02DD> cannam@167: <7E> <007E> cannam@167: <7F> <00A8> cannam@167: endbfchar cannam@167: endcmap cannam@167: CMapName currentdict /CMap defineresource pop cannam@167: end cannam@167: end cannam@167: %%EndResource cannam@167: %%EOF cannam@167: }\endgroup cannam@167: \expandafter\edef\csname cmapOT1IT\endcsname#1{% cannam@167: \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% cannam@167: }% cannam@167: % cannam@167: % \cmapOT1TT cannam@167: \begingroup cannam@167: \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. cannam@167: \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap cannam@167: %%DocumentNeededResources: ProcSet (CIDInit) cannam@167: %%IncludeResource: ProcSet (CIDInit) cannam@167: %%BeginResource: CMap (TeX-OT1TT-0) cannam@167: %%Title: (TeX-OT1TT-0 TeX OT1TT 0) cannam@167: %%Version: 1.000 cannam@167: %%EndComments cannam@167: /CIDInit /ProcSet findresource begin cannam@167: 12 dict begin cannam@167: begincmap cannam@167: /CIDSystemInfo cannam@167: << /Registry (TeX) cannam@167: /Ordering (OT1TT) cannam@167: /Supplement 0 cannam@167: >> def cannam@167: /CMapName /TeX-OT1TT-0 def cannam@167: /CMapType 2 def cannam@167: 1 begincodespacerange cannam@167: <00> <7F> cannam@167: endcodespacerange cannam@167: 5 beginbfrange cannam@167: <00> <01> <0393> cannam@167: <09> <0A> <03A8> cannam@167: <21> <26> <0021> cannam@167: <28> <5F> <0028> cannam@167: <61> <7E> <0061> cannam@167: endbfrange cannam@167: 32 beginbfchar cannam@167: <02> <0398> cannam@167: <03> <039B> cannam@167: <04> <039E> cannam@167: <05> <03A0> cannam@167: <06> <03A3> cannam@167: <07> <03D2> cannam@167: <08> <03A6> cannam@167: <0B> <2191> cannam@167: <0C> <2193> cannam@167: <0D> <0027> cannam@167: <0E> <00A1> cannam@167: <0F> <00BF> cannam@167: <10> <0131> cannam@167: <11> <0237> cannam@167: <12> <0060> cannam@167: <13> <00B4> cannam@167: <14> <02C7> cannam@167: <15> <02D8> cannam@167: <16> <00AF> cannam@167: <17> <02DA> cannam@167: <18> <00B8> cannam@167: <19> <00DF> cannam@167: <1A> <00E6> cannam@167: <1B> <0153> cannam@167: <1C> <00F8> cannam@167: <1D> <00C6> cannam@167: <1E> <0152> cannam@167: <1F> <00D8> cannam@167: <20> <2423> cannam@167: <27> <2019> cannam@167: <60> <2018> cannam@167: <7F> <00A8> cannam@167: endbfchar cannam@167: endcmap cannam@167: CMapName currentdict /CMap defineresource pop cannam@167: end cannam@167: end cannam@167: %%EndResource cannam@167: %%EOF cannam@167: }\endgroup cannam@167: \expandafter\edef\csname cmapOT1TT\endcsname#1{% cannam@167: \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}% cannam@167: }% cannam@167: \fi\fi cannam@167: cannam@167: cannam@167: % Set the font macro #1 to the font named \fontprefix#2. cannam@167: % #3 is the font's design size, #4 is a scale factor, #5 is the CMap cannam@167: % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit). cannam@167: % Example: cannam@167: % #1 = \textrm cannam@167: % #2 = \rmshape cannam@167: % #3 = 10 cannam@167: % #4 = \mainmagstep cannam@167: % #5 = OT1 cannam@167: % cannam@167: \def\setfont#1#2#3#4#5{% cannam@167: \font#1=\fontprefix#2#3 scaled #4 cannam@167: \csname cmap#5\endcsname#1% cannam@167: } cannam@167: % This is what gets called when #5 of \setfont is empty. cannam@167: \let\cmap\gobble cannam@167: % cannam@167: % (end of cmaps) cannam@167: cannam@167: % Use cm as the default font prefix. cannam@167: % To specify the font prefix, you must define \fontprefix cannam@167: % before you read in texinfo.tex. cannam@167: \ifx\fontprefix\thisisundefined cannam@167: \def\fontprefix{cm} cannam@167: \fi cannam@167: % Support font families that don't use the same naming scheme as CM. cannam@167: \def\rmshape{r} cannam@167: \def\rmbshape{bx} % where the normal face is bold cannam@167: \def\bfshape{b} cannam@167: \def\bxshape{bx} cannam@167: \def\ttshape{tt} cannam@167: \def\ttbshape{tt} cannam@167: \def\ttslshape{sltt} cannam@167: \def\itshape{ti} cannam@167: \def\itbshape{bxti} cannam@167: \def\slshape{sl} cannam@167: \def\slbshape{bxsl} cannam@167: \def\sfshape{ss} cannam@167: \def\sfbshape{ss} cannam@167: \def\scshape{csc} cannam@167: \def\scbshape{csc} cannam@167: cannam@167: % Definitions for a main text size of 11pt. (The default in Texinfo.) cannam@167: % cannam@167: \def\definetextfontsizexi{% cannam@167: % Text fonts (11.2pt, magstep1). cannam@167: \def\textnominalsize{11pt} cannam@167: \edef\mainmagstep{\magstephalf} cannam@167: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} cannam@167: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} cannam@167: \setfont\textsl\slshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textsc\scshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} cannam@167: \font\texti=cmmi10 scaled \mainmagstep cannam@167: \font\textsy=cmsy10 scaled \mainmagstep cannam@167: \def\textecsize{1095} cannam@167: cannam@167: % A few fonts for @defun names and args. cannam@167: \setfont\defbf\bfshape{10}{\magstep1}{OT1} cannam@167: \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} cannam@167: \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} cannam@167: \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} cannam@167: cannam@167: % Fonts for indices, footnotes, small examples (9pt). cannam@167: \def\smallnominalsize{9pt} cannam@167: \setfont\smallrm\rmshape{9}{1000}{OT1} cannam@167: \setfont\smalltt\ttshape{9}{1000}{OT1TT} cannam@167: \setfont\smallbf\bfshape{10}{900}{OT1} cannam@167: \setfont\smallit\itshape{9}{1000}{OT1IT} cannam@167: \setfont\smallsl\slshape{9}{1000}{OT1} cannam@167: \setfont\smallsf\sfshape{9}{1000}{OT1} cannam@167: \setfont\smallsc\scshape{10}{900}{OT1} cannam@167: \setfont\smallttsl\ttslshape{10}{900}{OT1TT} cannam@167: \font\smalli=cmmi9 cannam@167: \font\smallsy=cmsy9 cannam@167: \def\smallecsize{0900} cannam@167: cannam@167: % Fonts for small examples (8pt). cannam@167: \def\smallernominalsize{8pt} cannam@167: \setfont\smallerrm\rmshape{8}{1000}{OT1} cannam@167: \setfont\smallertt\ttshape{8}{1000}{OT1TT} cannam@167: \setfont\smallerbf\bfshape{10}{800}{OT1} cannam@167: \setfont\smallerit\itshape{8}{1000}{OT1IT} cannam@167: \setfont\smallersl\slshape{8}{1000}{OT1} cannam@167: \setfont\smallersf\sfshape{8}{1000}{OT1} cannam@167: \setfont\smallersc\scshape{10}{800}{OT1} cannam@167: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} cannam@167: \font\smalleri=cmmi8 cannam@167: \font\smallersy=cmsy8 cannam@167: \def\smallerecsize{0800} cannam@167: cannam@167: % Fonts for title page (20.4pt): cannam@167: \def\titlenominalsize{20pt} cannam@167: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} cannam@167: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} cannam@167: \setfont\titlesl\slbshape{10}{\magstep4}{OT1} cannam@167: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} cannam@167: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} cannam@167: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} cannam@167: \let\titlebf=\titlerm cannam@167: \setfont\titlesc\scbshape{10}{\magstep4}{OT1} cannam@167: \font\titlei=cmmi12 scaled \magstep3 cannam@167: \font\titlesy=cmsy10 scaled \magstep4 cannam@167: \def\titleecsize{2074} cannam@167: cannam@167: % Chapter (and unnumbered) fonts (17.28pt). cannam@167: \def\chapnominalsize{17pt} cannam@167: \setfont\chaprm\rmbshape{12}{\magstep2}{OT1} cannam@167: \setfont\chapit\itbshape{10}{\magstep3}{OT1IT} cannam@167: \setfont\chapsl\slbshape{10}{\magstep3}{OT1} cannam@167: \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT} cannam@167: \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT} cannam@167: \setfont\chapsf\sfbshape{17}{1000}{OT1} cannam@167: \let\chapbf=\chaprm cannam@167: \setfont\chapsc\scbshape{10}{\magstep3}{OT1} cannam@167: \font\chapi=cmmi12 scaled \magstep2 cannam@167: \font\chapsy=cmsy10 scaled \magstep3 cannam@167: \def\chapecsize{1728} cannam@167: cannam@167: % Section fonts (14.4pt). cannam@167: \def\secnominalsize{14pt} cannam@167: \setfont\secrm\rmbshape{12}{\magstep1}{OT1} cannam@167: \setfont\secit\itbshape{10}{\magstep2}{OT1IT} cannam@167: \setfont\secsl\slbshape{10}{\magstep2}{OT1} cannam@167: \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT} cannam@167: \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT} cannam@167: \setfont\secsf\sfbshape{12}{\magstep1}{OT1} cannam@167: \let\secbf\secrm cannam@167: \setfont\secsc\scbshape{10}{\magstep2}{OT1} cannam@167: \font\seci=cmmi12 scaled \magstep1 cannam@167: \font\secsy=cmsy10 scaled \magstep2 cannam@167: \def\sececsize{1440} cannam@167: cannam@167: % Subsection fonts (13.15pt). cannam@167: \def\ssecnominalsize{13pt} cannam@167: \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1} cannam@167: \setfont\ssecit\itbshape{10}{1315}{OT1IT} cannam@167: \setfont\ssecsl\slbshape{10}{1315}{OT1} cannam@167: \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT} cannam@167: \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT} cannam@167: \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1} cannam@167: \let\ssecbf\ssecrm cannam@167: \setfont\ssecsc\scbshape{10}{1315}{OT1} cannam@167: \font\sseci=cmmi12 scaled \magstephalf cannam@167: \font\ssecsy=cmsy10 scaled 1315 cannam@167: \def\ssececsize{1200} cannam@167: cannam@167: % Reduced fonts for @acro in text (10pt). cannam@167: \def\reducednominalsize{10pt} cannam@167: \setfont\reducedrm\rmshape{10}{1000}{OT1} cannam@167: \setfont\reducedtt\ttshape{10}{1000}{OT1TT} cannam@167: \setfont\reducedbf\bfshape{10}{1000}{OT1} cannam@167: \setfont\reducedit\itshape{10}{1000}{OT1IT} cannam@167: \setfont\reducedsl\slshape{10}{1000}{OT1} cannam@167: \setfont\reducedsf\sfshape{10}{1000}{OT1} cannam@167: \setfont\reducedsc\scshape{10}{1000}{OT1} cannam@167: \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT} cannam@167: \font\reducedi=cmmi10 cannam@167: \font\reducedsy=cmsy10 cannam@167: \def\reducedecsize{1000} cannam@167: cannam@167: \textleading = 13.2pt % line spacing for 11pt CM cannam@167: \textfonts % reset the current fonts cannam@167: \rm cannam@167: } % end of 11pt text font size definitions, \definetextfontsizexi cannam@167: cannam@167: cannam@167: % Definitions to make the main text be 10pt Computer Modern, with cannam@167: % section, chapter, etc., sizes following suit. This is for the GNU cannam@167: % Press printing of the Emacs 22 manual. Maybe other manuals in the cannam@167: % future. Used with @smallbook, which sets the leading to 12pt. cannam@167: % cannam@167: \def\definetextfontsizex{% cannam@167: % Text fonts (10pt). cannam@167: \def\textnominalsize{10pt} cannam@167: \edef\mainmagstep{1000} cannam@167: \setfont\textrm\rmshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT} cannam@167: \setfont\textbf\bfshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textit\itshape{10}{\mainmagstep}{OT1IT} cannam@167: \setfont\textsl\slshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textsf\sfshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textsc\scshape{10}{\mainmagstep}{OT1} cannam@167: \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT} cannam@167: \font\texti=cmmi10 scaled \mainmagstep cannam@167: \font\textsy=cmsy10 scaled \mainmagstep cannam@167: \def\textecsize{1000} cannam@167: cannam@167: % A few fonts for @defun names and args. cannam@167: \setfont\defbf\bfshape{10}{\magstephalf}{OT1} cannam@167: \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} cannam@167: \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} cannam@167: \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} cannam@167: cannam@167: % Fonts for indices, footnotes, small examples (9pt). cannam@167: \def\smallnominalsize{9pt} cannam@167: \setfont\smallrm\rmshape{9}{1000}{OT1} cannam@167: \setfont\smalltt\ttshape{9}{1000}{OT1TT} cannam@167: \setfont\smallbf\bfshape{10}{900}{OT1} cannam@167: \setfont\smallit\itshape{9}{1000}{OT1IT} cannam@167: \setfont\smallsl\slshape{9}{1000}{OT1} cannam@167: \setfont\smallsf\sfshape{9}{1000}{OT1} cannam@167: \setfont\smallsc\scshape{10}{900}{OT1} cannam@167: \setfont\smallttsl\ttslshape{10}{900}{OT1TT} cannam@167: \font\smalli=cmmi9 cannam@167: \font\smallsy=cmsy9 cannam@167: \def\smallecsize{0900} cannam@167: cannam@167: % Fonts for small examples (8pt). cannam@167: \def\smallernominalsize{8pt} cannam@167: \setfont\smallerrm\rmshape{8}{1000}{OT1} cannam@167: \setfont\smallertt\ttshape{8}{1000}{OT1TT} cannam@167: \setfont\smallerbf\bfshape{10}{800}{OT1} cannam@167: \setfont\smallerit\itshape{8}{1000}{OT1IT} cannam@167: \setfont\smallersl\slshape{8}{1000}{OT1} cannam@167: \setfont\smallersf\sfshape{8}{1000}{OT1} cannam@167: \setfont\smallersc\scshape{10}{800}{OT1} cannam@167: \setfont\smallerttsl\ttslshape{10}{800}{OT1TT} cannam@167: \font\smalleri=cmmi8 cannam@167: \font\smallersy=cmsy8 cannam@167: \def\smallerecsize{0800} cannam@167: cannam@167: % Fonts for title page (20.4pt): cannam@167: \def\titlenominalsize{20pt} cannam@167: \setfont\titlerm\rmbshape{12}{\magstep3}{OT1} cannam@167: \setfont\titleit\itbshape{10}{\magstep4}{OT1IT} cannam@167: \setfont\titlesl\slbshape{10}{\magstep4}{OT1} cannam@167: \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT} cannam@167: \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT} cannam@167: \setfont\titlesf\sfbshape{17}{\magstep1}{OT1} cannam@167: \let\titlebf=\titlerm cannam@167: \setfont\titlesc\scbshape{10}{\magstep4}{OT1} cannam@167: \font\titlei=cmmi12 scaled \magstep3 cannam@167: \font\titlesy=cmsy10 scaled \magstep4 cannam@167: \def\titleecsize{2074} cannam@167: cannam@167: % Chapter fonts (14.4pt). cannam@167: \def\chapnominalsize{14pt} cannam@167: \setfont\chaprm\rmbshape{12}{\magstep1}{OT1} cannam@167: \setfont\chapit\itbshape{10}{\magstep2}{OT1IT} cannam@167: \setfont\chapsl\slbshape{10}{\magstep2}{OT1} cannam@167: \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT} cannam@167: \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT} cannam@167: \setfont\chapsf\sfbshape{12}{\magstep1}{OT1} cannam@167: \let\chapbf\chaprm cannam@167: \setfont\chapsc\scbshape{10}{\magstep2}{OT1} cannam@167: \font\chapi=cmmi12 scaled \magstep1 cannam@167: \font\chapsy=cmsy10 scaled \magstep2 cannam@167: \def\chapecsize{1440} cannam@167: cannam@167: % Section fonts (12pt). cannam@167: \def\secnominalsize{12pt} cannam@167: \setfont\secrm\rmbshape{12}{1000}{OT1} cannam@167: \setfont\secit\itbshape{10}{\magstep1}{OT1IT} cannam@167: \setfont\secsl\slbshape{10}{\magstep1}{OT1} cannam@167: \setfont\sectt\ttbshape{12}{1000}{OT1TT} cannam@167: \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT} cannam@167: \setfont\secsf\sfbshape{12}{1000}{OT1} cannam@167: \let\secbf\secrm cannam@167: \setfont\secsc\scbshape{10}{\magstep1}{OT1} cannam@167: \font\seci=cmmi12 cannam@167: \font\secsy=cmsy10 scaled \magstep1 cannam@167: \def\sececsize{1200} cannam@167: cannam@167: % Subsection fonts (10pt). cannam@167: \def\ssecnominalsize{10pt} cannam@167: \setfont\ssecrm\rmbshape{10}{1000}{OT1} cannam@167: \setfont\ssecit\itbshape{10}{1000}{OT1IT} cannam@167: \setfont\ssecsl\slbshape{10}{1000}{OT1} cannam@167: \setfont\ssectt\ttbshape{10}{1000}{OT1TT} cannam@167: \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT} cannam@167: \setfont\ssecsf\sfbshape{10}{1000}{OT1} cannam@167: \let\ssecbf\ssecrm cannam@167: \setfont\ssecsc\scbshape{10}{1000}{OT1} cannam@167: \font\sseci=cmmi10 cannam@167: \font\ssecsy=cmsy10 cannam@167: \def\ssececsize{1000} cannam@167: cannam@167: % Reduced fonts for @acro in text (9pt). cannam@167: \def\reducednominalsize{9pt} cannam@167: \setfont\reducedrm\rmshape{9}{1000}{OT1} cannam@167: \setfont\reducedtt\ttshape{9}{1000}{OT1TT} cannam@167: \setfont\reducedbf\bfshape{10}{900}{OT1} cannam@167: \setfont\reducedit\itshape{9}{1000}{OT1IT} cannam@167: \setfont\reducedsl\slshape{9}{1000}{OT1} cannam@167: \setfont\reducedsf\sfshape{9}{1000}{OT1} cannam@167: \setfont\reducedsc\scshape{10}{900}{OT1} cannam@167: \setfont\reducedttsl\ttslshape{10}{900}{OT1TT} cannam@167: \font\reducedi=cmmi9 cannam@167: \font\reducedsy=cmsy9 cannam@167: \def\reducedecsize{0900} cannam@167: cannam@167: \divide\parskip by 2 % reduce space between paragraphs cannam@167: \textleading = 12pt % line spacing for 10pt CM cannam@167: \textfonts % reset the current fonts cannam@167: \rm cannam@167: } % end of 10pt text font size definitions, \definetextfontsizex cannam@167: cannam@167: cannam@167: % We provide the user-level command cannam@167: % @fonttextsize 10 cannam@167: % (or 11) to redefine the text font size. pt is assumed. cannam@167: % cannam@167: \def\xiword{11} cannam@167: \def\xword{10} cannam@167: \def\xwordpt{10pt} cannam@167: % cannam@167: \parseargdef\fonttextsize{% cannam@167: \def\textsizearg{#1}% cannam@167: %\wlog{doing @fonttextsize \textsizearg}% cannam@167: % cannam@167: % Set \globaldefs so that documents can use this inside @tex, since cannam@167: % makeinfo 4.8 does not support it, but we need it nonetheless. cannam@167: % cannam@167: \begingroup \globaldefs=1 cannam@167: \ifx\textsizearg\xword \definetextfontsizex cannam@167: \else \ifx\textsizearg\xiword \definetextfontsizexi cannam@167: \else cannam@167: \errhelp=\EMsimple cannam@167: \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'} cannam@167: \fi\fi cannam@167: \endgroup cannam@167: } cannam@167: cannam@167: cannam@167: % In order for the font changes to affect most math symbols and letters, cannam@167: % we have to define the \textfont of the standard families. Since cannam@167: % texinfo doesn't allow for producing subscripts and superscripts except cannam@167: % in the main text, we don't bother to reset \scriptfont and cannam@167: % \scriptscriptfont (which would also require loading a lot more fonts). cannam@167: % cannam@167: \def\resetmathfonts{% cannam@167: \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy cannam@167: \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf cannam@167: \textfont\ttfam=\tentt \textfont\sffam=\tensf cannam@167: } cannam@167: cannam@167: % The font-changing commands redefine the meanings of \tenSTYLE, instead cannam@167: % of just \STYLE. We do this because \STYLE needs to also set the cannam@167: % current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire cannam@167: % \tenSTYLE to set the current font. cannam@167: % cannam@167: % Each font-changing command also sets the names \lsize (one size lower) cannam@167: % and \lllsize (three sizes lower). These relative commands are used in cannam@167: % the LaTeX logo and acronyms. cannam@167: % cannam@167: % This all needs generalizing, badly. cannam@167: % cannam@167: \def\textfonts{% cannam@167: \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl cannam@167: \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc cannam@167: \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy cannam@167: \let\tenttsl=\textttsl cannam@167: \def\curfontsize{text}% cannam@167: \def\lsize{reduced}\def\lllsize{smaller}% cannam@167: \resetmathfonts \setleading{\textleading}} cannam@167: \def\titlefonts{% cannam@167: \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl cannam@167: \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc cannam@167: \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy cannam@167: \let\tenttsl=\titlettsl cannam@167: \def\curfontsize{title}% cannam@167: \def\lsize{chap}\def\lllsize{subsec}% cannam@167: \resetmathfonts \setleading{27pt}} cannam@167: \def\titlefont#1{{\titlefonts\rmisbold #1}} cannam@167: \def\chapfonts{% cannam@167: \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl cannam@167: \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc cannam@167: \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy cannam@167: \let\tenttsl=\chapttsl cannam@167: \def\curfontsize{chap}% cannam@167: \def\lsize{sec}\def\lllsize{text}% cannam@167: \resetmathfonts \setleading{19pt}} cannam@167: \def\secfonts{% cannam@167: \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl cannam@167: \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc cannam@167: \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy cannam@167: \let\tenttsl=\secttsl cannam@167: \def\curfontsize{sec}% cannam@167: \def\lsize{subsec}\def\lllsize{reduced}% cannam@167: \resetmathfonts \setleading{16pt}} cannam@167: \def\subsecfonts{% cannam@167: \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl cannam@167: \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc cannam@167: \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy cannam@167: \let\tenttsl=\ssecttsl cannam@167: \def\curfontsize{ssec}% cannam@167: \def\lsize{text}\def\lllsize{small}% cannam@167: \resetmathfonts \setleading{15pt}} cannam@167: \let\subsubsecfonts = \subsecfonts cannam@167: \def\reducedfonts{% cannam@167: \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl cannam@167: \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc cannam@167: \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy cannam@167: \let\tenttsl=\reducedttsl cannam@167: \def\curfontsize{reduced}% cannam@167: \def\lsize{small}\def\lllsize{smaller}% cannam@167: \resetmathfonts \setleading{10.5pt}} cannam@167: \def\smallfonts{% cannam@167: \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl cannam@167: \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc cannam@167: \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy cannam@167: \let\tenttsl=\smallttsl cannam@167: \def\curfontsize{small}% cannam@167: \def\lsize{smaller}\def\lllsize{smaller}% cannam@167: \resetmathfonts \setleading{10.5pt}} cannam@167: \def\smallerfonts{% cannam@167: \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl cannam@167: \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc cannam@167: \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy cannam@167: \let\tenttsl=\smallerttsl cannam@167: \def\curfontsize{smaller}% cannam@167: \def\lsize{smaller}\def\lllsize{smaller}% cannam@167: \resetmathfonts \setleading{9.5pt}} cannam@167: cannam@167: % Fonts for short table of contents. cannam@167: \setfont\shortcontrm\rmshape{12}{1000}{OT1} cannam@167: \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12 cannam@167: \setfont\shortcontsl\slshape{12}{1000}{OT1} cannam@167: \setfont\shortconttt\ttshape{12}{1000}{OT1TT} cannam@167: cannam@167: % Define these just so they can be easily changed for other fonts. cannam@167: \def\angleleft{$\langle$} cannam@167: \def\angleright{$\rangle$} cannam@167: cannam@167: % Set the fonts to use with the @small... environments. cannam@167: \let\smallexamplefonts = \smallfonts cannam@167: cannam@167: % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample cannam@167: % can fit this many characters: cannam@167: % 8.5x11=86 smallbook=72 a4=90 a5=69 cannam@167: % If we use \scriptfonts (8pt), then we can fit this many characters: cannam@167: % 8.5x11=90+ smallbook=80 a4=90+ a5=77 cannam@167: % For me, subjectively, the few extra characters that fit aren't worth cannam@167: % the additional smallness of 8pt. So I'm making the default 9pt. cannam@167: % cannam@167: % By the way, for comparison, here's what fits with @example (10pt): cannam@167: % 8.5x11=71 smallbook=60 a4=75 a5=58 cannam@167: % --karl, 24jan03. cannam@167: cannam@167: % Set up the default fonts, so we can use them for creating boxes. cannam@167: % cannam@167: \definetextfontsizexi cannam@167: cannam@167: cannam@167: \message{markup,} cannam@167: cannam@167: % Check if we are currently using a typewriter font. Since all the cannam@167: % Computer Modern typewriter fonts have zero interword stretch (and cannam@167: % shrink), and it is reasonable to expect all typewriter fonts to have cannam@167: % this property, we can check that font parameter. cannam@167: % cannam@167: \def\ifmonospace{\ifdim\fontdimen3\font=0pt } cannam@167: cannam@167: % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will cannam@167: % define and register \INITMACRO to be called on markup style changes. cannam@167: % \INITMACRO can check \currentmarkupstyle for the innermost cannam@167: % style and the set of \ifmarkupSTYLE switches for all styles cannam@167: % currently in effect. cannam@167: \newif\ifmarkupvar cannam@167: \newif\ifmarkupsamp cannam@167: \newif\ifmarkupkey cannam@167: %\newif\ifmarkupfile % @file == @samp. cannam@167: %\newif\ifmarkupoption % @option == @samp. cannam@167: \newif\ifmarkupcode cannam@167: \newif\ifmarkupkbd cannam@167: %\newif\ifmarkupenv % @env == @code. cannam@167: %\newif\ifmarkupcommand % @command == @code. cannam@167: \newif\ifmarkuptex % @tex (and part of @math, for now). cannam@167: \newif\ifmarkupexample cannam@167: \newif\ifmarkupverb cannam@167: \newif\ifmarkupverbatim cannam@167: cannam@167: \let\currentmarkupstyle\empty cannam@167: cannam@167: \def\setupmarkupstyle#1{% cannam@167: \csname markup#1true\endcsname cannam@167: \def\currentmarkupstyle{#1}% cannam@167: \markupstylesetup cannam@167: } cannam@167: cannam@167: \let\markupstylesetup\empty cannam@167: cannam@167: \def\defmarkupstylesetup#1{% cannam@167: \expandafter\def\expandafter\markupstylesetup cannam@167: \expandafter{\markupstylesetup #1}% cannam@167: \def#1% cannam@167: } cannam@167: cannam@167: % Markup style setup for left and right quotes. cannam@167: \defmarkupstylesetup\markupsetuplq{% cannam@167: \expandafter\let\expandafter \temp cannam@167: \csname markupsetuplq\currentmarkupstyle\endcsname cannam@167: \ifx\temp\relax \markupsetuplqdefault \else \temp \fi cannam@167: } cannam@167: cannam@167: \defmarkupstylesetup\markupsetuprq{% cannam@167: \expandafter\let\expandafter \temp cannam@167: \csname markupsetuprq\currentmarkupstyle\endcsname cannam@167: \ifx\temp\relax \markupsetuprqdefault \else \temp \fi cannam@167: } cannam@167: cannam@167: { cannam@167: \catcode`\'=\active cannam@167: \catcode`\`=\active cannam@167: cannam@167: \gdef\markupsetuplqdefault{\let`\lq} cannam@167: \gdef\markupsetuprqdefault{\let'\rq} cannam@167: cannam@167: \gdef\markupsetcodequoteleft{\let`\codequoteleft} cannam@167: \gdef\markupsetcodequoteright{\let'\codequoteright} cannam@167: } cannam@167: cannam@167: \let\markupsetuplqcode \markupsetcodequoteleft cannam@167: \let\markupsetuprqcode \markupsetcodequoteright cannam@167: % cannam@167: \let\markupsetuplqexample \markupsetcodequoteleft cannam@167: \let\markupsetuprqexample \markupsetcodequoteright cannam@167: % cannam@167: \let\markupsetuplqkbd \markupsetcodequoteleft cannam@167: \let\markupsetuprqkbd \markupsetcodequoteright cannam@167: % cannam@167: \let\markupsetuplqsamp \markupsetcodequoteleft cannam@167: \let\markupsetuprqsamp \markupsetcodequoteright cannam@167: % cannam@167: \let\markupsetuplqverb \markupsetcodequoteleft cannam@167: \let\markupsetuprqverb \markupsetcodequoteright cannam@167: % cannam@167: \let\markupsetuplqverbatim \markupsetcodequoteleft cannam@167: \let\markupsetuprqverbatim \markupsetcodequoteright cannam@167: cannam@167: % Allow an option to not use regular directed right quote/apostrophe cannam@167: % (char 0x27), but instead the undirected quote from cmtt (char 0x0d). cannam@167: % The undirected quote is ugly, so don't make it the default, but it cannam@167: % works for pasting with more pdf viewers (at least evince), the cannam@167: % lilypond developers report. xpdf does work with the regular 0x27. cannam@167: % cannam@167: \def\codequoteright{% cannam@167: \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax cannam@167: \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax cannam@167: '% cannam@167: \else \char'15 \fi cannam@167: \else \char'15 \fi cannam@167: } cannam@167: % cannam@167: % and a similar option for the left quote char vs. a grave accent. cannam@167: % Modern fonts display ASCII 0x60 as a grave accent, so some people like cannam@167: % the code environments to do likewise. cannam@167: % cannam@167: \def\codequoteleft{% cannam@167: \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax cannam@167: \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax cannam@167: % [Knuth] pp. 380,381,391 cannam@167: % \relax disables Spanish ligatures ?` and !` of \tt font. cannam@167: \relax`% cannam@167: \else \char'22 \fi cannam@167: \else \char'22 \fi cannam@167: } cannam@167: cannam@167: % Commands to set the quote options. cannam@167: % cannam@167: \parseargdef\codequoteundirected{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\onword cannam@167: \expandafter\let\csname SETtxicodequoteundirected\endcsname cannam@167: = t% cannam@167: \else\ifx\temp\offword cannam@167: \expandafter\let\csname SETtxicodequoteundirected\endcsname cannam@167: = \relax cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% cannam@167: \fi\fi cannam@167: } cannam@167: % cannam@167: \parseargdef\codequotebacktick{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\onword cannam@167: \expandafter\let\csname SETtxicodequotebacktick\endcsname cannam@167: = t% cannam@167: \else\ifx\temp\offword cannam@167: \expandafter\let\csname SETtxicodequotebacktick\endcsname cannam@167: = \relax cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. cannam@167: \def\noligaturesquoteleft{\relax\lq} cannam@167: cannam@167: % Count depth in font-changes, for error checks cannam@167: \newcount\fontdepth \fontdepth=0 cannam@167: cannam@167: % Font commands. cannam@167: cannam@167: % #1 is the font command (\sl or \it), #2 is the text to slant. cannam@167: % If we are in a monospaced environment, however, 1) always use \ttsl, cannam@167: % and 2) do not add an italic correction. cannam@167: \def\dosmartslant#1#2{% cannam@167: \ifusingtt cannam@167: {{\ttsl #2}\let\next=\relax}% cannam@167: {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}% cannam@167: \next cannam@167: } cannam@167: \def\smartslanted{\dosmartslant\sl} cannam@167: \def\smartitalic{\dosmartslant\it} cannam@167: cannam@167: % Output an italic correction unless \next (presumed to be the following cannam@167: % character) is such as not to need one. cannam@167: \def\smartitaliccorrection{% cannam@167: \ifx\next,% cannam@167: \else\ifx\next-% cannam@167: \else\ifx\next.% cannam@167: \else\ptexslash cannam@167: \fi\fi\fi cannam@167: \aftersmartic cannam@167: } cannam@167: cannam@167: % Unconditional use \ttsl, and no ic. @var is set to this for defuns. cannam@167: \def\ttslanted#1{{\ttsl #1}} cannam@167: cannam@167: % @cite is like \smartslanted except unconditionally use \sl. We never want cannam@167: % ttsl for book titles, do we? cannam@167: \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} cannam@167: cannam@167: \def\aftersmartic{} cannam@167: \def\var#1{% cannam@167: \let\saveaftersmartic = \aftersmartic cannam@167: \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% cannam@167: \smartslanted{#1}% cannam@167: } cannam@167: cannam@167: \let\i=\smartitalic cannam@167: \let\slanted=\smartslanted cannam@167: \let\dfn=\smartslanted cannam@167: \let\emph=\smartitalic cannam@167: cannam@167: % Explicit font changes: @r, @sc, undocumented @ii. cannam@167: \def\r#1{{\rm #1}} % roman font cannam@167: \def\sc#1{{\smallcaps#1}} % smallcaps font cannam@167: \def\ii#1{{\it #1}} % italic font cannam@167: cannam@167: % @b, explicit bold. Also @strong. cannam@167: \def\b#1{{\bf #1}} cannam@167: \let\strong=\b cannam@167: cannam@167: % @sansserif, explicit sans. cannam@167: \def\sansserif#1{{\sf #1}} cannam@167: cannam@167: % We can't just use \exhyphenpenalty, because that only has effect at cannam@167: % the end of a paragraph. Restore normal hyphenation at the end of the cannam@167: % group within which \nohyphenation is presumably called. cannam@167: % cannam@167: \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} cannam@167: \def\restorehyphenation{\hyphenchar\font = `- } cannam@167: cannam@167: % Set sfcode to normal for the chars that usually have another value. cannam@167: % Can't use plain's \frenchspacing because it uses the `\x notation, and cannam@167: % sometimes \x has an active definition that messes things up. cannam@167: % cannam@167: \catcode`@=11 cannam@167: \def\plainfrenchspacing{% cannam@167: \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m cannam@167: \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m cannam@167: \def\endofsentencespacefactor{1000}% for @. and friends cannam@167: } cannam@167: \def\plainnonfrenchspacing{% cannam@167: \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 cannam@167: \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 cannam@167: \def\endofsentencespacefactor{3000}% for @. and friends cannam@167: } cannam@167: \catcode`@=\other cannam@167: \def\endofsentencespacefactor{3000}% default cannam@167: cannam@167: % @t, explicit typewriter. cannam@167: \def\t#1{% cannam@167: {\tt \rawbackslash \plainfrenchspacing #1}% cannam@167: \null cannam@167: } cannam@167: cannam@167: % @samp. cannam@167: \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}} cannam@167: cannam@167: % @indicateurl is \samp, that is, with quotes. cannam@167: \let\indicateurl=\samp cannam@167: cannam@167: % @code (and similar) prints in typewriter, but with spaces the same cannam@167: % size as normal in the surrounding text, without hyphenation, etc. cannam@167: % This is a subroutine for that. cannam@167: \def\tclose#1{% cannam@167: {% cannam@167: % Change normal interword space to be same as for the current font. cannam@167: \spaceskip = \fontdimen2\font cannam@167: % cannam@167: % Switch to typewriter. cannam@167: \tt cannam@167: % cannam@167: % But `\ ' produces the large typewriter interword space. cannam@167: \def\ {{\spaceskip = 0pt{} }}% cannam@167: % cannam@167: % Turn off hyphenation. cannam@167: \nohyphenation cannam@167: % cannam@167: \rawbackslash cannam@167: \plainfrenchspacing cannam@167: #1% cannam@167: }% cannam@167: \null % reset spacefactor to 1000 cannam@167: } cannam@167: cannam@167: % We *must* turn on hyphenation at `-' and `_' in @code. cannam@167: % Otherwise, it is too hard to avoid overfull hboxes cannam@167: % in the Emacs manual, the Library manual, etc. cannam@167: % cannam@167: % Unfortunately, TeX uses one parameter (\hyphenchar) to control cannam@167: % both hyphenation at - and hyphenation within words. cannam@167: % We must therefore turn them both off (\tclose does that) cannam@167: % and arrange explicitly to hyphenate at a dash. cannam@167: % -- rms. cannam@167: { cannam@167: \catcode`\-=\active \catcode`\_=\active cannam@167: \catcode`\'=\active \catcode`\`=\active cannam@167: \global\let'=\rq \global\let`=\lq % default definitions cannam@167: % cannam@167: \global\def\code{\begingroup cannam@167: \setupmarkupstyle{code}% cannam@167: % The following should really be moved into \setupmarkupstyle handlers. cannam@167: \catcode\dashChar=\active \catcode\underChar=\active cannam@167: \ifallowcodebreaks cannam@167: \let-\codedash cannam@167: \let_\codeunder cannam@167: \else cannam@167: \let-\normaldash cannam@167: \let_\realunder cannam@167: \fi cannam@167: \codex cannam@167: } cannam@167: } cannam@167: cannam@167: \def\codex #1{\tclose{#1}\endgroup} cannam@167: cannam@167: \def\normaldash{-} cannam@167: \def\codedash{-\discretionary{}{}{}} cannam@167: \def\codeunder{% cannam@167: % this is all so @math{@code{var_name}+1} can work. In math mode, _ cannam@167: % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) cannam@167: % will therefore expand the active definition of _, which is us cannam@167: % (inside @code that is), therefore an endless loop. cannam@167: \ifusingtt{\ifmmode cannam@167: \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. cannam@167: \else\normalunderscore \fi cannam@167: \discretionary{}{}{}}% cannam@167: {\_}% cannam@167: } cannam@167: cannam@167: % An additional complication: the above will allow breaks after, e.g., cannam@167: % each of the four underscores in __typeof__. This is bad. cannam@167: % @allowcodebreaks provides a document-level way to turn breaking at - cannam@167: % and _ on and off. cannam@167: % cannam@167: \newif\ifallowcodebreaks \allowcodebreakstrue cannam@167: cannam@167: \def\keywordtrue{true} cannam@167: \def\keywordfalse{false} cannam@167: cannam@167: \parseargdef\allowcodebreaks{% cannam@167: \def\txiarg{#1}% cannam@167: \ifx\txiarg\keywordtrue cannam@167: \allowcodebreakstrue cannam@167: \else\ifx\txiarg\keywordfalse cannam@167: \allowcodebreaksfalse cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % For @command, @env, @file, @option quotes seem unnecessary, cannam@167: % so use \code rather than \samp. cannam@167: \let\command=\code cannam@167: \let\env=\code cannam@167: \let\file=\code cannam@167: \let\option=\code cannam@167: cannam@167: % @uref (abbreviation for `urlref') takes an optional (comma-separated) cannam@167: % second argument specifying the text to display and an optional third cannam@167: % arg as text to display instead of (rather than in addition to) the url cannam@167: % itself. First (mandatory) arg is the url. cannam@167: % (This \urefnobreak definition isn't used now, leaving it for a while cannam@167: % for comparison.) cannam@167: \def\urefnobreak#1{\dourefnobreak #1,,,\finish} cannam@167: \def\dourefnobreak#1,#2,#3,#4\finish{\begingroup cannam@167: \unsepspaces cannam@167: \pdfurl{#1}% cannam@167: \setbox0 = \hbox{\ignorespaces #3}% cannam@167: \ifdim\wd0 > 0pt cannam@167: \unhbox0 % third arg given, show only that cannam@167: \else cannam@167: \setbox0 = \hbox{\ignorespaces #2}% cannam@167: \ifdim\wd0 > 0pt cannam@167: \ifpdf cannam@167: \unhbox0 % PDF: 2nd arg given, show only it cannam@167: \else cannam@167: \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url cannam@167: \fi cannam@167: \else cannam@167: \code{#1}% only url given, so show it cannam@167: \fi cannam@167: \fi cannam@167: \endlink cannam@167: \endgroup} cannam@167: cannam@167: % This \urefbreak definition is the active one. cannam@167: \def\urefbreak{\begingroup \urefcatcodes \dourefbreak} cannam@167: \let\uref=\urefbreak cannam@167: \def\dourefbreak#1{\urefbreakfinish #1,,,\finish} cannam@167: \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example cannam@167: \unsepspaces cannam@167: \pdfurl{#1}% cannam@167: \setbox0 = \hbox{\ignorespaces #3}% cannam@167: \ifdim\wd0 > 0pt cannam@167: \unhbox0 % third arg given, show only that cannam@167: \else cannam@167: \setbox0 = \hbox{\ignorespaces #2}% cannam@167: \ifdim\wd0 > 0pt cannam@167: \ifpdf cannam@167: \unhbox0 % PDF: 2nd arg given, show only it cannam@167: \else cannam@167: \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url cannam@167: \fi cannam@167: \else cannam@167: \urefcode{#1}% only url given, so show it cannam@167: \fi cannam@167: \fi cannam@167: \endlink cannam@167: \endgroup} cannam@167: cannam@167: % Allow line breaks around only a few characters (only). cannam@167: \def\urefcatcodes{% cannam@167: \catcode\ampChar=\active \catcode\dotChar=\active cannam@167: \catcode\hashChar=\active \catcode\questChar=\active cannam@167: \catcode\slashChar=\active cannam@167: } cannam@167: { cannam@167: \urefcatcodes cannam@167: % cannam@167: \global\def\urefcode{\begingroup cannam@167: \setupmarkupstyle{code}% cannam@167: \urefcatcodes cannam@167: \let&\urefcodeamp cannam@167: \let.\urefcodedot cannam@167: \let#\urefcodehash cannam@167: \let?\urefcodequest cannam@167: \let/\urefcodeslash cannam@167: \codex cannam@167: } cannam@167: % cannam@167: % By default, they are just regular characters. cannam@167: \global\def&{\normalamp} cannam@167: \global\def.{\normaldot} cannam@167: \global\def#{\normalhash} cannam@167: \global\def?{\normalquest} cannam@167: \global\def/{\normalslash} cannam@167: } cannam@167: cannam@167: % we put a little stretch before and after the breakable chars, to help cannam@167: % line breaking of long url's. The unequal skips make look better in cannam@167: % cmtt at least, especially for dots. cannam@167: \def\urefprestretch{\urefprebreak \hskip0pt plus.13em } cannam@167: \def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } cannam@167: % cannam@167: \def\urefcodeamp{\urefprestretch \&\urefpoststretch} cannam@167: \def\urefcodedot{\urefprestretch .\urefpoststretch} cannam@167: \def\urefcodehash{\urefprestretch \#\urefpoststretch} cannam@167: \def\urefcodequest{\urefprestretch ?\urefpoststretch} cannam@167: \def\urefcodeslash{\futurelet\next\urefcodeslashfinish} cannam@167: { cannam@167: \catcode`\/=\active cannam@167: \global\def\urefcodeslashfinish{% cannam@167: \urefprestretch \slashChar cannam@167: % Allow line break only after the final / in a sequence of cannam@167: % slashes, to avoid line break between the slashes in http://. cannam@167: \ifx\next/\else \urefpoststretch \fi cannam@167: } cannam@167: } cannam@167: cannam@167: % One more complication: by default we'll break after the special cannam@167: % characters, but some people like to break before the special chars, so cannam@167: % allow that. Also allow no breaking at all, for manual control. cannam@167: % cannam@167: \parseargdef\urefbreakstyle{% cannam@167: \def\txiarg{#1}% cannam@167: \ifx\txiarg\wordnone cannam@167: \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} cannam@167: \else\ifx\txiarg\wordbefore cannam@167: \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} cannam@167: \else\ifx\txiarg\wordafter cannam@167: \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% cannam@167: \fi\fi\fi cannam@167: } cannam@167: \def\wordafter{after} cannam@167: \def\wordbefore{before} cannam@167: \def\wordnone{none} cannam@167: cannam@167: \urefbreakstyle after cannam@167: cannam@167: % @url synonym for @uref, since that's how everyone uses it. cannam@167: % cannam@167: \let\url=\uref cannam@167: cannam@167: % rms does not like angle brackets --karl, 17may97. cannam@167: % So now @email is just like @uref, unless we are pdf. cannam@167: % cannam@167: %\def\email#1{\angleleft{\tt #1}\angleright} cannam@167: \ifpdf cannam@167: \def\email#1{\doemail#1,,\finish} cannam@167: \def\doemail#1,#2,#3\finish{\begingroup cannam@167: \unsepspaces cannam@167: \pdfurl{mailto:#1}% cannam@167: \setbox0 = \hbox{\ignorespaces #2}% cannam@167: \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi cannam@167: \endlink cannam@167: \endgroup} cannam@167: \else cannam@167: \let\email=\uref cannam@167: \fi cannam@167: cannam@167: % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), cannam@167: % `example' (@kbd uses ttsl only inside of @example and friends), cannam@167: % or `code' (@kbd uses normal tty font always). cannam@167: \parseargdef\kbdinputstyle{% cannam@167: \def\txiarg{#1}% cannam@167: \ifx\txiarg\worddistinct cannam@167: \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% cannam@167: \else\ifx\txiarg\wordexample cannam@167: \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% cannam@167: \else\ifx\txiarg\wordcode cannam@167: \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% cannam@167: \fi\fi\fi cannam@167: } cannam@167: \def\worddistinct{distinct} cannam@167: \def\wordexample{example} cannam@167: \def\wordcode{code} cannam@167: cannam@167: % Default is `distinct'. cannam@167: \kbdinputstyle distinct cannam@167: cannam@167: % @kbd is like @code, except that if the argument is just one @key command, cannam@167: % then @kbd has no effect. cannam@167: \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}} cannam@167: cannam@167: \def\xkey{\key} cannam@167: \def\kbdsub#1#2#3\par{% cannam@167: \def\one{#1}\def\three{#3}\def\threex{??}% cannam@167: \ifx\one\xkey\ifx\threex\three \key{#2}% cannam@167: \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi cannam@167: \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi cannam@167: } cannam@167: cannam@167: % definition of @key that produces a lozenge. Doesn't adjust to text size. cannam@167: %\setfont\keyrm\rmshape{8}{1000}{OT1} cannam@167: %\font\keysy=cmsy9 cannam@167: %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% cannam@167: % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% cannam@167: % \vbox{\hrule\kern-0.4pt cannam@167: % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% cannam@167: % \kern-0.4pt\hrule}% cannam@167: % \kern-.06em\raise0.4pt\hbox{\angleright}}}} cannam@167: cannam@167: % definition of @key with no lozenge. If the current font is already cannam@167: % monospace, don't change it; that way, we respect @kbdinputstyle. But cannam@167: % if it isn't monospace, then use \tt. cannam@167: % cannam@167: \def\key#1{{\setupmarkupstyle{key}% cannam@167: \nohyphenation cannam@167: \ifmonospace\else\tt\fi cannam@167: #1}\null} cannam@167: cannam@167: % @clicksequence{File @click{} Open ...} cannam@167: \def\clicksequence#1{\begingroup #1\endgroup} cannam@167: cannam@167: % @clickstyle @arrow (by default) cannam@167: \parseargdef\clickstyle{\def\click{#1}} cannam@167: \def\click{\arrow} cannam@167: cannam@167: % Typeset a dimension, e.g., `in' or `pt'. The only reason for the cannam@167: % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. cannam@167: % cannam@167: \def\dmn#1{\thinspace #1} cannam@167: cannam@167: % @l was never documented to mean ``switch to the Lisp font'', cannam@167: % and it is not used as such in any manual I can find. We need it for cannam@167: % Polish suppressed-l. --karl, 22sep96. cannam@167: %\def\l#1{{\li #1}\null} cannam@167: cannam@167: % @acronym for "FBI", "NATO", and the like. cannam@167: % We print this one point size smaller, since it's intended for cannam@167: % all-uppercase. cannam@167: % cannam@167: \def\acronym#1{\doacronym #1,,\finish} cannam@167: \def\doacronym#1,#2,#3\finish{% cannam@167: {\selectfonts\lsize #1}% cannam@167: \def\temp{#2}% cannam@167: \ifx\temp\empty \else cannam@167: \space ({\unsepspaces \ignorespaces \temp \unskip})% cannam@167: \fi cannam@167: \null % reset \spacefactor=1000 cannam@167: } cannam@167: cannam@167: % @abbr for "Comput. J." and the like. cannam@167: % No font change, but don't do end-of-sentence spacing. cannam@167: % cannam@167: \def\abbr#1{\doabbr #1,,\finish} cannam@167: \def\doabbr#1,#2,#3\finish{% cannam@167: {\plainfrenchspacing #1}% cannam@167: \def\temp{#2}% cannam@167: \ifx\temp\empty \else cannam@167: \space ({\unsepspaces \ignorespaces \temp \unskip})% cannam@167: \fi cannam@167: \null % reset \spacefactor=1000 cannam@167: } cannam@167: cannam@167: % @asis just yields its argument. Used with @table, for example. cannam@167: % cannam@167: \def\asis#1{#1} cannam@167: cannam@167: % @math outputs its argument in math mode. cannam@167: % cannam@167: % One complication: _ usually means subscripts, but it could also mean cannam@167: % an actual _ character, as in @math{@var{some_variable} + 1}. So make cannam@167: % _ active, and distinguish by seeing if the current family is \slfam, cannam@167: % which is what @var uses. cannam@167: { cannam@167: \catcode`\_ = \active cannam@167: \gdef\mathunderscore{% cannam@167: \catcode`\_=\active cannam@167: \def_{\ifnum\fam=\slfam \_\else\sb\fi}% cannam@167: } cannam@167: } cannam@167: % Another complication: we want \\ (and @\) to output a math (or tt) \. cannam@167: % FYI, plain.tex uses \\ as a temporary control sequence (for no cannam@167: % particular reason), but this is not advertised and we don't care. cannam@167: % cannam@167: % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. cannam@167: \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} cannam@167: % cannam@167: \def\math{% cannam@167: \tex cannam@167: \mathunderscore cannam@167: \let\\ = \mathbackslash cannam@167: \mathactive cannam@167: % make the texinfo accent commands work in math mode cannam@167: \let\"=\ddot cannam@167: \let\'=\acute cannam@167: \let\==\bar cannam@167: \let\^=\hat cannam@167: \let\`=\grave cannam@167: \let\u=\breve cannam@167: \let\v=\check cannam@167: \let\~=\tilde cannam@167: \let\dotaccent=\dot cannam@167: $\finishmath cannam@167: } cannam@167: \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. cannam@167: cannam@167: % Some active characters (such as <) are spaced differently in math. cannam@167: % We have to reset their definitions in case the @math was an argument cannam@167: % to a command which sets the catcodes (such as @item or @section). cannam@167: % cannam@167: { cannam@167: \catcode`^ = \active cannam@167: \catcode`< = \active cannam@167: \catcode`> = \active cannam@167: \catcode`+ = \active cannam@167: \catcode`' = \active cannam@167: \gdef\mathactive{% cannam@167: \let^ = \ptexhat cannam@167: \let< = \ptexless cannam@167: \let> = \ptexgtr cannam@167: \let+ = \ptexplus cannam@167: \let' = \ptexquoteright cannam@167: } cannam@167: } cannam@167: cannam@167: % ctrl is no longer a Texinfo command, but leave this definition for fun. cannam@167: \def\ctrl #1{{\tt \rawbackslash \hat}#1} cannam@167: cannam@167: % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. cannam@167: % Ignore unless FMTNAME == tex; then it is like @iftex and @tex, cannam@167: % except specified as a normal braced arg, so no newlines to worry about. cannam@167: % cannam@167: \def\outfmtnametex{tex} cannam@167: % cannam@167: \long\def\inlinefmt#1{\doinlinefmt #1,\finish} cannam@167: \long\def\doinlinefmt#1,#2,\finish{% cannam@167: \def\inlinefmtname{#1}% cannam@167: \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi cannam@167: } cannam@167: % For raw, must switch into @tex before parsing the argument, to avoid cannam@167: % setting catcodes prematurely. Doing it this way means that, for cannam@167: % example, @inlineraw{html, foo{bar} gets a parse error instead of being cannam@167: % ignored. But this isn't important because if people want a literal cannam@167: % *right* brace they would have to use a command anyway, so they may as cannam@167: % well use a command to get a left brace too. We could re-use the cannam@167: % delimiter character idea from \verb, but it seems like overkill. cannam@167: % cannam@167: \long\def\inlineraw{\tex \doinlineraw} cannam@167: \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} cannam@167: \def\doinlinerawtwo#1,#2,\finish{% cannam@167: \def\inlinerawname{#1}% cannam@167: \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi cannam@167: \endgroup % close group opened by \tex. cannam@167: } cannam@167: cannam@167: cannam@167: \message{glyphs,} cannam@167: % and logos. cannam@167: cannam@167: % @@ prints an @, as does @atchar{}. cannam@167: \def\@{\char64 } cannam@167: \let\atchar=\@ cannam@167: cannam@167: % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. cannam@167: % Unless we're in typewriter, use \ecfont because the CM text fonts do cannam@167: % not have braces, and we don't want to switch into math. cannam@167: \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} cannam@167: \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} cannam@167: \let\{=\mylbrace \let\lbracechar=\{ cannam@167: \let\}=\myrbrace \let\rbracechar=\} cannam@167: \begingroup cannam@167: % Definitions to produce \{ and \} commands for indices, cannam@167: % and @{ and @} for the aux/toc files. cannam@167: \catcode`\{ = \other \catcode`\} = \other cannam@167: \catcode`\[ = 1 \catcode`\] = 2 cannam@167: \catcode`\! = 0 \catcode`\\ = \other cannam@167: !gdef!lbracecmd[\{]% cannam@167: !gdef!rbracecmd[\}]% cannam@167: !gdef!lbraceatcmd[@{]% cannam@167: !gdef!rbraceatcmd[@}]% cannam@167: !endgroup cannam@167: cannam@167: % @comma{} to avoid , parsing problems. cannam@167: \let\comma = , cannam@167: cannam@167: % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent cannam@167: % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. cannam@167: \let\, = \ptexc cannam@167: \let\dotaccent = \ptexdot cannam@167: \def\ringaccent#1{{\accent23 #1}} cannam@167: \let\tieaccent = \ptext cannam@167: \let\ubaraccent = \ptexb cannam@167: \let\udotaccent = \d cannam@167: cannam@167: % Other special characters: @questiondown @exclamdown @ordf @ordm cannam@167: % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. cannam@167: \def\questiondown{?`} cannam@167: \def\exclamdown{!`} cannam@167: \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} cannam@167: \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} cannam@167: cannam@167: % Dotless i and dotless j, used for accents. cannam@167: \def\imacro{i} cannam@167: \def\jmacro{j} cannam@167: \def\dotless#1{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi cannam@167: \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi cannam@167: \else \errmessage{@dotless can be used only with i or j}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % The \TeX{} logo, as in plain, but resetting the spacing so that a cannam@167: % period following counts as ending a sentence. (Idea found in latex.) cannam@167: % cannam@167: \edef\TeX{\TeX \spacefactor=1000 } cannam@167: cannam@167: % @LaTeX{} logo. Not quite the same results as the definition in cannam@167: % latex.ltx, since we use a different font for the raised A; it's most cannam@167: % convenient for us to use an explicitly smaller font, rather than using cannam@167: % the \scriptstyle font (since we don't reset \scriptstyle and cannam@167: % \scriptscriptstyle). cannam@167: % cannam@167: \def\LaTeX{% cannam@167: L\kern-.36em cannam@167: {\setbox0=\hbox{T}% cannam@167: \vbox to \ht0{\hbox{% cannam@167: \ifx\textnominalsize\xwordpt cannam@167: % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX. cannam@167: % Revert to plain's \scriptsize, which is 7pt. cannam@167: \count255=\the\fam $\fam\count255 \scriptstyle A$% cannam@167: \else cannam@167: % For 11pt, we can use our lllsize. cannam@167: \selectfonts\lllsize A% cannam@167: \fi cannam@167: }% cannam@167: \vss cannam@167: }}% cannam@167: \kern-.15em cannam@167: \TeX cannam@167: } cannam@167: cannam@167: % Some math mode symbols. cannam@167: \def\bullet{$\ptexbullet$} cannam@167: \def\geq{\ifmmode \ge\else $\ge$\fi} cannam@167: \def\leq{\ifmmode \le\else $\le$\fi} cannam@167: \def\minus{\ifmmode -\else $-$\fi} cannam@167: cannam@167: % @dots{} outputs an ellipsis using the current font. cannam@167: % We do .5em per period so that it has the same spacing in the cm cannam@167: % typewriter fonts as three actual period characters; on the other hand, cannam@167: % in other typewriter fonts three periods are wider than 1.5em. So do cannam@167: % whichever is larger. cannam@167: % cannam@167: \def\dots{% cannam@167: \leavevmode cannam@167: \setbox0=\hbox{...}% get width of three periods cannam@167: \ifdim\wd0 > 1.5em cannam@167: \dimen0 = \wd0 cannam@167: \else cannam@167: \dimen0 = 1.5em cannam@167: \fi cannam@167: \hbox to \dimen0{% cannam@167: \hskip 0pt plus.25fil cannam@167: .\hskip 0pt plus1fil cannam@167: .\hskip 0pt plus1fil cannam@167: .\hskip 0pt plus.5fil cannam@167: }% cannam@167: } cannam@167: cannam@167: % @enddots{} is an end-of-sentence ellipsis. cannam@167: % cannam@167: \def\enddots{% cannam@167: \dots cannam@167: \spacefactor=\endofsentencespacefactor cannam@167: } cannam@167: cannam@167: % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. cannam@167: % cannam@167: % Since these characters are used in examples, they should be an even number of cannam@167: % \tt widths. Each \tt character is 1en, so two makes it 1em. cannam@167: % cannam@167: \def\point{$\star$} cannam@167: \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}} cannam@167: \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} cannam@167: \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}} cannam@167: \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} cannam@167: \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}} cannam@167: cannam@167: % The @error{} command. cannam@167: % Adapted from the TeXbook's \boxit. cannam@167: % cannam@167: \newbox\errorbox cannam@167: % cannam@167: {\tentt \global\dimen0 = 3em}% Width of the box. cannam@167: \dimen2 = .55pt % Thickness of rules cannam@167: % The text. (`r' is open on the right, `e' somewhat less so on the left.) cannam@167: \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} cannam@167: % cannam@167: \setbox\errorbox=\hbox to \dimen0{\hfil cannam@167: \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. cannam@167: \advance\hsize by -2\dimen2 % Rules. cannam@167: \vbox{% cannam@167: \hrule height\dimen2 cannam@167: \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. cannam@167: \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. cannam@167: \kern3pt\vrule width\dimen2}% Space to right. cannam@167: \hrule height\dimen2} cannam@167: \hfil} cannam@167: % cannam@167: \def\error{\leavevmode\lower.7ex\copy\errorbox} cannam@167: cannam@167: % @pounds{} is a sterling sign, which Knuth put in the CM italic font. cannam@167: % cannam@167: \def\pounds{{\it\$}} cannam@167: cannam@167: % @euro{} comes from a separate font, depending on the current style. cannam@167: % We use the free feym* fonts from the eurosym package by Henrik cannam@167: % Theiling, which support regular, slanted, bold and bold slanted (and cannam@167: % "outlined" (blackboard board, sort of) versions, which we don't need). cannam@167: % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. cannam@167: % cannam@167: % Although only regular is the truly official Euro symbol, we ignore cannam@167: % that. The Euro is designed to be slightly taller than the regular cannam@167: % font height. cannam@167: % cannam@167: % feymr - regular cannam@167: % feymo - slanted cannam@167: % feybr - bold cannam@167: % feybo - bold slanted cannam@167: % cannam@167: % There is no good (free) typewriter version, to my knowledge. cannam@167: % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. cannam@167: % Hmm. cannam@167: % cannam@167: % Also doesn't work in math. Do we need to do math with euro symbols? cannam@167: % Hope not. cannam@167: % cannam@167: % cannam@167: \def\euro{{\eurofont e}} cannam@167: \def\eurofont{% cannam@167: % We set the font at each command, rather than predefining it in cannam@167: % \textfonts and the other font-switching commands, so that cannam@167: % installations which never need the symbol don't have to have the cannam@167: % font installed. cannam@167: % cannam@167: % There is only one designed size (nominal 10pt), so we always scale cannam@167: % that to the current nominal size. cannam@167: % cannam@167: % By the way, simply using "at 1em" works for cmr10 and the like, but cannam@167: % does not work for cmbx10 and other extended/shrunken fonts. cannam@167: % cannam@167: \def\eurosize{\csname\curfontsize nominalsize\endcsname}% cannam@167: % cannam@167: \ifx\curfontstyle\bfstylename cannam@167: % bold: cannam@167: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize cannam@167: \else cannam@167: % regular: cannam@167: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize cannam@167: \fi cannam@167: \thiseurofont cannam@167: } cannam@167: cannam@167: % Glyphs from the EC fonts. We don't use \let for the aliases, because cannam@167: % sometimes we redefine the original macro, and the alias should reflect cannam@167: % the redefinition. cannam@167: % cannam@167: % Use LaTeX names for the Icelandic letters. cannam@167: \def\DH{{\ecfont \char"D0}} % Eth cannam@167: \def\dh{{\ecfont \char"F0}} % eth cannam@167: \def\TH{{\ecfont \char"DE}} % Thorn cannam@167: \def\th{{\ecfont \char"FE}} % thorn cannam@167: % cannam@167: \def\guillemetleft{{\ecfont \char"13}} cannam@167: \def\guillemotleft{\guillemetleft} cannam@167: \def\guillemetright{{\ecfont \char"14}} cannam@167: \def\guillemotright{\guillemetright} cannam@167: \def\guilsinglleft{{\ecfont \char"0E}} cannam@167: \def\guilsinglright{{\ecfont \char"0F}} cannam@167: \def\quotedblbase{{\ecfont \char"12}} cannam@167: \def\quotesinglbase{{\ecfont \char"0D}} cannam@167: % cannam@167: % This positioning is not perfect (see the ogonek LaTeX package), but cannam@167: % we have the precomposed glyphs for the most common cases. We put the cannam@167: % tests to use those glyphs in the single \ogonek macro so we have fewer cannam@167: % dummy definitions to worry about for index entries, etc. cannam@167: % cannam@167: % ogonek is also used with other letters in Lithuanian (IOU), but using cannam@167: % the precomposed glyphs for those is not so easy since they aren't in cannam@167: % the same EC font. cannam@167: \def\ogonek#1{{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\macrocharA\Aogonek cannam@167: \else\ifx\temp\macrochara\aogonek cannam@167: \else\ifx\temp\macrocharE\Eogonek cannam@167: \else\ifx\temp\macrochare\eogonek cannam@167: \else cannam@167: \ecfont \setbox0=\hbox{#1}% cannam@167: \ifdim\ht0=1ex\accent"0C #1% cannam@167: \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}% cannam@167: \fi cannam@167: \fi\fi\fi\fi cannam@167: }% cannam@167: } cannam@167: \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A} cannam@167: \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a} cannam@167: \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E} cannam@167: \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e} cannam@167: % cannam@167: % Use the ec* fonts (cm-super in outline format) for non-CM glyphs. cannam@167: \def\ecfont{% cannam@167: % We can't distinguish serif/sans and italic/slanted, but this cannam@167: % is used for crude hacks anyway (like adding French and German cannam@167: % quotes to documents typeset with CM, where we lose kerning), so cannam@167: % hopefully nobody will notice/care. cannam@167: \edef\ecsize{\csname\curfontsize ecsize\endcsname}% cannam@167: \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% cannam@167: \ifmonospace cannam@167: % typewriter: cannam@167: \font\thisecfont = ectt\ecsize \space at \nominalsize cannam@167: \else cannam@167: \ifx\curfontstyle\bfstylename cannam@167: % bold: cannam@167: \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize cannam@167: \else cannam@167: % regular: cannam@167: \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize cannam@167: \fi cannam@167: \fi cannam@167: \thisecfont cannam@167: } cannam@167: cannam@167: % @registeredsymbol - R in a circle. The font for the R should really cannam@167: % be smaller yet, but lllsize is the best we can do for now. cannam@167: % Adapted from the plain.tex definition of \copyright. cannam@167: % cannam@167: \def\registeredsymbol{% cannam@167: $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% cannam@167: \hfil\crcr\Orb}}% cannam@167: }$% cannam@167: } cannam@167: cannam@167: % @textdegree - the normal degrees sign. cannam@167: % cannam@167: \def\textdegree{$^\circ$} cannam@167: cannam@167: % Laurent Siebenmann reports \Orb undefined with: cannam@167: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 cannam@167: % so we'll define it if necessary. cannam@167: % cannam@167: \ifx\Orb\thisisundefined cannam@167: \def\Orb{\mathhexbox20D} cannam@167: \fi cannam@167: cannam@167: % Quotes. cannam@167: \chardef\quotedblleft="5C cannam@167: \chardef\quotedblright=`\" cannam@167: \chardef\quoteleft=`\` cannam@167: \chardef\quoteright=`\' cannam@167: cannam@167: cannam@167: \message{page headings,} cannam@167: cannam@167: \newskip\titlepagetopglue \titlepagetopglue = 1.5in cannam@167: \newskip\titlepagebottomglue \titlepagebottomglue = 2pc cannam@167: cannam@167: % First the title page. Must do @settitle before @titlepage. cannam@167: \newif\ifseenauthor cannam@167: \newif\iffinishedtitlepage cannam@167: cannam@167: % Do an implicit @contents or @shortcontents after @end titlepage if the cannam@167: % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. cannam@167: % cannam@167: \newif\ifsetcontentsaftertitlepage cannam@167: \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue cannam@167: \newif\ifsetshortcontentsaftertitlepage cannam@167: \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue cannam@167: cannam@167: \parseargdef\shorttitlepage{% cannam@167: \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% cannam@167: \endgroup\page\hbox{}\page} cannam@167: cannam@167: \envdef\titlepage{% cannam@167: % Open one extra group, as we want to close it in the middle of \Etitlepage. cannam@167: \begingroup cannam@167: \parindent=0pt \textfonts cannam@167: % Leave some space at the very top of the page. cannam@167: \vglue\titlepagetopglue cannam@167: % No rule at page bottom unless we print one at the top with @title. cannam@167: \finishedtitlepagetrue cannam@167: % cannam@167: % Most title ``pages'' are actually two pages long, with space cannam@167: % at the top of the second. We don't want the ragged left on the second. cannam@167: \let\oldpage = \page cannam@167: \def\page{% cannam@167: \iffinishedtitlepage\else cannam@167: \finishtitlepage cannam@167: \fi cannam@167: \let\page = \oldpage cannam@167: \page cannam@167: \null cannam@167: }% cannam@167: } cannam@167: cannam@167: \def\Etitlepage{% cannam@167: \iffinishedtitlepage\else cannam@167: \finishtitlepage cannam@167: \fi cannam@167: % It is important to do the page break before ending the group, cannam@167: % because the headline and footline are only empty inside the group. cannam@167: % If we use the new definition of \page, we always get a blank page cannam@167: % after the title page, which we certainly don't want. cannam@167: \oldpage cannam@167: \endgroup cannam@167: % cannam@167: % Need this before the \...aftertitlepage checks so that if they are cannam@167: % in effect the toc pages will come out with page numbers. cannam@167: \HEADINGSon cannam@167: % cannam@167: % If they want short, they certainly want long too. cannam@167: \ifsetshortcontentsaftertitlepage cannam@167: \shortcontents cannam@167: \contents cannam@167: \global\let\shortcontents = \relax cannam@167: \global\let\contents = \relax cannam@167: \fi cannam@167: % cannam@167: \ifsetcontentsaftertitlepage cannam@167: \contents cannam@167: \global\let\contents = \relax cannam@167: \global\let\shortcontents = \relax cannam@167: \fi cannam@167: } cannam@167: cannam@167: \def\finishtitlepage{% cannam@167: \vskip4pt \hrule height 2pt width \hsize cannam@167: \vskip\titlepagebottomglue cannam@167: \finishedtitlepagetrue cannam@167: } cannam@167: cannam@167: % Settings used for typesetting titles: no hyphenation, no indentation, cannam@167: % don't worry much about spacing, ragged right. This should be used cannam@167: % inside a \vbox, and fonts need to be set appropriately first. Because cannam@167: % it is always used for titles, nothing else, we call \rmisbold. \par cannam@167: % should be specified before the end of the \vbox, since a vbox is a group. cannam@167: % cannam@167: \def\raggedtitlesettings{% cannam@167: \rmisbold cannam@167: \hyphenpenalty=10000 cannam@167: \parindent=0pt cannam@167: \tolerance=5000 cannam@167: \ptexraggedright cannam@167: } cannam@167: cannam@167: % Macros to be used within @titlepage: cannam@167: cannam@167: \let\subtitlerm=\tenrm cannam@167: \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} cannam@167: cannam@167: \parseargdef\title{% cannam@167: \checkenv\titlepage cannam@167: \vbox{\titlefonts \raggedtitlesettings #1\par}% cannam@167: % print a rule at the page bottom also. cannam@167: \finishedtitlepagefalse cannam@167: \vskip4pt \hrule height 4pt width \hsize \vskip4pt cannam@167: } cannam@167: cannam@167: \parseargdef\subtitle{% cannam@167: \checkenv\titlepage cannam@167: {\subtitlefont \rightline{#1}}% cannam@167: } cannam@167: cannam@167: % @author should come last, but may come many times. cannam@167: % It can also be used inside @quotation. cannam@167: % cannam@167: \parseargdef\author{% cannam@167: \def\temp{\quotation}% cannam@167: \ifx\thisenv\temp cannam@167: \def\quotationauthor{#1}% printed in \Equotation. cannam@167: \else cannam@167: \checkenv\titlepage cannam@167: \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi cannam@167: {\secfonts\rmisbold \leftline{#1}}% cannam@167: \fi cannam@167: } cannam@167: cannam@167: cannam@167: % Set up page headings and footings. cannam@167: cannam@167: \let\thispage=\folio cannam@167: cannam@167: \newtoks\evenheadline % headline on even pages cannam@167: \newtoks\oddheadline % headline on odd pages cannam@167: \newtoks\evenfootline % footline on even pages cannam@167: \newtoks\oddfootline % footline on odd pages cannam@167: cannam@167: % Now make TeX use those variables cannam@167: \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline cannam@167: \else \the\evenheadline \fi}} cannam@167: \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline cannam@167: \else \the\evenfootline \fi}\HEADINGShook} cannam@167: \let\HEADINGShook=\relax cannam@167: cannam@167: % Commands to set those variables. cannam@167: % For example, this is what @headings on does cannam@167: % @evenheading @thistitle|@thispage|@thischapter cannam@167: % @oddheading @thischapter|@thispage|@thistitle cannam@167: % @evenfooting @thisfile|| cannam@167: % @oddfooting ||@thisfile cannam@167: cannam@167: cannam@167: \def\evenheading{\parsearg\evenheadingxxx} cannam@167: \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} cannam@167: \def\evenheadingyyy #1\|#2\|#3\|#4\finish{% cannam@167: \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} cannam@167: cannam@167: \def\oddheading{\parsearg\oddheadingxxx} cannam@167: \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} cannam@167: \def\oddheadingyyy #1\|#2\|#3\|#4\finish{% cannam@167: \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} cannam@167: cannam@167: \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% cannam@167: cannam@167: \def\evenfooting{\parsearg\evenfootingxxx} cannam@167: \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} cannam@167: \def\evenfootingyyy #1\|#2\|#3\|#4\finish{% cannam@167: \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} cannam@167: cannam@167: \def\oddfooting{\parsearg\oddfootingxxx} cannam@167: \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} cannam@167: \def\oddfootingyyy #1\|#2\|#3\|#4\finish{% cannam@167: \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% cannam@167: % cannam@167: % Leave some space for the footline. Hopefully ok to assume cannam@167: % @evenfooting will not be used by itself. cannam@167: \global\advance\pageheight by -12pt cannam@167: \global\advance\vsize by -12pt cannam@167: } cannam@167: cannam@167: \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} cannam@167: cannam@167: % @evenheadingmarks top \thischapter <- chapter at the top of a page cannam@167: % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page cannam@167: % cannam@167: % The same set of arguments for: cannam@167: % cannam@167: % @oddheadingmarks cannam@167: % @evenfootingmarks cannam@167: % @oddfootingmarks cannam@167: % @everyheadingmarks cannam@167: % @everyfootingmarks cannam@167: cannam@167: \def\evenheadingmarks{\headingmarks{even}{heading}} cannam@167: \def\oddheadingmarks{\headingmarks{odd}{heading}} cannam@167: \def\evenfootingmarks{\headingmarks{even}{footing}} cannam@167: \def\oddfootingmarks{\headingmarks{odd}{footing}} cannam@167: \def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1} cannam@167: \headingmarks{odd}{heading}{#1} } cannam@167: \def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1} cannam@167: \headingmarks{odd}{footing}{#1} } cannam@167: % #1 = even/odd, #2 = heading/footing, #3 = top/bottom. cannam@167: \def\headingmarks#1#2#3 {% cannam@167: \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname cannam@167: \global\expandafter\let\csname get#1#2marks\endcsname \temp cannam@167: } cannam@167: cannam@167: \everyheadingmarks bottom cannam@167: \everyfootingmarks bottom cannam@167: cannam@167: % @headings double turns headings on for double-sided printing. cannam@167: % @headings single turns headings on for single-sided printing. cannam@167: % @headings off turns them off. cannam@167: % @headings on same as @headings double, retained for compatibility. cannam@167: % @headings after turns on double-sided headings after this page. cannam@167: % @headings doubleafter turns on double-sided headings after this page. cannam@167: % @headings singleafter turns on single-sided headings after this page. cannam@167: % By default, they are off at the start of a document, cannam@167: % and turned `on' after @end titlepage. cannam@167: cannam@167: \def\headings #1 {\csname HEADINGS#1\endcsname} cannam@167: cannam@167: \def\headingsoff{% non-global headings elimination cannam@167: \evenheadline={\hfil}\evenfootline={\hfil}% cannam@167: \oddheadline={\hfil}\oddfootline={\hfil}% cannam@167: } cannam@167: cannam@167: \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting cannam@167: \HEADINGSoff % it's the default cannam@167: cannam@167: % When we turn headings on, set the page number to 1. cannam@167: % For double-sided printing, put current file name in lower left corner, cannam@167: % chapter name on inside top of right hand pages, document cannam@167: % title on inside top of left hand pages, and page numbers on outside top cannam@167: % edge of all pages. cannam@167: \def\HEADINGSdouble{% cannam@167: \global\pageno=1 cannam@167: \global\evenfootline={\hfil} cannam@167: \global\oddfootline={\hfil} cannam@167: \global\evenheadline={\line{\folio\hfil\thistitle}} cannam@167: \global\oddheadline={\line{\thischapter\hfil\folio}} cannam@167: \global\let\contentsalignmacro = \chapoddpage cannam@167: } cannam@167: \let\contentsalignmacro = \chappager cannam@167: cannam@167: % For single-sided printing, chapter title goes across top left of page, cannam@167: % page number on top right. cannam@167: \def\HEADINGSsingle{% cannam@167: \global\pageno=1 cannam@167: \global\evenfootline={\hfil} cannam@167: \global\oddfootline={\hfil} cannam@167: \global\evenheadline={\line{\thischapter\hfil\folio}} cannam@167: \global\oddheadline={\line{\thischapter\hfil\folio}} cannam@167: \global\let\contentsalignmacro = \chappager cannam@167: } cannam@167: \def\HEADINGSon{\HEADINGSdouble} cannam@167: cannam@167: \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} cannam@167: \let\HEADINGSdoubleafter=\HEADINGSafter cannam@167: \def\HEADINGSdoublex{% cannam@167: \global\evenfootline={\hfil} cannam@167: \global\oddfootline={\hfil} cannam@167: \global\evenheadline={\line{\folio\hfil\thistitle}} cannam@167: \global\oddheadline={\line{\thischapter\hfil\folio}} cannam@167: \global\let\contentsalignmacro = \chapoddpage cannam@167: } cannam@167: cannam@167: \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} cannam@167: \def\HEADINGSsinglex{% cannam@167: \global\evenfootline={\hfil} cannam@167: \global\oddfootline={\hfil} cannam@167: \global\evenheadline={\line{\thischapter\hfil\folio}} cannam@167: \global\oddheadline={\line{\thischapter\hfil\folio}} cannam@167: \global\let\contentsalignmacro = \chappager cannam@167: } cannam@167: cannam@167: % Subroutines used in generating headings cannam@167: % This produces Day Month Year style of output. cannam@167: % Only define if not already defined, in case a txi-??.tex file has set cannam@167: % up a different format (e.g., txi-cs.tex does this). cannam@167: \ifx\today\thisisundefined cannam@167: \def\today{% cannam@167: \number\day\space cannam@167: \ifcase\month cannam@167: \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr cannam@167: \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug cannam@167: \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec cannam@167: \fi cannam@167: \space\number\year} cannam@167: \fi cannam@167: cannam@167: % @settitle line... specifies the title of the document, for headings. cannam@167: % It generates no output of its own. cannam@167: \def\thistitle{\putwordNoTitle} cannam@167: \def\settitle{\parsearg{\gdef\thistitle}} cannam@167: cannam@167: cannam@167: \message{tables,} cannam@167: % Tables -- @table, @ftable, @vtable, @item(x). cannam@167: cannam@167: % default indentation of table text cannam@167: \newdimen\tableindent \tableindent=.8in cannam@167: % default indentation of @itemize and @enumerate text cannam@167: \newdimen\itemindent \itemindent=.3in cannam@167: % margin between end of table item and start of table text. cannam@167: \newdimen\itemmargin \itemmargin=.1in cannam@167: cannam@167: % used internally for \itemindent minus \itemmargin cannam@167: \newdimen\itemmax cannam@167: cannam@167: % Note @table, @ftable, and @vtable define @item, @itemx, etc., with cannam@167: % these defs. cannam@167: % They also define \itemindex cannam@167: % to index the item name in whatever manner is desired (perhaps none). cannam@167: cannam@167: \newif\ifitemxneedsnegativevskip cannam@167: cannam@167: \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} cannam@167: cannam@167: \def\internalBitem{\smallbreak \parsearg\itemzzz} cannam@167: \def\internalBitemx{\itemxpar \parsearg\itemzzz} cannam@167: cannam@167: \def\itemzzz #1{\begingroup % cannam@167: \advance\hsize by -\rightskip cannam@167: \advance\hsize by -\tableindent cannam@167: \setbox0=\hbox{\itemindicate{#1}}% cannam@167: \itemindex{#1}% cannam@167: \nobreak % This prevents a break before @itemx. cannam@167: % cannam@167: % If the item text does not fit in the space we have, put it on a line cannam@167: % by itself, and do not allow a page break either before or after that cannam@167: % line. We do not start a paragraph here because then if the next cannam@167: % command is, e.g., @kindex, the whatsit would get put into the cannam@167: % horizontal list on a line by itself, resulting in extra blank space. cannam@167: \ifdim \wd0>\itemmax cannam@167: % cannam@167: % Make this a paragraph so we get the \parskip glue and wrapping, cannam@167: % but leave it ragged-right. cannam@167: \begingroup cannam@167: \advance\leftskip by-\tableindent cannam@167: \advance\hsize by\tableindent cannam@167: \advance\rightskip by0pt plus1fil\relax cannam@167: \leavevmode\unhbox0\par cannam@167: \endgroup cannam@167: % cannam@167: % We're going to be starting a paragraph, but we don't want the cannam@167: % \parskip glue -- logically it's part of the @item we just started. cannam@167: \nobreak \vskip-\parskip cannam@167: % cannam@167: % Stop a page break at the \parskip glue coming up. However, if cannam@167: % what follows is an environment such as @example, there will be no cannam@167: % \parskip glue; then the negative vskip we just inserted would cannam@167: % cause the example and the item to crash together. So we use this cannam@167: % bizarre value of 10001 as a signal to \aboveenvbreak to insert cannam@167: % \parskip glue after all. Section titles are handled this way also. cannam@167: % cannam@167: \penalty 10001 cannam@167: \endgroup cannam@167: \itemxneedsnegativevskipfalse cannam@167: \else cannam@167: % The item text fits into the space. Start a paragraph, so that the cannam@167: % following text (if any) will end up on the same line. cannam@167: \noindent cannam@167: % Do this with kerns and \unhbox so that if there is a footnote in cannam@167: % the item text, it can migrate to the main vertical list and cannam@167: % eventually be printed. cannam@167: \nobreak\kern-\tableindent cannam@167: \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 cannam@167: \unhbox0 cannam@167: \nobreak\kern\dimen0 cannam@167: \endgroup cannam@167: \itemxneedsnegativevskiptrue cannam@167: \fi cannam@167: } cannam@167: cannam@167: \def\item{\errmessage{@item while not in a list environment}} cannam@167: \def\itemx{\errmessage{@itemx while not in a list environment}} cannam@167: cannam@167: % @table, @ftable, @vtable. cannam@167: \envdef\table{% cannam@167: \let\itemindex\gobble cannam@167: \tablecheck{table}% cannam@167: } cannam@167: \envdef\ftable{% cannam@167: \def\itemindex ##1{\doind {fn}{\code{##1}}}% cannam@167: \tablecheck{ftable}% cannam@167: } cannam@167: \envdef\vtable{% cannam@167: \def\itemindex ##1{\doind {vr}{\code{##1}}}% cannam@167: \tablecheck{vtable}% cannam@167: } cannam@167: \def\tablecheck#1{% cannam@167: \ifnum \the\catcode`\^^M=\active cannam@167: \endgroup cannam@167: \errmessage{This command won't work in this context; perhaps the problem is cannam@167: that we are \inenvironment\thisenv}% cannam@167: \def\next{\doignore{#1}}% cannam@167: \else cannam@167: \let\next\tablex cannam@167: \fi cannam@167: \next cannam@167: } cannam@167: \def\tablex#1{% cannam@167: \def\itemindicate{#1}% cannam@167: \parsearg\tabley cannam@167: } cannam@167: \def\tabley#1{% cannam@167: {% cannam@167: \makevalueexpandable cannam@167: \edef\temp{\noexpand\tablez #1\space\space\space}% cannam@167: \expandafter cannam@167: }\temp \endtablez cannam@167: } cannam@167: \def\tablez #1 #2 #3 #4\endtablez{% cannam@167: \aboveenvbreak cannam@167: \ifnum 0#1>0 \advance \leftskip by #1\mil \fi cannam@167: \ifnum 0#2>0 \tableindent=#2\mil \fi cannam@167: \ifnum 0#3>0 \advance \rightskip by #3\mil \fi cannam@167: \itemmax=\tableindent cannam@167: \advance \itemmax by -\itemmargin cannam@167: \advance \leftskip by \tableindent cannam@167: \exdentamount=\tableindent cannam@167: \parindent = 0pt cannam@167: \parskip = \smallskipamount cannam@167: \ifdim \parskip=0pt \parskip=2pt \fi cannam@167: \let\item = \internalBitem cannam@167: \let\itemx = \internalBitemx cannam@167: } cannam@167: \def\Etable{\endgraf\afterenvbreak} cannam@167: \let\Eftable\Etable cannam@167: \let\Evtable\Etable cannam@167: \let\Eitemize\Etable cannam@167: \let\Eenumerate\Etable cannam@167: cannam@167: % This is the counter used by @enumerate, which is really @itemize cannam@167: cannam@167: \newcount \itemno cannam@167: cannam@167: \envdef\itemize{\parsearg\doitemize} cannam@167: cannam@167: \def\doitemize#1{% cannam@167: \aboveenvbreak cannam@167: \itemmax=\itemindent cannam@167: \advance\itemmax by -\itemmargin cannam@167: \advance\leftskip by \itemindent cannam@167: \exdentamount=\itemindent cannam@167: \parindent=0pt cannam@167: \parskip=\smallskipamount cannam@167: \ifdim\parskip=0pt \parskip=2pt \fi cannam@167: % cannam@167: % Try typesetting the item mark that if the document erroneously says cannam@167: % something like @itemize @samp (intending @table), there's an error cannam@167: % right away at the @itemize. It's not the best error message in the cannam@167: % world, but it's better than leaving it to the @item. This means if cannam@167: % the user wants an empty mark, they have to say @w{} not just @w. cannam@167: \def\itemcontents{#1}% cannam@167: \setbox0 = \hbox{\itemcontents}% cannam@167: % cannam@167: % @itemize with no arg is equivalent to @itemize @bullet. cannam@167: \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi cannam@167: % cannam@167: \let\item=\itemizeitem cannam@167: } cannam@167: cannam@167: % Definition of @item while inside @itemize and @enumerate. cannam@167: % cannam@167: \def\itemizeitem{% cannam@167: \advance\itemno by 1 % for enumerations cannam@167: {\let\par=\endgraf \smallbreak}% reasonable place to break cannam@167: {% cannam@167: % If the document has an @itemize directly after a section title, a cannam@167: % \nobreak will be last on the list, and \sectionheading will have cannam@167: % done a \vskip-\parskip. In that case, we don't want to zero cannam@167: % parskip, or the item text will crash with the heading. On the cannam@167: % other hand, when there is normal text preceding the item (as there cannam@167: % usually is), we do want to zero parskip, or there would be too much cannam@167: % space. In that case, we won't have a \nobreak before. At least cannam@167: % that's the theory. cannam@167: \ifnum\lastpenalty<10000 \parskip=0in \fi cannam@167: \noindent cannam@167: \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% cannam@167: % cannam@167: \vadjust{\penalty 1200}}% not good to break after first line of item. cannam@167: \flushcr cannam@167: } cannam@167: cannam@167: % \splitoff TOKENS\endmark defines \first to be the first token in cannam@167: % TOKENS, and \rest to be the remainder. cannam@167: % cannam@167: \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% cannam@167: cannam@167: % Allow an optional argument of an uppercase letter, lowercase letter, cannam@167: % or number, to specify the first label in the enumerated list. No cannam@167: % argument is the same as `1'. cannam@167: % cannam@167: \envparseargdef\enumerate{\enumeratey #1 \endenumeratey} cannam@167: \def\enumeratey #1 #2\endenumeratey{% cannam@167: % If we were given no argument, pretend we were given `1'. cannam@167: \def\thearg{#1}% cannam@167: \ifx\thearg\empty \def\thearg{1}\fi cannam@167: % cannam@167: % Detect if the argument is a single token. If so, it might be a cannam@167: % letter. Otherwise, the only valid thing it can be is a number. cannam@167: % (We will always have one token, because of the test we just made. cannam@167: % This is a good thing, since \splitoff doesn't work given nothing at cannam@167: % all -- the first parameter is undelimited.) cannam@167: \expandafter\splitoff\thearg\endmark cannam@167: \ifx\rest\empty cannam@167: % Only one token in the argument. It could still be anything. cannam@167: % A ``lowercase letter'' is one whose \lccode is nonzero. cannam@167: % An ``uppercase letter'' is one whose \lccode is both nonzero, and cannam@167: % not equal to itself. cannam@167: % Otherwise, we assume it's a number. cannam@167: % cannam@167: % We need the \relax at the end of the \ifnum lines to stop TeX from cannam@167: % continuing to look for a . cannam@167: % cannam@167: \ifnum\lccode\expandafter`\thearg=0\relax cannam@167: \numericenumerate % a number (we hope) cannam@167: \else cannam@167: % It's a letter. cannam@167: \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax cannam@167: \lowercaseenumerate % lowercase letter cannam@167: \else cannam@167: \uppercaseenumerate % uppercase letter cannam@167: \fi cannam@167: \fi cannam@167: \else cannam@167: % Multiple tokens in the argument. We hope it's a number. cannam@167: \numericenumerate cannam@167: \fi cannam@167: } cannam@167: cannam@167: % An @enumerate whose labels are integers. The starting integer is cannam@167: % given in \thearg. cannam@167: % cannam@167: \def\numericenumerate{% cannam@167: \itemno = \thearg cannam@167: \startenumeration{\the\itemno}% cannam@167: } cannam@167: cannam@167: % The starting (lowercase) letter is in \thearg. cannam@167: \def\lowercaseenumerate{% cannam@167: \itemno = \expandafter`\thearg cannam@167: \startenumeration{% cannam@167: % Be sure we're not beyond the end of the alphabet. cannam@167: \ifnum\itemno=0 cannam@167: \errmessage{No more lowercase letters in @enumerate; get a bigger cannam@167: alphabet}% cannam@167: \fi cannam@167: \char\lccode\itemno cannam@167: }% cannam@167: } cannam@167: cannam@167: % The starting (uppercase) letter is in \thearg. cannam@167: \def\uppercaseenumerate{% cannam@167: \itemno = \expandafter`\thearg cannam@167: \startenumeration{% cannam@167: % Be sure we're not beyond the end of the alphabet. cannam@167: \ifnum\itemno=0 cannam@167: \errmessage{No more uppercase letters in @enumerate; get a bigger cannam@167: alphabet} cannam@167: \fi cannam@167: \char\uccode\itemno cannam@167: }% cannam@167: } cannam@167: cannam@167: % Call \doitemize, adding a period to the first argument and supplying the cannam@167: % common last two arguments. Also subtract one from the initial value in cannam@167: % \itemno, since @item increments \itemno. cannam@167: % cannam@167: \def\startenumeration#1{% cannam@167: \advance\itemno by -1 cannam@167: \doitemize{#1.}\flushcr cannam@167: } cannam@167: cannam@167: % @alphaenumerate and @capsenumerate are abbreviations for giving an arg cannam@167: % to @enumerate. cannam@167: % cannam@167: \def\alphaenumerate{\enumerate{a}} cannam@167: \def\capsenumerate{\enumerate{A}} cannam@167: \def\Ealphaenumerate{\Eenumerate} cannam@167: \def\Ecapsenumerate{\Eenumerate} cannam@167: cannam@167: cannam@167: % @multitable macros cannam@167: % Amy Hendrickson, 8/18/94, 3/6/96 cannam@167: % cannam@167: % @multitable ... @end multitable will make as many columns as desired. cannam@167: % Contents of each column will wrap at width given in preamble. Width cannam@167: % can be specified either with sample text given in a template line, cannam@167: % or in percent of \hsize, the current width of text on page. cannam@167: cannam@167: % Table can continue over pages but will only break between lines. cannam@167: cannam@167: % To make preamble: cannam@167: % cannam@167: % Either define widths of columns in terms of percent of \hsize: cannam@167: % @multitable @columnfractions .25 .3 .45 cannam@167: % @item ... cannam@167: % cannam@167: % Numbers following @columnfractions are the percent of the total cannam@167: % current hsize to be used for each column. You may use as many cannam@167: % columns as desired. cannam@167: cannam@167: cannam@167: % Or use a template: cannam@167: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} cannam@167: % @item ... cannam@167: % using the widest term desired in each column. cannam@167: cannam@167: % Each new table line starts with @item, each subsequent new column cannam@167: % starts with @tab. Empty columns may be produced by supplying @tab's cannam@167: % with nothing between them for as many times as empty columns are needed, cannam@167: % ie, @tab@tab@tab will produce two empty columns. cannam@167: cannam@167: % @item, @tab do not need to be on their own lines, but it will not hurt cannam@167: % if they are. cannam@167: cannam@167: % Sample multitable: cannam@167: cannam@167: % @multitable {Column 1 template} {Column 2 template} {Column 3 template} cannam@167: % @item first col stuff @tab second col stuff @tab third col cannam@167: % @item cannam@167: % first col stuff cannam@167: % @tab cannam@167: % second col stuff cannam@167: % @tab cannam@167: % third col cannam@167: % @item first col stuff @tab second col stuff cannam@167: % @tab Many paragraphs of text may be used in any column. cannam@167: % cannam@167: % They will wrap at the width determined by the template. cannam@167: % @item@tab@tab This will be in third column. cannam@167: % @end multitable cannam@167: cannam@167: % Default dimensions may be reset by user. cannam@167: % @multitableparskip is vertical space between paragraphs in table. cannam@167: % @multitableparindent is paragraph indent in table. cannam@167: % @multitablecolmargin is horizontal space to be left between columns. cannam@167: % @multitablelinespace is space to leave between table items, baseline cannam@167: % to baseline. cannam@167: % 0pt means it depends on current normal line spacing. cannam@167: % cannam@167: \newskip\multitableparskip cannam@167: \newskip\multitableparindent cannam@167: \newdimen\multitablecolspace cannam@167: \newskip\multitablelinespace cannam@167: \multitableparskip=0pt cannam@167: \multitableparindent=6pt cannam@167: \multitablecolspace=12pt cannam@167: \multitablelinespace=0pt cannam@167: cannam@167: % Macros used to set up halign preamble: cannam@167: % cannam@167: \let\endsetuptable\relax cannam@167: \def\xendsetuptable{\endsetuptable} cannam@167: \let\columnfractions\relax cannam@167: \def\xcolumnfractions{\columnfractions} cannam@167: \newif\ifsetpercent cannam@167: cannam@167: % #1 is the @columnfraction, usually a decimal number like .5, but might cannam@167: % be just 1. We just use it, whatever it is. cannam@167: % cannam@167: \def\pickupwholefraction#1 {% cannam@167: \global\advance\colcount by 1 cannam@167: \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% cannam@167: \setuptable cannam@167: } cannam@167: cannam@167: \newcount\colcount cannam@167: \def\setuptable#1{% cannam@167: \def\firstarg{#1}% cannam@167: \ifx\firstarg\xendsetuptable cannam@167: \let\go = \relax cannam@167: \else cannam@167: \ifx\firstarg\xcolumnfractions cannam@167: \global\setpercenttrue cannam@167: \else cannam@167: \ifsetpercent cannam@167: \let\go\pickupwholefraction cannam@167: \else cannam@167: \global\advance\colcount by 1 cannam@167: \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a cannam@167: % separator; typically that is always in the input, anyway. cannam@167: \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% cannam@167: \fi cannam@167: \fi cannam@167: \ifx\go\pickupwholefraction cannam@167: % Put the argument back for the \pickupwholefraction call, so cannam@167: % we'll always have a period there to be parsed. cannam@167: \def\go{\pickupwholefraction#1}% cannam@167: \else cannam@167: \let\go = \setuptable cannam@167: \fi% cannam@167: \fi cannam@167: \go cannam@167: } cannam@167: cannam@167: % multitable-only commands. cannam@167: % cannam@167: % @headitem starts a heading row, which we typeset in bold. cannam@167: % Assignments have to be global since we are inside the implicit group cannam@167: % of an alignment entry. \everycr resets \everytab so we don't have to cannam@167: % undo it ourselves. cannam@167: \def\headitemfont{\b}% for people to use in the template row; not changeable cannam@167: \def\headitem{% cannam@167: \checkenv\multitable cannam@167: \crcr cannam@167: \global\everytab={\bf}% can't use \headitemfont since the parsing differs cannam@167: \the\everytab % for the first item cannam@167: }% cannam@167: % cannam@167: % A \tab used to include \hskip1sp. But then the space in a template cannam@167: % line is not enough. That is bad. So let's go back to just `&' until cannam@167: % we again encounter the problem the 1sp was intended to solve. cannam@167: % --karl, nathan@acm.org, 20apr99. cannam@167: \def\tab{\checkenv\multitable &\the\everytab}% cannam@167: cannam@167: % @multitable ... @end multitable definitions: cannam@167: % cannam@167: \newtoks\everytab % insert after every tab. cannam@167: % cannam@167: \envdef\multitable{% cannam@167: \vskip\parskip cannam@167: \startsavinginserts cannam@167: % cannam@167: % @item within a multitable starts a normal row. cannam@167: % We use \def instead of \let so that if one of the multitable entries cannam@167: % contains an @itemize, we don't choke on the \item (seen as \crcr aka cannam@167: % \endtemplate) expanding \doitemize. cannam@167: \def\item{\crcr}% cannam@167: % cannam@167: \tolerance=9500 cannam@167: \hbadness=9500 cannam@167: \setmultitablespacing cannam@167: \parskip=\multitableparskip cannam@167: \parindent=\multitableparindent cannam@167: \overfullrule=0pt cannam@167: \global\colcount=0 cannam@167: % cannam@167: \everycr = {% cannam@167: \noalign{% cannam@167: \global\everytab={}% cannam@167: \global\colcount=0 % Reset the column counter. cannam@167: % Check for saved footnotes, etc. cannam@167: \checkinserts cannam@167: % Keeps underfull box messages off when table breaks over pages. cannam@167: %\filbreak cannam@167: % Maybe so, but it also creates really weird page breaks when the cannam@167: % table breaks over pages. Wouldn't \vfil be better? Wait until the cannam@167: % problem manifests itself, so it can be fixed for real --karl. cannam@167: }% cannam@167: }% cannam@167: % cannam@167: \parsearg\domultitable cannam@167: } cannam@167: \def\domultitable#1{% cannam@167: % To parse everything between @multitable and @item: cannam@167: \setuptable#1 \endsetuptable cannam@167: % cannam@167: % This preamble sets up a generic column definition, which will cannam@167: % be used as many times as user calls for columns. cannam@167: % \vtop will set a single line and will also let text wrap and cannam@167: % continue for many paragraphs if desired. cannam@167: \halign\bgroup &% cannam@167: \global\advance\colcount by 1 cannam@167: \multistrut cannam@167: \vtop{% cannam@167: % Use the current \colcount to find the correct column width: cannam@167: \hsize=\expandafter\csname col\the\colcount\endcsname cannam@167: % cannam@167: % In order to keep entries from bumping into each other cannam@167: % we will add a \leftskip of \multitablecolspace to all columns after cannam@167: % the first one. cannam@167: % cannam@167: % If a template has been used, we will add \multitablecolspace cannam@167: % to the width of each template entry. cannam@167: % cannam@167: % If the user has set preamble in terms of percent of \hsize we will cannam@167: % use that dimension as the width of the column, and the \leftskip cannam@167: % will keep entries from bumping into each other. Table will start at cannam@167: % left margin and final column will justify at right margin. cannam@167: % cannam@167: % Make sure we don't inherit \rightskip from the outer environment. cannam@167: \rightskip=0pt cannam@167: \ifnum\colcount=1 cannam@167: % The first column will be indented with the surrounding text. cannam@167: \advance\hsize by\leftskip cannam@167: \else cannam@167: \ifsetpercent \else cannam@167: % If user has not set preamble in terms of percent of \hsize cannam@167: % we will advance \hsize by \multitablecolspace. cannam@167: \advance\hsize by \multitablecolspace cannam@167: \fi cannam@167: % In either case we will make \leftskip=\multitablecolspace: cannam@167: \leftskip=\multitablecolspace cannam@167: \fi cannam@167: % Ignoring space at the beginning and end avoids an occasional spurious cannam@167: % blank line, when TeX decides to break the line at the space before the cannam@167: % box from the multistrut, so the strut ends up on a line by itself. cannam@167: % For example: cannam@167: % @multitable @columnfractions .11 .89 cannam@167: % @item @code{#} cannam@167: % @tab Legal holiday which is valid in major parts of the whole country. cannam@167: % Is automatically provided with highlighting sequences respectively cannam@167: % marking characters. cannam@167: \noindent\ignorespaces##\unskip\multistrut cannam@167: }\cr cannam@167: } cannam@167: \def\Emultitable{% cannam@167: \crcr cannam@167: \egroup % end the \halign cannam@167: \global\setpercentfalse cannam@167: } cannam@167: cannam@167: \def\setmultitablespacing{% cannam@167: \def\multistrut{\strut}% just use the standard line spacing cannam@167: % cannam@167: % Compute \multitablelinespace (if not defined by user) for use in cannam@167: % \multitableparskip calculation. We used define \multistrut based on cannam@167: % this, but (ironically) that caused the spacing to be off. cannam@167: % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. cannam@167: \ifdim\multitablelinespace=0pt cannam@167: \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip cannam@167: \global\advance\multitablelinespace by-\ht0 cannam@167: \fi cannam@167: % Test to see if parskip is larger than space between lines of cannam@167: % table. If not, do nothing. cannam@167: % If so, set to same dimension as multitablelinespace. cannam@167: \ifdim\multitableparskip>\multitablelinespace cannam@167: \global\multitableparskip=\multitablelinespace cannam@167: \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller cannam@167: % than skip between lines in the table. cannam@167: \fi% cannam@167: \ifdim\multitableparskip=0pt cannam@167: \global\multitableparskip=\multitablelinespace cannam@167: \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller cannam@167: % than skip between lines in the table. cannam@167: \fi} cannam@167: cannam@167: cannam@167: \message{conditionals,} cannam@167: cannam@167: % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, cannam@167: % @ifnotxml always succeed. They currently do nothing; we don't cannam@167: % attempt to check whether the conditionals are properly nested. But we cannam@167: % have to remember that they are conditionals, so that @end doesn't cannam@167: % attempt to close an environment group. cannam@167: % cannam@167: \def\makecond#1{% cannam@167: \expandafter\let\csname #1\endcsname = \relax cannam@167: \expandafter\let\csname iscond.#1\endcsname = 1 cannam@167: } cannam@167: \makecond{iftex} cannam@167: \makecond{ifnotdocbook} cannam@167: \makecond{ifnothtml} cannam@167: \makecond{ifnotinfo} cannam@167: \makecond{ifnotplaintext} cannam@167: \makecond{ifnotxml} cannam@167: cannam@167: % Ignore @ignore, @ifhtml, @ifinfo, and the like. cannam@167: % cannam@167: \def\direntry{\doignore{direntry}} cannam@167: \def\documentdescription{\doignore{documentdescription}} cannam@167: \def\docbook{\doignore{docbook}} cannam@167: \def\html{\doignore{html}} cannam@167: \def\ifdocbook{\doignore{ifdocbook}} cannam@167: \def\ifhtml{\doignore{ifhtml}} cannam@167: \def\ifinfo{\doignore{ifinfo}} cannam@167: \def\ifnottex{\doignore{ifnottex}} cannam@167: \def\ifplaintext{\doignore{ifplaintext}} cannam@167: \def\ifxml{\doignore{ifxml}} cannam@167: \def\ignore{\doignore{ignore}} cannam@167: \def\menu{\doignore{menu}} cannam@167: \def\xml{\doignore{xml}} cannam@167: cannam@167: % Ignore text until a line `@end #1', keeping track of nested conditionals. cannam@167: % cannam@167: % A count to remember the depth of nesting. cannam@167: \newcount\doignorecount cannam@167: cannam@167: \def\doignore#1{\begingroup cannam@167: % Scan in ``verbatim'' mode: cannam@167: \obeylines cannam@167: \catcode`\@ = \other cannam@167: \catcode`\{ = \other cannam@167: \catcode`\} = \other cannam@167: % cannam@167: % Make sure that spaces turn into tokens that match what \doignoretext wants. cannam@167: \spaceisspace cannam@167: % cannam@167: % Count number of #1's that we've seen. cannam@167: \doignorecount = 0 cannam@167: % cannam@167: % Swallow text until we reach the matching `@end #1'. cannam@167: \dodoignore{#1}% cannam@167: } cannam@167: cannam@167: { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. cannam@167: \obeylines % cannam@167: % cannam@167: \gdef\dodoignore#1{% cannam@167: % #1 contains the command name as a string, e.g., `ifinfo'. cannam@167: % cannam@167: % Define a command to find the next `@end #1'. cannam@167: \long\def\doignoretext##1^^M@end #1{% cannam@167: \doignoretextyyy##1^^M@#1\_STOP_}% cannam@167: % cannam@167: % And this command to find another #1 command, at the beginning of a cannam@167: % line. (Otherwise, we would consider a line `@c @ifset', for cannam@167: % example, to count as an @ifset for nesting.) cannam@167: \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% cannam@167: % cannam@167: % And now expand that command. cannam@167: \doignoretext ^^M% cannam@167: }% cannam@167: } cannam@167: cannam@167: \def\doignoreyyy#1{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\empty % Nothing found. cannam@167: \let\next\doignoretextzzz cannam@167: \else % Found a nested condition, ... cannam@167: \advance\doignorecount by 1 cannam@167: \let\next\doignoretextyyy % ..., look for another. cannam@167: % If we're here, #1 ends with ^^M\ifinfo (for example). cannam@167: \fi cannam@167: \next #1% the token \_STOP_ is present just after this macro. cannam@167: } cannam@167: cannam@167: % We have to swallow the remaining "\_STOP_". cannam@167: % cannam@167: \def\doignoretextzzz#1{% cannam@167: \ifnum\doignorecount = 0 % We have just found the outermost @end. cannam@167: \let\next\enddoignore cannam@167: \else % Still inside a nested condition. cannam@167: \advance\doignorecount by -1 cannam@167: \let\next\doignoretext % Look for the next @end. cannam@167: \fi cannam@167: \next cannam@167: } cannam@167: cannam@167: % Finish off ignored text. cannam@167: { \obeylines% cannam@167: % Ignore anything after the last `@end #1'; this matters in verbatim cannam@167: % environments, where otherwise the newline after an ignored conditional cannam@167: % would result in a blank line in the output. cannam@167: \gdef\enddoignore#1^^M{\endgroup\ignorespaces}% cannam@167: } cannam@167: cannam@167: cannam@167: % @set VAR sets the variable VAR to an empty value. cannam@167: % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. cannam@167: % cannam@167: % Since we want to separate VAR from REST-OF-LINE (which might be cannam@167: % empty), we can't just use \parsearg; we have to insert a space of our cannam@167: % own to delimit the rest of the line, and then take it out again if we cannam@167: % didn't need it. cannam@167: % We rely on the fact that \parsearg sets \catcode`\ =10. cannam@167: % cannam@167: \parseargdef\set{\setyyy#1 \endsetyyy} cannam@167: \def\setyyy#1 #2\endsetyyy{% cannam@167: {% cannam@167: \makevalueexpandable cannam@167: \def\temp{#2}% cannam@167: \edef\next{\gdef\makecsname{SET#1}}% cannam@167: \ifx\temp\empty cannam@167: \next{}% cannam@167: \else cannam@167: \setzzz#2\endsetzzz cannam@167: \fi cannam@167: }% cannam@167: } cannam@167: % Remove the trailing space \setxxx inserted. cannam@167: \def\setzzz#1 \endsetzzz{\next{#1}} cannam@167: cannam@167: % @clear VAR clears (i.e., unsets) the variable VAR. cannam@167: % cannam@167: \parseargdef\clear{% cannam@167: {% cannam@167: \makevalueexpandable cannam@167: \global\expandafter\let\csname SET#1\endcsname=\relax cannam@167: }% cannam@167: } cannam@167: cannam@167: % @value{foo} gets the text saved in variable foo. cannam@167: \def\value{\begingroup\makevalueexpandable\valuexxx} cannam@167: \def\valuexxx#1{\expandablevalue{#1}\endgroup} cannam@167: { cannam@167: \catcode`\- = \active \catcode`\_ = \active cannam@167: % cannam@167: \gdef\makevalueexpandable{% cannam@167: \let\value = \expandablevalue cannam@167: % We don't want these characters active, ... cannam@167: \catcode`\-=\other \catcode`\_=\other cannam@167: % ..., but we might end up with active ones in the argument if cannam@167: % we're called from @code, as @code{@value{foo-bar_}}, though. cannam@167: % So \let them to their normal equivalents. cannam@167: \let-\normaldash \let_\normalunderscore cannam@167: } cannam@167: } cannam@167: cannam@167: % We have this subroutine so that we can handle at least some @value's cannam@167: % properly in indexes (we call \makevalueexpandable in \indexdummies). cannam@167: % The command has to be fully expandable (if the variable is set), since cannam@167: % the result winds up in the index file. This means that if the cannam@167: % variable's value contains other Texinfo commands, it's almost certain cannam@167: % it will fail (although perhaps we could fix that with sufficient work cannam@167: % to do a one-level expansion on the result, instead of complete). cannam@167: % cannam@167: \def\expandablevalue#1{% cannam@167: \expandafter\ifx\csname SET#1\endcsname\relax cannam@167: {[No value for ``#1'']}% cannam@167: \message{Variable `#1', used in @value, is not set.}% cannam@167: \else cannam@167: \csname SET#1\endcsname cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined cannam@167: % with @set. cannam@167: % cannam@167: % To get special treatment of `@end ifset,' call \makeond and the redefine. cannam@167: % cannam@167: \makecond{ifset} cannam@167: \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} cannam@167: \def\doifset#1#2{% cannam@167: {% cannam@167: \makevalueexpandable cannam@167: \let\next=\empty cannam@167: \expandafter\ifx\csname SET#2\endcsname\relax cannam@167: #1% If not set, redefine \next. cannam@167: \fi cannam@167: \expandafter cannam@167: }\next cannam@167: } cannam@167: \def\ifsetfail{\doignore{ifset}} cannam@167: cannam@167: % @ifclear VAR ... @end executes the `...' iff VAR has never been cannam@167: % defined with @set, or has been undefined with @clear. cannam@167: % cannam@167: % The `\else' inside the `\doifset' parameter is a trick to reuse the cannam@167: % above code: if the variable is not set, do nothing, if it is set, cannam@167: % then redefine \next to \ifclearfail. cannam@167: % cannam@167: \makecond{ifclear} cannam@167: \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} cannam@167: \def\ifclearfail{\doignore{ifclear}} cannam@167: cannam@167: % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written cannam@167: % without the @) is in fact defined. We can only feasibly check at the cannam@167: % TeX level, so something like `mathcode' is going to considered cannam@167: % defined even though it is not a Texinfo command. cannam@167: % cannam@167: \makecond{ifcommanddefined} cannam@167: \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}} cannam@167: % cannam@167: \def\doifcmddefined#1#2{{% cannam@167: \makevalueexpandable cannam@167: \let\next=\empty cannam@167: \expandafter\ifx\csname #2\endcsname\relax cannam@167: #1% If not defined, \let\next as above. cannam@167: \fi cannam@167: \expandafter cannam@167: }\next cannam@167: } cannam@167: \def\ifcmddefinedfail{\doignore{ifcommanddefined}} cannam@167: cannam@167: % @ifcommandnotdefined CMD ... handled similar to @ifclear above. cannam@167: \makecond{ifcommandnotdefined} cannam@167: \def\ifcommandnotdefined{% cannam@167: \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}} cannam@167: \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}} cannam@167: cannam@167: % Set the `txicommandconditionals' variable, so documents have a way to cannam@167: % test if the @ifcommand...defined conditionals are available. cannam@167: \set txicommandconditionals cannam@167: cannam@167: % @dircategory CATEGORY -- specify a category of the dir file cannam@167: % which this file should belong to. Ignore this in TeX. cannam@167: \let\dircategory=\comment cannam@167: cannam@167: % @defininfoenclose. cannam@167: \let\definfoenclose=\comment cannam@167: cannam@167: cannam@167: \message{indexing,} cannam@167: % Index generation facilities cannam@167: cannam@167: % Define \newwrite to be identical to plain tex's \newwrite cannam@167: % except not \outer, so it can be used within macros and \if's. cannam@167: \edef\newwrite{\makecsname{ptexnewwrite}} cannam@167: cannam@167: % \newindex {foo} defines an index named foo. cannam@167: % It automatically defines \fooindex such that cannam@167: % \fooindex ...rest of line... puts an entry in the index foo. cannam@167: % It also defines \fooindfile to be the number of the output channel for cannam@167: % the file that accumulates this index. The file's extension is foo. cannam@167: % The name of an index should be no more than 2 characters long cannam@167: % for the sake of vms. cannam@167: % cannam@167: \def\newindex#1{% cannam@167: \iflinks cannam@167: \expandafter\newwrite \csname#1indfile\endcsname cannam@167: \openout \csname#1indfile\endcsname \jobname.#1 % Open the file cannam@167: \fi cannam@167: \expandafter\xdef\csname#1index\endcsname{% % Define @#1index cannam@167: \noexpand\doindex{#1}} cannam@167: } cannam@167: cannam@167: % @defindex foo == \newindex{foo} cannam@167: % cannam@167: \def\defindex{\parsearg\newindex} cannam@167: cannam@167: % Define @defcodeindex, like @defindex except put all entries in @code. cannam@167: % cannam@167: \def\defcodeindex{\parsearg\newcodeindex} cannam@167: % cannam@167: \def\newcodeindex#1{% cannam@167: \iflinks cannam@167: \expandafter\newwrite \csname#1indfile\endcsname cannam@167: \openout \csname#1indfile\endcsname \jobname.#1 cannam@167: \fi cannam@167: \expandafter\xdef\csname#1index\endcsname{% cannam@167: \noexpand\docodeindex{#1}}% cannam@167: } cannam@167: cannam@167: cannam@167: % @synindex foo bar makes index foo feed into index bar. cannam@167: % Do this instead of @defindex foo if you don't want it as a separate index. cannam@167: % cannam@167: % @syncodeindex foo bar similar, but put all entries made for index foo cannam@167: % inside @code. cannam@167: % cannam@167: \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} cannam@167: \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} cannam@167: cannam@167: % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), cannam@167: % #3 the target index (bar). cannam@167: \def\dosynindex#1#2#3{% cannam@167: % Only do \closeout if we haven't already done it, else we'll end up cannam@167: % closing the target index. cannam@167: \expandafter \ifx\csname donesynindex#2\endcsname \relax cannam@167: % The \closeout helps reduce unnecessary open files; the limit on the cannam@167: % Acorn RISC OS is a mere 16 files. cannam@167: \expandafter\closeout\csname#2indfile\endcsname cannam@167: \expandafter\let\csname donesynindex#2\endcsname = 1 cannam@167: \fi cannam@167: % redefine \fooindfile: cannam@167: \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname cannam@167: \expandafter\let\csname#2indfile\endcsname=\temp cannam@167: % redefine \fooindex: cannam@167: \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% cannam@167: } cannam@167: cannam@167: % Define \doindex, the driver for all \fooindex macros. cannam@167: % Argument #1 is generated by the calling \fooindex macro, cannam@167: % and it is "foo", the name of the index. cannam@167: cannam@167: % \doindex just uses \parsearg; it calls \doind for the actual work. cannam@167: % This is because \doind is more useful to call from other macros. cannam@167: cannam@167: % There is also \dosubind {index}{topic}{subtopic} cannam@167: % which makes an entry in a two-level index such as the operation index. cannam@167: cannam@167: \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} cannam@167: \def\singleindexer #1{\doind{\indexname}{#1}} cannam@167: cannam@167: % like the previous two, but they put @code around the argument. cannam@167: \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} cannam@167: \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} cannam@167: cannam@167: % Take care of Texinfo commands that can appear in an index entry. cannam@167: % Since there are some commands we want to expand, and others we don't, cannam@167: % we have to laboriously prevent expansion for those that we don't. cannam@167: % cannam@167: \def\indexdummies{% cannam@167: \escapechar = `\\ % use backslash in output files. cannam@167: \def\@{@}% change to @@ when we switch to @ as escape char in index files. cannam@167: \def\ {\realbackslash\space }% cannam@167: % cannam@167: % Need these unexpandable (because we define \tt as a dummy) cannam@167: % definitions when @{ or @} appear in index entry text. Also, more cannam@167: % complicated, when \tex is in effect and \{ is a \delimiter again. cannam@167: % We can't use \lbracecmd and \rbracecmd because texindex assumes cannam@167: % braces and backslashes are used only as delimiters. Perhaps we cannam@167: % should define @lbrace and @rbrace commands a la @comma. cannam@167: \def\{{{\tt\char123}}% cannam@167: \def\}{{\tt\char125}}% cannam@167: % cannam@167: % I don't entirely understand this, but when an index entry is cannam@167: % generated from a macro call, the \endinput which \scanmacro inserts cannam@167: % causes processing to be prematurely terminated. This is, cannam@167: % apparently, because \indexsorttmp is fully expanded, and \endinput cannam@167: % is an expandable command. The redefinition below makes \endinput cannam@167: % disappear altogether for that purpose -- although logging shows that cannam@167: % processing continues to some further point. On the other hand, it cannam@167: % seems \endinput does not hurt in the printed index arg, since that cannam@167: % is still getting written without apparent harm. cannam@167: % cannam@167: % Sample source (mac-idx3.tex, reported by Graham Percival to cannam@167: % help-texinfo, 22may06): cannam@167: % @macro funindex {WORD} cannam@167: % @findex xyz cannam@167: % @end macro cannam@167: % ... cannam@167: % @funindex commtest cannam@167: % cannam@167: % The above is not enough to reproduce the bug, but it gives the flavor. cannam@167: % cannam@167: % Sample whatsit resulting: cannam@167: % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}} cannam@167: % cannam@167: % So: cannam@167: \let\endinput = \empty cannam@167: % cannam@167: % Do the redefinitions. cannam@167: \commondummies cannam@167: } cannam@167: cannam@167: % For the aux and toc files, @ is the escape character. So we want to cannam@167: % redefine everything using @ as the escape character (instead of cannam@167: % \realbackslash, still used for index files). When everything uses @, cannam@167: % this will be simpler. cannam@167: % cannam@167: \def\atdummies{% cannam@167: \def\@{@@}% cannam@167: \def\ {@ }% cannam@167: \let\{ = \lbraceatcmd cannam@167: \let\} = \rbraceatcmd cannam@167: % cannam@167: % Do the redefinitions. cannam@167: \commondummies cannam@167: \otherbackslash cannam@167: } cannam@167: cannam@167: % Called from \indexdummies and \atdummies. cannam@167: % cannam@167: \def\commondummies{% cannam@167: % cannam@167: % \definedummyword defines \#1 as \string\#1\space, thus effectively cannam@167: % preventing its expansion. This is used only for control words, cannam@167: % not control letters, because the \space would be incorrect for cannam@167: % control characters, but is needed to separate the control word cannam@167: % from whatever follows. cannam@167: % cannam@167: % For control letters, we have \definedummyletter, which omits the cannam@167: % space. cannam@167: % cannam@167: % These can be used both for control words that take an argument and cannam@167: % those that do not. If it is followed by {arg} in the input, then cannam@167: % that will dutifully get written to the index (or wherever). cannam@167: % cannam@167: \def\definedummyword ##1{\def##1{\string##1\space}}% cannam@167: \def\definedummyletter##1{\def##1{\string##1}}% cannam@167: \let\definedummyaccent\definedummyletter cannam@167: % cannam@167: \commondummiesnofonts cannam@167: % cannam@167: \definedummyletter\_% cannam@167: \definedummyletter\-% cannam@167: % cannam@167: % Non-English letters. cannam@167: \definedummyword\AA cannam@167: \definedummyword\AE cannam@167: \definedummyword\DH cannam@167: \definedummyword\L cannam@167: \definedummyword\O cannam@167: \definedummyword\OE cannam@167: \definedummyword\TH cannam@167: \definedummyword\aa cannam@167: \definedummyword\ae cannam@167: \definedummyword\dh cannam@167: \definedummyword\exclamdown cannam@167: \definedummyword\l cannam@167: \definedummyword\o cannam@167: \definedummyword\oe cannam@167: \definedummyword\ordf cannam@167: \definedummyword\ordm cannam@167: \definedummyword\questiondown cannam@167: \definedummyword\ss cannam@167: \definedummyword\th cannam@167: % cannam@167: % Although these internal commands shouldn't show up, sometimes they do. cannam@167: \definedummyword\bf cannam@167: \definedummyword\gtr cannam@167: \definedummyword\hat cannam@167: \definedummyword\less cannam@167: \definedummyword\sf cannam@167: \definedummyword\sl cannam@167: \definedummyword\tclose cannam@167: \definedummyword\tt cannam@167: % cannam@167: \definedummyword\LaTeX cannam@167: \definedummyword\TeX cannam@167: % cannam@167: % Assorted special characters. cannam@167: \definedummyword\arrow cannam@167: \definedummyword\bullet cannam@167: \definedummyword\comma cannam@167: \definedummyword\copyright cannam@167: \definedummyword\registeredsymbol cannam@167: \definedummyword\dots cannam@167: \definedummyword\enddots cannam@167: \definedummyword\entrybreak cannam@167: \definedummyword\equiv cannam@167: \definedummyword\error cannam@167: \definedummyword\euro cannam@167: \definedummyword\expansion cannam@167: \definedummyword\geq cannam@167: \definedummyword\guillemetleft cannam@167: \definedummyword\guillemetright cannam@167: \definedummyword\guilsinglleft cannam@167: \definedummyword\guilsinglright cannam@167: \definedummyword\lbracechar cannam@167: \definedummyword\leq cannam@167: \definedummyword\minus cannam@167: \definedummyword\ogonek cannam@167: \definedummyword\pounds cannam@167: \definedummyword\point cannam@167: \definedummyword\print cannam@167: \definedummyword\quotedblbase cannam@167: \definedummyword\quotedblleft cannam@167: \definedummyword\quotedblright cannam@167: \definedummyword\quoteleft cannam@167: \definedummyword\quoteright cannam@167: \definedummyword\quotesinglbase cannam@167: \definedummyword\rbracechar cannam@167: \definedummyword\result cannam@167: \definedummyword\textdegree cannam@167: % cannam@167: % We want to disable all macros so that they are not expanded by \write. cannam@167: \macrolist cannam@167: % cannam@167: \normalturnoffactive cannam@167: % cannam@167: % Handle some cases of @value -- where it does not contain any cannam@167: % (non-fully-expandable) commands. cannam@167: \makevalueexpandable cannam@167: } cannam@167: cannam@167: % \commondummiesnofonts: common to \commondummies and \indexnofonts. cannam@167: % cannam@167: \def\commondummiesnofonts{% cannam@167: % Control letters and accents. cannam@167: \definedummyletter\!% cannam@167: \definedummyaccent\"% cannam@167: \definedummyaccent\'% cannam@167: \definedummyletter\*% cannam@167: \definedummyaccent\,% cannam@167: \definedummyletter\.% cannam@167: \definedummyletter\/% cannam@167: \definedummyletter\:% cannam@167: \definedummyaccent\=% cannam@167: \definedummyletter\?% cannam@167: \definedummyaccent\^% cannam@167: \definedummyaccent\`% cannam@167: \definedummyaccent\~% cannam@167: \definedummyword\u cannam@167: \definedummyword\v cannam@167: \definedummyword\H cannam@167: \definedummyword\dotaccent cannam@167: \definedummyword\ogonek cannam@167: \definedummyword\ringaccent cannam@167: \definedummyword\tieaccent cannam@167: \definedummyword\ubaraccent cannam@167: \definedummyword\udotaccent cannam@167: \definedummyword\dotless cannam@167: % cannam@167: % Texinfo font commands. cannam@167: \definedummyword\b cannam@167: \definedummyword\i cannam@167: \definedummyword\r cannam@167: \definedummyword\sansserif cannam@167: \definedummyword\sc cannam@167: \definedummyword\slanted cannam@167: \definedummyword\t cannam@167: % cannam@167: % Commands that take arguments. cannam@167: \definedummyword\abbr cannam@167: \definedummyword\acronym cannam@167: \definedummyword\anchor cannam@167: \definedummyword\cite cannam@167: \definedummyword\code cannam@167: \definedummyword\command cannam@167: \definedummyword\dfn cannam@167: \definedummyword\dmn cannam@167: \definedummyword\email cannam@167: \definedummyword\emph cannam@167: \definedummyword\env cannam@167: \definedummyword\file cannam@167: \definedummyword\image cannam@167: \definedummyword\indicateurl cannam@167: \definedummyword\inforef cannam@167: \definedummyword\kbd cannam@167: \definedummyword\key cannam@167: \definedummyword\math cannam@167: \definedummyword\option cannam@167: \definedummyword\pxref cannam@167: \definedummyword\ref cannam@167: \definedummyword\samp cannam@167: \definedummyword\strong cannam@167: \definedummyword\tie cannam@167: \definedummyword\uref cannam@167: \definedummyword\url cannam@167: \definedummyword\var cannam@167: \definedummyword\verb cannam@167: \definedummyword\w cannam@167: \definedummyword\xref cannam@167: } cannam@167: cannam@167: % \indexnofonts is used when outputting the strings to sort the index cannam@167: % by, and when constructing control sequence names. It eliminates all cannam@167: % control sequences and just writes whatever the best ASCII sort string cannam@167: % would be for a given command (usually its argument). cannam@167: % cannam@167: \def\indexnofonts{% cannam@167: % Accent commands should become @asis. cannam@167: \def\definedummyaccent##1{\let##1\asis}% cannam@167: % We can just ignore other control letters. cannam@167: \def\definedummyletter##1{\let##1\empty}% cannam@167: % All control words become @asis by default; overrides below. cannam@167: \let\definedummyword\definedummyaccent cannam@167: % cannam@167: \commondummiesnofonts cannam@167: % cannam@167: % Don't no-op \tt, since it isn't a user-level command cannam@167: % and is used in the definitions of the active chars like <, >, |, etc. cannam@167: % Likewise with the other plain tex font commands. cannam@167: %\let\tt=\asis cannam@167: % cannam@167: \def\ { }% cannam@167: \def\@{@}% cannam@167: \def\_{\normalunderscore}% cannam@167: \def\-{}% @- shouldn't affect sorting cannam@167: % cannam@167: % Unfortunately, texindex is not prepared to handle braces in the cannam@167: % content at all. So for index sorting, we map @{ and @} to strings cannam@167: % starting with |, since that ASCII character is between ASCII { and }. cannam@167: \def\{{|a}% cannam@167: \def\lbracechar{|a}% cannam@167: % cannam@167: \def\}{|b}% cannam@167: \def\rbracechar{|b}% cannam@167: % cannam@167: % Non-English letters. cannam@167: \def\AA{AA}% cannam@167: \def\AE{AE}% cannam@167: \def\DH{DZZ}% cannam@167: \def\L{L}% cannam@167: \def\OE{OE}% cannam@167: \def\O{O}% cannam@167: \def\TH{ZZZ}% cannam@167: \def\aa{aa}% cannam@167: \def\ae{ae}% cannam@167: \def\dh{dzz}% cannam@167: \def\exclamdown{!}% cannam@167: \def\l{l}% cannam@167: \def\oe{oe}% cannam@167: \def\ordf{a}% cannam@167: \def\ordm{o}% cannam@167: \def\o{o}% cannam@167: \def\questiondown{?}% cannam@167: \def\ss{ss}% cannam@167: \def\th{zzz}% cannam@167: % cannam@167: \def\LaTeX{LaTeX}% cannam@167: \def\TeX{TeX}% cannam@167: % cannam@167: % Assorted special characters. cannam@167: % (The following {} will end up in the sort string, but that's ok.) cannam@167: \def\arrow{->}% cannam@167: \def\bullet{bullet}% cannam@167: \def\comma{,}% cannam@167: \def\copyright{copyright}% cannam@167: \def\dots{...}% cannam@167: \def\enddots{...}% cannam@167: \def\equiv{==}% cannam@167: \def\error{error}% cannam@167: \def\euro{euro}% cannam@167: \def\expansion{==>}% cannam@167: \def\geq{>=}% cannam@167: \def\guillemetleft{<<}% cannam@167: \def\guillemetright{>>}% cannam@167: \def\guilsinglleft{<}% cannam@167: \def\guilsinglright{>}% cannam@167: \def\leq{<=}% cannam@167: \def\minus{-}% cannam@167: \def\point{.}% cannam@167: \def\pounds{pounds}% cannam@167: \def\print{-|}% cannam@167: \def\quotedblbase{"}% cannam@167: \def\quotedblleft{"}% cannam@167: \def\quotedblright{"}% cannam@167: \def\quoteleft{`}% cannam@167: \def\quoteright{'}% cannam@167: \def\quotesinglbase{,}% cannam@167: \def\registeredsymbol{R}% cannam@167: \def\result{=>}% cannam@167: \def\textdegree{o}% cannam@167: % cannam@167: \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax cannam@167: \else \indexlquoteignore \fi cannam@167: % cannam@167: % We need to get rid of all macros, leaving only the arguments (if present). cannam@167: % Of course this is not nearly correct, but it is the best we can do for now. cannam@167: % makeinfo does not expand macros in the argument to @deffn, which ends up cannam@167: % writing an index entry, and texindex isn't prepared for an index sort entry cannam@167: % that starts with \. cannam@167: % cannam@167: % Since macro invocations are followed by braces, we can just redefine them cannam@167: % to take a single TeX argument. The case of a macro invocation that cannam@167: % goes to end-of-line is not handled. cannam@167: % cannam@167: \macrolist cannam@167: } cannam@167: cannam@167: % Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us cannam@167: % ignore left quotes in the sort term. cannam@167: {\catcode`\`=\active cannam@167: \gdef\indexlquoteignore{\let`=\empty}} cannam@167: cannam@167: \let\indexbackslash=0 %overridden during \printindex. cannam@167: \let\SETmarginindex=\relax % put index entries in margin (undocumented)? cannam@167: cannam@167: % Most index entries go through here, but \dosubind is the general case. cannam@167: % #1 is the index name, #2 is the entry text. cannam@167: \def\doind#1#2{\dosubind{#1}{#2}{}} cannam@167: cannam@167: % Workhorse for all \fooindexes. cannam@167: % #1 is name of index, #2 is stuff to put there, #3 is subentry -- cannam@167: % empty if called from \doind, as we usually are (the main exception cannam@167: % is with most defuns, which call us directly). cannam@167: % cannam@167: \def\dosubind#1#2#3{% cannam@167: \iflinks cannam@167: {% cannam@167: % Store the main index entry text (including the third arg). cannam@167: \toks0 = {#2}% cannam@167: % If third arg is present, precede it with a space. cannam@167: \def\thirdarg{#3}% cannam@167: \ifx\thirdarg\empty \else cannam@167: \toks0 = \expandafter{\the\toks0 \space #3}% cannam@167: \fi cannam@167: % cannam@167: \edef\writeto{\csname#1indfile\endcsname}% cannam@167: % cannam@167: \safewhatsit\dosubindwrite cannam@167: }% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % Write the entry in \toks0 to the index file: cannam@167: % cannam@167: \def\dosubindwrite{% cannam@167: % Put the index entry in the margin if desired. cannam@167: \ifx\SETmarginindex\relax\else cannam@167: \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% cannam@167: \fi cannam@167: % cannam@167: % Remember, we are within a group. cannam@167: \indexdummies % Must do this here, since \bf, etc expand at this stage cannam@167: \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now cannam@167: % so it will be output as is; and it will print as backslash. cannam@167: % cannam@167: % Process the index entry with all font commands turned off, to cannam@167: % get the string to sort by. cannam@167: {\indexnofonts cannam@167: \edef\temp{\the\toks0}% need full expansion cannam@167: \xdef\indexsorttmp{\temp}% cannam@167: }% cannam@167: % cannam@167: % Set up the complete index entry, with both the sort key and cannam@167: % the original text, including any font commands. We write cannam@167: % three arguments to \entry to the .?? file (four in the cannam@167: % subentry case), texindex reduces to two when writing the .??s cannam@167: % sorted result. cannam@167: \edef\temp{% cannam@167: \write\writeto{% cannam@167: \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% cannam@167: }% cannam@167: \temp cannam@167: } cannam@167: cannam@167: % Take care of unwanted page breaks/skips around a whatsit: cannam@167: % cannam@167: % If a skip is the last thing on the list now, preserve it cannam@167: % by backing up by \lastskip, doing the \write, then inserting cannam@167: % the skip again. Otherwise, the whatsit generated by the cannam@167: % \write or \pdfdest will make \lastskip zero. The result is that cannam@167: % sequences like this: cannam@167: % @end defun cannam@167: % @tindex whatever cannam@167: % @defun ... cannam@167: % will have extra space inserted, because the \medbreak in the cannam@167: % start of the @defun won't see the skip inserted by the @end of cannam@167: % the previous defun. cannam@167: % cannam@167: % But don't do any of this if we're not in vertical mode. We cannam@167: % don't want to do a \vskip and prematurely end a paragraph. cannam@167: % cannam@167: % Avoid page breaks due to these extra skips, too. cannam@167: % cannam@167: % But wait, there is a catch there: cannam@167: % We'll have to check whether \lastskip is zero skip. \ifdim is not cannam@167: % sufficient for this purpose, as it ignores stretch and shrink parts cannam@167: % of the skip. The only way seems to be to check the textual cannam@167: % representation of the skip. cannam@167: % cannam@167: % The following is almost like \def\zeroskipmacro{0.0pt} except that cannam@167: % the ``p'' and ``t'' characters have catcode \other, not 11 (letter). cannam@167: % cannam@167: \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} cannam@167: % cannam@167: \newskip\whatsitskip cannam@167: \newcount\whatsitpenalty cannam@167: % cannam@167: % ..., ready, GO: cannam@167: % cannam@167: \def\safewhatsit#1{\ifhmode cannam@167: #1% cannam@167: \else cannam@167: % \lastskip and \lastpenalty cannot both be nonzero simultaneously. cannam@167: \whatsitskip = \lastskip cannam@167: \edef\lastskipmacro{\the\lastskip}% cannam@167: \whatsitpenalty = \lastpenalty cannam@167: % cannam@167: % If \lastskip is nonzero, that means the last item was a cannam@167: % skip. And since a skip is discardable, that means this cannam@167: % -\whatsitskip glue we're inserting is preceded by a cannam@167: % non-discardable item, therefore it is not a potential cannam@167: % breakpoint, therefore no \nobreak needed. cannam@167: \ifx\lastskipmacro\zeroskipmacro cannam@167: \else cannam@167: \vskip-\whatsitskip cannam@167: \fi cannam@167: % cannam@167: #1% cannam@167: % cannam@167: \ifx\lastskipmacro\zeroskipmacro cannam@167: % If \lastskip was zero, perhaps the last item was a penalty, and cannam@167: % perhaps it was >=10000, e.g., a \nobreak. In that case, we want cannam@167: % to re-insert the same penalty (values >10000 are used for various cannam@167: % signals); since we just inserted a non-discardable item, any cannam@167: % following glue (such as a \parskip) would be a breakpoint. For example: cannam@167: % @deffn deffn-whatever cannam@167: % @vindex index-whatever cannam@167: % Description. cannam@167: % would allow a break between the index-whatever whatsit cannam@167: % and the "Description." paragraph. cannam@167: \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi cannam@167: \else cannam@167: % On the other hand, if we had a nonzero \lastskip, cannam@167: % this make-up glue would be preceded by a non-discardable item cannam@167: % (the whatsit from the \write), so we must insert a \nobreak. cannam@167: \nobreak\vskip\whatsitskip cannam@167: \fi cannam@167: \fi} cannam@167: cannam@167: % The index entry written in the file actually looks like cannam@167: % \entry {sortstring}{page}{topic} cannam@167: % or cannam@167: % \entry {sortstring}{page}{topic}{subtopic} cannam@167: % The texindex program reads in these files and writes files cannam@167: % containing these kinds of lines: cannam@167: % \initial {c} cannam@167: % before the first topic whose initial is c cannam@167: % \entry {topic}{pagelist} cannam@167: % for a topic that is used without subtopics cannam@167: % \primary {topic} cannam@167: % for the beginning of a topic that is used with subtopics cannam@167: % \secondary {subtopic}{pagelist} cannam@167: % for each subtopic. cannam@167: cannam@167: % Define the user-accessible indexing commands cannam@167: % @findex, @vindex, @kindex, @cindex. cannam@167: cannam@167: \def\findex {\fnindex} cannam@167: \def\kindex {\kyindex} cannam@167: \def\cindex {\cpindex} cannam@167: \def\vindex {\vrindex} cannam@167: \def\tindex {\tpindex} cannam@167: \def\pindex {\pgindex} cannam@167: cannam@167: \def\cindexsub {\begingroup\obeylines\cindexsub} cannam@167: {\obeylines % cannam@167: \gdef\cindexsub "#1" #2^^M{\endgroup % cannam@167: \dosubind{cp}{#2}{#1}}} cannam@167: cannam@167: % Define the macros used in formatting output of the sorted index material. cannam@167: cannam@167: % @printindex causes a particular index (the ??s file) to get printed. cannam@167: % It does not print any chapter heading (usually an @unnumbered). cannam@167: % cannam@167: \parseargdef\printindex{\begingroup cannam@167: \dobreak \chapheadingskip{10000}% cannam@167: % cannam@167: \smallfonts \rm cannam@167: \tolerance = 9500 cannam@167: \plainfrenchspacing cannam@167: \everypar = {}% don't want the \kern\-parindent from indentation suppression. cannam@167: % cannam@167: % See if the index file exists and is nonempty. cannam@167: % Change catcode of @ here so that if the index file contains cannam@167: % \initial {@} cannam@167: % as its first line, TeX doesn't complain about mismatched braces cannam@167: % (because it thinks @} is a control sequence). cannam@167: \catcode`\@ = 11 cannam@167: \openin 1 \jobname.#1s cannam@167: \ifeof 1 cannam@167: % \enddoublecolumns gets confused if there is no text in the index, cannam@167: % and it loses the chapter title and the aux file entries for the cannam@167: % index. The easiest way to prevent this problem is to make sure cannam@167: % there is some text. cannam@167: \putwordIndexNonexistent cannam@167: \else cannam@167: % cannam@167: % If the index file exists but is empty, then \openin leaves \ifeof cannam@167: % false. We have to make TeX try to read something from the file, so cannam@167: % it can discover if there is anything in it. cannam@167: \read 1 to \temp cannam@167: \ifeof 1 cannam@167: \putwordIndexIsEmpty cannam@167: \else cannam@167: % Index files are almost Texinfo source, but we use \ as the escape cannam@167: % character. It would be better to use @, but that's too big a change cannam@167: % to make right now. cannam@167: \def\indexbackslash{\backslashcurfont}% cannam@167: \catcode`\\ = 0 cannam@167: \escapechar = `\\ cannam@167: \begindoublecolumns cannam@167: \input \jobname.#1s cannam@167: \enddoublecolumns cannam@167: \fi cannam@167: \fi cannam@167: \closein 1 cannam@167: \endgroup} cannam@167: cannam@167: % These macros are used by the sorted index file itself. cannam@167: % Change them to control the appearance of the index. cannam@167: cannam@167: \def\initial#1{{% cannam@167: % Some minor font changes for the special characters. cannam@167: \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt cannam@167: % cannam@167: % Remove any glue we may have, we'll be inserting our own. cannam@167: \removelastskip cannam@167: % cannam@167: % We like breaks before the index initials, so insert a bonus. cannam@167: \nobreak cannam@167: \vskip 0pt plus 3\baselineskip cannam@167: \penalty 0 cannam@167: \vskip 0pt plus -3\baselineskip cannam@167: % cannam@167: % Typeset the initial. Making this add up to a whole number of cannam@167: % baselineskips increases the chance of the dots lining up from column cannam@167: % to column. It still won't often be perfect, because of the stretch cannam@167: % we need before each entry, but it's better. cannam@167: % cannam@167: % No shrink because it confuses \balancecolumns. cannam@167: \vskip 1.67\baselineskip plus .5\baselineskip cannam@167: \leftline{\secbf #1}% cannam@167: % Do our best not to break after the initial. cannam@167: \nobreak cannam@167: \vskip .33\baselineskip plus .1\baselineskip cannam@167: }} cannam@167: cannam@167: % \entry typesets a paragraph consisting of the text (#1), dot leaders, and cannam@167: % then page number (#2) flushed to the right margin. It is used for index cannam@167: % and table of contents entries. The paragraph is indented by \leftskip. cannam@167: % cannam@167: % A straightforward implementation would start like this: cannam@167: % \def\entry#1#2{... cannam@167: % But this freezes the catcodes in the argument, and can cause problems to cannam@167: % @code, which sets - active. This problem was fixed by a kludge--- cannam@167: % ``-'' was active throughout whole index, but this isn't really right. cannam@167: % The right solution is to prevent \entry from swallowing the whole text. cannam@167: % --kasal, 21nov03 cannam@167: \def\entry{% cannam@167: \begingroup cannam@167: % cannam@167: % Start a new paragraph if necessary, so our assignments below can't cannam@167: % affect previous text. cannam@167: \par cannam@167: % cannam@167: % Do not fill out the last line with white space. cannam@167: \parfillskip = 0in cannam@167: % cannam@167: % No extra space above this paragraph. cannam@167: \parskip = 0in cannam@167: % cannam@167: % Do not prefer a separate line ending with a hyphen to fewer lines. cannam@167: \finalhyphendemerits = 0 cannam@167: % cannam@167: % \hangindent is only relevant when the entry text and page number cannam@167: % don't both fit on one line. In that case, bob suggests starting the cannam@167: % dots pretty far over on the line. Unfortunately, a large cannam@167: % indentation looks wrong when the entry text itself is broken across cannam@167: % lines. So we use a small indentation and put up with long leaders. cannam@167: % cannam@167: % \hangafter is reset to 1 (which is the value we want) at the start cannam@167: % of each paragraph, so we need not do anything with that. cannam@167: \hangindent = 2em cannam@167: % cannam@167: % When the entry text needs to be broken, just fill out the first line cannam@167: % with blank space. cannam@167: \rightskip = 0pt plus1fil cannam@167: % cannam@167: % A bit of stretch before each entry for the benefit of balancing cannam@167: % columns. cannam@167: \vskip 0pt plus1pt cannam@167: % cannam@167: % When reading the text of entry, convert explicit line breaks cannam@167: % from @* into spaces. The user might give these in long section cannam@167: % titles, for instance. cannam@167: \def\*{\unskip\space\ignorespaces}% cannam@167: \def\entrybreak{\hfil\break}% cannam@167: % cannam@167: % Swallow the left brace of the text (first parameter): cannam@167: \afterassignment\doentry cannam@167: \let\temp = cannam@167: } cannam@167: \def\entrybreak{\unskip\space\ignorespaces}% cannam@167: \def\doentry{% cannam@167: \bgroup % Instead of the swallowed brace. cannam@167: \noindent cannam@167: \aftergroup\finishentry cannam@167: % And now comes the text of the entry. cannam@167: } cannam@167: \def\finishentry#1{% cannam@167: % #1 is the page number. cannam@167: % cannam@167: % The following is kludged to not output a line of dots in the index if cannam@167: % there are no page numbers. The next person who breaks this will be cannam@167: % cursed by a Unix daemon. cannam@167: \setbox\boxA = \hbox{#1}% cannam@167: \ifdim\wd\boxA = 0pt cannam@167: \ % cannam@167: \else cannam@167: % cannam@167: % If we must, put the page number on a line of its own, and fill out cannam@167: % this line with blank space. (The \hfil is overwhelmed with the cannam@167: % fill leaders glue in \indexdotfill if the page number does fit.) cannam@167: \hfil\penalty50 cannam@167: \null\nobreak\indexdotfill % Have leaders before the page number. cannam@167: % cannam@167: % The `\ ' here is removed by the implicit \unskip that TeX does as cannam@167: % part of (the primitive) \par. Without it, a spurious underfull cannam@167: % \hbox ensues. cannam@167: \ifpdf cannam@167: \pdfgettoks#1.% cannam@167: \ \the\toksA cannam@167: \else cannam@167: \ #1% cannam@167: \fi cannam@167: \fi cannam@167: \par cannam@167: \endgroup cannam@167: } cannam@167: cannam@167: % Like plain.tex's \dotfill, except uses up at least 1 em. cannam@167: \def\indexdotfill{\cleaders cannam@167: \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} cannam@167: cannam@167: \def\primary #1{\line{#1\hfil}} cannam@167: cannam@167: \newskip\secondaryindent \secondaryindent=0.5cm cannam@167: \def\secondary#1#2{{% cannam@167: \parfillskip=0in cannam@167: \parskip=0in cannam@167: \hangindent=1in cannam@167: \hangafter=1 cannam@167: \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill cannam@167: \ifpdf cannam@167: \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. cannam@167: \else cannam@167: #2 cannam@167: \fi cannam@167: \par cannam@167: }} cannam@167: cannam@167: % Define two-column mode, which we use to typeset indexes. cannam@167: % Adapted from the TeXbook, page 416, which is to say, cannam@167: % the manmac.tex format used to print the TeXbook itself. cannam@167: \catcode`\@=11 cannam@167: cannam@167: \newbox\partialpage cannam@167: \newdimen\doublecolumnhsize cannam@167: cannam@167: \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns cannam@167: % Grab any single-column material above us. cannam@167: \output = {% cannam@167: % cannam@167: % Here is a possibility not foreseen in manmac: if we accumulate a cannam@167: % whole lot of material, we might end up calling this \output cannam@167: % routine twice in a row (see the doublecol-lose test, which is cannam@167: % essentially a couple of indexes with @setchapternewpage off). In cannam@167: % that case we just ship out what is in \partialpage with the normal cannam@167: % output routine. Generally, \partialpage will be empty when this cannam@167: % runs and this will be a no-op. See the indexspread.tex test case. cannam@167: \ifvoid\partialpage \else cannam@167: \onepageout{\pagecontents\partialpage}% cannam@167: \fi cannam@167: % cannam@167: \global\setbox\partialpage = \vbox{% cannam@167: % Unvbox the main output page. cannam@167: \unvbox\PAGE cannam@167: \kern-\topskip \kern\baselineskip cannam@167: }% cannam@167: }% cannam@167: \eject % run that output routine to set \partialpage cannam@167: % cannam@167: % Use the double-column output routine for subsequent pages. cannam@167: \output = {\doublecolumnout}% cannam@167: % cannam@167: % Change the page size parameters. We could do this once outside this cannam@167: % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 cannam@167: % format, but then we repeat the same computation. Repeating a couple cannam@167: % of assignments once per index is clearly meaningless for the cannam@167: % execution time, so we may as well do it in one place. cannam@167: % cannam@167: % First we halve the line length, less a little for the gutter between cannam@167: % the columns. We compute the gutter based on the line length, so it cannam@167: % changes automatically with the paper format. The magic constant cannam@167: % below is chosen so that the gutter has the same value (well, +-<1pt) cannam@167: % as it did when we hard-coded it. cannam@167: % cannam@167: % We put the result in a separate register, \doublecolumhsize, so we cannam@167: % can restore it in \pagesofar, after \hsize itself has (potentially) cannam@167: % been clobbered. cannam@167: % cannam@167: \doublecolumnhsize = \hsize cannam@167: \advance\doublecolumnhsize by -.04154\hsize cannam@167: \divide\doublecolumnhsize by 2 cannam@167: \hsize = \doublecolumnhsize cannam@167: % cannam@167: % Double the \vsize as well. (We don't need a separate register here, cannam@167: % since nobody clobbers \vsize.) cannam@167: \vsize = 2\vsize cannam@167: } cannam@167: cannam@167: % The double-column output routine for all double-column pages except cannam@167: % the last. cannam@167: % cannam@167: \def\doublecolumnout{% cannam@167: \splittopskip=\topskip \splitmaxdepth=\maxdepth cannam@167: % Get the available space for the double columns -- the normal cannam@167: % (undoubled) page height minus any material left over from the cannam@167: % previous page. cannam@167: \dimen@ = \vsize cannam@167: \divide\dimen@ by 2 cannam@167: \advance\dimen@ by -\ht\partialpage cannam@167: % cannam@167: % box0 will be the left-hand column, box2 the right. cannam@167: \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ cannam@167: \onepageout\pagesofar cannam@167: \unvbox255 cannam@167: \penalty\outputpenalty cannam@167: } cannam@167: % cannam@167: % Re-output the contents of the output page -- any previous material, cannam@167: % followed by the two boxes we just split, in box0 and box2. cannam@167: \def\pagesofar{% cannam@167: \unvbox\partialpage cannam@167: % cannam@167: \hsize = \doublecolumnhsize cannam@167: \wd0=\hsize \wd2=\hsize cannam@167: \hbox to\pagewidth{\box0\hfil\box2}% cannam@167: } cannam@167: % cannam@167: % All done with double columns. cannam@167: \def\enddoublecolumns{% cannam@167: % The following penalty ensures that the page builder is exercised cannam@167: % _before_ we change the output routine. This is necessary in the cannam@167: % following situation: cannam@167: % cannam@167: % The last section of the index consists only of a single entry. cannam@167: % Before this section, \pagetotal is less than \pagegoal, so no cannam@167: % break occurs before the last section starts. However, the last cannam@167: % section, consisting of \initial and the single \entry, does not cannam@167: % fit on the page and has to be broken off. Without the following cannam@167: % penalty the page builder will not be exercised until \eject cannam@167: % below, and by that time we'll already have changed the output cannam@167: % routine to the \balancecolumns version, so the next-to-last cannam@167: % double-column page will be processed with \balancecolumns, which cannam@167: % is wrong: The two columns will go to the main vertical list, with cannam@167: % the broken-off section in the recent contributions. As soon as cannam@167: % the output routine finishes, TeX starts reconsidering the page cannam@167: % break. The two columns and the broken-off section both fit on the cannam@167: % page, because the two columns now take up only half of the page cannam@167: % goal. When TeX sees \eject from below which follows the final cannam@167: % section, it invokes the new output routine that we've set after cannam@167: % \balancecolumns below; \onepageout will try to fit the two columns cannam@167: % and the final section into the vbox of \pageheight (see cannam@167: % \pagebody), causing an overfull box. cannam@167: % cannam@167: % Note that glue won't work here, because glue does not exercise the cannam@167: % page builder, unlike penalties (see The TeXbook, pp. 280-281). cannam@167: \penalty0 cannam@167: % cannam@167: \output = {% cannam@167: % Split the last of the double-column material. Leave it on the cannam@167: % current page, no automatic page break. cannam@167: \balancecolumns cannam@167: % cannam@167: % If we end up splitting too much material for the current page, cannam@167: % though, there will be another page break right after this \output cannam@167: % invocation ends. Having called \balancecolumns once, we do not cannam@167: % want to call it again. Therefore, reset \output to its normal cannam@167: % definition right away. (We hope \balancecolumns will never be cannam@167: % called on to balance too much material, but if it is, this makes cannam@167: % the output somewhat more palatable.) cannam@167: \global\output = {\onepageout{\pagecontents\PAGE}}% cannam@167: }% cannam@167: \eject cannam@167: \endgroup % started in \begindoublecolumns cannam@167: % cannam@167: % \pagegoal was set to the doubled \vsize above, since we restarted cannam@167: % the current page. We're now back to normal single-column cannam@167: % typesetting, so reset \pagegoal to the normal \vsize (after the cannam@167: % \endgroup where \vsize got restored). cannam@167: \pagegoal = \vsize cannam@167: } cannam@167: % cannam@167: % Called at the end of the double column material. cannam@167: \def\balancecolumns{% cannam@167: \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. cannam@167: \dimen@ = \ht0 cannam@167: \advance\dimen@ by \topskip cannam@167: \advance\dimen@ by-\baselineskip cannam@167: \divide\dimen@ by 2 % target to split to cannam@167: %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% cannam@167: \splittopskip = \topskip cannam@167: % Loop until we get a decent breakpoint. cannam@167: {% cannam@167: \vbadness = 10000 cannam@167: \loop cannam@167: \global\setbox3 = \copy0 cannam@167: \global\setbox1 = \vsplit3 to \dimen@ cannam@167: \ifdim\ht3>\dimen@ cannam@167: \global\advance\dimen@ by 1pt cannam@167: \repeat cannam@167: }% cannam@167: %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% cannam@167: \setbox0=\vbox to\dimen@{\unvbox1}% cannam@167: \setbox2=\vbox to\dimen@{\unvbox3}% cannam@167: % cannam@167: \pagesofar cannam@167: } cannam@167: \catcode`\@ = \other cannam@167: cannam@167: cannam@167: \message{sectioning,} cannam@167: % Chapters, sections, etc. cannam@167: cannam@167: % Let's start with @part. cannam@167: \outer\parseargdef\part{\partzzz{#1}} cannam@167: \def\partzzz#1{% cannam@167: \chapoddpage cannam@167: \null cannam@167: \vskip.3\vsize % move it down on the page a bit cannam@167: \begingroup cannam@167: \noindent \titlefonts\rmisbold #1\par % the text cannam@167: \let\lastnode=\empty % no node to associate with cannam@167: \writetocentry{part}{#1}{}% but put it in the toc cannam@167: \headingsoff % no headline or footline on the part page cannam@167: \chapoddpage cannam@167: \endgroup cannam@167: } cannam@167: cannam@167: % \unnumberedno is an oxymoron. But we count the unnumbered cannam@167: % sections so that we can refer to them unambiguously in the pdf cannam@167: % outlines by their "section number". We avoid collisions with chapter cannam@167: % numbers by starting them at 10000. (If a document ever has 10000 cannam@167: % chapters, we're in trouble anyway, I'm sure.) cannam@167: \newcount\unnumberedno \unnumberedno = 10000 cannam@167: \newcount\chapno cannam@167: \newcount\secno \secno=0 cannam@167: \newcount\subsecno \subsecno=0 cannam@167: \newcount\subsubsecno \subsubsecno=0 cannam@167: cannam@167: % This counter is funny since it counts through charcodes of letters A, B, ... cannam@167: \newcount\appendixno \appendixno = `\@ cannam@167: % cannam@167: % \def\appendixletter{\char\the\appendixno} cannam@167: % We do the following ugly conditional instead of the above simple cannam@167: % construct for the sake of pdftex, which needs the actual cannam@167: % letter in the expansion, not just typeset. cannam@167: % cannam@167: \def\appendixletter{% cannam@167: \ifnum\appendixno=`A A% cannam@167: \else\ifnum\appendixno=`B B% cannam@167: \else\ifnum\appendixno=`C C% cannam@167: \else\ifnum\appendixno=`D D% cannam@167: \else\ifnum\appendixno=`E E% cannam@167: \else\ifnum\appendixno=`F F% cannam@167: \else\ifnum\appendixno=`G G% cannam@167: \else\ifnum\appendixno=`H H% cannam@167: \else\ifnum\appendixno=`I I% cannam@167: \else\ifnum\appendixno=`J J% cannam@167: \else\ifnum\appendixno=`K K% cannam@167: \else\ifnum\appendixno=`L L% cannam@167: \else\ifnum\appendixno=`M M% cannam@167: \else\ifnum\appendixno=`N N% cannam@167: \else\ifnum\appendixno=`O O% cannam@167: \else\ifnum\appendixno=`P P% cannam@167: \else\ifnum\appendixno=`Q Q% cannam@167: \else\ifnum\appendixno=`R R% cannam@167: \else\ifnum\appendixno=`S S% cannam@167: \else\ifnum\appendixno=`T T% cannam@167: \else\ifnum\appendixno=`U U% cannam@167: \else\ifnum\appendixno=`V V% cannam@167: \else\ifnum\appendixno=`W W% cannam@167: \else\ifnum\appendixno=`X X% cannam@167: \else\ifnum\appendixno=`Y Y% cannam@167: \else\ifnum\appendixno=`Z Z% cannam@167: % The \the is necessary, despite appearances, because \appendixletter is cannam@167: % expanded while writing the .toc file. \char\appendixno is not cannam@167: % expandable, thus it is written literally, thus all appendixes come out cannam@167: % with the same letter (or @) in the toc without it. cannam@167: \else\char\the\appendixno cannam@167: \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi cannam@167: \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} cannam@167: cannam@167: % Each @chapter defines these (using marks) as the number+name, number cannam@167: % and name of the chapter. Page headings and footings can use cannam@167: % these. @section does likewise. cannam@167: \def\thischapter{} cannam@167: \def\thischapternum{} cannam@167: \def\thischaptername{} cannam@167: \def\thissection{} cannam@167: \def\thissectionnum{} cannam@167: \def\thissectionname{} cannam@167: cannam@167: \newcount\absseclevel % used to calculate proper heading level cannam@167: \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count cannam@167: cannam@167: % @raisesections: treat @section as chapter, @subsection as section, etc. cannam@167: \def\raisesections{\global\advance\secbase by -1} cannam@167: \let\up=\raisesections % original BFox name cannam@167: cannam@167: % @lowersections: treat @chapter as section, @section as subsection, etc. cannam@167: \def\lowersections{\global\advance\secbase by 1} cannam@167: \let\down=\lowersections % original BFox name cannam@167: cannam@167: % we only have subsub. cannam@167: \chardef\maxseclevel = 3 cannam@167: % cannam@167: % A numbered section within an unnumbered changes to unnumbered too. cannam@167: % To achieve this, remember the "biggest" unnum. sec. we are currently in: cannam@167: \chardef\unnlevel = \maxseclevel cannam@167: % cannam@167: % Trace whether the current chapter is an appendix or not: cannam@167: % \chapheadtype is "N" or "A", unnumbered chapters are ignored. cannam@167: \def\chapheadtype{N} cannam@167: cannam@167: % Choose a heading macro cannam@167: % #1 is heading type cannam@167: % #2 is heading level cannam@167: % #3 is text for heading cannam@167: \def\genhead#1#2#3{% cannam@167: % Compute the abs. sec. level: cannam@167: \absseclevel=#2 cannam@167: \advance\absseclevel by \secbase cannam@167: % Make sure \absseclevel doesn't fall outside the range: cannam@167: \ifnum \absseclevel < 0 cannam@167: \absseclevel = 0 cannam@167: \else cannam@167: \ifnum \absseclevel > 3 cannam@167: \absseclevel = 3 cannam@167: \fi cannam@167: \fi cannam@167: % The heading type: cannam@167: \def\headtype{#1}% cannam@167: \if \headtype U% cannam@167: \ifnum \absseclevel < \unnlevel cannam@167: \chardef\unnlevel = \absseclevel cannam@167: \fi cannam@167: \else cannam@167: % Check for appendix sections: cannam@167: \ifnum \absseclevel = 0 cannam@167: \edef\chapheadtype{\headtype}% cannam@167: \else cannam@167: \if \headtype A\if \chapheadtype N% cannam@167: \errmessage{@appendix... within a non-appendix chapter}% cannam@167: \fi\fi cannam@167: \fi cannam@167: % Check for numbered within unnumbered: cannam@167: \ifnum \absseclevel > \unnlevel cannam@167: \def\headtype{U}% cannam@167: \else cannam@167: \chardef\unnlevel = 3 cannam@167: \fi cannam@167: \fi cannam@167: % Now print the heading: cannam@167: \if \headtype U% cannam@167: \ifcase\absseclevel cannam@167: \unnumberedzzz{#3}% cannam@167: \or \unnumberedseczzz{#3}% cannam@167: \or \unnumberedsubseczzz{#3}% cannam@167: \or \unnumberedsubsubseczzz{#3}% cannam@167: \fi cannam@167: \else cannam@167: \if \headtype A% cannam@167: \ifcase\absseclevel cannam@167: \appendixzzz{#3}% cannam@167: \or \appendixsectionzzz{#3}% cannam@167: \or \appendixsubseczzz{#3}% cannam@167: \or \appendixsubsubseczzz{#3}% cannam@167: \fi cannam@167: \else cannam@167: \ifcase\absseclevel cannam@167: \chapterzzz{#3}% cannam@167: \or \seczzz{#3}% cannam@167: \or \numberedsubseczzz{#3}% cannam@167: \or \numberedsubsubseczzz{#3}% cannam@167: \fi cannam@167: \fi cannam@167: \fi cannam@167: \suppressfirstparagraphindent cannam@167: } cannam@167: cannam@167: % an interface: cannam@167: \def\numhead{\genhead N} cannam@167: \def\apphead{\genhead A} cannam@167: \def\unnmhead{\genhead U} cannam@167: cannam@167: % @chapter, @appendix, @unnumbered. Increment top-level counter, reset cannam@167: % all lower-level sectioning counters to zero. cannam@167: % cannam@167: % Also set \chaplevelprefix, which we prepend to @float sequence numbers cannam@167: % (e.g., figures), q.v. By default (before any chapter), that is empty. cannam@167: \let\chaplevelprefix = \empty cannam@167: % cannam@167: \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz cannam@167: \def\chapterzzz#1{% cannam@167: % section resetting is \global in case the chapter is in a group, such cannam@167: % as an @include file. cannam@167: \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 cannam@167: \global\advance\chapno by 1 cannam@167: % cannam@167: % Used for \float. cannam@167: \gdef\chaplevelprefix{\the\chapno.}% cannam@167: \resetallfloatnos cannam@167: % cannam@167: % \putwordChapter can contain complex things in translations. cannam@167: \toks0=\expandafter{\putwordChapter}% cannam@167: \message{\the\toks0 \space \the\chapno}% cannam@167: % cannam@167: % Write the actual heading. cannam@167: \chapmacro{#1}{Ynumbered}{\the\chapno}% cannam@167: % cannam@167: % So @section and the like are numbered underneath this chapter. cannam@167: \global\let\section = \numberedsec cannam@167: \global\let\subsection = \numberedsubsec cannam@167: \global\let\subsubsection = \numberedsubsubsec cannam@167: } cannam@167: cannam@167: \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz cannam@167: % cannam@167: \def\appendixzzz#1{% cannam@167: \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 cannam@167: \global\advance\appendixno by 1 cannam@167: \gdef\chaplevelprefix{\appendixletter.}% cannam@167: \resetallfloatnos cannam@167: % cannam@167: % \putwordAppendix can contain complex things in translations. cannam@167: \toks0=\expandafter{\putwordAppendix}% cannam@167: \message{\the\toks0 \space \appendixletter}% cannam@167: % cannam@167: \chapmacro{#1}{Yappendix}{\appendixletter}% cannam@167: % cannam@167: \global\let\section = \appendixsec cannam@167: \global\let\subsection = \appendixsubsec cannam@167: \global\let\subsubsection = \appendixsubsubsec cannam@167: } cannam@167: cannam@167: % normally unnmhead0 calls unnumberedzzz: cannam@167: \outer\parseargdef\unnumbered{\unnmhead0{#1}} cannam@167: \def\unnumberedzzz#1{% cannam@167: \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 cannam@167: \global\advance\unnumberedno by 1 cannam@167: % cannam@167: % Since an unnumbered has no number, no prefix for figures. cannam@167: \global\let\chaplevelprefix = \empty cannam@167: \resetallfloatnos cannam@167: % cannam@167: % This used to be simply \message{#1}, but TeX fully expands the cannam@167: % argument to \message. Therefore, if #1 contained @-commands, TeX cannam@167: % expanded them. For example, in `@unnumbered The @cite{Book}', TeX cannam@167: % expanded @cite (which turns out to cause errors because \cite is meant cannam@167: % to be executed, not expanded). cannam@167: % cannam@167: % Anyway, we don't want the fully-expanded definition of @cite to appear cannam@167: % as a result of the \message, we just want `@cite' itself. We use cannam@167: % \the to achieve this: TeX expands \the only once, cannam@167: % simply yielding the contents of . (We also do this for cannam@167: % the toc entries.) cannam@167: \toks0 = {#1}% cannam@167: \message{(\the\toks0)}% cannam@167: % cannam@167: \chapmacro{#1}{Ynothing}{\the\unnumberedno}% cannam@167: % cannam@167: \global\let\section = \unnumberedsec cannam@167: \global\let\subsection = \unnumberedsubsec cannam@167: \global\let\subsubsection = \unnumberedsubsubsec cannam@167: } cannam@167: cannam@167: % @centerchap is like @unnumbered, but the heading is centered. cannam@167: \outer\parseargdef\centerchap{% cannam@167: % Well, we could do the following in a group, but that would break cannam@167: % an assumption that \chapmacro is called at the outermost level. cannam@167: % Thus we are safer this way: --kasal, 24feb04 cannam@167: \let\centerparametersmaybe = \centerparameters cannam@167: \unnmhead0{#1}% cannam@167: \let\centerparametersmaybe = \relax cannam@167: } cannam@167: cannam@167: % @top is like @unnumbered. cannam@167: \let\top\unnumbered cannam@167: cannam@167: % Sections. cannam@167: % cannam@167: \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz cannam@167: \def\seczzz#1{% cannam@167: \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 cannam@167: \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% cannam@167: } cannam@167: cannam@167: % normally calls appendixsectionzzz: cannam@167: \outer\parseargdef\appendixsection{\apphead1{#1}} cannam@167: \def\appendixsectionzzz#1{% cannam@167: \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 cannam@167: \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% cannam@167: } cannam@167: \let\appendixsec\appendixsection cannam@167: cannam@167: % normally calls unnumberedseczzz: cannam@167: \outer\parseargdef\unnumberedsec{\unnmhead1{#1}} cannam@167: \def\unnumberedseczzz#1{% cannam@167: \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 cannam@167: \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% cannam@167: } cannam@167: cannam@167: % Subsections. cannam@167: % cannam@167: % normally calls numberedsubseczzz: cannam@167: \outer\parseargdef\numberedsubsec{\numhead2{#1}} cannam@167: \def\numberedsubseczzz#1{% cannam@167: \global\subsubsecno=0 \global\advance\subsecno by 1 cannam@167: \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% cannam@167: } cannam@167: cannam@167: % normally calls appendixsubseczzz: cannam@167: \outer\parseargdef\appendixsubsec{\apphead2{#1}} cannam@167: \def\appendixsubseczzz#1{% cannam@167: \global\subsubsecno=0 \global\advance\subsecno by 1 cannam@167: \sectionheading{#1}{subsec}{Yappendix}% cannam@167: {\appendixletter.\the\secno.\the\subsecno}% cannam@167: } cannam@167: cannam@167: % normally calls unnumberedsubseczzz: cannam@167: \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} cannam@167: \def\unnumberedsubseczzz#1{% cannam@167: \global\subsubsecno=0 \global\advance\subsecno by 1 cannam@167: \sectionheading{#1}{subsec}{Ynothing}% cannam@167: {\the\unnumberedno.\the\secno.\the\subsecno}% cannam@167: } cannam@167: cannam@167: % Subsubsections. cannam@167: % cannam@167: % normally numberedsubsubseczzz: cannam@167: \outer\parseargdef\numberedsubsubsec{\numhead3{#1}} cannam@167: \def\numberedsubsubseczzz#1{% cannam@167: \global\advance\subsubsecno by 1 cannam@167: \sectionheading{#1}{subsubsec}{Ynumbered}% cannam@167: {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% cannam@167: } cannam@167: cannam@167: % normally appendixsubsubseczzz: cannam@167: \outer\parseargdef\appendixsubsubsec{\apphead3{#1}} cannam@167: \def\appendixsubsubseczzz#1{% cannam@167: \global\advance\subsubsecno by 1 cannam@167: \sectionheading{#1}{subsubsec}{Yappendix}% cannam@167: {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% cannam@167: } cannam@167: cannam@167: % normally unnumberedsubsubseczzz: cannam@167: \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} cannam@167: \def\unnumberedsubsubseczzz#1{% cannam@167: \global\advance\subsubsecno by 1 cannam@167: \sectionheading{#1}{subsubsec}{Ynothing}% cannam@167: {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% cannam@167: } cannam@167: cannam@167: % These macros control what the section commands do, according cannam@167: % to what kind of chapter we are in (ordinary, appendix, or unnumbered). cannam@167: % Define them by default for a numbered chapter. cannam@167: \let\section = \numberedsec cannam@167: \let\subsection = \numberedsubsec cannam@167: \let\subsubsection = \numberedsubsubsec cannam@167: cannam@167: % Define @majorheading, @heading and @subheading cannam@167: cannam@167: \def\majorheading{% cannam@167: {\advance\chapheadingskip by 10pt \chapbreak }% cannam@167: \parsearg\chapheadingzzz cannam@167: } cannam@167: cannam@167: \def\chapheading{\chapbreak \parsearg\chapheadingzzz} cannam@167: \def\chapheadingzzz#1{% cannam@167: \vbox{\chapfonts \raggedtitlesettings #1\par}% cannam@167: \nobreak\bigskip \nobreak cannam@167: \suppressfirstparagraphindent cannam@167: } cannam@167: cannam@167: % @heading, @subheading, @subsubheading. cannam@167: \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} cannam@167: \suppressfirstparagraphindent} cannam@167: \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} cannam@167: \suppressfirstparagraphindent} cannam@167: \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} cannam@167: \suppressfirstparagraphindent} cannam@167: cannam@167: % These macros generate a chapter, section, etc. heading only cannam@167: % (including whitespace, linebreaking, etc. around it), cannam@167: % given all the information in convenient, parsed form. cannam@167: cannam@167: % Args are the skip and penalty (usually negative) cannam@167: \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} cannam@167: cannam@167: % Parameter controlling skip before chapter headings (if needed) cannam@167: \newskip\chapheadingskip cannam@167: cannam@167: % Define plain chapter starts, and page on/off switching for it. cannam@167: \def\chapbreak{\dobreak \chapheadingskip {-4000}} cannam@167: \def\chappager{\par\vfill\supereject} cannam@167: % Because \domark is called before \chapoddpage, the filler page will cannam@167: % get the headings for the next chapter, which is wrong. But we don't cannam@167: % care -- we just disable all headings on the filler page. cannam@167: \def\chapoddpage{% cannam@167: \chappager cannam@167: \ifodd\pageno \else cannam@167: \begingroup cannam@167: \headingsoff cannam@167: \null cannam@167: \chappager cannam@167: \endgroup cannam@167: \fi cannam@167: } cannam@167: cannam@167: \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} cannam@167: cannam@167: \def\CHAPPAGoff{% cannam@167: \global\let\contentsalignmacro = \chappager cannam@167: \global\let\pchapsepmacro=\chapbreak cannam@167: \global\let\pagealignmacro=\chappager} cannam@167: cannam@167: \def\CHAPPAGon{% cannam@167: \global\let\contentsalignmacro = \chappager cannam@167: \global\let\pchapsepmacro=\chappager cannam@167: \global\let\pagealignmacro=\chappager cannam@167: \global\def\HEADINGSon{\HEADINGSsingle}} cannam@167: cannam@167: \def\CHAPPAGodd{% cannam@167: \global\let\contentsalignmacro = \chapoddpage cannam@167: \global\let\pchapsepmacro=\chapoddpage cannam@167: \global\let\pagealignmacro=\chapoddpage cannam@167: \global\def\HEADINGSon{\HEADINGSdouble}} cannam@167: cannam@167: \CHAPPAGon cannam@167: cannam@167: % Chapter opening. cannam@167: % cannam@167: % #1 is the text, #2 is the section type (Ynumbered, Ynothing, cannam@167: % Yappendix, Yomitfromtoc), #3 the chapter number. cannam@167: % cannam@167: % To test against our argument. cannam@167: \def\Ynothingkeyword{Ynothing} cannam@167: \def\Yomitfromtockeyword{Yomitfromtoc} cannam@167: \def\Yappendixkeyword{Yappendix} cannam@167: % cannam@167: \def\chapmacro#1#2#3{% cannam@167: % Insert the first mark before the heading break (see notes for \domark). cannam@167: \let\prevchapterdefs=\lastchapterdefs cannam@167: \let\prevsectiondefs=\lastsectiondefs cannam@167: \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}% cannam@167: \gdef\thissection{}}% cannam@167: % cannam@167: \def\temptype{#2}% cannam@167: \ifx\temptype\Ynothingkeyword cannam@167: \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% cannam@167: \gdef\thischapter{\thischaptername}}% cannam@167: \else\ifx\temptype\Yomitfromtockeyword cannam@167: \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}% cannam@167: \gdef\thischapter{}}% cannam@167: \else\ifx\temptype\Yappendixkeyword cannam@167: \toks0={#1}% cannam@167: \xdef\lastchapterdefs{% cannam@167: \gdef\noexpand\thischaptername{\the\toks0}% cannam@167: \gdef\noexpand\thischapternum{\appendixletter}% cannam@167: % \noexpand\putwordAppendix avoids expanding indigestible cannam@167: % commands in some of the translations. cannam@167: \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} cannam@167: \noexpand\thischapternum: cannam@167: \noexpand\thischaptername}% cannam@167: }% cannam@167: \else cannam@167: \toks0={#1}% cannam@167: \xdef\lastchapterdefs{% cannam@167: \gdef\noexpand\thischaptername{\the\toks0}% cannam@167: \gdef\noexpand\thischapternum{\the\chapno}% cannam@167: % \noexpand\putwordChapter avoids expanding indigestible cannam@167: % commands in some of the translations. cannam@167: \gdef\noexpand\thischapter{\noexpand\putwordChapter{} cannam@167: \noexpand\thischapternum: cannam@167: \noexpand\thischaptername}% cannam@167: }% cannam@167: \fi\fi\fi cannam@167: % cannam@167: % Output the mark. Pass it through \safewhatsit, to take care of cannam@167: % the preceding space. cannam@167: \safewhatsit\domark cannam@167: % cannam@167: % Insert the chapter heading break. cannam@167: \pchapsepmacro cannam@167: % cannam@167: % Now the second mark, after the heading break. No break points cannam@167: % between here and the heading. cannam@167: \let\prevchapterdefs=\lastchapterdefs cannam@167: \let\prevsectiondefs=\lastsectiondefs cannam@167: \domark cannam@167: % cannam@167: {% cannam@167: \chapfonts \rmisbold cannam@167: % cannam@167: % Have to define \lastsection before calling \donoderef, because the cannam@167: % xref code eventually uses it. On the other hand, it has to be called cannam@167: % after \pchapsepmacro, or the headline will change too soon. cannam@167: \gdef\lastsection{#1}% cannam@167: % cannam@167: % Only insert the separating space if we have a chapter/appendix cannam@167: % number, and don't print the unnumbered ``number''. cannam@167: \ifx\temptype\Ynothingkeyword cannam@167: \setbox0 = \hbox{}% cannam@167: \def\toctype{unnchap}% cannam@167: \else\ifx\temptype\Yomitfromtockeyword cannam@167: \setbox0 = \hbox{}% contents like unnumbered, but no toc entry cannam@167: \def\toctype{omit}% cannam@167: \else\ifx\temptype\Yappendixkeyword cannam@167: \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% cannam@167: \def\toctype{app}% cannam@167: \else cannam@167: \setbox0 = \hbox{#3\enspace}% cannam@167: \def\toctype{numchap}% cannam@167: \fi\fi\fi cannam@167: % cannam@167: % Write the toc entry for this chapter. Must come before the cannam@167: % \donoderef, because we include the current node name in the toc cannam@167: % entry, and \donoderef resets it to empty. cannam@167: \writetocentry{\toctype}{#1}{#3}% cannam@167: % cannam@167: % For pdftex, we have to write out the node definition (aka, make cannam@167: % the pdfdest) after any page break, but before the actual text has cannam@167: % been typeset. If the destination for the pdf outline is after the cannam@167: % text, then jumping from the outline may wind up with the text not cannam@167: % being visible, for instance under high magnification. cannam@167: \donoderef{#2}% cannam@167: % cannam@167: % Typeset the actual heading. cannam@167: \nobreak % Avoid page breaks at the interline glue. cannam@167: \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe cannam@167: \unhbox0 #1\par}% cannam@167: }% cannam@167: \nobreak\bigskip % no page break after a chapter title cannam@167: \nobreak cannam@167: } cannam@167: cannam@167: % @centerchap -- centered and unnumbered. cannam@167: \let\centerparametersmaybe = \relax cannam@167: \def\centerparameters{% cannam@167: \advance\rightskip by 3\rightskip cannam@167: \leftskip = \rightskip cannam@167: \parfillskip = 0pt cannam@167: } cannam@167: cannam@167: cannam@167: % I don't think this chapter style is supported any more, so I'm not cannam@167: % updating it with the new noderef stuff. We'll see. --karl, 11aug03. cannam@167: % cannam@167: \def\setchapterstyle #1 {\csname CHAPF#1\endcsname} cannam@167: % cannam@167: \def\unnchfopen #1{% cannam@167: \chapoddpage cannam@167: \vbox{\chapfonts \raggedtitlesettings #1\par}% cannam@167: \nobreak\bigskip\nobreak cannam@167: } cannam@167: \def\chfopen #1#2{\chapoddpage {\chapfonts cannam@167: \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% cannam@167: \par\penalty 5000 % cannam@167: } cannam@167: \def\centerchfopen #1{% cannam@167: \chapoddpage cannam@167: \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}% cannam@167: \nobreak\bigskip \nobreak cannam@167: } cannam@167: \def\CHAPFopen{% cannam@167: \global\let\chapmacro=\chfopen cannam@167: \global\let\centerchapmacro=\centerchfopen} cannam@167: cannam@167: cannam@167: % Section titles. These macros combine the section number parts and cannam@167: % call the generic \sectionheading to do the printing. cannam@167: % cannam@167: \newskip\secheadingskip cannam@167: \def\secheadingbreak{\dobreak \secheadingskip{-1000}} cannam@167: cannam@167: % Subsection titles. cannam@167: \newskip\subsecheadingskip cannam@167: \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} cannam@167: cannam@167: % Subsubsection titles. cannam@167: \def\subsubsecheadingskip{\subsecheadingskip} cannam@167: \def\subsubsecheadingbreak{\subsecheadingbreak} cannam@167: cannam@167: cannam@167: % Print any size, any type, section title. cannam@167: % cannam@167: % #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is cannam@167: % the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the cannam@167: % section number. cannam@167: % cannam@167: \def\seckeyword{sec} cannam@167: % cannam@167: \def\sectionheading#1#2#3#4{% cannam@167: {% cannam@167: \checkenv{}% should not be in an environment. cannam@167: % cannam@167: % Switch to the right set of fonts. cannam@167: \csname #2fonts\endcsname \rmisbold cannam@167: % cannam@167: \def\sectionlevel{#2}% cannam@167: \def\temptype{#3}% cannam@167: % cannam@167: % Insert first mark before the heading break (see notes for \domark). cannam@167: \let\prevsectiondefs=\lastsectiondefs cannam@167: \ifx\temptype\Ynothingkeyword cannam@167: \ifx\sectionlevel\seckeyword cannam@167: \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}% cannam@167: \gdef\thissection{\thissectionname}}% cannam@167: \fi cannam@167: \else\ifx\temptype\Yomitfromtockeyword cannam@167: % Don't redefine \thissection. cannam@167: \else\ifx\temptype\Yappendixkeyword cannam@167: \ifx\sectionlevel\seckeyword cannam@167: \toks0={#1}% cannam@167: \xdef\lastsectiondefs{% cannam@167: \gdef\noexpand\thissectionname{\the\toks0}% cannam@167: \gdef\noexpand\thissectionnum{#4}% cannam@167: % \noexpand\putwordSection avoids expanding indigestible cannam@167: % commands in some of the translations. cannam@167: \gdef\noexpand\thissection{\noexpand\putwordSection{} cannam@167: \noexpand\thissectionnum: cannam@167: \noexpand\thissectionname}% cannam@167: }% cannam@167: \fi cannam@167: \else cannam@167: \ifx\sectionlevel\seckeyword cannam@167: \toks0={#1}% cannam@167: \xdef\lastsectiondefs{% cannam@167: \gdef\noexpand\thissectionname{\the\toks0}% cannam@167: \gdef\noexpand\thissectionnum{#4}% cannam@167: % \noexpand\putwordSection avoids expanding indigestible cannam@167: % commands in some of the translations. cannam@167: \gdef\noexpand\thissection{\noexpand\putwordSection{} cannam@167: \noexpand\thissectionnum: cannam@167: \noexpand\thissectionname}% cannam@167: }% cannam@167: \fi cannam@167: \fi\fi\fi cannam@167: % cannam@167: % Go into vertical mode. Usually we'll already be there, but we cannam@167: % don't want the following whatsit to end up in a preceding paragraph cannam@167: % if the document didn't happen to have a blank line. cannam@167: \par cannam@167: % cannam@167: % Output the mark. Pass it through \safewhatsit, to take care of cannam@167: % the preceding space. cannam@167: \safewhatsit\domark cannam@167: % cannam@167: % Insert space above the heading. cannam@167: \csname #2headingbreak\endcsname cannam@167: % cannam@167: % Now the second mark, after the heading break. No break points cannam@167: % between here and the heading. cannam@167: \let\prevsectiondefs=\lastsectiondefs cannam@167: \domark cannam@167: % cannam@167: % Only insert the space after the number if we have a section number. cannam@167: \ifx\temptype\Ynothingkeyword cannam@167: \setbox0 = \hbox{}% cannam@167: \def\toctype{unn}% cannam@167: \gdef\lastsection{#1}% cannam@167: \else\ifx\temptype\Yomitfromtockeyword cannam@167: % for @headings -- no section number, don't include in toc, cannam@167: % and don't redefine \lastsection. cannam@167: \setbox0 = \hbox{}% cannam@167: \def\toctype{omit}% cannam@167: \let\sectionlevel=\empty cannam@167: \else\ifx\temptype\Yappendixkeyword cannam@167: \setbox0 = \hbox{#4\enspace}% cannam@167: \def\toctype{app}% cannam@167: \gdef\lastsection{#1}% cannam@167: \else cannam@167: \setbox0 = \hbox{#4\enspace}% cannam@167: \def\toctype{num}% cannam@167: \gdef\lastsection{#1}% cannam@167: \fi\fi\fi cannam@167: % cannam@167: % Write the toc entry (before \donoderef). See comments in \chapmacro. cannam@167: \writetocentry{\toctype\sectionlevel}{#1}{#4}% cannam@167: % cannam@167: % Write the node reference (= pdf destination for pdftex). cannam@167: % Again, see comments in \chapmacro. cannam@167: \donoderef{#3}% cannam@167: % cannam@167: % Interline glue will be inserted when the vbox is completed. cannam@167: % That glue will be a valid breakpoint for the page, since it'll be cannam@167: % preceded by a whatsit (usually from the \donoderef, or from the cannam@167: % \writetocentry if there was no node). We don't want to allow that cannam@167: % break, since then the whatsits could end up on page n while the cannam@167: % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000. cannam@167: \nobreak cannam@167: % cannam@167: % Output the actual section heading. cannam@167: \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright cannam@167: \hangindent=\wd0 % zero if no section number cannam@167: \unhbox0 #1}% cannam@167: }% cannam@167: % Add extra space after the heading -- half of whatever came above it. cannam@167: % Don't allow stretch, though. cannam@167: \kern .5 \csname #2headingskip\endcsname cannam@167: % cannam@167: % Do not let the kern be a potential breakpoint, as it would be if it cannam@167: % was followed by glue. cannam@167: \nobreak cannam@167: % cannam@167: % We'll almost certainly start a paragraph next, so don't let that cannam@167: % glue accumulate. (Not a breakpoint because it's preceded by a cannam@167: % discardable item.) However, when a paragraph is not started next cannam@167: % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out cannam@167: % or the negative glue will cause weirdly wrong output, typically cannam@167: % obscuring the section heading with something else. cannam@167: \vskip-\parskip cannam@167: % cannam@167: % This is so the last item on the main vertical list is a known cannam@167: % \penalty > 10000, so \startdefun, etc., can recognize the situation cannam@167: % and do the needful. cannam@167: \penalty 10001 cannam@167: } cannam@167: cannam@167: cannam@167: \message{toc,} cannam@167: % Table of contents. cannam@167: \newwrite\tocfile cannam@167: cannam@167: % Write an entry to the toc file, opening it if necessary. cannam@167: % Called from @chapter, etc. cannam@167: % cannam@167: % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} cannam@167: % We append the current node name (if any) and page number as additional cannam@167: % arguments for the \{chap,sec,...}entry macros which will eventually cannam@167: % read this. The node name is used in the pdf outlines as the cannam@167: % destination to jump to. cannam@167: % cannam@167: % We open the .toc file for writing here instead of at @setfilename (or cannam@167: % any other fixed time) so that @contents can be anywhere in the document. cannam@167: % But if #1 is `omit', then we don't do anything. This is used for the cannam@167: % table of contents chapter openings themselves. cannam@167: % cannam@167: \newif\iftocfileopened cannam@167: \def\omitkeyword{omit}% cannam@167: % cannam@167: \def\writetocentry#1#2#3{% cannam@167: \edef\writetoctype{#1}% cannam@167: \ifx\writetoctype\omitkeyword \else cannam@167: \iftocfileopened\else cannam@167: \immediate\openout\tocfile = \jobname.toc cannam@167: \global\tocfileopenedtrue cannam@167: \fi cannam@167: % cannam@167: \iflinks cannam@167: {\atdummies cannam@167: \edef\temp{% cannam@167: \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% cannam@167: \temp cannam@167: }% cannam@167: \fi cannam@167: \fi cannam@167: % cannam@167: % Tell \shipout to create a pdf destination on each page, if we're cannam@167: % writing pdf. These are used in the table of contents. We can't cannam@167: % just write one on every page because the title pages are numbered cannam@167: % 1 and 2 (the page numbers aren't printed), and so are the first cannam@167: % two pages of the document. Thus, we'd have two destinations named cannam@167: % `1', and two named `2'. cannam@167: \ifpdf \global\pdfmakepagedesttrue \fi cannam@167: } cannam@167: cannam@167: cannam@167: % These characters do not print properly in the Computer Modern roman cannam@167: % fonts, so we must take special care. This is more or less redundant cannam@167: % with the Texinfo input format setup at the end of this file. cannam@167: % cannam@167: \def\activecatcodes{% cannam@167: \catcode`\"=\active cannam@167: \catcode`\$=\active cannam@167: \catcode`\<=\active cannam@167: \catcode`\>=\active cannam@167: \catcode`\\=\active cannam@167: \catcode`\^=\active cannam@167: \catcode`\_=\active cannam@167: \catcode`\|=\active cannam@167: \catcode`\~=\active cannam@167: } cannam@167: cannam@167: cannam@167: % Read the toc file, which is essentially Texinfo input. cannam@167: \def\readtocfile{% cannam@167: \setupdatafile cannam@167: \activecatcodes cannam@167: \input \tocreadfilename cannam@167: } cannam@167: cannam@167: \newskip\contentsrightmargin \contentsrightmargin=1in cannam@167: \newcount\savepageno cannam@167: \newcount\lastnegativepageno \lastnegativepageno = -1 cannam@167: cannam@167: % Prepare to read what we've written to \tocfile. cannam@167: % cannam@167: \def\startcontents#1{% cannam@167: % If @setchapternewpage on, and @headings double, the contents should cannam@167: % start on an odd page, unlike chapters. Thus, we maintain cannam@167: % \contentsalignmacro in parallel with \pagealignmacro. cannam@167: % From: Torbjorn Granlund cannam@167: \contentsalignmacro cannam@167: \immediate\closeout\tocfile cannam@167: % cannam@167: % Don't need to put `Contents' or `Short Contents' in the headline. cannam@167: % It is abundantly clear what they are. cannam@167: \chapmacro{#1}{Yomitfromtoc}{}% cannam@167: % cannam@167: \savepageno = \pageno cannam@167: \begingroup % Set up to handle contents files properly. cannam@167: \raggedbottom % Worry more about breakpoints than the bottom. cannam@167: \advance\hsize by -\contentsrightmargin % Don't use the full line length. cannam@167: % cannam@167: % Roman numerals for page numbers. cannam@167: \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi cannam@167: } cannam@167: cannam@167: % redefined for the two-volume lispref. We always output on cannam@167: % \jobname.toc even if this is redefined. cannam@167: % cannam@167: \def\tocreadfilename{\jobname.toc} cannam@167: cannam@167: % Normal (long) toc. cannam@167: % cannam@167: \def\contents{% cannam@167: \startcontents{\putwordTOC}% cannam@167: \openin 1 \tocreadfilename\space cannam@167: \ifeof 1 \else cannam@167: \readtocfile cannam@167: \fi cannam@167: \vfill \eject cannam@167: \contentsalignmacro % in case @setchapternewpage odd is in effect cannam@167: \ifeof 1 \else cannam@167: \pdfmakeoutlines cannam@167: \fi cannam@167: \closein 1 cannam@167: \endgroup cannam@167: \lastnegativepageno = \pageno cannam@167: \global\pageno = \savepageno cannam@167: } cannam@167: cannam@167: % And just the chapters. cannam@167: \def\summarycontents{% cannam@167: \startcontents{\putwordShortTOC}% cannam@167: % cannam@167: \let\partentry = \shortpartentry cannam@167: \let\numchapentry = \shortchapentry cannam@167: \let\appentry = \shortchapentry cannam@167: \let\unnchapentry = \shortunnchapentry cannam@167: % We want a true roman here for the page numbers. cannam@167: \secfonts cannam@167: \let\rm=\shortcontrm \let\bf=\shortcontbf cannam@167: \let\sl=\shortcontsl \let\tt=\shortconttt cannam@167: \rm cannam@167: \hyphenpenalty = 10000 cannam@167: \advance\baselineskip by 1pt % Open it up a little. cannam@167: \def\numsecentry##1##2##3##4{} cannam@167: \let\appsecentry = \numsecentry cannam@167: \let\unnsecentry = \numsecentry cannam@167: \let\numsubsecentry = \numsecentry cannam@167: \let\appsubsecentry = \numsecentry cannam@167: \let\unnsubsecentry = \numsecentry cannam@167: \let\numsubsubsecentry = \numsecentry cannam@167: \let\appsubsubsecentry = \numsecentry cannam@167: \let\unnsubsubsecentry = \numsecentry cannam@167: \openin 1 \tocreadfilename\space cannam@167: \ifeof 1 \else cannam@167: \readtocfile cannam@167: \fi cannam@167: \closein 1 cannam@167: \vfill \eject cannam@167: \contentsalignmacro % in case @setchapternewpage odd is in effect cannam@167: \endgroup cannam@167: \lastnegativepageno = \pageno cannam@167: \global\pageno = \savepageno cannam@167: } cannam@167: \let\shortcontents = \summarycontents cannam@167: cannam@167: % Typeset the label for a chapter or appendix for the short contents. cannam@167: % The arg is, e.g., `A' for an appendix, or `3' for a chapter. cannam@167: % cannam@167: \def\shortchaplabel#1{% cannam@167: % This space should be enough, since a single number is .5em, and the cannam@167: % widest letter (M) is 1em, at least in the Computer Modern fonts. cannam@167: % But use \hss just in case. cannam@167: % (This space doesn't include the extra space that gets added after cannam@167: % the label; that gets put in by \shortchapentry above.) cannam@167: % cannam@167: % We'd like to right-justify chapter numbers, but that looks strange cannam@167: % with appendix letters. And right-justifying numbers and cannam@167: % left-justifying letters looks strange when there is less than 10 cannam@167: % chapters. Have to read the whole toc once to know how many chapters cannam@167: % there are before deciding ... cannam@167: \hbox to 1em{#1\hss}% cannam@167: } cannam@167: cannam@167: % These macros generate individual entries in the table of contents. cannam@167: % The first argument is the chapter or section name. cannam@167: % The last argument is the page number. cannam@167: % The arguments in between are the chapter number, section number, ... cannam@167: cannam@167: % Parts, in the main contents. Replace the part number, which doesn't cannam@167: % exist, with an empty box. Let's hope all the numbers have the same width. cannam@167: % Also ignore the page number, which is conventionally not printed. cannam@167: \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}} cannam@167: \def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}} cannam@167: % cannam@167: % Parts, in the short toc. cannam@167: \def\shortpartentry#1#2#3#4{% cannam@167: \penalty-300 cannam@167: \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip cannam@167: \shortchapentry{{\bf #1}}{\numeralbox}{}{}% cannam@167: } cannam@167: cannam@167: % Chapters, in the main contents. cannam@167: \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} cannam@167: % cannam@167: % Chapters, in the short toc. cannam@167: % See comments in \dochapentry re vbox and related settings. cannam@167: \def\shortchapentry#1#2#3#4{% cannam@167: \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% cannam@167: } cannam@167: cannam@167: % Appendices, in the main contents. cannam@167: % Need the word Appendix, and a fixed-size box. cannam@167: % cannam@167: \def\appendixbox#1{% cannam@167: % We use M since it's probably the widest letter. cannam@167: \setbox0 = \hbox{\putwordAppendix{} M}% cannam@167: \hbox to \wd0{\putwordAppendix{} #1\hss}} cannam@167: % cannam@167: \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} cannam@167: cannam@167: % Unnumbered chapters. cannam@167: \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} cannam@167: \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} cannam@167: cannam@167: % Sections. cannam@167: \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} cannam@167: \let\appsecentry=\numsecentry cannam@167: \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} cannam@167: cannam@167: % Subsections. cannam@167: \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} cannam@167: \let\appsubsecentry=\numsubsecentry cannam@167: \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} cannam@167: cannam@167: % And subsubsections. cannam@167: \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} cannam@167: \let\appsubsubsecentry=\numsubsubsecentry cannam@167: \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} cannam@167: cannam@167: % This parameter controls the indentation of the various levels. cannam@167: % Same as \defaultparindent. cannam@167: \newdimen\tocindent \tocindent = 15pt cannam@167: cannam@167: % Now for the actual typesetting. In all these, #1 is the text and #2 is the cannam@167: % page number. cannam@167: % cannam@167: % If the toc has to be broken over pages, we want it to be at chapters cannam@167: % if at all possible; hence the \penalty. cannam@167: \def\dochapentry#1#2{% cannam@167: \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip cannam@167: \begingroup cannam@167: \chapentryfonts cannam@167: \tocentry{#1}{\dopageno\bgroup#2\egroup}% cannam@167: \endgroup cannam@167: \nobreak\vskip .25\baselineskip plus.1\baselineskip cannam@167: } cannam@167: cannam@167: \def\dosecentry#1#2{\begingroup cannam@167: \secentryfonts \leftskip=\tocindent cannam@167: \tocentry{#1}{\dopageno\bgroup#2\egroup}% cannam@167: \endgroup} cannam@167: cannam@167: \def\dosubsecentry#1#2{\begingroup cannam@167: \subsecentryfonts \leftskip=2\tocindent cannam@167: \tocentry{#1}{\dopageno\bgroup#2\egroup}% cannam@167: \endgroup} cannam@167: cannam@167: \def\dosubsubsecentry#1#2{\begingroup cannam@167: \subsubsecentryfonts \leftskip=3\tocindent cannam@167: \tocentry{#1}{\dopageno\bgroup#2\egroup}% cannam@167: \endgroup} cannam@167: cannam@167: % We use the same \entry macro as for the index entries. cannam@167: \let\tocentry = \entry cannam@167: cannam@167: % Space between chapter (or whatever) number and the title. cannam@167: \def\labelspace{\hskip1em \relax} cannam@167: cannam@167: \def\dopageno#1{{\rm #1}} cannam@167: \def\doshortpageno#1{{\rm #1}} cannam@167: cannam@167: \def\chapentryfonts{\secfonts \rm} cannam@167: \def\secentryfonts{\textfonts} cannam@167: \def\subsecentryfonts{\textfonts} cannam@167: \def\subsubsecentryfonts{\textfonts} cannam@167: cannam@167: cannam@167: \message{environments,} cannam@167: % @foo ... @end foo. cannam@167: cannam@167: % @tex ... @end tex escapes into raw TeX temporarily. cannam@167: % One exception: @ is still an escape character, so that @end tex works. cannam@167: % But \@ or @@ will get a plain @ character. cannam@167: cannam@167: \envdef\tex{% cannam@167: \setupmarkupstyle{tex}% cannam@167: \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 cannam@167: \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 cannam@167: \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie cannam@167: \catcode `\%=14 cannam@167: \catcode `\+=\other cannam@167: \catcode `\"=\other cannam@167: \catcode `\|=\other cannam@167: \catcode `\<=\other cannam@167: \catcode `\>=\other cannam@167: \catcode`\`=\other cannam@167: \catcode`\'=\other cannam@167: \escapechar=`\\ cannam@167: % cannam@167: % ' is active in math mode (mathcode"8000). So reset it, and all our cannam@167: % other math active characters (just in case), to plain's definitions. cannam@167: \mathactive cannam@167: % cannam@167: \let\b=\ptexb cannam@167: \let\bullet=\ptexbullet cannam@167: \let\c=\ptexc cannam@167: \let\,=\ptexcomma cannam@167: \let\.=\ptexdot cannam@167: \let\dots=\ptexdots cannam@167: \let\equiv=\ptexequiv cannam@167: \let\!=\ptexexclam cannam@167: \let\i=\ptexi cannam@167: \let\indent=\ptexindent cannam@167: \let\noindent=\ptexnoindent cannam@167: \let\{=\ptexlbrace cannam@167: \let\+=\tabalign cannam@167: \let\}=\ptexrbrace cannam@167: \let\/=\ptexslash cannam@167: \let\*=\ptexstar cannam@167: \let\t=\ptext cannam@167: \expandafter \let\csname top\endcsname=\ptextop % outer cannam@167: \let\frenchspacing=\plainfrenchspacing cannam@167: % cannam@167: \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% cannam@167: \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% cannam@167: \def\@{@}% cannam@167: } cannam@167: % There is no need to define \Etex. cannam@167: cannam@167: % Define @lisp ... @end lisp. cannam@167: % @lisp environment forms a group so it can rebind things, cannam@167: % including the definition of @end lisp (which normally is erroneous). cannam@167: cannam@167: % Amount to narrow the margins by for @lisp. cannam@167: \newskip\lispnarrowing \lispnarrowing=0.4in cannam@167: cannam@167: % This is the definition that ^^M gets inside @lisp, @example, and other cannam@167: % such environments. \null is better than a space, since it doesn't cannam@167: % have any width. cannam@167: \def\lisppar{\null\endgraf} cannam@167: cannam@167: % This space is always present above and below environments. cannam@167: \newskip\envskipamount \envskipamount = 0pt cannam@167: cannam@167: % Make spacing and below environment symmetrical. We use \parskip here cannam@167: % to help in doing that, since in @example-like environments \parskip cannam@167: % is reset to zero; thus the \afterenvbreak inserts no space -- but the cannam@167: % start of the next paragraph will insert \parskip. cannam@167: % cannam@167: \def\aboveenvbreak{{% cannam@167: % =10000 instead of <10000 because of a special case in \itemzzz and cannam@167: % \sectionheading, q.v. cannam@167: \ifnum \lastpenalty=10000 \else cannam@167: \advance\envskipamount by \parskip cannam@167: \endgraf cannam@167: \ifdim\lastskip<\envskipamount cannam@167: \removelastskip cannam@167: % it's not a good place to break if the last penalty was \nobreak cannam@167: % or better ... cannam@167: \ifnum\lastpenalty<10000 \penalty-50 \fi cannam@167: \vskip\envskipamount cannam@167: \fi cannam@167: \fi cannam@167: }} cannam@167: cannam@167: \let\afterenvbreak = \aboveenvbreak cannam@167: cannam@167: % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will cannam@167: % also clear it, so that its embedded environments do the narrowing again. cannam@167: \let\nonarrowing=\relax cannam@167: cannam@167: % @cartouche ... @end cartouche: draw rectangle w/rounded corners around cannam@167: % environment contents. cannam@167: \font\circle=lcircle10 cannam@167: \newdimen\circthick cannam@167: \newdimen\cartouter\newdimen\cartinner cannam@167: \newskip\normbskip\newskip\normpskip\newskip\normlskip cannam@167: \circthick=\fontdimen8\circle cannam@167: % cannam@167: \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth cannam@167: \def\ctr{{\hskip 6pt\circle\char'010}} cannam@167: \def\cbl{{\circle\char'012\hskip -6pt}} cannam@167: \def\cbr{{\hskip 6pt\circle\char'011}} cannam@167: \def\carttop{\hbox to \cartouter{\hskip\lskip cannam@167: \ctl\leaders\hrule height\circthick\hfil\ctr cannam@167: \hskip\rskip}} cannam@167: \def\cartbot{\hbox to \cartouter{\hskip\lskip cannam@167: \cbl\leaders\hrule height\circthick\hfil\cbr cannam@167: \hskip\rskip}} cannam@167: % cannam@167: \newskip\lskip\newskip\rskip cannam@167: cannam@167: \envdef\cartouche{% cannam@167: \ifhmode\par\fi % can't be in the midst of a paragraph. cannam@167: \startsavinginserts cannam@167: \lskip=\leftskip \rskip=\rightskip cannam@167: \leftskip=0pt\rightskip=0pt % we want these *outside*. cannam@167: \cartinner=\hsize \advance\cartinner by-\lskip cannam@167: \advance\cartinner by-\rskip cannam@167: \cartouter=\hsize cannam@167: \advance\cartouter by 18.4pt % allow for 3pt kerns on either cannam@167: % side, and for 6pt waste from cannam@167: % each corner char, and rule thickness cannam@167: \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip cannam@167: % Flag to tell @lisp, etc., not to narrow margin. cannam@167: \let\nonarrowing = t% cannam@167: % cannam@167: % If this cartouche directly follows a sectioning command, we need the cannam@167: % \parskip glue (backspaced over by default) or the cartouche can cannam@167: % collide with the section heading. cannam@167: \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi cannam@167: % cannam@167: \vbox\bgroup cannam@167: \baselineskip=0pt\parskip=0pt\lineskip=0pt cannam@167: \carttop cannam@167: \hbox\bgroup cannam@167: \hskip\lskip cannam@167: \vrule\kern3pt cannam@167: \vbox\bgroup cannam@167: \kern3pt cannam@167: \hsize=\cartinner cannam@167: \baselineskip=\normbskip cannam@167: \lineskip=\normlskip cannam@167: \parskip=\normpskip cannam@167: \vskip -\parskip cannam@167: \comment % For explanation, see the end of def\group. cannam@167: } cannam@167: \def\Ecartouche{% cannam@167: \ifhmode\par\fi cannam@167: \kern3pt cannam@167: \egroup cannam@167: \kern3pt\vrule cannam@167: \hskip\rskip cannam@167: \egroup cannam@167: \cartbot cannam@167: \egroup cannam@167: \checkinserts cannam@167: } cannam@167: cannam@167: cannam@167: % This macro is called at the beginning of all the @example variants, cannam@167: % inside a group. cannam@167: \newdimen\nonfillparindent cannam@167: \def\nonfillstart{% cannam@167: \aboveenvbreak cannam@167: \hfuzz = 12pt % Don't be fussy cannam@167: \sepspaces % Make spaces be word-separators rather than space tokens. cannam@167: \let\par = \lisppar % don't ignore blank lines cannam@167: \obeylines % each line of input is a line of output cannam@167: \parskip = 0pt cannam@167: % Turn off paragraph indentation but redefine \indent to emulate cannam@167: % the normal \indent. cannam@167: \nonfillparindent=\parindent cannam@167: \parindent = 0pt cannam@167: \let\indent\nonfillindent cannam@167: % cannam@167: \emergencystretch = 0pt % don't try to avoid overfull boxes cannam@167: \ifx\nonarrowing\relax cannam@167: \advance \leftskip by \lispnarrowing cannam@167: \exdentamount=\lispnarrowing cannam@167: \else cannam@167: \let\nonarrowing = \relax cannam@167: \fi cannam@167: \let\exdent=\nofillexdent cannam@167: } cannam@167: cannam@167: \begingroup cannam@167: \obeyspaces cannam@167: % We want to swallow spaces (but not other tokens) after the fake cannam@167: % @indent in our nonfill-environments, where spaces are normally cannam@167: % active and set to @tie, resulting in them not being ignored after cannam@167: % @indent. cannam@167: \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}% cannam@167: \gdef\nonfillindentcheck{% cannam@167: \ifx\temp % cannam@167: \expandafter\nonfillindentgobble% cannam@167: \else% cannam@167: \leavevmode\nonfillindentbox% cannam@167: \fi% cannam@167: }% cannam@167: \endgroup cannam@167: \def\nonfillindentgobble#1{\nonfillindent} cannam@167: \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}} cannam@167: cannam@167: % If you want all examples etc. small: @set dispenvsize small. cannam@167: % If you want even small examples the full size: @set dispenvsize nosmall. cannam@167: % This affects the following displayed environments: cannam@167: % @example, @display, @format, @lisp cannam@167: % cannam@167: \def\smallword{small} cannam@167: \def\nosmallword{nosmall} cannam@167: \let\SETdispenvsize\relax cannam@167: \def\setnormaldispenv{% cannam@167: \ifx\SETdispenvsize\smallword cannam@167: % end paragraph for sake of leading, in case document has no blank cannam@167: % line. This is redundant with what happens in \aboveenvbreak, but cannam@167: % we need to do it before changing the fonts, and it's inconvenient cannam@167: % to change the fonts afterward. cannam@167: \ifnum \lastpenalty=10000 \else \endgraf \fi cannam@167: \smallexamplefonts \rm cannam@167: \fi cannam@167: } cannam@167: \def\setsmalldispenv{% cannam@167: \ifx\SETdispenvsize\nosmallword cannam@167: \else cannam@167: \ifnum \lastpenalty=10000 \else \endgraf \fi cannam@167: \smallexamplefonts \rm cannam@167: \fi cannam@167: } cannam@167: cannam@167: % We often define two environments, @foo and @smallfoo. cannam@167: % Let's do it in one command. #1 is the env name, #2 the definition. cannam@167: \def\makedispenvdef#1#2{% cannam@167: \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}% cannam@167: \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}% cannam@167: \expandafter\let\csname E#1\endcsname \afterenvbreak cannam@167: \expandafter\let\csname Esmall#1\endcsname \afterenvbreak cannam@167: } cannam@167: cannam@167: % Define two environment synonyms (#1 and #2) for an environment. cannam@167: \def\maketwodispenvdef#1#2#3{% cannam@167: \makedispenvdef{#1}{#3}% cannam@167: \makedispenvdef{#2}{#3}% cannam@167: } cannam@167: % cannam@167: % @lisp: indented, narrowed, typewriter font; cannam@167: % @example: same as @lisp. cannam@167: % cannam@167: % @smallexample and @smalllisp: use smaller fonts. cannam@167: % Originally contributed by Pavel@xerox. cannam@167: % cannam@167: \maketwodispenvdef{lisp}{example}{% cannam@167: \nonfillstart cannam@167: \tt\setupmarkupstyle{example}% cannam@167: \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. cannam@167: \gobble % eat return cannam@167: } cannam@167: % @display/@smalldisplay: same as @lisp except keep current font. cannam@167: % cannam@167: \makedispenvdef{display}{% cannam@167: \nonfillstart cannam@167: \gobble cannam@167: } cannam@167: cannam@167: % @format/@smallformat: same as @display except don't narrow margins. cannam@167: % cannam@167: \makedispenvdef{format}{% cannam@167: \let\nonarrowing = t% cannam@167: \nonfillstart cannam@167: \gobble cannam@167: } cannam@167: cannam@167: % @flushleft: same as @format, but doesn't obey \SETdispenvsize. cannam@167: \envdef\flushleft{% cannam@167: \let\nonarrowing = t% cannam@167: \nonfillstart cannam@167: \gobble cannam@167: } cannam@167: \let\Eflushleft = \afterenvbreak cannam@167: cannam@167: % @flushright. cannam@167: % cannam@167: \envdef\flushright{% cannam@167: \let\nonarrowing = t% cannam@167: \nonfillstart cannam@167: \advance\leftskip by 0pt plus 1fill\relax cannam@167: \gobble cannam@167: } cannam@167: \let\Eflushright = \afterenvbreak cannam@167: cannam@167: cannam@167: % @raggedright does more-or-less normal line breaking but no right cannam@167: % justification. From plain.tex. cannam@167: \envdef\raggedright{% cannam@167: \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax cannam@167: } cannam@167: \let\Eraggedright\par cannam@167: cannam@167: \envdef\raggedleft{% cannam@167: \parindent=0pt \leftskip0pt plus2em cannam@167: \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt cannam@167: \hbadness=10000 % Last line will usually be underfull, so turn off cannam@167: % badness reporting. cannam@167: } cannam@167: \let\Eraggedleft\par cannam@167: cannam@167: \envdef\raggedcenter{% cannam@167: \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em cannam@167: \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt cannam@167: \hbadness=10000 % Last line will usually be underfull, so turn off cannam@167: % badness reporting. cannam@167: } cannam@167: \let\Eraggedcenter\par cannam@167: cannam@167: cannam@167: % @quotation does normal linebreaking (hence we can't use \nonfillstart) cannam@167: % and narrows the margins. We keep \parskip nonzero in general, since cannam@167: % we're doing normal filling. So, when using \aboveenvbreak and cannam@167: % \afterenvbreak, temporarily make \parskip 0. cannam@167: % cannam@167: \makedispenvdef{quotation}{\quotationstart} cannam@167: % cannam@167: \def\quotationstart{% cannam@167: \indentedblockstart % same as \indentedblock, but increase right margin too. cannam@167: \ifx\nonarrowing\relax cannam@167: \advance\rightskip by \lispnarrowing cannam@167: \fi cannam@167: \parsearg\quotationlabel cannam@167: } cannam@167: cannam@167: % We have retained a nonzero parskip for the environment, since we're cannam@167: % doing normal filling. cannam@167: % cannam@167: \def\Equotation{% cannam@167: \par cannam@167: \ifx\quotationauthor\thisisundefined\else cannam@167: % indent a bit. cannam@167: \leftline{\kern 2\leftskip \sl ---\quotationauthor}% cannam@167: \fi cannam@167: {\parskip=0pt \afterenvbreak}% cannam@167: } cannam@167: \def\Esmallquotation{\Equotation} cannam@167: cannam@167: % If we're given an argument, typeset it in bold with a colon after. cannam@167: \def\quotationlabel#1{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\empty \else cannam@167: {\bf #1: }% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @indentedblock is like @quotation, but indents only on the left and cannam@167: % has no optional argument. cannam@167: % cannam@167: \makedispenvdef{indentedblock}{\indentedblockstart} cannam@167: % cannam@167: \def\indentedblockstart{% cannam@167: {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip cannam@167: \parindent=0pt cannam@167: % cannam@167: % @cartouche defines \nonarrowing to inhibit narrowing at next level down. cannam@167: \ifx\nonarrowing\relax cannam@167: \advance\leftskip by \lispnarrowing cannam@167: \exdentamount = \lispnarrowing cannam@167: \else cannam@167: \let\nonarrowing = \relax cannam@167: \fi cannam@167: } cannam@167: cannam@167: % Keep a nonzero parskip for the environment, since we're doing normal filling. cannam@167: % cannam@167: \def\Eindentedblock{% cannam@167: \par cannam@167: {\parskip=0pt \afterenvbreak}% cannam@167: } cannam@167: \def\Esmallindentedblock{\Eindentedblock} cannam@167: cannam@167: cannam@167: % LaTeX-like @verbatim...@end verbatim and @verb{...} cannam@167: % If we want to allow any as delimiter, cannam@167: % we need the curly braces so that makeinfo sees the @verb command, eg: cannam@167: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org cannam@167: % cannam@167: % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. cannam@167: % cannam@167: % [Knuth] p.344; only we need to do the other characters Texinfo sets cannam@167: % active too. Otherwise, they get lost as the first character on a cannam@167: % verbatim line. cannam@167: \def\dospecials{% cannam@167: \do\ \do\\\do\{\do\}\do\$\do\&% cannam@167: \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% cannam@167: \do\<\do\>\do\|\do\@\do+\do\"% cannam@167: % Don't do the quotes -- if we do, @set txicodequoteundirected and cannam@167: % @set txicodequotebacktick will not have effect on @verb and cannam@167: % @verbatim, and ?` and !` ligatures won't get disabled. cannam@167: %\do\`\do\'% cannam@167: } cannam@167: % cannam@167: % [Knuth] p. 380 cannam@167: \def\uncatcodespecials{% cannam@167: \def\do##1{\catcode`##1=\other}\dospecials} cannam@167: % cannam@167: % Setup for the @verb command. cannam@167: % cannam@167: % Eight spaces for a tab cannam@167: \begingroup cannam@167: \catcode`\^^I=\active cannam@167: \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} cannam@167: \endgroup cannam@167: % cannam@167: \def\setupverb{% cannam@167: \tt % easiest (and conventionally used) font for verbatim cannam@167: \def\par{\leavevmode\endgraf}% cannam@167: \setupmarkupstyle{verb}% cannam@167: \tabeightspaces cannam@167: % Respect line breaks, cannam@167: % print special symbols as themselves, and cannam@167: % make each space count cannam@167: % must do in this order: cannam@167: \obeylines \uncatcodespecials \sepspaces cannam@167: } cannam@167: cannam@167: % Setup for the @verbatim environment cannam@167: % cannam@167: % Real tab expansion. cannam@167: \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount cannam@167: % cannam@167: % We typeset each line of the verbatim in an \hbox, so we can handle cannam@167: % tabs. The \global is in case the verbatim line starts with an accent, cannam@167: % or some other command that starts with a begin-group. Otherwise, the cannam@167: % entire \verbbox would disappear at the corresponding end-group, before cannam@167: % it is typeset. Meanwhile, we can't have nested verbatim commands cannam@167: % (can we?), so the \global won't be overwriting itself. cannam@167: \newbox\verbbox cannam@167: \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup} cannam@167: % cannam@167: \begingroup cannam@167: \catcode`\^^I=\active cannam@167: \gdef\tabexpand{% cannam@167: \catcode`\^^I=\active cannam@167: \def^^I{\leavevmode\egroup cannam@167: \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab cannam@167: \divide\dimen\verbbox by\tabw cannam@167: \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw cannam@167: \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw cannam@167: \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox cannam@167: }% cannam@167: } cannam@167: \endgroup cannam@167: cannam@167: % start the verbatim environment. cannam@167: \def\setupverbatim{% cannam@167: \let\nonarrowing = t% cannam@167: \nonfillstart cannam@167: \tt % easiest (and conventionally used) font for verbatim cannam@167: % The \leavevmode here is for blank lines. Otherwise, we would cannam@167: % never \starttabox and the \egroup would end verbatim mode. cannam@167: \def\par{\leavevmode\egroup\box\verbbox\endgraf}% cannam@167: \tabexpand cannam@167: \setupmarkupstyle{verbatim}% cannam@167: % Respect line breaks, cannam@167: % print special symbols as themselves, and cannam@167: % make each space count. cannam@167: % Must do in this order: cannam@167: \obeylines \uncatcodespecials \sepspaces cannam@167: \everypar{\starttabbox}% cannam@167: } cannam@167: cannam@167: % Do the @verb magic: verbatim text is quoted by unique cannam@167: % delimiter characters. Before first delimiter expect a cannam@167: % right brace, after last delimiter expect closing brace: cannam@167: % cannam@167: % \def\doverb'{'#1'}'{#1} cannam@167: % cannam@167: % [Knuth] p. 382; only eat outer {} cannam@167: \begingroup cannam@167: \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other cannam@167: \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] cannam@167: \endgroup cannam@167: % cannam@167: \def\verb{\begingroup\setupverb\doverb} cannam@167: % cannam@167: % cannam@167: % Do the @verbatim magic: define the macro \doverbatim so that cannam@167: % the (first) argument ends when '@end verbatim' is reached, ie: cannam@167: % cannam@167: % \def\doverbatim#1@end verbatim{#1} cannam@167: % cannam@167: % For Texinfo it's a lot easier than for LaTeX, cannam@167: % because texinfo's \verbatim doesn't stop at '\end{verbatim}': cannam@167: % we need not redefine '\', '{' and '}'. cannam@167: % cannam@167: % Inspired by LaTeX's verbatim command set [latex.ltx] cannam@167: % cannam@167: \begingroup cannam@167: \catcode`\ =\active cannam@167: \obeylines % cannam@167: % ignore everything up to the first ^^M, that's the newline at the end cannam@167: % of the @verbatim input line itself. Otherwise we get an extra blank cannam@167: % line in the output. cannam@167: \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% cannam@167: % We really want {...\end verbatim} in the body of the macro, but cannam@167: % without the active space; thus we have to use \xdef and \gobble. cannam@167: \endgroup cannam@167: % cannam@167: \envdef\verbatim{% cannam@167: \setupverbatim\doverbatim cannam@167: } cannam@167: \let\Everbatim = \afterenvbreak cannam@167: cannam@167: cannam@167: % @verbatiminclude FILE - insert text of file in verbatim environment. cannam@167: % cannam@167: \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} cannam@167: % cannam@167: \def\doverbatiminclude#1{% cannam@167: {% cannam@167: \makevalueexpandable cannam@167: \setupverbatim cannam@167: \indexnofonts % Allow `@@' and other weird things in file names. cannam@167: \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% cannam@167: \input #1 cannam@167: \afterenvbreak cannam@167: }% cannam@167: } cannam@167: cannam@167: % @copying ... @end copying. cannam@167: % Save the text away for @insertcopying later. cannam@167: % cannam@167: % We save the uninterpreted tokens, rather than creating a box. cannam@167: % Saving the text in a box would be much easier, but then all the cannam@167: % typesetting commands (@smallbook, font changes, etc.) have to be done cannam@167: % beforehand -- and a) we want @copying to be done first in the source cannam@167: % file; b) letting users define the frontmatter in as flexible order as cannam@167: % possible is very desirable. cannam@167: % cannam@167: \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} cannam@167: \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} cannam@167: % cannam@167: \def\insertcopying{% cannam@167: \begingroup cannam@167: \parindent = 0pt % paragraph indentation looks wrong on title page cannam@167: \scanexp\copyingtext cannam@167: \endgroup cannam@167: } cannam@167: cannam@167: cannam@167: \message{defuns,} cannam@167: % @defun etc. cannam@167: cannam@167: \newskip\defbodyindent \defbodyindent=.4in cannam@167: \newskip\defargsindent \defargsindent=50pt cannam@167: \newskip\deflastargmargin \deflastargmargin=18pt cannam@167: \newcount\defunpenalty cannam@167: cannam@167: % Start the processing of @deffn: cannam@167: \def\startdefun{% cannam@167: \ifnum\lastpenalty<10000 cannam@167: \medbreak cannam@167: \defunpenalty=10003 % Will keep this @deffn together with the cannam@167: % following @def command, see below. cannam@167: \else cannam@167: % If there are two @def commands in a row, we'll have a \nobreak, cannam@167: % which is there to keep the function description together with its cannam@167: % header. But if there's nothing but headers, we need to allow a cannam@167: % break somewhere. Check specifically for penalty 10002, inserted cannam@167: % by \printdefunline, instead of 10000, since the sectioning cannam@167: % commands also insert a nobreak penalty, and we don't want to allow cannam@167: % a break between a section heading and a defun. cannam@167: % cannam@167: % As a further refinement, we avoid "club" headers by signalling cannam@167: % with penalty of 10003 after the very first @deffn in the cannam@167: % sequence (see above), and penalty of 10002 after any following cannam@167: % @def command. cannam@167: \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi cannam@167: % cannam@167: % Similarly, after a section heading, do not allow a break. cannam@167: % But do insert the glue. cannam@167: \medskip % preceded by discardable penalty, so not a breakpoint cannam@167: \fi cannam@167: % cannam@167: \parindent=0in cannam@167: \advance\leftskip by \defbodyindent cannam@167: \exdentamount=\defbodyindent cannam@167: } cannam@167: cannam@167: \def\dodefunx#1{% cannam@167: % First, check whether we are in the right environment: cannam@167: \checkenv#1% cannam@167: % cannam@167: % As above, allow line break if we have multiple x headers in a row. cannam@167: % It's not a great place, though. cannam@167: \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi cannam@167: % cannam@167: % And now, it's time to reuse the body of the original defun: cannam@167: \expandafter\gobbledefun#1% cannam@167: } cannam@167: \def\gobbledefun#1\startdefun{} cannam@167: cannam@167: % \printdefunline \deffnheader{text} cannam@167: % cannam@167: \def\printdefunline#1#2{% cannam@167: \begingroup cannam@167: % call \deffnheader: cannam@167: #1#2 \endheader cannam@167: % common ending: cannam@167: \interlinepenalty = 10000 cannam@167: \advance\rightskip by 0pt plus 1fil\relax cannam@167: \endgraf cannam@167: \nobreak\vskip -\parskip cannam@167: \penalty\defunpenalty % signal to \startdefun and \dodefunx cannam@167: % Some of the @defun-type tags do not enable magic parentheses, cannam@167: % rendering the following check redundant. But we don't optimize. cannam@167: \checkparencounts cannam@167: \endgroup cannam@167: } cannam@167: cannam@167: \def\Edefun{\endgraf\medbreak} cannam@167: cannam@167: % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; cannam@167: % the only thing remaining is to define \deffnheader. cannam@167: % cannam@167: \def\makedefun#1{% cannam@167: \expandafter\let\csname E#1\endcsname = \Edefun cannam@167: \edef\temp{\noexpand\domakedefun cannam@167: \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% cannam@167: \temp cannam@167: } cannam@167: cannam@167: % \domakedefun \deffn \deffnx \deffnheader cannam@167: % cannam@167: % Define \deffn and \deffnx, without parameters. cannam@167: % \deffnheader has to be defined explicitly. cannam@167: % cannam@167: \def\domakedefun#1#2#3{% cannam@167: \envdef#1{% cannam@167: \startdefun cannam@167: \doingtypefnfalse % distinguish typed functions from all else cannam@167: \parseargusing\activeparens{\printdefunline#3}% cannam@167: }% cannam@167: \def#2{\dodefunx#1}% cannam@167: \def#3% cannam@167: } cannam@167: cannam@167: \newif\ifdoingtypefn % doing typed function? cannam@167: \newif\ifrettypeownline % typeset return type on its own line? cannam@167: cannam@167: % @deftypefnnewline on|off says whether the return type of typed functions cannam@167: % are printed on their own line. This affects @deftypefn, @deftypefun, cannam@167: % @deftypeop, and @deftypemethod. cannam@167: % cannam@167: \parseargdef\deftypefnnewline{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\onword cannam@167: \expandafter\let\csname SETtxideftypefnnl\endcsname cannam@167: = \empty cannam@167: \else\ifx\temp\offword cannam@167: \expandafter\let\csname SETtxideftypefnnl\endcsname cannam@167: = \relax cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @txideftypefnnl value `\temp', cannam@167: must be on|off}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % Untyped functions: cannam@167: cannam@167: % @deffn category name args cannam@167: \makedefun{deffn}{\deffngeneral{}} cannam@167: cannam@167: % @deffn category class name args cannam@167: \makedefun{defop}#1 {\defopon{#1\ \putwordon}} cannam@167: cannam@167: % \defopon {category on}class name args cannam@167: \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } cannam@167: cannam@167: % \deffngeneral {subind}category name args cannam@167: % cannam@167: \def\deffngeneral#1#2 #3 #4\endheader{% cannam@167: % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. cannam@167: \dosubind{fn}{\code{#3}}{#1}% cannam@167: \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% cannam@167: } cannam@167: cannam@167: % Typed functions: cannam@167: cannam@167: % @deftypefn category type name args cannam@167: \makedefun{deftypefn}{\deftypefngeneral{}} cannam@167: cannam@167: % @deftypeop category class type name args cannam@167: \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} cannam@167: cannam@167: % \deftypeopon {category on}class type name args cannam@167: \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } cannam@167: cannam@167: % \deftypefngeneral {subind}category type name args cannam@167: % cannam@167: \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% cannam@167: \dosubind{fn}{\code{#4}}{#1}% cannam@167: \doingtypefntrue cannam@167: \defname{#2}{#3}{#4}\defunargs{#5\unskip}% cannam@167: } cannam@167: cannam@167: % Typed variables: cannam@167: cannam@167: % @deftypevr category type var args cannam@167: \makedefun{deftypevr}{\deftypecvgeneral{}} cannam@167: cannam@167: % @deftypecv category class type var args cannam@167: \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} cannam@167: cannam@167: % \deftypecvof {category of}class type var args cannam@167: \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } cannam@167: cannam@167: % \deftypecvgeneral {subind}category type var args cannam@167: % cannam@167: \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% cannam@167: \dosubind{vr}{\code{#4}}{#1}% cannam@167: \defname{#2}{#3}{#4}\defunargs{#5\unskip}% cannam@167: } cannam@167: cannam@167: % Untyped variables: cannam@167: cannam@167: % @defvr category var args cannam@167: \makedefun{defvr}#1 {\deftypevrheader{#1} {} } cannam@167: cannam@167: % @defcv category class var args cannam@167: \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} cannam@167: cannam@167: % \defcvof {category of}class var args cannam@167: \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } cannam@167: cannam@167: % Types: cannam@167: cannam@167: % @deftp category name args cannam@167: \makedefun{deftp}#1 #2 #3\endheader{% cannam@167: \doind{tp}{\code{#2}}% cannam@167: \defname{#1}{}{#2}\defunargs{#3\unskip}% cannam@167: } cannam@167: cannam@167: % Remaining @defun-like shortcuts: cannam@167: \makedefun{defun}{\deffnheader{\putwordDeffunc} } cannam@167: \makedefun{defmac}{\deffnheader{\putwordDefmac} } cannam@167: \makedefun{defspec}{\deffnheader{\putwordDefspec} } cannam@167: \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } cannam@167: \makedefun{defvar}{\defvrheader{\putwordDefvar} } cannam@167: \makedefun{defopt}{\defvrheader{\putwordDefopt} } cannam@167: \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } cannam@167: \makedefun{defmethod}{\defopon\putwordMethodon} cannam@167: \makedefun{deftypemethod}{\deftypeopon\putwordMethodon} cannam@167: \makedefun{defivar}{\defcvof\putwordInstanceVariableof} cannam@167: \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} cannam@167: cannam@167: % \defname, which formats the name of the @def (not the args). cannam@167: % #1 is the category, such as "Function". cannam@167: % #2 is the return type, if any. cannam@167: % #3 is the function name. cannam@167: % cannam@167: % We are followed by (but not passed) the arguments, if any. cannam@167: % cannam@167: \def\defname#1#2#3{% cannam@167: \par cannam@167: % Get the values of \leftskip and \rightskip as they were outside the @def... cannam@167: \advance\leftskip by -\defbodyindent cannam@167: % cannam@167: % Determine if we are typesetting the return type of a typed function cannam@167: % on a line by itself. cannam@167: \rettypeownlinefalse cannam@167: \ifdoingtypefn % doing a typed function specifically? cannam@167: % then check user option for putting return type on its own line: cannam@167: \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else cannam@167: \rettypeownlinetrue cannam@167: \fi cannam@167: \fi cannam@167: % cannam@167: % How we'll format the category name. Putting it in brackets helps cannam@167: % distinguish it from the body text that may end up on the next line cannam@167: % just below it. cannam@167: \def\temp{#1}% cannam@167: \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} cannam@167: % cannam@167: % Figure out line sizes for the paragraph shape. We'll always have at cannam@167: % least two. cannam@167: \tempnum = 2 cannam@167: % cannam@167: % The first line needs space for \box0; but if \rightskip is nonzero, cannam@167: % we need only space for the part of \box0 which exceeds it: cannam@167: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip cannam@167: % cannam@167: % If doing a return type on its own line, we'll have another line. cannam@167: \ifrettypeownline cannam@167: \advance\tempnum by 1 cannam@167: \def\maybeshapeline{0in \hsize}% cannam@167: \else cannam@167: \def\maybeshapeline{}% cannam@167: \fi cannam@167: % cannam@167: % The continuations: cannam@167: \dimen2=\hsize \advance\dimen2 by -\defargsindent cannam@167: % cannam@167: % The final paragraph shape: cannam@167: \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 cannam@167: % cannam@167: % Put the category name at the right margin. cannam@167: \noindent cannam@167: \hbox to 0pt{% cannam@167: \hfil\box0 \kern-\hsize cannam@167: % \hsize has to be shortened this way: cannam@167: \kern\leftskip cannam@167: % Intentionally do not respect \rightskip, since we need the space. cannam@167: }% cannam@167: % cannam@167: % Allow all lines to be underfull without complaint: cannam@167: \tolerance=10000 \hbadness=10000 cannam@167: \exdentamount=\defbodyindent cannam@167: {% cannam@167: % defun fonts. We use typewriter by default (used to be bold) because: cannam@167: % . we're printing identifiers, they should be in tt in principle. cannam@167: % . in languages with many accents, such as Czech or French, it's cannam@167: % common to leave accents off identifiers. The result looks ok in cannam@167: % tt, but exceedingly strange in rm. cannam@167: % . we don't want -- and --- to be treated as ligatures. cannam@167: % . this still does not fix the ?` and !` ligatures, but so far no cannam@167: % one has made identifiers using them :). cannam@167: \df \tt cannam@167: \def\temp{#2}% text of the return type cannam@167: \ifx\temp\empty\else cannam@167: \tclose{\temp}% typeset the return type cannam@167: \ifrettypeownline cannam@167: % put return type on its own line; prohibit line break following: cannam@167: \hfil\vadjust{\nobreak}\break cannam@167: \else cannam@167: \space % type on same line, so just followed by a space cannam@167: \fi cannam@167: \fi % no return type cannam@167: #3% output function name cannam@167: }% cannam@167: {\rm\enskip}% hskip 0.5 em of \tenrm cannam@167: % cannam@167: \boldbrax cannam@167: % arguments will be output next, if any. cannam@167: } cannam@167: cannam@167: % Print arguments in slanted roman (not ttsl), inconsistently with using cannam@167: % tt for the name. This is because literal text is sometimes needed in cannam@167: % the argument list (groff manual), and ttsl and tt are not very cannam@167: % distinguishable. Prevent hyphenation at `-' chars. cannam@167: % cannam@167: \def\defunargs#1{% cannam@167: % use sl by default (not ttsl), cannam@167: % tt for the names. cannam@167: \df \sl \hyphenchar\font=0 cannam@167: % cannam@167: % On the other hand, if an argument has two dashes (for instance), we cannam@167: % want a way to get ttsl. We used to recommend @var for that, so cannam@167: % leave the code in, but it's strange for @var to lead to typewriter. cannam@167: % Nowadays we recommend @code, since the difference between a ttsl hyphen cannam@167: % and a tt hyphen is pretty tiny. @code also disables ?` !`. cannam@167: \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}% cannam@167: #1% cannam@167: \sl\hyphenchar\font=45 cannam@167: } cannam@167: cannam@167: % We want ()&[] to print specially on the defun line. cannam@167: % cannam@167: \def\activeparens{% cannam@167: \catcode`\(=\active \catcode`\)=\active cannam@167: \catcode`\[=\active \catcode`\]=\active cannam@167: \catcode`\&=\active cannam@167: } cannam@167: cannam@167: % Make control sequences which act like normal parenthesis chars. cannam@167: \let\lparen = ( \let\rparen = ) cannam@167: cannam@167: % Be sure that we always have a definition for `(', etc. For example, cannam@167: % if the fn name has parens in it, \boldbrax will not be in effect yet, cannam@167: % so TeX would otherwise complain about undefined control sequence. cannam@167: { cannam@167: \activeparens cannam@167: \global\let(=\lparen \global\let)=\rparen cannam@167: \global\let[=\lbrack \global\let]=\rbrack cannam@167: \global\let& = \& cannam@167: cannam@167: \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} cannam@167: \gdef\magicamp{\let&=\amprm} cannam@167: } cannam@167: cannam@167: \newcount\parencount cannam@167: cannam@167: % If we encounter &foo, then turn on ()-hacking afterwards cannam@167: \newif\ifampseen cannam@167: \def\amprm#1 {\ampseentrue{\bf\ }} cannam@167: cannam@167: \def\parenfont{% cannam@167: \ifampseen cannam@167: % At the first level, print parens in roman, cannam@167: % otherwise use the default font. cannam@167: \ifnum \parencount=1 \rm \fi cannam@167: \else cannam@167: % The \sf parens (in \boldbrax) actually are a little bolder than cannam@167: % the contained text. This is especially needed for [ and ] . cannam@167: \sf cannam@167: \fi cannam@167: } cannam@167: \def\infirstlevel#1{% cannam@167: \ifampseen cannam@167: \ifnum\parencount=1 cannam@167: #1% cannam@167: \fi cannam@167: \fi cannam@167: } cannam@167: \def\bfafterword#1 {#1 \bf} cannam@167: cannam@167: \def\opnr{% cannam@167: \global\advance\parencount by 1 cannam@167: {\parenfont(}% cannam@167: \infirstlevel \bfafterword cannam@167: } cannam@167: \def\clnr{% cannam@167: {\parenfont)}% cannam@167: \infirstlevel \sl cannam@167: \global\advance\parencount by -1 cannam@167: } cannam@167: cannam@167: \newcount\brackcount cannam@167: \def\lbrb{% cannam@167: \global\advance\brackcount by 1 cannam@167: {\bf[}% cannam@167: } cannam@167: \def\rbrb{% cannam@167: {\bf]}% cannam@167: \global\advance\brackcount by -1 cannam@167: } cannam@167: cannam@167: \def\checkparencounts{% cannam@167: \ifnum\parencount=0 \else \badparencount \fi cannam@167: \ifnum\brackcount=0 \else \badbrackcount \fi cannam@167: } cannam@167: % these should not use \errmessage; the glibc manual, at least, actually cannam@167: % has such constructs (when documenting function pointers). cannam@167: \def\badparencount{% cannam@167: \message{Warning: unbalanced parentheses in @def...}% cannam@167: \global\parencount=0 cannam@167: } cannam@167: \def\badbrackcount{% cannam@167: \message{Warning: unbalanced square brackets in @def...}% cannam@167: \global\brackcount=0 cannam@167: } cannam@167: cannam@167: cannam@167: \message{macros,} cannam@167: % @macro. cannam@167: cannam@167: % To do this right we need a feature of e-TeX, \scantokens, cannam@167: % which we arrange to emulate with a temporary file in ordinary TeX. cannam@167: \ifx\eTeXversion\thisisundefined cannam@167: \newwrite\macscribble cannam@167: \def\scantokens#1{% cannam@167: \toks0={#1}% cannam@167: \immediate\openout\macscribble=\jobname.tmp cannam@167: \immediate\write\macscribble{\the\toks0}% cannam@167: \immediate\closeout\macscribble cannam@167: \input \jobname.tmp cannam@167: } cannam@167: \fi cannam@167: cannam@167: \def\scanmacro#1{\begingroup cannam@167: \newlinechar`\^^M cannam@167: \let\xeatspaces\eatspaces cannam@167: % cannam@167: % Undo catcode changes of \startcontents and \doprintindex cannam@167: % When called from @insertcopying or (short)caption, we need active cannam@167: % backslash to get it printed correctly. Previously, we had cannam@167: % \catcode`\\=\other instead. We'll see whether a problem appears cannam@167: % with macro expansion. --kasal, 19aug04 cannam@167: \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ cannam@167: % cannam@167: % ... and for \example: cannam@167: \spaceisspace cannam@167: % cannam@167: % The \empty here causes a following catcode 5 newline to be eaten as cannam@167: % part of reading whitespace after a control sequence. It does not cannam@167: % eat a catcode 13 newline. There's no good way to handle the two cannam@167: % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX cannam@167: % would then have different behavior). See the Macro Details node in cannam@167: % the manual for the workaround we recommend for macros and cannam@167: % line-oriented commands. cannam@167: % cannam@167: \scantokens{#1\empty}% cannam@167: \endgroup} cannam@167: cannam@167: \def\scanexp#1{% cannam@167: \edef\temp{\noexpand\scanmacro{#1}}% cannam@167: \temp cannam@167: } cannam@167: cannam@167: \newcount\paramno % Count of parameters cannam@167: \newtoks\macname % Macro name cannam@167: \newif\ifrecursive % Is it recursive? cannam@167: cannam@167: % List of all defined macros in the form cannam@167: % \definedummyword\macro1\definedummyword\macro2... cannam@167: % Currently is also contains all @aliases; the list can be split cannam@167: % if there is a need. cannam@167: \def\macrolist{} cannam@167: cannam@167: % Add the macro to \macrolist cannam@167: \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} cannam@167: \def\addtomacrolistxxx#1{% cannam@167: \toks0 = \expandafter{\macrolist\definedummyword#1}% cannam@167: \xdef\macrolist{\the\toks0}% cannam@167: } cannam@167: cannam@167: % Utility routines. cannam@167: % This does \let #1 = #2, with \csnames; that is, cannam@167: % \let \csname#1\endcsname = \csname#2\endcsname cannam@167: % (except of course we have to play expansion games). cannam@167: % cannam@167: \def\cslet#1#2{% cannam@167: \expandafter\let cannam@167: \csname#1\expandafter\endcsname cannam@167: \csname#2\endcsname cannam@167: } cannam@167: cannam@167: % Trim leading and trailing spaces off a string. cannam@167: % Concepts from aro-bend problem 15 (see CTAN). cannam@167: {\catcode`\@=11 cannam@167: \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} cannam@167: \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} cannam@167: \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} cannam@167: \def\unbrace#1{#1} cannam@167: \unbrace{\gdef\trim@@@ #1 } #2@{#1} cannam@167: } cannam@167: cannam@167: % Trim a single trailing ^^M off a string. cannam@167: {\catcode`\^^M=\other \catcode`\Q=3% cannam@167: \gdef\eatcr #1{\eatcra #1Q^^MQ}% cannam@167: \gdef\eatcra#1^^MQ{\eatcrb#1Q}% cannam@167: \gdef\eatcrb#1Q#2Q{#1}% cannam@167: } cannam@167: cannam@167: % Macro bodies are absorbed as an argument in a context where cannam@167: % all characters are catcode 10, 11 or 12, except \ which is active cannam@167: % (as in normal texinfo). It is necessary to change the definition of \ cannam@167: % to recognize macro arguments; this is the job of \mbodybackslash. cannam@167: % cannam@167: % Non-ASCII encodings make 8-bit characters active, so un-activate cannam@167: % them to avoid their expansion. Must do this non-globally, to cannam@167: % confine the change to the current group. cannam@167: % cannam@167: % It's necessary to have hard CRs when the macro is executed. This is cannam@167: % done by making ^^M (\endlinechar) catcode 12 when reading the macro cannam@167: % body, and then making it the \newlinechar in \scanmacro. cannam@167: % cannam@167: \def\scanctxt{% used as subroutine cannam@167: \catcode`\"=\other cannam@167: \catcode`\+=\other cannam@167: \catcode`\<=\other cannam@167: \catcode`\>=\other cannam@167: \catcode`\@=\other cannam@167: \catcode`\^=\other cannam@167: \catcode`\_=\other cannam@167: \catcode`\|=\other cannam@167: \catcode`\~=\other cannam@167: \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi cannam@167: } cannam@167: cannam@167: \def\scanargctxt{% used for copying and captions, not macros. cannam@167: \scanctxt cannam@167: \catcode`\\=\other cannam@167: \catcode`\^^M=\other cannam@167: } cannam@167: cannam@167: \def\macrobodyctxt{% used for @macro definitions cannam@167: \scanctxt cannam@167: \catcode`\{=\other cannam@167: \catcode`\}=\other cannam@167: \catcode`\^^M=\other cannam@167: \usembodybackslash cannam@167: } cannam@167: cannam@167: \def\macroargctxt{% used when scanning invocations cannam@167: \scanctxt cannam@167: \catcode`\\=0 cannam@167: } cannam@167: % why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes" cannam@167: % for the single characters \ { }. Thus, we end up with the "commands" cannam@167: % that would be written @\ @{ @} in a Texinfo document. cannam@167: % cannam@167: % We already have @{ and @}. For @\, we define it here, and only for cannam@167: % this purpose, to produce a typewriter backslash (so, the @\ that we cannam@167: % define for @math can't be used with @macro calls): cannam@167: % cannam@167: \def\\{\normalbackslash}% cannam@167: % cannam@167: % We would like to do this for \, too, since that is what makeinfo does. cannam@167: % But it is not possible, because Texinfo already has a command @, for a cannam@167: % cedilla accent. Documents must use @comma{} instead. cannam@167: % cannam@167: % \anythingelse will almost certainly be an error of some kind. cannam@167: cannam@167: cannam@167: % \mbodybackslash is the definition of \ in @macro bodies. cannam@167: % It maps \foo\ => \csname macarg.foo\endcsname => #N cannam@167: % where N is the macro parameter number. cannam@167: % We define \csname macarg.\endcsname to be \realbackslash, so cannam@167: % \\ in macro replacement text gets you a backslash. cannam@167: % cannam@167: {\catcode`@=0 @catcode`@\=@active cannam@167: @gdef@usembodybackslash{@let\=@mbodybackslash} cannam@167: @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} cannam@167: } cannam@167: \expandafter\def\csname macarg.\endcsname{\realbackslash} cannam@167: cannam@167: \def\margbackslash#1{\char`\#1 } cannam@167: cannam@167: \def\macro{\recursivefalse\parsearg\macroxxx} cannam@167: \def\rmacro{\recursivetrue\parsearg\macroxxx} cannam@167: cannam@167: \def\macroxxx#1{% cannam@167: \getargs{#1}% now \macname is the macname and \argl the arglist cannam@167: \ifx\argl\empty % no arguments cannam@167: \paramno=0\relax cannam@167: \else cannam@167: \expandafter\parsemargdef \argl;% cannam@167: \if\paramno>256\relax cannam@167: \ifx\eTeXversion\thisisundefined cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} cannam@167: \fi cannam@167: \fi cannam@167: \fi cannam@167: \if1\csname ismacro.\the\macname\endcsname cannam@167: \message{Warning: redefining \the\macname}% cannam@167: \else cannam@167: \expandafter\ifx\csname \the\macname\endcsname \relax cannam@167: \else \errmessage{Macro name \the\macname\space already defined}\fi cannam@167: \global\cslet{macsave.\the\macname}{\the\macname}% cannam@167: \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% cannam@167: \addtomacrolist{\the\macname}% cannam@167: \fi cannam@167: \begingroup \macrobodyctxt cannam@167: \ifrecursive \expandafter\parsermacbody cannam@167: \else \expandafter\parsemacbody cannam@167: \fi} cannam@167: cannam@167: \parseargdef\unmacro{% cannam@167: \if1\csname ismacro.#1\endcsname cannam@167: \global\cslet{#1}{macsave.#1}% cannam@167: \global\expandafter\let \csname ismacro.#1\endcsname=0% cannam@167: % Remove the macro name from \macrolist: cannam@167: \begingroup cannam@167: \expandafter\let\csname#1\endcsname \relax cannam@167: \let\definedummyword\unmacrodo cannam@167: \xdef\macrolist{\macrolist}% cannam@167: \endgroup cannam@167: \else cannam@167: \errmessage{Macro #1 not defined}% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % Called by \do from \dounmacro on each macro. The idea is to omit any cannam@167: % macro definitions that have been changed to \relax. cannam@167: % cannam@167: \def\unmacrodo#1{% cannam@167: \ifx #1\relax cannam@167: % remove this cannam@167: \else cannam@167: \noexpand\definedummyword \noexpand#1% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % This makes use of the obscure feature that if the last token of a cannam@167: % is #, then the preceding argument is delimited by cannam@167: % an opening brace, and that opening brace is not consumed. cannam@167: \def\getargs#1{\getargsxxx#1{}} cannam@167: \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} cannam@167: \def\getmacname#1 #2\relax{\macname={#1}} cannam@167: \def\getmacargs#1{\def\argl{#1}} cannam@167: cannam@167: % For macro processing make @ a letter so that we can make Texinfo private macro names. cannam@167: \edef\texiatcatcode{\the\catcode`\@} cannam@167: \catcode `@=11\relax cannam@167: cannam@167: % Parse the optional {params} list. Set up \paramno and \paramlist cannam@167: % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH cannam@167: % in the params list to some hook where the argument si to be expanded. If cannam@167: % there are less than 10 arguments that hook is to be replaced by ##N where N cannam@167: % is the position in that list, that is to say the macro arguments are to be cannam@167: % defined `a la TeX in the macro body. cannam@167: % cannam@167: % That gets used by \mbodybackslash (above). cannam@167: % cannam@167: % We need to get `macro parameter char #' into several definitions. cannam@167: % The technique used is stolen from LaTeX: let \hash be something cannam@167: % unexpandable, insert that wherever you need a #, and then redefine cannam@167: % it to # just before using the token list produced. cannam@167: % cannam@167: % The same technique is used to protect \eatspaces till just before cannam@167: % the macro is used. cannam@167: % cannam@167: % If there are 10 or more arguments, a different technique is used, where the cannam@167: % hook remains in the body, and when macro is to be expanded the body is cannam@167: % processed again to replace the arguments. cannam@167: % cannam@167: % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the cannam@167: % argument N value and then \edef the body (nothing else will expand because of cannam@167: % the catcode regime underwhich the body was input). cannam@167: % cannam@167: % If you compile with TeX (not eTeX), and you have macros with 10 or more cannam@167: % arguments, you need that no macro has more than 256 arguments, otherwise an cannam@167: % error is produced. cannam@167: \def\parsemargdef#1;{% cannam@167: \paramno=0\def\paramlist{}% cannam@167: \let\hash\relax cannam@167: \let\xeatspaces\relax cannam@167: \parsemargdefxxx#1,;,% cannam@167: % In case that there are 10 or more arguments we parse again the arguments cannam@167: % list to set new definitions for the \macarg.BLAH macros corresponding to cannam@167: % each BLAH argument. It was anyhow needed to parse already once this list cannam@167: % in order to count the arguments, and as macros with at most 9 arguments cannam@167: % are by far more frequent than macro with 10 or more arguments, defining cannam@167: % twice the \macarg.BLAH macros does not cost too much processing power. cannam@167: \ifnum\paramno<10\relax\else cannam@167: \paramno0\relax cannam@167: \parsemmanyargdef@@#1,;,% 10 or more arguments cannam@167: \fi cannam@167: } cannam@167: \def\parsemargdefxxx#1,{% cannam@167: \if#1;\let\next=\relax cannam@167: \else \let\next=\parsemargdefxxx cannam@167: \advance\paramno by 1 cannam@167: \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname cannam@167: {\xeatspaces{\hash\the\paramno}}% cannam@167: \edef\paramlist{\paramlist\hash\the\paramno,}% cannam@167: \fi\next} cannam@167: cannam@167: \def\parsemmanyargdef@@#1,{% cannam@167: \if#1;\let\next=\relax cannam@167: \else cannam@167: \let\next=\parsemmanyargdef@@ cannam@167: \edef\tempb{\eatspaces{#1}}% cannam@167: \expandafter\def\expandafter\tempa cannam@167: \expandafter{\csname macarg.\tempb\endcsname}% cannam@167: % Note that we need some extra \noexpand\noexpand, this is because we cannam@167: % don't want \the to be expanded in the \parsermacbody as it uses an cannam@167: % \xdef . cannam@167: \expandafter\edef\tempa cannam@167: {\noexpand\noexpand\noexpand\the\toks\the\paramno}% cannam@167: \advance\paramno by 1\relax cannam@167: \fi\next} cannam@167: cannam@167: % These two commands read recursive and nonrecursive macro bodies. cannam@167: % (They're different since rec and nonrec macros end differently.) cannam@167: % cannam@167: cannam@167: \catcode `\@\texiatcatcode cannam@167: \long\def\parsemacbody#1@end macro% cannam@167: {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% cannam@167: \long\def\parsermacbody#1@end rmacro% cannam@167: {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% cannam@167: \catcode `\@=11\relax cannam@167: cannam@167: \let\endargs@\relax cannam@167: \let\nil@\relax cannam@167: \def\nilm@{\nil@}% cannam@167: \long\def\nillm@{\nil@}% cannam@167: cannam@167: % This macro is expanded during the Texinfo macro expansion, not during its cannam@167: % definition. It gets all the arguments values and assigns them to macros cannam@167: % macarg.ARGNAME cannam@167: % cannam@167: % #1 is the macro name cannam@167: % #2 is the list of argument names cannam@167: % #3 is the list of argument values cannam@167: \def\getargvals@#1#2#3{% cannam@167: \def\macargdeflist@{}% cannam@167: \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. cannam@167: \def\paramlist{#2,\nil@}% cannam@167: \def\macroname{#1}% cannam@167: \begingroup cannam@167: \macroargctxt cannam@167: \def\argvaluelist{#3,\nil@}% cannam@167: \def\@tempa{#3}% cannam@167: \ifx\@tempa\empty cannam@167: \setemptyargvalues@ cannam@167: \else cannam@167: \getargvals@@ cannam@167: \fi cannam@167: } cannam@167: cannam@167: % cannam@167: \def\getargvals@@{% cannam@167: \ifx\paramlist\nilm@ cannam@167: % Some sanity check needed here that \argvaluelist is also empty. cannam@167: \ifx\argvaluelist\nillm@ cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Too many arguments in macro `\macroname'!}% cannam@167: \fi cannam@167: \let\next\macargexpandinbody@ cannam@167: \else cannam@167: \ifx\argvaluelist\nillm@ cannam@167: % No more arguments values passed to macro. Set remaining named-arg cannam@167: % macros to empty. cannam@167: \let\next\setemptyargvalues@ cannam@167: \else cannam@167: % pop current arg name into \@tempb cannam@167: \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% cannam@167: \expandafter\@tempa\expandafter{\paramlist}% cannam@167: % pop current argument value into \@tempc cannam@167: \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% cannam@167: \expandafter\@tempa\expandafter{\argvaluelist}% cannam@167: % Here \@tempb is the current arg name and \@tempc is the current arg value. cannam@167: % First place the new argument macro definition into \@tempd cannam@167: \expandafter\macname\expandafter{\@tempc}% cannam@167: \expandafter\let\csname macarg.\@tempb\endcsname\relax cannam@167: \expandafter\def\expandafter\@tempe\expandafter{% cannam@167: \csname macarg.\@tempb\endcsname}% cannam@167: \edef\@tempd{\long\def\@tempe{\the\macname}}% cannam@167: \push@\@tempd\macargdeflist@ cannam@167: \let\next\getargvals@@ cannam@167: \fi cannam@167: \fi cannam@167: \next cannam@167: } cannam@167: cannam@167: \def\push@#1#2{% cannam@167: \expandafter\expandafter\expandafter\def cannam@167: \expandafter\expandafter\expandafter#2% cannam@167: \expandafter\expandafter\expandafter{% cannam@167: \expandafter#1#2}% cannam@167: } cannam@167: cannam@167: % Replace arguments by their values in the macro body, and place the result cannam@167: % in macro \@tempa cannam@167: \def\macvalstoargs@{% cannam@167: % To do this we use the property that token registers that are \the'ed cannam@167: % within an \edef expand only once. So we are going to place all argument cannam@167: % values into respective token registers. cannam@167: % cannam@167: % First we save the token context, and initialize argument numbering. cannam@167: \begingroup cannam@167: \paramno0\relax cannam@167: % Then, for each argument number #N, we place the corresponding argument cannam@167: % value into a new token list register \toks#N cannam@167: \expandafter\putargsintokens@\saveparamlist@,;,% cannam@167: % Then, we expand the body so that argument are replaced by their cannam@167: % values. The trick for values not to be expanded themselves is that they cannam@167: % are within tokens and that tokens expand only once in an \edef . cannam@167: \edef\@tempc{\csname mac.\macroname .body\endcsname}% cannam@167: % Now we restore the token stack pointer to free the token list registers cannam@167: % which we have used, but we make sure that expanded body is saved after cannam@167: % group. cannam@167: \expandafter cannam@167: \endgroup cannam@167: \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% cannam@167: } cannam@167: cannam@167: \def\macargexpandinbody@{% cannam@167: %% Define the named-macro outside of this group and then close this group. cannam@167: \expandafter cannam@167: \endgroup cannam@167: \macargdeflist@ cannam@167: % First the replace in body the macro arguments by their values, the result cannam@167: % is in \@tempa . cannam@167: \macvalstoargs@ cannam@167: % Then we point at the \norecurse or \gobble (for recursive) macro value cannam@167: % with \@tempb . cannam@167: \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname cannam@167: % Depending on whether it is recursive or not, we need some tailing cannam@167: % \egroup . cannam@167: \ifx\@tempb\gobble cannam@167: \let\@tempc\relax cannam@167: \else cannam@167: \let\@tempc\egroup cannam@167: \fi cannam@167: % And now we do the real job: cannam@167: \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% cannam@167: \@tempd cannam@167: } cannam@167: cannam@167: \def\putargsintokens@#1,{% cannam@167: \if#1;\let\next\relax cannam@167: \else cannam@167: \let\next\putargsintokens@ cannam@167: % First we allocate the new token list register, and give it a temporary cannam@167: % alias \@tempb . cannam@167: \toksdef\@tempb\the\paramno cannam@167: % Then we place the argument value into that token list register. cannam@167: \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname cannam@167: \expandafter\@tempb\expandafter{\@tempa}% cannam@167: \advance\paramno by 1\relax cannam@167: \fi cannam@167: \next cannam@167: } cannam@167: cannam@167: % Save the token stack pointer into macro #1 cannam@167: \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} cannam@167: % Restore the token stack pointer from number in macro #1 cannam@167: \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} cannam@167: % newtoks that can be used non \outer . cannam@167: \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} cannam@167: cannam@167: % Tailing missing arguments are set to empty cannam@167: \def\setemptyargvalues@{% cannam@167: \ifx\paramlist\nilm@ cannam@167: \let\next\macargexpandinbody@ cannam@167: \else cannam@167: \expandafter\setemptyargvaluesparser@\paramlist\endargs@ cannam@167: \let\next\setemptyargvalues@ cannam@167: \fi cannam@167: \next cannam@167: } cannam@167: cannam@167: \def\setemptyargvaluesparser@#1,#2\endargs@{% cannam@167: \expandafter\def\expandafter\@tempa\expandafter{% cannam@167: \expandafter\def\csname macarg.#1\endcsname{}}% cannam@167: \push@\@tempa\macargdeflist@ cannam@167: \def\paramlist{#2}% cannam@167: } cannam@167: cannam@167: % #1 is the element target macro cannam@167: % #2 is the list macro cannam@167: % #3,#4\endargs@ is the list value cannam@167: \def\pop@#1#2#3,#4\endargs@{% cannam@167: \def#1{#3}% cannam@167: \def#2{#4}% cannam@167: } cannam@167: \long\def\longpop@#1#2#3,#4\endargs@{% cannam@167: \long\def#1{#3}% cannam@167: \long\def#2{#4}% cannam@167: } cannam@167: cannam@167: % This defines a Texinfo @macro. There are eight cases: recursive and cannam@167: % nonrecursive macros of zero, one, up to nine, and many arguments. cannam@167: % Much magic with \expandafter here. cannam@167: % \xdef is used so that macro definitions will survive the file cannam@167: % they're defined in; @include reads the file inside a group. cannam@167: % cannam@167: \def\defmacro{% cannam@167: \let\hash=##% convert placeholders to macro parameter chars cannam@167: \ifrecursive cannam@167: \ifcase\paramno cannam@167: % 0 cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \noexpand\scanmacro{\temp}}% cannam@167: \or % 1 cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \bgroup\noexpand\macroargctxt cannam@167: \noexpand\braceorline cannam@167: \expandafter\noexpand\csname\the\macname xxx\endcsname}% cannam@167: \expandafter\xdef\csname\the\macname xxx\endcsname##1{% cannam@167: \egroup\noexpand\scanmacro{\temp}}% cannam@167: \else cannam@167: \ifnum\paramno<10\relax % at most 9 cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \bgroup\noexpand\macroargctxt cannam@167: \noexpand\csname\the\macname xx\endcsname}% cannam@167: \expandafter\xdef\csname\the\macname xx\endcsname##1{% cannam@167: \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% cannam@167: \expandafter\expandafter cannam@167: \expandafter\xdef cannam@167: \expandafter\expandafter cannam@167: \csname\the\macname xxx\endcsname cannam@167: \paramlist{\egroup\noexpand\scanmacro{\temp}}% cannam@167: \else % 10 or more cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \noexpand\getargvals@{\the\macname}{\argl}% cannam@167: }% cannam@167: \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp cannam@167: \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble cannam@167: \fi cannam@167: \fi cannam@167: \else cannam@167: \ifcase\paramno cannam@167: % 0 cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \noexpand\norecurse{\the\macname}% cannam@167: \noexpand\scanmacro{\temp}\egroup}% cannam@167: \or % 1 cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \bgroup\noexpand\macroargctxt cannam@167: \noexpand\braceorline cannam@167: \expandafter\noexpand\csname\the\macname xxx\endcsname}% cannam@167: \expandafter\xdef\csname\the\macname xxx\endcsname##1{% cannam@167: \egroup cannam@167: \noexpand\norecurse{\the\macname}% cannam@167: \noexpand\scanmacro{\temp}\egroup}% cannam@167: \else % at most 9 cannam@167: \ifnum\paramno<10\relax cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \bgroup\noexpand\macroargctxt cannam@167: \expandafter\noexpand\csname\the\macname xx\endcsname}% cannam@167: \expandafter\xdef\csname\the\macname xx\endcsname##1{% cannam@167: \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% cannam@167: \expandafter\expandafter cannam@167: \expandafter\xdef cannam@167: \expandafter\expandafter cannam@167: \csname\the\macname xxx\endcsname cannam@167: \paramlist{% cannam@167: \egroup cannam@167: \noexpand\norecurse{\the\macname}% cannam@167: \noexpand\scanmacro{\temp}\egroup}% cannam@167: \else % 10 or more: cannam@167: \expandafter\xdef\csname\the\macname\endcsname{% cannam@167: \noexpand\getargvals@{\the\macname}{\argl}% cannam@167: }% cannam@167: \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp cannam@167: \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse cannam@167: \fi cannam@167: \fi cannam@167: \fi} cannam@167: cannam@167: \catcode `\@\texiatcatcode\relax cannam@167: cannam@167: \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} cannam@167: cannam@167: % \braceorline decides whether the next nonwhitespace character is a cannam@167: % {. If so it reads up to the closing }, if not, it reads the whole cannam@167: % line. Whatever was read is then fed to the next control sequence cannam@167: % as an argument (by \parsebrace or \parsearg). cannam@167: % cannam@167: \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} cannam@167: \def\braceorlinexxx{% cannam@167: \ifx\nchar\bgroup\else cannam@167: \expandafter\parsearg cannam@167: \fi \macnamexxx} cannam@167: cannam@167: cannam@167: % @alias. cannam@167: % We need some trickery to remove the optional spaces around the equal cannam@167: % sign. Make them active and then expand them all to nothing. cannam@167: % cannam@167: \def\alias{\parseargusing\obeyspaces\aliasxxx} cannam@167: \def\aliasxxx #1{\aliasyyy#1\relax} cannam@167: \def\aliasyyy #1=#2\relax{% cannam@167: {% cannam@167: \expandafter\let\obeyedspace=\empty cannam@167: \addtomacrolist{#1}% cannam@167: \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% cannam@167: }% cannam@167: \next cannam@167: } cannam@167: cannam@167: cannam@167: \message{cross references,} cannam@167: cannam@167: \newwrite\auxfile cannam@167: \newif\ifhavexrefs % True if xref values are known. cannam@167: \newif\ifwarnedxrefs % True if we warned once that they aren't known. cannam@167: cannam@167: % @inforef is relatively simple. cannam@167: \def\inforef #1{\inforefzzz #1,,,,**} cannam@167: \def\inforefzzz #1,#2,#3,#4**{% cannam@167: \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, cannam@167: node \samp{\ignorespaces#1{}}} cannam@167: cannam@167: % @node's only job in TeX is to define \lastnode, which is used in cannam@167: % cross-references. The @node line might or might not have commas, and cannam@167: % might or might not have spaces before the first comma, like: cannam@167: % @node foo , bar , ... cannam@167: % We don't want such trailing spaces in the node name. cannam@167: % cannam@167: \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} cannam@167: % cannam@167: % also remove a trailing comma, in case of something like this: cannam@167: % @node Help-Cross, , , Cross-refs cannam@167: \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} cannam@167: \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} cannam@167: cannam@167: \let\nwnode=\node cannam@167: \let\lastnode=\empty cannam@167: cannam@167: % Write a cross-reference definition for the current node. #1 is the cannam@167: % type (Ynumbered, Yappendix, Ynothing). cannam@167: % cannam@167: \def\donoderef#1{% cannam@167: \ifx\lastnode\empty\else cannam@167: \setref{\lastnode}{#1}% cannam@167: \global\let\lastnode=\empty cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @anchor{NAME} -- define xref target at arbitrary point. cannam@167: % cannam@167: \newcount\savesfregister cannam@167: % cannam@167: \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} cannam@167: \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} cannam@167: \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} cannam@167: cannam@167: % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an cannam@167: % anchor), which consists of three parts: cannam@167: % 1) NAME-title - the current sectioning name taken from \lastsection, cannam@167: % or the anchor name. cannam@167: % 2) NAME-snt - section number and type, passed as the SNT arg, or cannam@167: % empty for anchors. cannam@167: % 3) NAME-pg - the page number. cannam@167: % cannam@167: % This is called from \donoderef, \anchor, and \dofloat. In the case of cannam@167: % floats, there is an additional part, which is not written here: cannam@167: % 4) NAME-lof - the text as it should appear in a @listoffloats. cannam@167: % cannam@167: \def\setref#1#2{% cannam@167: \pdfmkdest{#1}% cannam@167: \iflinks cannam@167: {% cannam@167: \atdummies % preserve commands, but don't expand them cannam@167: \edef\writexrdef##1##2{% cannam@167: \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef cannam@167: ##1}{##2}}% these are parameters of \writexrdef cannam@167: }% cannam@167: \toks0 = \expandafter{\lastsection}% cannam@167: \immediate \writexrdef{title}{\the\toks0 }% cannam@167: \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. cannam@167: \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout cannam@167: }% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % @xrefautosectiontitle on|off says whether @section(ing) names are used cannam@167: % automatically in xrefs, if the third arg is not explicitly specified. cannam@167: % This was provided as a "secret" @set xref-automatic-section-title cannam@167: % variable, now it's official. cannam@167: % cannam@167: \parseargdef\xrefautomaticsectiontitle{% cannam@167: \def\temp{#1}% cannam@167: \ifx\temp\onword cannam@167: \expandafter\let\csname SETxref-automatic-section-title\endcsname cannam@167: = \empty cannam@167: \else\ifx\temp\offword cannam@167: \expandafter\let\csname SETxref-automatic-section-title\endcsname cannam@167: = \relax cannam@167: \else cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', cannam@167: must be on|off}% cannam@167: \fi\fi cannam@167: } cannam@167: cannam@167: % cannam@167: % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is cannam@167: % the node name, #2 the name of the Info cross-reference, #3 the printed cannam@167: % node name, #4 the name of the Info file, #5 the name of the printed cannam@167: % manual. All but the node name can be omitted. cannam@167: % cannam@167: \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} cannam@167: \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} cannam@167: \def\ref#1{\xrefX[#1,,,,,,,]} cannam@167: % cannam@167: \newbox\toprefbox cannam@167: \newbox\printedrefnamebox cannam@167: \newbox\infofilenamebox cannam@167: \newbox\printedmanualbox cannam@167: % cannam@167: \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup cannam@167: \unsepspaces cannam@167: % cannam@167: % Get args without leading/trailing spaces. cannam@167: \def\printedrefname{\ignorespaces #3}% cannam@167: \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% cannam@167: % cannam@167: \def\infofilename{\ignorespaces #4}% cannam@167: \setbox\infofilenamebox = \hbox{\infofilename\unskip}% cannam@167: % cannam@167: \def\printedmanual{\ignorespaces #5}% cannam@167: \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% cannam@167: % cannam@167: % If the printed reference name (arg #3) was not explicitly given in cannam@167: % the @xref, figure out what we want to use. cannam@167: \ifdim \wd\printedrefnamebox = 0pt cannam@167: % No printed node name was explicitly given. cannam@167: \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax cannam@167: % Not auto section-title: use node name inside the square brackets. cannam@167: \def\printedrefname{\ignorespaces #1}% cannam@167: \else cannam@167: % Auto section-title: use chapter/section title inside cannam@167: % the square brackets if we have it. cannam@167: \ifdim \wd\printedmanualbox > 0pt cannam@167: % It is in another manual, so we don't have it; use node name. cannam@167: \def\printedrefname{\ignorespaces #1}% cannam@167: \else cannam@167: \ifhavexrefs cannam@167: % We (should) know the real title if we have the xref values. cannam@167: \def\printedrefname{\refx{#1-title}{}}% cannam@167: \else cannam@167: % Otherwise just copy the Info node name. cannam@167: \def\printedrefname{\ignorespaces #1}% cannam@167: \fi% cannam@167: \fi cannam@167: \fi cannam@167: \fi cannam@167: % cannam@167: % Make link in pdf output. cannam@167: \ifpdf cannam@167: {\indexnofonts cannam@167: \turnoffactive cannam@167: \makevalueexpandable cannam@167: % This expands tokens, so do it after making catcode changes, so _ cannam@167: % etc. don't get their TeX definitions. This ignores all spaces in cannam@167: % #4, including (wrongly) those in the middle of the filename. cannam@167: \getfilename{#4}% cannam@167: % cannam@167: % This (wrongly) does not take account of leading or trailing cannam@167: % spaces in #1, which should be ignored. cannam@167: \edef\pdfxrefdest{#1}% cannam@167: \ifx\pdfxrefdest\empty cannam@167: \def\pdfxrefdest{Top}% no empty targets cannam@167: \else cannam@167: \txiescapepdf\pdfxrefdest % escape PDF special chars cannam@167: \fi cannam@167: % cannam@167: \leavevmode cannam@167: \startlink attr{/Border [0 0 0]}% cannam@167: \ifnum\filenamelength>0 cannam@167: goto file{\the\filename.pdf} name{\pdfxrefdest}% cannam@167: \else cannam@167: goto name{\pdfmkpgn{\pdfxrefdest}}% cannam@167: \fi cannam@167: }% cannam@167: \setcolor{\linkcolor}% cannam@167: \fi cannam@167: % cannam@167: % Float references are printed completely differently: "Figure 1.2" cannam@167: % instead of "[somenode], p.3". We distinguish them by the cannam@167: % LABEL-title being set to a magic string. cannam@167: {% cannam@167: % Have to otherify everything special to allow the \csname to cannam@167: % include an _ in the xref name, etc. cannam@167: \indexnofonts cannam@167: \turnoffactive cannam@167: \expandafter\global\expandafter\let\expandafter\Xthisreftitle cannam@167: \csname XR#1-title\endcsname cannam@167: }% cannam@167: \iffloat\Xthisreftitle cannam@167: % If the user specified the print name (third arg) to the ref, cannam@167: % print it instead of our usual "Figure 1.2". cannam@167: \ifdim\wd\printedrefnamebox = 0pt cannam@167: \refx{#1-snt}{}% cannam@167: \else cannam@167: \printedrefname cannam@167: \fi cannam@167: % cannam@167: % If the user also gave the printed manual name (fifth arg), append cannam@167: % "in MANUALNAME". cannam@167: \ifdim \wd\printedmanualbox > 0pt cannam@167: \space \putwordin{} \cite{\printedmanual}% cannam@167: \fi cannam@167: \else cannam@167: % node/anchor (non-float) references. cannam@167: % cannam@167: % If we use \unhbox to print the node names, TeX does not insert cannam@167: % empty discretionaries after hyphens, which means that it will not cannam@167: % find a line break at a hyphen in a node names. Since some manuals cannam@167: % are best written with fairly long node names, containing hyphens, cannam@167: % this is a loss. Therefore, we give the text of the node name cannam@167: % again, so it is as if TeX is seeing it for the first time. cannam@167: % cannam@167: \ifdim \wd\printedmanualbox > 0pt cannam@167: % Cross-manual reference with a printed manual name. cannam@167: % cannam@167: \crossmanualxref{\cite{\printedmanual\unskip}}% cannam@167: % cannam@167: \else\ifdim \wd\infofilenamebox > 0pt cannam@167: % Cross-manual reference with only an info filename (arg 4), no cannam@167: % printed manual name (arg 5). This is essentially the same as cannam@167: % the case above; we output the filename, since we have nothing else. cannam@167: % cannam@167: \crossmanualxref{\code{\infofilename\unskip}}% cannam@167: % cannam@167: \else cannam@167: % Reference within this manual. cannam@167: % cannam@167: % _ (for example) has to be the character _ for the purposes of the cannam@167: % control sequence corresponding to the node, but it has to expand cannam@167: % into the usual \leavevmode...\vrule stuff for purposes of cannam@167: % printing. So we \turnoffactive for the \refx-snt, back on for the cannam@167: % printing, back off for the \refx-pg. cannam@167: {\turnoffactive cannam@167: % Only output a following space if the -snt ref is nonempty; for cannam@167: % @unnumbered and @anchor, it won't be. cannam@167: \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% cannam@167: \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi cannam@167: }% cannam@167: % output the `[mynode]' via the macro below so it can be overridden. cannam@167: \xrefprintnodename\printedrefname cannam@167: % cannam@167: % But we always want a comma and a space: cannam@167: ,\space cannam@167: % cannam@167: % output the `page 3'. cannam@167: \turnoffactive \putwordpage\tie\refx{#1-pg}{}% cannam@167: \fi\fi cannam@167: \fi cannam@167: \endlink cannam@167: \endgroup} cannam@167: cannam@167: % Output a cross-manual xref to #1. Used just above (twice). cannam@167: % cannam@167: % Only include the text "Section ``foo'' in" if the foo is neither cannam@167: % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply cannam@167: % "see The Foo Manual", the idea being to refer to the whole manual. cannam@167: % cannam@167: % But, this being TeX, we can't easily compare our node name against the cannam@167: % string "Top" while ignoring the possible spaces before and after in cannam@167: % the input. By adding the arbitrary 7sp below, we make it much less cannam@167: % likely that a real node name would have the same width as "Top" (e.g., cannam@167: % in a monospaced font). Hopefully it will never happen in practice. cannam@167: % cannam@167: % For the same basic reason, we retypeset the "Top" at every cannam@167: % reference, since the current font is indeterminate. cannam@167: % cannam@167: \def\crossmanualxref#1{% cannam@167: \setbox\toprefbox = \hbox{Top\kern7sp}% cannam@167: \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% cannam@167: \ifdim \wd2 > 7sp % nonempty? cannam@167: \ifdim \wd2 = \wd\toprefbox \else % same as Top? cannam@167: \putwordSection{} ``\printedrefname'' \putwordin{}\space cannam@167: \fi cannam@167: \fi cannam@167: #1% cannam@167: } cannam@167: cannam@167: % This macro is called from \xrefX for the `[nodename]' part of xref cannam@167: % output. It's a separate macro only so it can be changed more easily, cannam@167: % since square brackets don't work well in some documents. Particularly cannam@167: % one that Bob is working on :). cannam@167: % cannam@167: \def\xrefprintnodename#1{[#1]} cannam@167: cannam@167: % Things referred to by \setref. cannam@167: % cannam@167: \def\Ynothing{} cannam@167: \def\Yomitfromtoc{} cannam@167: \def\Ynumbered{% cannam@167: \ifnum\secno=0 cannam@167: \putwordChapter@tie \the\chapno cannam@167: \else \ifnum\subsecno=0 cannam@167: \putwordSection@tie \the\chapno.\the\secno cannam@167: \else \ifnum\subsubsecno=0 cannam@167: \putwordSection@tie \the\chapno.\the\secno.\the\subsecno cannam@167: \else cannam@167: \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno cannam@167: \fi\fi\fi cannam@167: } cannam@167: \def\Yappendix{% cannam@167: \ifnum\secno=0 cannam@167: \putwordAppendix@tie @char\the\appendixno{}% cannam@167: \else \ifnum\subsecno=0 cannam@167: \putwordSection@tie @char\the\appendixno.\the\secno cannam@167: \else \ifnum\subsubsecno=0 cannam@167: \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno cannam@167: \else cannam@167: \putwordSection@tie cannam@167: @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno cannam@167: \fi\fi\fi cannam@167: } cannam@167: cannam@167: % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. cannam@167: % If its value is nonempty, SUFFIX is output afterward. cannam@167: % cannam@167: \def\refx#1#2{% cannam@167: {% cannam@167: \indexnofonts cannam@167: \otherbackslash cannam@167: \expandafter\global\expandafter\let\expandafter\thisrefX cannam@167: \csname XR#1\endcsname cannam@167: }% cannam@167: \ifx\thisrefX\relax cannam@167: % If not defined, say something at least. cannam@167: \angleleft un\-de\-fined\angleright cannam@167: \iflinks cannam@167: \ifhavexrefs cannam@167: {\toks0 = {#1}% avoid expansion of possibly-complex value cannam@167: \message{\linenumber Undefined cross reference `\the\toks0'.}}% cannam@167: \else cannam@167: \ifwarnedxrefs\else cannam@167: \global\warnedxrefstrue cannam@167: \message{Cross reference values unknown; you must run TeX again.}% cannam@167: \fi cannam@167: \fi cannam@167: \fi cannam@167: \else cannam@167: % It's defined, so just use it. cannam@167: \thisrefX cannam@167: \fi cannam@167: #2% Output the suffix in any case. cannam@167: } cannam@167: cannam@167: % This is the macro invoked by entries in the aux file. Usually it's cannam@167: % just a \def (we prepend XR to the control sequence name to avoid cannam@167: % collisions). But if this is a float type, we have more work to do. cannam@167: % cannam@167: \def\xrdef#1#2{% cannam@167: {% The node name might contain 8-bit characters, which in our current cannam@167: % implementation are changed to commands like @'e. Don't let these cannam@167: % mess up the control sequence name. cannam@167: \indexnofonts cannam@167: \turnoffactive cannam@167: \xdef\safexrefname{#1}% cannam@167: }% cannam@167: % cannam@167: \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref cannam@167: % cannam@167: % Was that xref control sequence that we just defined for a float? cannam@167: \expandafter\iffloat\csname XR\safexrefname\endcsname cannam@167: % it was a float, and we have the (safe) float type in \iffloattype. cannam@167: \expandafter\let\expandafter\floatlist cannam@167: \csname floatlist\iffloattype\endcsname cannam@167: % cannam@167: % Is this the first time we've seen this float type? cannam@167: \expandafter\ifx\floatlist\relax cannam@167: \toks0 = {\do}% yes, so just \do cannam@167: \else cannam@167: % had it before, so preserve previous elements in list. cannam@167: \toks0 = \expandafter{\floatlist\do}% cannam@167: \fi cannam@167: % cannam@167: % Remember this xref in the control sequence \floatlistFLOATTYPE, cannam@167: % for later use in \listoffloats. cannam@167: \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0 cannam@167: {\safexrefname}}% cannam@167: \fi cannam@167: } cannam@167: cannam@167: % Read the last existing aux file, if any. No error if none exists. cannam@167: % cannam@167: \def\tryauxfile{% cannam@167: \openin 1 \jobname.aux cannam@167: \ifeof 1 \else cannam@167: \readdatafile{aux}% cannam@167: \global\havexrefstrue cannam@167: \fi cannam@167: \closein 1 cannam@167: } cannam@167: cannam@167: \def\setupdatafile{% cannam@167: \catcode`\^^@=\other cannam@167: \catcode`\^^A=\other cannam@167: \catcode`\^^B=\other cannam@167: \catcode`\^^C=\other cannam@167: \catcode`\^^D=\other cannam@167: \catcode`\^^E=\other cannam@167: \catcode`\^^F=\other cannam@167: \catcode`\^^G=\other cannam@167: \catcode`\^^H=\other cannam@167: \catcode`\^^K=\other cannam@167: \catcode`\^^L=\other cannam@167: \catcode`\^^N=\other cannam@167: \catcode`\^^P=\other cannam@167: \catcode`\^^Q=\other cannam@167: \catcode`\^^R=\other cannam@167: \catcode`\^^S=\other cannam@167: \catcode`\^^T=\other cannam@167: \catcode`\^^U=\other cannam@167: \catcode`\^^V=\other cannam@167: \catcode`\^^W=\other cannam@167: \catcode`\^^X=\other cannam@167: \catcode`\^^Z=\other cannam@167: \catcode`\^^[=\other cannam@167: \catcode`\^^\=\other cannam@167: \catcode`\^^]=\other cannam@167: \catcode`\^^^=\other cannam@167: \catcode`\^^_=\other cannam@167: % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. cannam@167: % in xref tags, i.e., node names. But since ^^e4 notation isn't cannam@167: % supported in the main text, it doesn't seem desirable. Furthermore, cannam@167: % that is not enough: for node names that actually contain a ^ cannam@167: % character, we would end up writing a line like this: 'xrdef {'hat cannam@167: % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first cannam@167: % argument, and \hat is not an expandable control sequence. It could cannam@167: % all be worked out, but why? Either we support ^^ or we don't. cannam@167: % cannam@167: % The other change necessary for this was to define \auxhat: cannam@167: % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter cannam@167: % and then to call \auxhat in \setq. cannam@167: % cannam@167: \catcode`\^=\other cannam@167: % cannam@167: % Special characters. Should be turned off anyway, but... cannam@167: \catcode`\~=\other cannam@167: \catcode`\[=\other cannam@167: \catcode`\]=\other cannam@167: \catcode`\"=\other cannam@167: \catcode`\_=\other cannam@167: \catcode`\|=\other cannam@167: \catcode`\<=\other cannam@167: \catcode`\>=\other cannam@167: \catcode`\$=\other cannam@167: \catcode`\#=\other cannam@167: \catcode`\&=\other cannam@167: \catcode`\%=\other cannam@167: \catcode`+=\other % avoid \+ for paranoia even though we've turned it off cannam@167: % cannam@167: % This is to support \ in node names and titles, since the \ cannam@167: % characters end up in a \csname. It's easier than cannam@167: % leaving it active and making its active definition an actual \ cannam@167: % character. What I don't understand is why it works in the *value* cannam@167: % of the xrdef. Seems like it should be a catcode12 \, and that cannam@167: % should not typeset properly. But it works, so I'm moving on for cannam@167: % now. --karl, 15jan04. cannam@167: \catcode`\\=\other cannam@167: % cannam@167: % Make the characters 128-255 be printing characters. cannam@167: {% cannam@167: \count1=128 cannam@167: \def\loop{% cannam@167: \catcode\count1=\other cannam@167: \advance\count1 by 1 cannam@167: \ifnum \count1<256 \loop \fi cannam@167: }% cannam@167: }% cannam@167: % cannam@167: % @ is our escape character in .aux files, and we need braces. cannam@167: \catcode`\{=1 cannam@167: \catcode`\}=2 cannam@167: \catcode`\@=0 cannam@167: } cannam@167: cannam@167: \def\readdatafile#1{% cannam@167: \begingroup cannam@167: \setupdatafile cannam@167: \input\jobname.#1 cannam@167: \endgroup} cannam@167: cannam@167: cannam@167: \message{insertions,} cannam@167: % including footnotes. cannam@167: cannam@167: \newcount \footnoteno cannam@167: cannam@167: % The trailing space in the following definition for supereject is cannam@167: % vital for proper filling; pages come out unaligned when you do a cannam@167: % pagealignmacro call if that space before the closing brace is cannam@167: % removed. (Generally, numeric constants should always be followed by a cannam@167: % space to prevent strange expansion errors.) cannam@167: \def\supereject{\par\penalty -20000\footnoteno =0 } cannam@167: cannam@167: % @footnotestyle is meaningful for Info output only. cannam@167: \let\footnotestyle=\comment cannam@167: cannam@167: {\catcode `\@=11 cannam@167: % cannam@167: % Auto-number footnotes. Otherwise like plain. cannam@167: \gdef\footnote{% cannam@167: \let\indent=\ptexindent cannam@167: \let\noindent=\ptexnoindent cannam@167: \global\advance\footnoteno by \@ne cannam@167: \edef\thisfootno{$^{\the\footnoteno}$}% cannam@167: % cannam@167: % In case the footnote comes at the end of a sentence, preserve the cannam@167: % extra spacing after we do the footnote number. cannam@167: \let\@sf\empty cannam@167: \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi cannam@167: % cannam@167: % Remove inadvertent blank space before typesetting the footnote number. cannam@167: \unskip cannam@167: \thisfootno\@sf cannam@167: \dofootnote cannam@167: }% cannam@167: cannam@167: % Don't bother with the trickery in plain.tex to not require the cannam@167: % footnote text as a parameter. Our footnotes don't need to be so general. cannam@167: % cannam@167: % Oh yes, they do; otherwise, @ifset (and anything else that uses cannam@167: % \parseargline) fails inside footnotes because the tokens are fixed when cannam@167: % the footnote is read. --karl, 16nov96. cannam@167: % cannam@167: \gdef\dofootnote{% cannam@167: \insert\footins\bgroup cannam@167: % We want to typeset this text as a normal paragraph, even if the cannam@167: % footnote reference occurs in (for example) a display environment. cannam@167: % So reset some parameters. cannam@167: \hsize=\pagewidth cannam@167: \interlinepenalty\interfootnotelinepenalty cannam@167: \splittopskip\ht\strutbox % top baseline for broken footnotes cannam@167: \splitmaxdepth\dp\strutbox cannam@167: \floatingpenalty\@MM cannam@167: \leftskip\z@skip cannam@167: \rightskip\z@skip cannam@167: \spaceskip\z@skip cannam@167: \xspaceskip\z@skip cannam@167: \parindent\defaultparindent cannam@167: % cannam@167: \smallfonts \rm cannam@167: % cannam@167: % Because we use hanging indentation in footnotes, a @noindent appears cannam@167: % to exdent this text, so make it be a no-op. makeinfo does not use cannam@167: % hanging indentation so @noindent can still be needed within footnote cannam@167: % text after an @example or the like (not that this is good style). cannam@167: \let\noindent = \relax cannam@167: % cannam@167: % Hang the footnote text off the number. Use \everypar in case the cannam@167: % footnote extends for more than one paragraph. cannam@167: \everypar = {\hang}% cannam@167: \textindent{\thisfootno}% cannam@167: % cannam@167: % Don't crash into the line above the footnote text. Since this cannam@167: % expands into a box, it must come within the paragraph, lest it cannam@167: % provide a place where TeX can split the footnote. cannam@167: \footstrut cannam@167: % cannam@167: % Invoke rest of plain TeX footnote routine. cannam@167: \futurelet\next\fo@t cannam@167: } cannam@167: }%end \catcode `\@=11 cannam@167: cannam@167: % In case a @footnote appears in a vbox, save the footnote text and create cannam@167: % the real \insert just after the vbox finished. Otherwise, the insertion cannam@167: % would be lost. cannam@167: % Similarly, if a @footnote appears inside an alignment, save the footnote cannam@167: % text to a box and make the \insert when a row of the table is finished. cannam@167: % And the same can be done for other insert classes. --kasal, 16nov03. cannam@167: cannam@167: % Replace the \insert primitive by a cheating macro. cannam@167: % Deeper inside, just make sure that the saved insertions are not spilled cannam@167: % out prematurely. cannam@167: % cannam@167: \def\startsavinginserts{% cannam@167: \ifx \insert\ptexinsert cannam@167: \let\insert\saveinsert cannam@167: \else cannam@167: \let\checkinserts\relax cannam@167: \fi cannam@167: } cannam@167: cannam@167: % This \insert replacement works for both \insert\footins{foo} and cannam@167: % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. cannam@167: % cannam@167: \def\saveinsert#1{% cannam@167: \edef\next{\noexpand\savetobox \makeSAVEname#1}% cannam@167: \afterassignment\next cannam@167: % swallow the left brace cannam@167: \let\temp = cannam@167: } cannam@167: \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} cannam@167: \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} cannam@167: cannam@167: \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} cannam@167: cannam@167: \def\placesaveins#1{% cannam@167: \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname cannam@167: {\box#1}% cannam@167: } cannam@167: cannam@167: % eat @SAVE -- beware, all of them have catcode \other: cannam@167: { cannam@167: \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) cannam@167: \gdef\gobblesave @SAVE{} cannam@167: } cannam@167: cannam@167: % initialization: cannam@167: \def\newsaveins #1{% cannam@167: \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% cannam@167: \next cannam@167: } cannam@167: \def\newsaveinsX #1{% cannam@167: \csname newbox\endcsname #1% cannam@167: \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts cannam@167: \checksaveins #1}% cannam@167: } cannam@167: cannam@167: % initialize: cannam@167: \let\checkinserts\empty cannam@167: \newsaveins\footins cannam@167: \newsaveins\margin cannam@167: cannam@167: cannam@167: % @image. We use the macros from epsf.tex to support this. cannam@167: % If epsf.tex is not installed and @image is used, we complain. cannam@167: % cannam@167: % Check for and read epsf.tex up front. If we read it only at @image cannam@167: % time, we might be inside a group, and then its definitions would get cannam@167: % undone and the next image would fail. cannam@167: \openin 1 = epsf.tex cannam@167: \ifeof 1 \else cannam@167: % Do not bother showing banner with epsf.tex v2.7k (available in cannam@167: % doc/epsf.tex and on ctan). cannam@167: \def\epsfannounce{\toks0 = }% cannam@167: \input epsf.tex cannam@167: \fi cannam@167: \closein 1 cannam@167: % cannam@167: % We will only complain once about lack of epsf.tex. cannam@167: \newif\ifwarnednoepsf cannam@167: \newhelp\noepsfhelp{epsf.tex must be installed for images to cannam@167: work. It is also included in the Texinfo distribution, or you can get cannam@167: it from ftp://tug.org/tex/epsf.tex.} cannam@167: % cannam@167: \def\image#1{% cannam@167: \ifx\epsfbox\thisisundefined cannam@167: \ifwarnednoepsf \else cannam@167: \errhelp = \noepsfhelp cannam@167: \errmessage{epsf.tex not found, images will be ignored}% cannam@167: \global\warnednoepsftrue cannam@167: \fi cannam@167: \else cannam@167: \imagexxx #1,,,,,\finish cannam@167: \fi cannam@167: } cannam@167: % cannam@167: % Arguments to @image: cannam@167: % #1 is (mandatory) image filename; we tack on .eps extension. cannam@167: % #2 is (optional) width, #3 is (optional) height. cannam@167: % #4 is (ignored optional) html alt text. cannam@167: % #5 is (ignored optional) extension. cannam@167: % #6 is just the usual extra ignored arg for parsing stuff. cannam@167: \newif\ifimagevmode cannam@167: \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup cannam@167: \catcode`\^^M = 5 % in case we're inside an example cannam@167: \normalturnoffactive % allow _ et al. in names cannam@167: % If the image is by itself, center it. cannam@167: \ifvmode cannam@167: \imagevmodetrue cannam@167: \else \ifx\centersub\centerV cannam@167: % for @center @image, we need a vbox so we can have our vertical space cannam@167: \imagevmodetrue cannam@167: \vbox\bgroup % vbox has better behavior than vtop herev cannam@167: \fi\fi cannam@167: % cannam@167: \ifimagevmode cannam@167: \nobreak\medskip cannam@167: % Usually we'll have text after the image which will insert cannam@167: % \parskip glue, so insert it here too to equalize the space cannam@167: % above and below. cannam@167: \nobreak\vskip\parskip cannam@167: \nobreak cannam@167: \fi cannam@167: % cannam@167: % Leave vertical mode so that indentation from an enclosing cannam@167: % environment such as @quotation is respected. cannam@167: % However, if we're at the top level, we don't want the cannam@167: % normal paragraph indentation. cannam@167: % On the other hand, if we are in the case of @center @image, we don't cannam@167: % want to start a paragraph, which will create a hsize-width box and cannam@167: % eradicate the centering. cannam@167: \ifx\centersub\centerV\else \noindent \fi cannam@167: % cannam@167: % Output the image. cannam@167: \ifpdf cannam@167: \dopdfimage{#1}{#2}{#3}% cannam@167: \else cannam@167: % \epsfbox itself resets \epsf?size at each figure. cannam@167: \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi cannam@167: \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi cannam@167: \epsfbox{#1.eps}% cannam@167: \fi cannam@167: % cannam@167: \ifimagevmode cannam@167: \medskip % space after a standalone image cannam@167: \fi cannam@167: \ifx\centersub\centerV \egroup \fi cannam@167: \endgroup} cannam@167: cannam@167: cannam@167: % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, cannam@167: % etc. We don't actually implement floating yet, we always include the cannam@167: % float "here". But it seemed the best name for the future. cannam@167: % cannam@167: \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} cannam@167: cannam@167: % There may be a space before second and/or third parameter; delete it. cannam@167: \def\eatcommaspace#1, {#1,} cannam@167: cannam@167: % #1 is the optional FLOATTYPE, the text label for this float, typically cannam@167: % "Figure", "Table", "Example", etc. Can't contain commas. If omitted, cannam@167: % this float will not be numbered and cannot be referred to. cannam@167: % cannam@167: % #2 is the optional xref label. Also must be present for the float to cannam@167: % be referable. cannam@167: % cannam@167: % #3 is the optional positioning argument; for now, it is ignored. It cannam@167: % will somehow specify the positions allowed to float to (here, top, bottom). cannam@167: % cannam@167: % We keep a separate counter for each FLOATTYPE, which we reset at each cannam@167: % chapter-level command. cannam@167: \let\resetallfloatnos=\empty cannam@167: % cannam@167: \def\dofloat#1,#2,#3,#4\finish{% cannam@167: \let\thiscaption=\empty cannam@167: \let\thisshortcaption=\empty cannam@167: % cannam@167: % don't lose footnotes inside @float. cannam@167: % cannam@167: % BEWARE: when the floats start float, we have to issue warning whenever an cannam@167: % insert appears inside a float which could possibly float. --kasal, 26may04 cannam@167: % cannam@167: \startsavinginserts cannam@167: % cannam@167: % We can't be used inside a paragraph. cannam@167: \par cannam@167: % cannam@167: \vtop\bgroup cannam@167: \def\floattype{#1}% cannam@167: \def\floatlabel{#2}% cannam@167: \def\floatloc{#3}% we do nothing with this yet. cannam@167: % cannam@167: \ifx\floattype\empty cannam@167: \let\safefloattype=\empty cannam@167: \else cannam@167: {% cannam@167: % the floattype might have accents or other special characters, cannam@167: % but we need to use it in a control sequence name. cannam@167: \indexnofonts cannam@167: \turnoffactive cannam@167: \xdef\safefloattype{\floattype}% cannam@167: }% cannam@167: \fi cannam@167: % cannam@167: % If label is given but no type, we handle that as the empty type. cannam@167: \ifx\floatlabel\empty \else cannam@167: % We want each FLOATTYPE to be numbered separately (Figure 1, cannam@167: % Table 1, Figure 2, ...). (And if no label, no number.) cannam@167: % cannam@167: \expandafter\getfloatno\csname\safefloattype floatno\endcsname cannam@167: \global\advance\floatno by 1 cannam@167: % cannam@167: {% cannam@167: % This magic value for \lastsection is output by \setref as the cannam@167: % XREFLABEL-title value. \xrefX uses it to distinguish float cannam@167: % labels (which have a completely different output format) from cannam@167: % node and anchor labels. And \xrdef uses it to construct the cannam@167: % lists of floats. cannam@167: % cannam@167: \edef\lastsection{\floatmagic=\safefloattype}% cannam@167: \setref{\floatlabel}{Yfloat}% cannam@167: }% cannam@167: \fi cannam@167: % cannam@167: % start with \parskip glue, I guess. cannam@167: \vskip\parskip cannam@167: % cannam@167: % Don't suppress indentation if a float happens to start a section. cannam@167: \restorefirstparagraphindent cannam@167: } cannam@167: cannam@167: % we have these possibilities: cannam@167: % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap cannam@167: % @float Foo,lbl & no caption: Foo 1.1 cannam@167: % @float Foo & @caption{Cap}: Foo: Cap cannam@167: % @float Foo & no caption: Foo cannam@167: % @float ,lbl & Caption{Cap}: 1.1: Cap cannam@167: % @float ,lbl & no caption: 1.1 cannam@167: % @float & @caption{Cap}: Cap cannam@167: % @float & no caption: cannam@167: % cannam@167: \def\Efloat{% cannam@167: \let\floatident = \empty cannam@167: % cannam@167: % In all cases, if we have a float type, it comes first. cannam@167: \ifx\floattype\empty \else \def\floatident{\floattype}\fi cannam@167: % cannam@167: % If we have an xref label, the number comes next. cannam@167: \ifx\floatlabel\empty \else cannam@167: \ifx\floattype\empty \else % if also had float type, need tie first. cannam@167: \appendtomacro\floatident{\tie}% cannam@167: \fi cannam@167: % the number. cannam@167: \appendtomacro\floatident{\chaplevelprefix\the\floatno}% cannam@167: \fi cannam@167: % cannam@167: % Start the printed caption with what we've constructed in cannam@167: % \floatident, but keep it separate; we need \floatident again. cannam@167: \let\captionline = \floatident cannam@167: % cannam@167: \ifx\thiscaption\empty \else cannam@167: \ifx\floatident\empty \else cannam@167: \appendtomacro\captionline{: }% had ident, so need a colon between cannam@167: \fi cannam@167: % cannam@167: % caption text. cannam@167: \appendtomacro\captionline{\scanexp\thiscaption}% cannam@167: \fi cannam@167: % cannam@167: % If we have anything to print, print it, with space before. cannam@167: % Eventually this needs to become an \insert. cannam@167: \ifx\captionline\empty \else cannam@167: \vskip.5\parskip cannam@167: \captionline cannam@167: % cannam@167: % Space below caption. cannam@167: \vskip\parskip cannam@167: \fi cannam@167: % cannam@167: % If have an xref label, write the list of floats info. Do this cannam@167: % after the caption, to avoid chance of it being a breakpoint. cannam@167: \ifx\floatlabel\empty \else cannam@167: % Write the text that goes in the lof to the aux file as cannam@167: % \floatlabel-lof. Besides \floatident, we include the short cannam@167: % caption if specified, else the full caption if specified, else nothing. cannam@167: {% cannam@167: \atdummies cannam@167: % cannam@167: % since we read the caption text in the macro world, where ^^M cannam@167: % is turned into a normal character, we have to scan it back, so cannam@167: % we don't write the literal three characters "^^M" into the aux file. cannam@167: \scanexp{% cannam@167: \xdef\noexpand\gtemp{% cannam@167: \ifx\thisshortcaption\empty cannam@167: \thiscaption cannam@167: \else cannam@167: \thisshortcaption cannam@167: \fi cannam@167: }% cannam@167: }% cannam@167: \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident cannam@167: \ifx\gtemp\empty \else : \gtemp \fi}}% cannam@167: }% cannam@167: \fi cannam@167: \egroup % end of \vtop cannam@167: % cannam@167: % place the captured inserts cannam@167: % cannam@167: % BEWARE: when the floats start floating, we have to issue warning cannam@167: % whenever an insert appears inside a float which could possibly cannam@167: % float. --kasal, 26may04 cannam@167: % cannam@167: \checkinserts cannam@167: } cannam@167: cannam@167: % Append the tokens #2 to the definition of macro #1, not expanding either. cannam@167: % cannam@167: \def\appendtomacro#1#2{% cannam@167: \expandafter\def\expandafter#1\expandafter{#1#2}% cannam@167: } cannam@167: cannam@167: % @caption, @shortcaption cannam@167: % cannam@167: \def\caption{\docaption\thiscaption} cannam@167: \def\shortcaption{\docaption\thisshortcaption} cannam@167: \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} cannam@167: \def\defcaption#1#2{\egroup \def#1{#2}} cannam@167: cannam@167: % The parameter is the control sequence identifying the counter we are cannam@167: % going to use. Create it if it doesn't exist and assign it to \floatno. cannam@167: \def\getfloatno#1{% cannam@167: \ifx#1\relax cannam@167: % Haven't seen this figure type before. cannam@167: \csname newcount\endcsname #1% cannam@167: % cannam@167: % Remember to reset this floatno at the next chap. cannam@167: \expandafter\gdef\expandafter\resetallfloatnos cannam@167: \expandafter{\resetallfloatnos #1=0 }% cannam@167: \fi cannam@167: \let\floatno#1% cannam@167: } cannam@167: cannam@167: % \setref calls this to get the XREFLABEL-snt value. We want an @xref cannam@167: % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we cannam@167: % first read the @float command. cannam@167: % cannam@167: \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% cannam@167: cannam@167: % Magic string used for the XREFLABEL-title value, so \xrefX can cannam@167: % distinguish floats from other xref types. cannam@167: \def\floatmagic{!!float!!} cannam@167: cannam@167: % #1 is the control sequence we are passed; we expand into a conditional cannam@167: % which is true if #1 represents a float ref. That is, the magic cannam@167: % \lastsection value which we \setref above. cannam@167: % cannam@167: \def\iffloat#1{\expandafter\doiffloat#1==\finish} cannam@167: % cannam@167: % #1 is (maybe) the \floatmagic string. If so, #2 will be the cannam@167: % (safe) float type for this float. We set \iffloattype to #2. cannam@167: % cannam@167: \def\doiffloat#1=#2=#3\finish{% cannam@167: \def\temp{#1}% cannam@167: \def\iffloattype{#2}% cannam@167: \ifx\temp\floatmagic cannam@167: } cannam@167: cannam@167: % @listoffloats FLOATTYPE - print a list of floats like a table of contents. cannam@167: % cannam@167: \parseargdef\listoffloats{% cannam@167: \def\floattype{#1}% floattype cannam@167: {% cannam@167: % the floattype might have accents or other special characters, cannam@167: % but we need to use it in a control sequence name. cannam@167: \indexnofonts cannam@167: \turnoffactive cannam@167: \xdef\safefloattype{\floattype}% cannam@167: }% cannam@167: % cannam@167: % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. cannam@167: \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax cannam@167: \ifhavexrefs cannam@167: % if the user said @listoffloats foo but never @float foo. cannam@167: \message{\linenumber No `\safefloattype' floats to list.}% cannam@167: \fi cannam@167: \else cannam@167: \begingroup cannam@167: \leftskip=\tocindent % indent these entries like a toc cannam@167: \let\do=\listoffloatsdo cannam@167: \csname floatlist\safefloattype\endcsname cannam@167: \endgroup cannam@167: \fi cannam@167: } cannam@167: cannam@167: % This is called on each entry in a list of floats. We're passed the cannam@167: % xref label, in the form LABEL-title, which is how we save it in the cannam@167: % aux file. We strip off the -title and look up \XRLABEL-lof, which cannam@167: % has the text we're supposed to typeset here. cannam@167: % cannam@167: % Figures without xref labels will not be included in the list (since cannam@167: % they won't appear in the aux file). cannam@167: % cannam@167: \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} cannam@167: \def\listoffloatsdoentry#1-title\finish{{% cannam@167: % Can't fully expand XR#1-lof because it can contain anything. Just cannam@167: % pass the control sequence. On the other hand, XR#1-pg is just the cannam@167: % page number, and we want to fully expand that so we can get a link cannam@167: % in pdf output. cannam@167: \toksA = \expandafter{\csname XR#1-lof\endcsname}% cannam@167: % cannam@167: % use the same \entry macro we use to generate the TOC and index. cannam@167: \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% cannam@167: \writeentry cannam@167: }} cannam@167: cannam@167: cannam@167: \message{localization,} cannam@167: cannam@167: % For single-language documents, @documentlanguage is usually given very cannam@167: % early, just after @documentencoding. Single argument is the language cannam@167: % (de) or locale (de_DE) abbreviation. cannam@167: % cannam@167: { cannam@167: \catcode`\_ = \active cannam@167: \globaldefs=1 cannam@167: \parseargdef\documentlanguage{\begingroup cannam@167: \let_=\normalunderscore % normal _ character for filenames cannam@167: \tex % read txi-??.tex file in plain TeX. cannam@167: % Read the file by the name they passed if it exists. cannam@167: \openin 1 txi-#1.tex cannam@167: \ifeof 1 cannam@167: \documentlanguagetrywithoutunderscore{#1_\finish}% cannam@167: \else cannam@167: \globaldefs = 1 % everything in the txi-LL files needs to persist cannam@167: \input txi-#1.tex cannam@167: \fi cannam@167: \closein 1 cannam@167: \endgroup % end raw TeX cannam@167: \endgroup} cannam@167: % cannam@167: % If they passed de_DE, and txi-de_DE.tex doesn't exist, cannam@167: % try txi-de.tex. cannam@167: % cannam@167: \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{% cannam@167: \openin 1 txi-#1.tex cannam@167: \ifeof 1 cannam@167: \errhelp = \nolanghelp cannam@167: \errmessage{Cannot read language file txi-#1.tex}% cannam@167: \else cannam@167: \globaldefs = 1 % everything in the txi-LL files needs to persist cannam@167: \input txi-#1.tex cannam@167: \fi cannam@167: \closein 1 cannam@167: } cannam@167: }% end of special _ catcode cannam@167: % cannam@167: \newhelp\nolanghelp{The given language definition file cannot be found or cannam@167: is empty. Maybe you need to install it? Putting it in the current cannam@167: directory should work if nowhere else does.} cannam@167: cannam@167: % This macro is called from txi-??.tex files; the first argument is the cannam@167: % \language name to set (without the "\lang@" prefix), the second and cannam@167: % third args are \{left,right}hyphenmin. cannam@167: % cannam@167: % The language names to pass are determined when the format is built. cannam@167: % See the etex.log file created at that time, e.g., cannam@167: % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log. cannam@167: % cannam@167: % With TeX Live 2008, etex now includes hyphenation patterns for all cannam@167: % available languages. This means we can support hyphenation in cannam@167: % Texinfo, at least to some extent. (This still doesn't solve the cannam@167: % accented characters problem.) cannam@167: % cannam@167: \catcode`@=11 cannam@167: \def\txisetlanguage#1#2#3{% cannam@167: % do not set the language if the name is undefined in the current TeX. cannam@167: \expandafter\ifx\csname lang@#1\endcsname \relax cannam@167: \message{no patterns for #1}% cannam@167: \else cannam@167: \global\language = \csname lang@#1\endcsname cannam@167: \fi cannam@167: % but there is no harm in adjusting the hyphenmin values regardless. cannam@167: \global\lefthyphenmin = #2\relax cannam@167: \global\righthyphenmin = #3\relax cannam@167: } cannam@167: cannam@167: % Helpers for encodings. cannam@167: % Set the catcode of characters 128 through 255 to the specified number. cannam@167: % cannam@167: \def\setnonasciicharscatcode#1{% cannam@167: \count255=128 cannam@167: \loop\ifnum\count255<256 cannam@167: \global\catcode\count255=#1\relax cannam@167: \advance\count255 by 1 cannam@167: \repeat cannam@167: } cannam@167: cannam@167: \def\setnonasciicharscatcodenonglobal#1{% cannam@167: \count255=128 cannam@167: \loop\ifnum\count255<256 cannam@167: \catcode\count255=#1\relax cannam@167: \advance\count255 by 1 cannam@167: \repeat cannam@167: } cannam@167: cannam@167: % @documentencoding sets the definition of non-ASCII characters cannam@167: % according to the specified encoding. cannam@167: % cannam@167: \parseargdef\documentencoding{% cannam@167: % Encoding being declared for the document. cannam@167: \def\declaredencoding{\csname #1.enc\endcsname}% cannam@167: % cannam@167: % Supported encodings: names converted to tokens in order to be able cannam@167: % to compare them with \ifx. cannam@167: \def\ascii{\csname US-ASCII.enc\endcsname}% cannam@167: \def\latnine{\csname ISO-8859-15.enc\endcsname}% cannam@167: \def\latone{\csname ISO-8859-1.enc\endcsname}% cannam@167: \def\lattwo{\csname ISO-8859-2.enc\endcsname}% cannam@167: \def\utfeight{\csname UTF-8.enc\endcsname}% cannam@167: % cannam@167: \ifx \declaredencoding \ascii cannam@167: \asciichardefs cannam@167: % cannam@167: \else \ifx \declaredencoding \lattwo cannam@167: \setnonasciicharscatcode\active cannam@167: \lattwochardefs cannam@167: % cannam@167: \else \ifx \declaredencoding \latone cannam@167: \setnonasciicharscatcode\active cannam@167: \latonechardefs cannam@167: % cannam@167: \else \ifx \declaredencoding \latnine cannam@167: \setnonasciicharscatcode\active cannam@167: \latninechardefs cannam@167: % cannam@167: \else \ifx \declaredencoding \utfeight cannam@167: \setnonasciicharscatcode\active cannam@167: \utfeightchardefs cannam@167: % cannam@167: \else cannam@167: \message{Unknown document encoding #1, ignoring.}% cannam@167: % cannam@167: \fi % utfeight cannam@167: \fi % latnine cannam@167: \fi % latone cannam@167: \fi % lattwo cannam@167: \fi % ascii cannam@167: } cannam@167: cannam@167: % A message to be logged when using a character that isn't available cannam@167: % the default font encoding (OT1). cannam@167: % cannam@167: \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} cannam@167: cannam@167: % Take account of \c (plain) vs. \, (Texinfo) difference. cannam@167: \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi} cannam@167: cannam@167: % First, make active non-ASCII characters in order for them to be cannam@167: % correctly categorized when TeX reads the replacement text of cannam@167: % macros containing the character definitions. cannam@167: \setnonasciicharscatcode\active cannam@167: % cannam@167: % Latin1 (ISO-8859-1) character definitions. cannam@167: \def\latonechardefs{% cannam@167: \gdef^^a0{\tie} cannam@167: \gdef^^a1{\exclamdown} cannam@167: \gdef^^a2{\missingcharmsg{CENT SIGN}} cannam@167: \gdef^^a3{{\pounds}} cannam@167: \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} cannam@167: \gdef^^a5{\missingcharmsg{YEN SIGN}} cannam@167: \gdef^^a6{\missingcharmsg{BROKEN BAR}} cannam@167: \gdef^^a7{\S} cannam@167: \gdef^^a8{\"{}} cannam@167: \gdef^^a9{\copyright} cannam@167: \gdef^^aa{\ordf} cannam@167: \gdef^^ab{\guillemetleft} cannam@167: \gdef^^ac{$\lnot$} cannam@167: \gdef^^ad{\-} cannam@167: \gdef^^ae{\registeredsymbol} cannam@167: \gdef^^af{\={}} cannam@167: % cannam@167: \gdef^^b0{\textdegree} cannam@167: \gdef^^b1{$\pm$} cannam@167: \gdef^^b2{$^2$} cannam@167: \gdef^^b3{$^3$} cannam@167: \gdef^^b4{\'{}} cannam@167: \gdef^^b5{$\mu$} cannam@167: \gdef^^b6{\P} cannam@167: % cannam@167: \gdef^^b7{$^.$} cannam@167: \gdef^^b8{\cedilla\ } cannam@167: \gdef^^b9{$^1$} cannam@167: \gdef^^ba{\ordm} cannam@167: % cannam@167: \gdef^^bb{\guillemetright} cannam@167: \gdef^^bc{$1\over4$} cannam@167: \gdef^^bd{$1\over2$} cannam@167: \gdef^^be{$3\over4$} cannam@167: \gdef^^bf{\questiondown} cannam@167: % cannam@167: \gdef^^c0{\`A} cannam@167: \gdef^^c1{\'A} cannam@167: \gdef^^c2{\^A} cannam@167: \gdef^^c3{\~A} cannam@167: \gdef^^c4{\"A} cannam@167: \gdef^^c5{\ringaccent A} cannam@167: \gdef^^c6{\AE} cannam@167: \gdef^^c7{\cedilla C} cannam@167: \gdef^^c8{\`E} cannam@167: \gdef^^c9{\'E} cannam@167: \gdef^^ca{\^E} cannam@167: \gdef^^cb{\"E} cannam@167: \gdef^^cc{\`I} cannam@167: \gdef^^cd{\'I} cannam@167: \gdef^^ce{\^I} cannam@167: \gdef^^cf{\"I} cannam@167: % cannam@167: \gdef^^d0{\DH} cannam@167: \gdef^^d1{\~N} cannam@167: \gdef^^d2{\`O} cannam@167: \gdef^^d3{\'O} cannam@167: \gdef^^d4{\^O} cannam@167: \gdef^^d5{\~O} cannam@167: \gdef^^d6{\"O} cannam@167: \gdef^^d7{$\times$} cannam@167: \gdef^^d8{\O} cannam@167: \gdef^^d9{\`U} cannam@167: \gdef^^da{\'U} cannam@167: \gdef^^db{\^U} cannam@167: \gdef^^dc{\"U} cannam@167: \gdef^^dd{\'Y} cannam@167: \gdef^^de{\TH} cannam@167: \gdef^^df{\ss} cannam@167: % cannam@167: \gdef^^e0{\`a} cannam@167: \gdef^^e1{\'a} cannam@167: \gdef^^e2{\^a} cannam@167: \gdef^^e3{\~a} cannam@167: \gdef^^e4{\"a} cannam@167: \gdef^^e5{\ringaccent a} cannam@167: \gdef^^e6{\ae} cannam@167: \gdef^^e7{\cedilla c} cannam@167: \gdef^^e8{\`e} cannam@167: \gdef^^e9{\'e} cannam@167: \gdef^^ea{\^e} cannam@167: \gdef^^eb{\"e} cannam@167: \gdef^^ec{\`{\dotless i}} cannam@167: \gdef^^ed{\'{\dotless i}} cannam@167: \gdef^^ee{\^{\dotless i}} cannam@167: \gdef^^ef{\"{\dotless i}} cannam@167: % cannam@167: \gdef^^f0{\dh} cannam@167: \gdef^^f1{\~n} cannam@167: \gdef^^f2{\`o} cannam@167: \gdef^^f3{\'o} cannam@167: \gdef^^f4{\^o} cannam@167: \gdef^^f5{\~o} cannam@167: \gdef^^f6{\"o} cannam@167: \gdef^^f7{$\div$} cannam@167: \gdef^^f8{\o} cannam@167: \gdef^^f9{\`u} cannam@167: \gdef^^fa{\'u} cannam@167: \gdef^^fb{\^u} cannam@167: \gdef^^fc{\"u} cannam@167: \gdef^^fd{\'y} cannam@167: \gdef^^fe{\th} cannam@167: \gdef^^ff{\"y} cannam@167: } cannam@167: cannam@167: % Latin9 (ISO-8859-15) encoding character definitions. cannam@167: \def\latninechardefs{% cannam@167: % Encoding is almost identical to Latin1. cannam@167: \latonechardefs cannam@167: % cannam@167: \gdef^^a4{\euro} cannam@167: \gdef^^a6{\v S} cannam@167: \gdef^^a8{\v s} cannam@167: \gdef^^b4{\v Z} cannam@167: \gdef^^b8{\v z} cannam@167: \gdef^^bc{\OE} cannam@167: \gdef^^bd{\oe} cannam@167: \gdef^^be{\"Y} cannam@167: } cannam@167: cannam@167: % Latin2 (ISO-8859-2) character definitions. cannam@167: \def\lattwochardefs{% cannam@167: \gdef^^a0{\tie} cannam@167: \gdef^^a1{\ogonek{A}} cannam@167: \gdef^^a2{\u{}} cannam@167: \gdef^^a3{\L} cannam@167: \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} cannam@167: \gdef^^a5{\v L} cannam@167: \gdef^^a6{\'S} cannam@167: \gdef^^a7{\S} cannam@167: \gdef^^a8{\"{}} cannam@167: \gdef^^a9{\v S} cannam@167: \gdef^^aa{\cedilla S} cannam@167: \gdef^^ab{\v T} cannam@167: \gdef^^ac{\'Z} cannam@167: \gdef^^ad{\-} cannam@167: \gdef^^ae{\v Z} cannam@167: \gdef^^af{\dotaccent Z} cannam@167: % cannam@167: \gdef^^b0{\textdegree} cannam@167: \gdef^^b1{\ogonek{a}} cannam@167: \gdef^^b2{\ogonek{ }} cannam@167: \gdef^^b3{\l} cannam@167: \gdef^^b4{\'{}} cannam@167: \gdef^^b5{\v l} cannam@167: \gdef^^b6{\'s} cannam@167: \gdef^^b7{\v{}} cannam@167: \gdef^^b8{\cedilla\ } cannam@167: \gdef^^b9{\v s} cannam@167: \gdef^^ba{\cedilla s} cannam@167: \gdef^^bb{\v t} cannam@167: \gdef^^bc{\'z} cannam@167: \gdef^^bd{\H{}} cannam@167: \gdef^^be{\v z} cannam@167: \gdef^^bf{\dotaccent z} cannam@167: % cannam@167: \gdef^^c0{\'R} cannam@167: \gdef^^c1{\'A} cannam@167: \gdef^^c2{\^A} cannam@167: \gdef^^c3{\u A} cannam@167: \gdef^^c4{\"A} cannam@167: \gdef^^c5{\'L} cannam@167: \gdef^^c6{\'C} cannam@167: \gdef^^c7{\cedilla C} cannam@167: \gdef^^c8{\v C} cannam@167: \gdef^^c9{\'E} cannam@167: \gdef^^ca{\ogonek{E}} cannam@167: \gdef^^cb{\"E} cannam@167: \gdef^^cc{\v E} cannam@167: \gdef^^cd{\'I} cannam@167: \gdef^^ce{\^I} cannam@167: \gdef^^cf{\v D} cannam@167: % cannam@167: \gdef^^d0{\DH} cannam@167: \gdef^^d1{\'N} cannam@167: \gdef^^d2{\v N} cannam@167: \gdef^^d3{\'O} cannam@167: \gdef^^d4{\^O} cannam@167: \gdef^^d5{\H O} cannam@167: \gdef^^d6{\"O} cannam@167: \gdef^^d7{$\times$} cannam@167: \gdef^^d8{\v R} cannam@167: \gdef^^d9{\ringaccent U} cannam@167: \gdef^^da{\'U} cannam@167: \gdef^^db{\H U} cannam@167: \gdef^^dc{\"U} cannam@167: \gdef^^dd{\'Y} cannam@167: \gdef^^de{\cedilla T} cannam@167: \gdef^^df{\ss} cannam@167: % cannam@167: \gdef^^e0{\'r} cannam@167: \gdef^^e1{\'a} cannam@167: \gdef^^e2{\^a} cannam@167: \gdef^^e3{\u a} cannam@167: \gdef^^e4{\"a} cannam@167: \gdef^^e5{\'l} cannam@167: \gdef^^e6{\'c} cannam@167: \gdef^^e7{\cedilla c} cannam@167: \gdef^^e8{\v c} cannam@167: \gdef^^e9{\'e} cannam@167: \gdef^^ea{\ogonek{e}} cannam@167: \gdef^^eb{\"e} cannam@167: \gdef^^ec{\v e} cannam@167: \gdef^^ed{\'{\dotless{i}}} cannam@167: \gdef^^ee{\^{\dotless{i}}} cannam@167: \gdef^^ef{\v d} cannam@167: % cannam@167: \gdef^^f0{\dh} cannam@167: \gdef^^f1{\'n} cannam@167: \gdef^^f2{\v n} cannam@167: \gdef^^f3{\'o} cannam@167: \gdef^^f4{\^o} cannam@167: \gdef^^f5{\H o} cannam@167: \gdef^^f6{\"o} cannam@167: \gdef^^f7{$\div$} cannam@167: \gdef^^f8{\v r} cannam@167: \gdef^^f9{\ringaccent u} cannam@167: \gdef^^fa{\'u} cannam@167: \gdef^^fb{\H u} cannam@167: \gdef^^fc{\"u} cannam@167: \gdef^^fd{\'y} cannam@167: \gdef^^fe{\cedilla t} cannam@167: \gdef^^ff{\dotaccent{}} cannam@167: } cannam@167: cannam@167: % UTF-8 character definitions. cannam@167: % cannam@167: % This code to support UTF-8 is based on LaTeX's utf8.def, with some cannam@167: % changes for Texinfo conventions. It is included here under the GPL by cannam@167: % permission from Frank Mittelbach and the LaTeX team. cannam@167: % cannam@167: \newcount\countUTFx cannam@167: \newcount\countUTFy cannam@167: \newcount\countUTFz cannam@167: cannam@167: \gdef\UTFviiiTwoOctets#1#2{\expandafter cannam@167: \UTFviiiDefined\csname u8:#1\string #2\endcsname} cannam@167: % cannam@167: \gdef\UTFviiiThreeOctets#1#2#3{\expandafter cannam@167: \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname} cannam@167: % cannam@167: \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter cannam@167: \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname} cannam@167: cannam@167: \gdef\UTFviiiDefined#1{% cannam@167: \ifx #1\relax cannam@167: \message{\linenumber Unicode char \string #1 not defined for Texinfo}% cannam@167: \else cannam@167: \expandafter #1% cannam@167: \fi cannam@167: } cannam@167: cannam@167: \begingroup cannam@167: \catcode`\~13 cannam@167: \catcode`\"12 cannam@167: cannam@167: \def\UTFviiiLoop{% cannam@167: \global\catcode\countUTFx\active cannam@167: \uccode`\~\countUTFx cannam@167: \uppercase\expandafter{\UTFviiiTmp}% cannam@167: \advance\countUTFx by 1 cannam@167: \ifnum\countUTFx < \countUTFy cannam@167: \expandafter\UTFviiiLoop cannam@167: \fi} cannam@167: cannam@167: \countUTFx = "C2 cannam@167: \countUTFy = "E0 cannam@167: \def\UTFviiiTmp{% cannam@167: \xdef~{\noexpand\UTFviiiTwoOctets\string~}} cannam@167: \UTFviiiLoop cannam@167: cannam@167: \countUTFx = "E0 cannam@167: \countUTFy = "F0 cannam@167: \def\UTFviiiTmp{% cannam@167: \xdef~{\noexpand\UTFviiiThreeOctets\string~}} cannam@167: \UTFviiiLoop cannam@167: cannam@167: \countUTFx = "F0 cannam@167: \countUTFy = "F4 cannam@167: \def\UTFviiiTmp{% cannam@167: \xdef~{\noexpand\UTFviiiFourOctets\string~}} cannam@167: \UTFviiiLoop cannam@167: \endgroup cannam@167: cannam@167: \begingroup cannam@167: \catcode`\"=12 cannam@167: \catcode`\<=12 cannam@167: \catcode`\.=12 cannam@167: \catcode`\,=12 cannam@167: \catcode`\;=12 cannam@167: \catcode`\!=12 cannam@167: \catcode`\~=13 cannam@167: cannam@167: \gdef\DeclareUnicodeCharacter#1#2{% cannam@167: \countUTFz = "#1\relax cannam@167: %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% cannam@167: \begingroup cannam@167: \parseXMLCharref cannam@167: \def\UTFviiiTwoOctets##1##2{% cannam@167: \csname u8:##1\string ##2\endcsname}% cannam@167: \def\UTFviiiThreeOctets##1##2##3{% cannam@167: \csname u8:##1\string ##2\string ##3\endcsname}% cannam@167: \def\UTFviiiFourOctets##1##2##3##4{% cannam@167: \csname u8:##1\string ##2\string ##3\string ##4\endcsname}% cannam@167: \expandafter\expandafter\expandafter\expandafter cannam@167: \expandafter\expandafter\expandafter cannam@167: \gdef\UTFviiiTmp{#2}% cannam@167: \endgroup} cannam@167: cannam@167: \gdef\parseXMLCharref{% cannam@167: \ifnum\countUTFz < "A0\relax cannam@167: \errhelp = \EMsimple cannam@167: \errmessage{Cannot define Unicode char value < 00A0}% cannam@167: \else\ifnum\countUTFz < "800\relax cannam@167: \parseUTFviiiA,% cannam@167: \parseUTFviiiB C\UTFviiiTwoOctets.,% cannam@167: \else\ifnum\countUTFz < "10000\relax cannam@167: \parseUTFviiiA;% cannam@167: \parseUTFviiiA,% cannam@167: \parseUTFviiiB E\UTFviiiThreeOctets.{,;}% cannam@167: \else cannam@167: \parseUTFviiiA;% cannam@167: \parseUTFviiiA,% cannam@167: \parseUTFviiiA!% cannam@167: \parseUTFviiiB F\UTFviiiFourOctets.{!,;}% cannam@167: \fi\fi\fi cannam@167: } cannam@167: cannam@167: \gdef\parseUTFviiiA#1{% cannam@167: \countUTFx = \countUTFz cannam@167: \divide\countUTFz by 64 cannam@167: \countUTFy = \countUTFz cannam@167: \multiply\countUTFz by 64 cannam@167: \advance\countUTFx by -\countUTFz cannam@167: \advance\countUTFx by 128 cannam@167: \uccode `#1\countUTFx cannam@167: \countUTFz = \countUTFy} cannam@167: cannam@167: \gdef\parseUTFviiiB#1#2#3#4{% cannam@167: \advance\countUTFz by "#10\relax cannam@167: \uccode `#3\countUTFz cannam@167: \uppercase{\gdef\UTFviiiTmp{#2#3#4}}} cannam@167: \endgroup cannam@167: cannam@167: \def\utfeightchardefs{% cannam@167: \DeclareUnicodeCharacter{00A0}{\tie} cannam@167: \DeclareUnicodeCharacter{00A1}{\exclamdown} cannam@167: \DeclareUnicodeCharacter{00A3}{\pounds} cannam@167: \DeclareUnicodeCharacter{00A8}{\"{ }} cannam@167: \DeclareUnicodeCharacter{00A9}{\copyright} cannam@167: \DeclareUnicodeCharacter{00AA}{\ordf} cannam@167: \DeclareUnicodeCharacter{00AB}{\guillemetleft} cannam@167: \DeclareUnicodeCharacter{00AD}{\-} cannam@167: \DeclareUnicodeCharacter{00AE}{\registeredsymbol} cannam@167: \DeclareUnicodeCharacter{00AF}{\={ }} cannam@167: cannam@167: \DeclareUnicodeCharacter{00B0}{\ringaccent{ }} cannam@167: \DeclareUnicodeCharacter{00B4}{\'{ }} cannam@167: \DeclareUnicodeCharacter{00B8}{\cedilla{ }} cannam@167: \DeclareUnicodeCharacter{00BA}{\ordm} cannam@167: \DeclareUnicodeCharacter{00BB}{\guillemetright} cannam@167: \DeclareUnicodeCharacter{00BF}{\questiondown} cannam@167: cannam@167: \DeclareUnicodeCharacter{00C0}{\`A} cannam@167: \DeclareUnicodeCharacter{00C1}{\'A} cannam@167: \DeclareUnicodeCharacter{00C2}{\^A} cannam@167: \DeclareUnicodeCharacter{00C3}{\~A} cannam@167: \DeclareUnicodeCharacter{00C4}{\"A} cannam@167: \DeclareUnicodeCharacter{00C5}{\AA} cannam@167: \DeclareUnicodeCharacter{00C6}{\AE} cannam@167: \DeclareUnicodeCharacter{00C7}{\cedilla{C}} cannam@167: \DeclareUnicodeCharacter{00C8}{\`E} cannam@167: \DeclareUnicodeCharacter{00C9}{\'E} cannam@167: \DeclareUnicodeCharacter{00CA}{\^E} cannam@167: \DeclareUnicodeCharacter{00CB}{\"E} cannam@167: \DeclareUnicodeCharacter{00CC}{\`I} cannam@167: \DeclareUnicodeCharacter{00CD}{\'I} cannam@167: \DeclareUnicodeCharacter{00CE}{\^I} cannam@167: \DeclareUnicodeCharacter{00CF}{\"I} cannam@167: cannam@167: \DeclareUnicodeCharacter{00D0}{\DH} cannam@167: \DeclareUnicodeCharacter{00D1}{\~N} cannam@167: \DeclareUnicodeCharacter{00D2}{\`O} cannam@167: \DeclareUnicodeCharacter{00D3}{\'O} cannam@167: \DeclareUnicodeCharacter{00D4}{\^O} cannam@167: \DeclareUnicodeCharacter{00D5}{\~O} cannam@167: \DeclareUnicodeCharacter{00D6}{\"O} cannam@167: \DeclareUnicodeCharacter{00D8}{\O} cannam@167: \DeclareUnicodeCharacter{00D9}{\`U} cannam@167: \DeclareUnicodeCharacter{00DA}{\'U} cannam@167: \DeclareUnicodeCharacter{00DB}{\^U} cannam@167: \DeclareUnicodeCharacter{00DC}{\"U} cannam@167: \DeclareUnicodeCharacter{00DD}{\'Y} cannam@167: \DeclareUnicodeCharacter{00DE}{\TH} cannam@167: \DeclareUnicodeCharacter{00DF}{\ss} cannam@167: cannam@167: \DeclareUnicodeCharacter{00E0}{\`a} cannam@167: \DeclareUnicodeCharacter{00E1}{\'a} cannam@167: \DeclareUnicodeCharacter{00E2}{\^a} cannam@167: \DeclareUnicodeCharacter{00E3}{\~a} cannam@167: \DeclareUnicodeCharacter{00E4}{\"a} cannam@167: \DeclareUnicodeCharacter{00E5}{\aa} cannam@167: \DeclareUnicodeCharacter{00E6}{\ae} cannam@167: \DeclareUnicodeCharacter{00E7}{\cedilla{c}} cannam@167: \DeclareUnicodeCharacter{00E8}{\`e} cannam@167: \DeclareUnicodeCharacter{00E9}{\'e} cannam@167: \DeclareUnicodeCharacter{00EA}{\^e} cannam@167: \DeclareUnicodeCharacter{00EB}{\"e} cannam@167: \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}} cannam@167: \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}} cannam@167: \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}} cannam@167: \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}} cannam@167: cannam@167: \DeclareUnicodeCharacter{00F0}{\dh} cannam@167: \DeclareUnicodeCharacter{00F1}{\~n} cannam@167: \DeclareUnicodeCharacter{00F2}{\`o} cannam@167: \DeclareUnicodeCharacter{00F3}{\'o} cannam@167: \DeclareUnicodeCharacter{00F4}{\^o} cannam@167: \DeclareUnicodeCharacter{00F5}{\~o} cannam@167: \DeclareUnicodeCharacter{00F6}{\"o} cannam@167: \DeclareUnicodeCharacter{00F8}{\o} cannam@167: \DeclareUnicodeCharacter{00F9}{\`u} cannam@167: \DeclareUnicodeCharacter{00FA}{\'u} cannam@167: \DeclareUnicodeCharacter{00FB}{\^u} cannam@167: \DeclareUnicodeCharacter{00FC}{\"u} cannam@167: \DeclareUnicodeCharacter{00FD}{\'y} cannam@167: \DeclareUnicodeCharacter{00FE}{\th} cannam@167: \DeclareUnicodeCharacter{00FF}{\"y} cannam@167: cannam@167: \DeclareUnicodeCharacter{0100}{\=A} cannam@167: \DeclareUnicodeCharacter{0101}{\=a} cannam@167: \DeclareUnicodeCharacter{0102}{\u{A}} cannam@167: \DeclareUnicodeCharacter{0103}{\u{a}} cannam@167: \DeclareUnicodeCharacter{0104}{\ogonek{A}} cannam@167: \DeclareUnicodeCharacter{0105}{\ogonek{a}} cannam@167: \DeclareUnicodeCharacter{0106}{\'C} cannam@167: \DeclareUnicodeCharacter{0107}{\'c} cannam@167: \DeclareUnicodeCharacter{0108}{\^C} cannam@167: \DeclareUnicodeCharacter{0109}{\^c} cannam@167: \DeclareUnicodeCharacter{0118}{\ogonek{E}} cannam@167: \DeclareUnicodeCharacter{0119}{\ogonek{e}} cannam@167: \DeclareUnicodeCharacter{010A}{\dotaccent{C}} cannam@167: \DeclareUnicodeCharacter{010B}{\dotaccent{c}} cannam@167: \DeclareUnicodeCharacter{010C}{\v{C}} cannam@167: \DeclareUnicodeCharacter{010D}{\v{c}} cannam@167: \DeclareUnicodeCharacter{010E}{\v{D}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0112}{\=E} cannam@167: \DeclareUnicodeCharacter{0113}{\=e} cannam@167: \DeclareUnicodeCharacter{0114}{\u{E}} cannam@167: \DeclareUnicodeCharacter{0115}{\u{e}} cannam@167: \DeclareUnicodeCharacter{0116}{\dotaccent{E}} cannam@167: \DeclareUnicodeCharacter{0117}{\dotaccent{e}} cannam@167: \DeclareUnicodeCharacter{011A}{\v{E}} cannam@167: \DeclareUnicodeCharacter{011B}{\v{e}} cannam@167: \DeclareUnicodeCharacter{011C}{\^G} cannam@167: \DeclareUnicodeCharacter{011D}{\^g} cannam@167: \DeclareUnicodeCharacter{011E}{\u{G}} cannam@167: \DeclareUnicodeCharacter{011F}{\u{g}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0120}{\dotaccent{G}} cannam@167: \DeclareUnicodeCharacter{0121}{\dotaccent{g}} cannam@167: \DeclareUnicodeCharacter{0124}{\^H} cannam@167: \DeclareUnicodeCharacter{0125}{\^h} cannam@167: \DeclareUnicodeCharacter{0128}{\~I} cannam@167: \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}} cannam@167: \DeclareUnicodeCharacter{012A}{\=I} cannam@167: \DeclareUnicodeCharacter{012B}{\={\dotless{i}}} cannam@167: \DeclareUnicodeCharacter{012C}{\u{I}} cannam@167: \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0130}{\dotaccent{I}} cannam@167: \DeclareUnicodeCharacter{0131}{\dotless{i}} cannam@167: \DeclareUnicodeCharacter{0132}{IJ} cannam@167: \DeclareUnicodeCharacter{0133}{ij} cannam@167: \DeclareUnicodeCharacter{0134}{\^J} cannam@167: \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}} cannam@167: \DeclareUnicodeCharacter{0139}{\'L} cannam@167: \DeclareUnicodeCharacter{013A}{\'l} cannam@167: cannam@167: \DeclareUnicodeCharacter{0141}{\L} cannam@167: \DeclareUnicodeCharacter{0142}{\l} cannam@167: \DeclareUnicodeCharacter{0143}{\'N} cannam@167: \DeclareUnicodeCharacter{0144}{\'n} cannam@167: \DeclareUnicodeCharacter{0147}{\v{N}} cannam@167: \DeclareUnicodeCharacter{0148}{\v{n}} cannam@167: \DeclareUnicodeCharacter{014C}{\=O} cannam@167: \DeclareUnicodeCharacter{014D}{\=o} cannam@167: \DeclareUnicodeCharacter{014E}{\u{O}} cannam@167: \DeclareUnicodeCharacter{014F}{\u{o}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0150}{\H{O}} cannam@167: \DeclareUnicodeCharacter{0151}{\H{o}} cannam@167: \DeclareUnicodeCharacter{0152}{\OE} cannam@167: \DeclareUnicodeCharacter{0153}{\oe} cannam@167: \DeclareUnicodeCharacter{0154}{\'R} cannam@167: \DeclareUnicodeCharacter{0155}{\'r} cannam@167: \DeclareUnicodeCharacter{0158}{\v{R}} cannam@167: \DeclareUnicodeCharacter{0159}{\v{r}} cannam@167: \DeclareUnicodeCharacter{015A}{\'S} cannam@167: \DeclareUnicodeCharacter{015B}{\'s} cannam@167: \DeclareUnicodeCharacter{015C}{\^S} cannam@167: \DeclareUnicodeCharacter{015D}{\^s} cannam@167: \DeclareUnicodeCharacter{015E}{\cedilla{S}} cannam@167: \DeclareUnicodeCharacter{015F}{\cedilla{s}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0160}{\v{S}} cannam@167: \DeclareUnicodeCharacter{0161}{\v{s}} cannam@167: \DeclareUnicodeCharacter{0162}{\cedilla{t}} cannam@167: \DeclareUnicodeCharacter{0163}{\cedilla{T}} cannam@167: \DeclareUnicodeCharacter{0164}{\v{T}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0168}{\~U} cannam@167: \DeclareUnicodeCharacter{0169}{\~u} cannam@167: \DeclareUnicodeCharacter{016A}{\=U} cannam@167: \DeclareUnicodeCharacter{016B}{\=u} cannam@167: \DeclareUnicodeCharacter{016C}{\u{U}} cannam@167: \DeclareUnicodeCharacter{016D}{\u{u}} cannam@167: \DeclareUnicodeCharacter{016E}{\ringaccent{U}} cannam@167: \DeclareUnicodeCharacter{016F}{\ringaccent{u}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0170}{\H{U}} cannam@167: \DeclareUnicodeCharacter{0171}{\H{u}} cannam@167: \DeclareUnicodeCharacter{0174}{\^W} cannam@167: \DeclareUnicodeCharacter{0175}{\^w} cannam@167: \DeclareUnicodeCharacter{0176}{\^Y} cannam@167: \DeclareUnicodeCharacter{0177}{\^y} cannam@167: \DeclareUnicodeCharacter{0178}{\"Y} cannam@167: \DeclareUnicodeCharacter{0179}{\'Z} cannam@167: \DeclareUnicodeCharacter{017A}{\'z} cannam@167: \DeclareUnicodeCharacter{017B}{\dotaccent{Z}} cannam@167: \DeclareUnicodeCharacter{017C}{\dotaccent{z}} cannam@167: \DeclareUnicodeCharacter{017D}{\v{Z}} cannam@167: \DeclareUnicodeCharacter{017E}{\v{z}} cannam@167: cannam@167: \DeclareUnicodeCharacter{01C4}{D\v{Z}} cannam@167: \DeclareUnicodeCharacter{01C5}{D\v{z}} cannam@167: \DeclareUnicodeCharacter{01C6}{d\v{z}} cannam@167: \DeclareUnicodeCharacter{01C7}{LJ} cannam@167: \DeclareUnicodeCharacter{01C8}{Lj} cannam@167: \DeclareUnicodeCharacter{01C9}{lj} cannam@167: \DeclareUnicodeCharacter{01CA}{NJ} cannam@167: \DeclareUnicodeCharacter{01CB}{Nj} cannam@167: \DeclareUnicodeCharacter{01CC}{nj} cannam@167: \DeclareUnicodeCharacter{01CD}{\v{A}} cannam@167: \DeclareUnicodeCharacter{01CE}{\v{a}} cannam@167: \DeclareUnicodeCharacter{01CF}{\v{I}} cannam@167: cannam@167: \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}} cannam@167: \DeclareUnicodeCharacter{01D1}{\v{O}} cannam@167: \DeclareUnicodeCharacter{01D2}{\v{o}} cannam@167: \DeclareUnicodeCharacter{01D3}{\v{U}} cannam@167: \DeclareUnicodeCharacter{01D4}{\v{u}} cannam@167: cannam@167: \DeclareUnicodeCharacter{01E2}{\={\AE}} cannam@167: \DeclareUnicodeCharacter{01E3}{\={\ae}} cannam@167: \DeclareUnicodeCharacter{01E6}{\v{G}} cannam@167: \DeclareUnicodeCharacter{01E7}{\v{g}} cannam@167: \DeclareUnicodeCharacter{01E8}{\v{K}} cannam@167: \DeclareUnicodeCharacter{01E9}{\v{k}} cannam@167: cannam@167: \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}} cannam@167: \DeclareUnicodeCharacter{01F1}{DZ} cannam@167: \DeclareUnicodeCharacter{01F2}{Dz} cannam@167: \DeclareUnicodeCharacter{01F3}{dz} cannam@167: \DeclareUnicodeCharacter{01F4}{\'G} cannam@167: \DeclareUnicodeCharacter{01F5}{\'g} cannam@167: \DeclareUnicodeCharacter{01F8}{\`N} cannam@167: \DeclareUnicodeCharacter{01F9}{\`n} cannam@167: \DeclareUnicodeCharacter{01FC}{\'{\AE}} cannam@167: \DeclareUnicodeCharacter{01FD}{\'{\ae}} cannam@167: \DeclareUnicodeCharacter{01FE}{\'{\O}} cannam@167: \DeclareUnicodeCharacter{01FF}{\'{\o}} cannam@167: cannam@167: \DeclareUnicodeCharacter{021E}{\v{H}} cannam@167: \DeclareUnicodeCharacter{021F}{\v{h}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0226}{\dotaccent{A}} cannam@167: \DeclareUnicodeCharacter{0227}{\dotaccent{a}} cannam@167: \DeclareUnicodeCharacter{0228}{\cedilla{E}} cannam@167: \DeclareUnicodeCharacter{0229}{\cedilla{e}} cannam@167: \DeclareUnicodeCharacter{022E}{\dotaccent{O}} cannam@167: \DeclareUnicodeCharacter{022F}{\dotaccent{o}} cannam@167: cannam@167: \DeclareUnicodeCharacter{0232}{\=Y} cannam@167: \DeclareUnicodeCharacter{0233}{\=y} cannam@167: \DeclareUnicodeCharacter{0237}{\dotless{j}} cannam@167: cannam@167: \DeclareUnicodeCharacter{02DB}{\ogonek{ }} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E02}{\dotaccent{B}} cannam@167: \DeclareUnicodeCharacter{1E03}{\dotaccent{b}} cannam@167: \DeclareUnicodeCharacter{1E04}{\udotaccent{B}} cannam@167: \DeclareUnicodeCharacter{1E05}{\udotaccent{b}} cannam@167: \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}} cannam@167: \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}} cannam@167: \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}} cannam@167: \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}} cannam@167: \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}} cannam@167: \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}} cannam@167: \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}} cannam@167: \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}} cannam@167: \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E20}{\=G} cannam@167: \DeclareUnicodeCharacter{1E21}{\=g} cannam@167: \DeclareUnicodeCharacter{1E22}{\dotaccent{H}} cannam@167: \DeclareUnicodeCharacter{1E23}{\dotaccent{h}} cannam@167: \DeclareUnicodeCharacter{1E24}{\udotaccent{H}} cannam@167: \DeclareUnicodeCharacter{1E25}{\udotaccent{h}} cannam@167: \DeclareUnicodeCharacter{1E26}{\"H} cannam@167: \DeclareUnicodeCharacter{1E27}{\"h} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E30}{\'K} cannam@167: \DeclareUnicodeCharacter{1E31}{\'k} cannam@167: \DeclareUnicodeCharacter{1E32}{\udotaccent{K}} cannam@167: \DeclareUnicodeCharacter{1E33}{\udotaccent{k}} cannam@167: \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}} cannam@167: \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}} cannam@167: \DeclareUnicodeCharacter{1E36}{\udotaccent{L}} cannam@167: \DeclareUnicodeCharacter{1E37}{\udotaccent{l}} cannam@167: \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}} cannam@167: \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}} cannam@167: \DeclareUnicodeCharacter{1E3E}{\'M} cannam@167: \DeclareUnicodeCharacter{1E3F}{\'m} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E40}{\dotaccent{M}} cannam@167: \DeclareUnicodeCharacter{1E41}{\dotaccent{m}} cannam@167: \DeclareUnicodeCharacter{1E42}{\udotaccent{M}} cannam@167: \DeclareUnicodeCharacter{1E43}{\udotaccent{m}} cannam@167: \DeclareUnicodeCharacter{1E44}{\dotaccent{N}} cannam@167: \DeclareUnicodeCharacter{1E45}{\dotaccent{n}} cannam@167: \DeclareUnicodeCharacter{1E46}{\udotaccent{N}} cannam@167: \DeclareUnicodeCharacter{1E47}{\udotaccent{n}} cannam@167: \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}} cannam@167: \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E54}{\'P} cannam@167: \DeclareUnicodeCharacter{1E55}{\'p} cannam@167: \DeclareUnicodeCharacter{1E56}{\dotaccent{P}} cannam@167: \DeclareUnicodeCharacter{1E57}{\dotaccent{p}} cannam@167: \DeclareUnicodeCharacter{1E58}{\dotaccent{R}} cannam@167: \DeclareUnicodeCharacter{1E59}{\dotaccent{r}} cannam@167: \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}} cannam@167: \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}} cannam@167: \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}} cannam@167: \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E60}{\dotaccent{S}} cannam@167: \DeclareUnicodeCharacter{1E61}{\dotaccent{s}} cannam@167: \DeclareUnicodeCharacter{1E62}{\udotaccent{S}} cannam@167: \DeclareUnicodeCharacter{1E63}{\udotaccent{s}} cannam@167: \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}} cannam@167: \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}} cannam@167: \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}} cannam@167: \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}} cannam@167: \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}} cannam@167: \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E7C}{\~V} cannam@167: \DeclareUnicodeCharacter{1E7D}{\~v} cannam@167: \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}} cannam@167: \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E80}{\`W} cannam@167: \DeclareUnicodeCharacter{1E81}{\`w} cannam@167: \DeclareUnicodeCharacter{1E82}{\'W} cannam@167: \DeclareUnicodeCharacter{1E83}{\'w} cannam@167: \DeclareUnicodeCharacter{1E84}{\"W} cannam@167: \DeclareUnicodeCharacter{1E85}{\"w} cannam@167: \DeclareUnicodeCharacter{1E86}{\dotaccent{W}} cannam@167: \DeclareUnicodeCharacter{1E87}{\dotaccent{w}} cannam@167: \DeclareUnicodeCharacter{1E88}{\udotaccent{W}} cannam@167: \DeclareUnicodeCharacter{1E89}{\udotaccent{w}} cannam@167: \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}} cannam@167: \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}} cannam@167: \DeclareUnicodeCharacter{1E8C}{\"X} cannam@167: \DeclareUnicodeCharacter{1E8D}{\"x} cannam@167: \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}} cannam@167: \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1E90}{\^Z} cannam@167: \DeclareUnicodeCharacter{1E91}{\^z} cannam@167: \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}} cannam@167: \DeclareUnicodeCharacter{1E93}{\udotaccent{z}} cannam@167: \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}} cannam@167: \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}} cannam@167: \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}} cannam@167: \DeclareUnicodeCharacter{1E97}{\"t} cannam@167: \DeclareUnicodeCharacter{1E98}{\ringaccent{w}} cannam@167: \DeclareUnicodeCharacter{1E99}{\ringaccent{y}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}} cannam@167: \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}} cannam@167: \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}} cannam@167: \DeclareUnicodeCharacter{1EBC}{\~E} cannam@167: \DeclareUnicodeCharacter{1EBD}{\~e} cannam@167: cannam@167: \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}} cannam@167: \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}} cannam@167: \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}} cannam@167: \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}} cannam@167: \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1EF2}{\`Y} cannam@167: \DeclareUnicodeCharacter{1EF3}{\`y} cannam@167: \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}} cannam@167: cannam@167: \DeclareUnicodeCharacter{1EF8}{\~Y} cannam@167: \DeclareUnicodeCharacter{1EF9}{\~y} cannam@167: cannam@167: \DeclareUnicodeCharacter{2013}{--} cannam@167: \DeclareUnicodeCharacter{2014}{---} cannam@167: \DeclareUnicodeCharacter{2018}{\quoteleft} cannam@167: \DeclareUnicodeCharacter{2019}{\quoteright} cannam@167: \DeclareUnicodeCharacter{201A}{\quotesinglbase} cannam@167: \DeclareUnicodeCharacter{201C}{\quotedblleft} cannam@167: \DeclareUnicodeCharacter{201D}{\quotedblright} cannam@167: \DeclareUnicodeCharacter{201E}{\quotedblbase} cannam@167: \DeclareUnicodeCharacter{2022}{\bullet} cannam@167: \DeclareUnicodeCharacter{2026}{\dots} cannam@167: \DeclareUnicodeCharacter{2039}{\guilsinglleft} cannam@167: \DeclareUnicodeCharacter{203A}{\guilsinglright} cannam@167: \DeclareUnicodeCharacter{20AC}{\euro} cannam@167: cannam@167: \DeclareUnicodeCharacter{2192}{\expansion} cannam@167: \DeclareUnicodeCharacter{21D2}{\result} cannam@167: cannam@167: \DeclareUnicodeCharacter{2212}{\minus} cannam@167: \DeclareUnicodeCharacter{2217}{\point} cannam@167: \DeclareUnicodeCharacter{2261}{\equiv} cannam@167: }% end of \utfeightchardefs cannam@167: cannam@167: cannam@167: % US-ASCII character definitions. cannam@167: \def\asciichardefs{% nothing need be done cannam@167: \relax cannam@167: } cannam@167: cannam@167: % Make non-ASCII characters printable again for compatibility with cannam@167: % existing Texinfo documents that may use them, even without declaring a cannam@167: % document encoding. cannam@167: % cannam@167: \setnonasciicharscatcode \other cannam@167: cannam@167: cannam@167: \message{formatting,} cannam@167: cannam@167: \newdimen\defaultparindent \defaultparindent = 15pt cannam@167: cannam@167: \chapheadingskip = 15pt plus 4pt minus 2pt cannam@167: \secheadingskip = 12pt plus 3pt minus 2pt cannam@167: \subsecheadingskip = 9pt plus 2pt minus 2pt cannam@167: cannam@167: % Prevent underfull vbox error messages. cannam@167: \vbadness = 10000 cannam@167: cannam@167: % Don't be very finicky about underfull hboxes, either. cannam@167: \hbadness = 6666 cannam@167: cannam@167: % Following George Bush, get rid of widows and orphans. cannam@167: \widowpenalty=10000 cannam@167: \clubpenalty=10000 cannam@167: cannam@167: % Use TeX 3.0's \emergencystretch to help line breaking, but if we're cannam@167: % using an old version of TeX, don't do anything. We want the amount of cannam@167: % stretch added to depend on the line length, hence the dependence on cannam@167: % \hsize. We call this whenever the paper size is set. cannam@167: % cannam@167: \def\setemergencystretch{% cannam@167: \ifx\emergencystretch\thisisundefined cannam@167: % Allow us to assign to \emergencystretch anyway. cannam@167: \def\emergencystretch{\dimen0}% cannam@167: \else cannam@167: \emergencystretch = .15\hsize cannam@167: \fi cannam@167: } cannam@167: cannam@167: % Parameters in order: 1) textheight; 2) textwidth; cannam@167: % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; cannam@167: % 7) physical page height; 8) physical page width. cannam@167: % cannam@167: % We also call \setleading{\textleading}, so the caller should define cannam@167: % \textleading. The caller should also set \parskip. cannam@167: % cannam@167: \def\internalpagesizes#1#2#3#4#5#6#7#8{% cannam@167: \voffset = #3\relax cannam@167: \topskip = #6\relax cannam@167: \splittopskip = \topskip cannam@167: % cannam@167: \vsize = #1\relax cannam@167: \advance\vsize by \topskip cannam@167: \outervsize = \vsize cannam@167: \advance\outervsize by 2\topandbottommargin cannam@167: \pageheight = \vsize cannam@167: % cannam@167: \hsize = #2\relax cannam@167: \outerhsize = \hsize cannam@167: \advance\outerhsize by 0.5in cannam@167: \pagewidth = \hsize cannam@167: % cannam@167: \normaloffset = #4\relax cannam@167: \bindingoffset = #5\relax cannam@167: % cannam@167: \ifpdf cannam@167: \pdfpageheight #7\relax cannam@167: \pdfpagewidth #8\relax cannam@167: % if we don't reset these, they will remain at "1 true in" of cannam@167: % whatever layout pdftex was dumped with. cannam@167: \pdfhorigin = 1 true in cannam@167: \pdfvorigin = 1 true in cannam@167: \fi cannam@167: % cannam@167: \setleading{\textleading} cannam@167: % cannam@167: \parindent = \defaultparindent cannam@167: \setemergencystretch cannam@167: } cannam@167: cannam@167: % @letterpaper (the default). cannam@167: \def\letterpaper{{\globaldefs = 1 cannam@167: \parskip = 3pt plus 2pt minus 1pt cannam@167: \textleading = 13.2pt cannam@167: % cannam@167: % If page is nothing but text, make it come out even. cannam@167: \internalpagesizes{607.2pt}{6in}% that's 46 lines cannam@167: {\voffset}{.25in}% cannam@167: {\bindingoffset}{36pt}% cannam@167: {11in}{8.5in}% cannam@167: }} cannam@167: cannam@167: % Use @smallbook to reset parameters for 7x9.25 trim size. cannam@167: \def\smallbook{{\globaldefs = 1 cannam@167: \parskip = 2pt plus 1pt cannam@167: \textleading = 12pt cannam@167: % cannam@167: \internalpagesizes{7.5in}{5in}% cannam@167: {-.2in}{0in}% cannam@167: {\bindingoffset}{16pt}% cannam@167: {9.25in}{7in}% cannam@167: % cannam@167: \lispnarrowing = 0.3in cannam@167: \tolerance = 700 cannam@167: \hfuzz = 1pt cannam@167: \contentsrightmargin = 0pt cannam@167: \defbodyindent = .5cm cannam@167: }} cannam@167: cannam@167: % Use @smallerbook to reset parameters for 6x9 trim size. cannam@167: % (Just testing, parameters still in flux.) cannam@167: \def\smallerbook{{\globaldefs = 1 cannam@167: \parskip = 1.5pt plus 1pt cannam@167: \textleading = 12pt cannam@167: % cannam@167: \internalpagesizes{7.4in}{4.8in}% cannam@167: {-.2in}{-.4in}% cannam@167: {0pt}{14pt}% cannam@167: {9in}{6in}% cannam@167: % cannam@167: \lispnarrowing = 0.25in cannam@167: \tolerance = 700 cannam@167: \hfuzz = 1pt cannam@167: \contentsrightmargin = 0pt cannam@167: \defbodyindent = .4cm cannam@167: }} cannam@167: cannam@167: % Use @afourpaper to print on European A4 paper. cannam@167: \def\afourpaper{{\globaldefs = 1 cannam@167: \parskip = 3pt plus 2pt minus 1pt cannam@167: \textleading = 13.2pt cannam@167: % cannam@167: % Double-side printing via postscript on Laserjet 4050 cannam@167: % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. cannam@167: % To change the settings for a different printer or situation, adjust cannam@167: % \normaloffset until the front-side and back-side texts align. Then cannam@167: % do the same for \bindingoffset. You can set these for testing in cannam@167: % your texinfo source file like this: cannam@167: % @tex cannam@167: % \global\normaloffset = -6mm cannam@167: % \global\bindingoffset = 10mm cannam@167: % @end tex cannam@167: \internalpagesizes{673.2pt}{160mm}% that's 51 lines cannam@167: {\voffset}{\hoffset}% cannam@167: {\bindingoffset}{44pt}% cannam@167: {297mm}{210mm}% cannam@167: % cannam@167: \tolerance = 700 cannam@167: \hfuzz = 1pt cannam@167: \contentsrightmargin = 0pt cannam@167: \defbodyindent = 5mm cannam@167: }} cannam@167: cannam@167: % Use @afivepaper to print on European A5 paper. cannam@167: % From romildo@urano.iceb.ufop.br, 2 July 2000. cannam@167: % He also recommends making @example and @lisp be small. cannam@167: \def\afivepaper{{\globaldefs = 1 cannam@167: \parskip = 2pt plus 1pt minus 0.1pt cannam@167: \textleading = 12.5pt cannam@167: % cannam@167: \internalpagesizes{160mm}{120mm}% cannam@167: {\voffset}{\hoffset}% cannam@167: {\bindingoffset}{8pt}% cannam@167: {210mm}{148mm}% cannam@167: % cannam@167: \lispnarrowing = 0.2in cannam@167: \tolerance = 800 cannam@167: \hfuzz = 1.2pt cannam@167: \contentsrightmargin = 0pt cannam@167: \defbodyindent = 2mm cannam@167: \tableindent = 12mm cannam@167: }} cannam@167: cannam@167: % A specific text layout, 24x15cm overall, intended for A4 paper. cannam@167: \def\afourlatex{{\globaldefs = 1 cannam@167: \afourpaper cannam@167: \internalpagesizes{237mm}{150mm}% cannam@167: {\voffset}{4.6mm}% cannam@167: {\bindingoffset}{7mm}% cannam@167: {297mm}{210mm}% cannam@167: % cannam@167: % Must explicitly reset to 0 because we call \afourpaper. cannam@167: \globaldefs = 0 cannam@167: }} cannam@167: cannam@167: % Use @afourwide to print on A4 paper in landscape format. cannam@167: \def\afourwide{{\globaldefs = 1 cannam@167: \afourpaper cannam@167: \internalpagesizes{241mm}{165mm}% cannam@167: {\voffset}{-2.95mm}% cannam@167: {\bindingoffset}{7mm}% cannam@167: {297mm}{210mm}% cannam@167: \globaldefs = 0 cannam@167: }} cannam@167: cannam@167: % @pagesizes TEXTHEIGHT[,TEXTWIDTH] cannam@167: % Perhaps we should allow setting the margins, \topskip, \parskip, cannam@167: % and/or leading, also. Or perhaps we should compute them somehow. cannam@167: % cannam@167: \parseargdef\pagesizes{\pagesizesyyy #1,,\finish} cannam@167: \def\pagesizesyyy#1,#2,#3\finish{{% cannam@167: \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi cannam@167: \globaldefs = 1 cannam@167: % cannam@167: \parskip = 3pt plus 2pt minus 1pt cannam@167: \setleading{\textleading}% cannam@167: % cannam@167: \dimen0 = #1\relax cannam@167: \advance\dimen0 by \voffset cannam@167: % cannam@167: \dimen2 = \hsize cannam@167: \advance\dimen2 by \normaloffset cannam@167: % cannam@167: \internalpagesizes{#1}{\hsize}% cannam@167: {\voffset}{\normaloffset}% cannam@167: {\bindingoffset}{44pt}% cannam@167: {\dimen0}{\dimen2}% cannam@167: }} cannam@167: cannam@167: % Set default to letter. cannam@167: % cannam@167: \letterpaper cannam@167: cannam@167: cannam@167: \message{and turning on texinfo input format.} cannam@167: cannam@167: \def^^L{\par} % remove \outer, so ^L can appear in an @comment cannam@167: cannam@167: % DEL is a comment character, in case @c does not suffice. cannam@167: \catcode`\^^? = 14 cannam@167: cannam@167: % Define macros to output various characters with catcode for normal text. cannam@167: \catcode`\"=\other \def\normaldoublequote{"} cannam@167: \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix cannam@167: \catcode`\+=\other \def\normalplus{+} cannam@167: \catcode`\<=\other \def\normalless{<} cannam@167: \catcode`\>=\other \def\normalgreater{>} cannam@167: \catcode`\^=\other \def\normalcaret{^} cannam@167: \catcode`\_=\other \def\normalunderscore{_} cannam@167: \catcode`\|=\other \def\normalverticalbar{|} cannam@167: \catcode`\~=\other \def\normaltilde{~} cannam@167: cannam@167: % This macro is used to make a character print one way in \tt cannam@167: % (where it can probably be output as-is), and another way in other fonts, cannam@167: % where something hairier probably needs to be done. cannam@167: % cannam@167: % #1 is what to print if we are indeed using \tt; #2 is what to print cannam@167: % otherwise. Since all the Computer Modern typewriter fonts have zero cannam@167: % interword stretch (and shrink), and it is reasonable to expect all cannam@167: % typewriter fonts to have this, we can check that font parameter. cannam@167: % cannam@167: \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} cannam@167: cannam@167: % Same as above, but check for italic font. Actually this also catches cannam@167: % non-italic slanted fonts since it is impossible to distinguish them from cannam@167: % italic fonts. But since this is only used by $ and it uses \sl anyway cannam@167: % this is not a problem. cannam@167: \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} cannam@167: cannam@167: % Turn off all special characters except @ cannam@167: % (and those which the user can use as if they were ordinary). cannam@167: % Most of these we simply print from the \tt font, but for some, we can cannam@167: % use math or other variants that look better in normal text. cannam@167: cannam@167: \catcode`\"=\active cannam@167: \def\activedoublequote{{\tt\char34}} cannam@167: \let"=\activedoublequote cannam@167: \catcode`\~=\active cannam@167: \def~{{\tt\char126}} cannam@167: \chardef\hat=`\^ cannam@167: \catcode`\^=\active cannam@167: \def^{{\tt \hat}} cannam@167: cannam@167: \catcode`\_=\active cannam@167: \def_{\ifusingtt\normalunderscore\_} cannam@167: \let\realunder=_ cannam@167: % Subroutine for the previous macro. cannam@167: \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } cannam@167: cannam@167: \catcode`\|=\active cannam@167: \def|{{\tt\char124}} cannam@167: \chardef \less=`\< cannam@167: \catcode`\<=\active cannam@167: \def<{{\tt \less}} cannam@167: \chardef \gtr=`\> cannam@167: \catcode`\>=\active cannam@167: \def>{{\tt \gtr}} cannam@167: \catcode`\+=\active cannam@167: \def+{{\tt \char 43}} cannam@167: \catcode`\$=\active cannam@167: \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix cannam@167: cannam@167: % If a .fmt file is being used, characters that might appear in a file cannam@167: % name cannot be active until we have parsed the command line. cannam@167: % So turn them off again, and have \everyjob (or @setfilename) turn them on. cannam@167: % \otherifyactive is called near the end of this file. cannam@167: \def\otherifyactive{\catcode`+=\other \catcode`\_=\other} cannam@167: cannam@167: % Used sometimes to turn off (effectively) the active characters even after cannam@167: % parsing them. cannam@167: \def\turnoffactive{% cannam@167: \normalturnoffactive cannam@167: \otherbackslash cannam@167: } cannam@167: cannam@167: \catcode`\@=0 cannam@167: cannam@167: % \backslashcurfont outputs one backslash character in current font, cannam@167: % as in \char`\\. cannam@167: \global\chardef\backslashcurfont=`\\ cannam@167: \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work cannam@167: cannam@167: % \realbackslash is an actual character `\' with catcode other, and cannam@167: % \doublebackslash is two of them (for the pdf outlines). cannam@167: {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} cannam@167: cannam@167: % In texinfo, backslash is an active character; it prints the backslash cannam@167: % in fixed width font. cannam@167: \catcode`\\=\active % @ for escape char from now on. cannam@167: cannam@167: % The story here is that in math mode, the \char of \backslashcurfont cannam@167: % ends up printing the roman \ from the math symbol font (because \char cannam@167: % in math mode uses the \mathcode, and plain.tex sets cannam@167: % \mathcode`\\="026E). It seems better for @backslashchar{} to always cannam@167: % print a typewriter backslash, hence we use an explicit \mathchar, cannam@167: % which is the decimal equivalent of "715c (class 7, e.g., use \fam; cannam@167: % ignored family value; char position "5C). We can't use " for the cannam@167: % usual hex value because it has already been made active. cannam@167: @def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} cannam@167: @let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. cannam@167: cannam@167: % On startup, @fixbackslash assigns: cannam@167: % @let \ = @normalbackslash cannam@167: % \rawbackslash defines an active \ to do \backslashcurfont. cannam@167: % \otherbackslash defines an active \ to be a literal `\' character with cannam@167: % catcode other. We switch back and forth between these. cannam@167: @gdef@rawbackslash{@let\=@backslashcurfont} cannam@167: @gdef@otherbackslash{@let\=@realbackslash} cannam@167: cannam@167: % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of cannam@167: % the literal character `\'. Also revert - to its normal character, in cannam@167: % case the active - from code has slipped in. cannam@167: % cannam@167: {@catcode`- = @active cannam@167: @gdef@normalturnoffactive{% cannam@167: @let-=@normaldash cannam@167: @let"=@normaldoublequote cannam@167: @let$=@normaldollar %$ font-lock fix cannam@167: @let+=@normalplus cannam@167: @let<=@normalless cannam@167: @let>=@normalgreater cannam@167: @let\=@normalbackslash cannam@167: @let^=@normalcaret cannam@167: @let_=@normalunderscore cannam@167: @let|=@normalverticalbar cannam@167: @let~=@normaltilde cannam@167: @markupsetuplqdefault cannam@167: @markupsetuprqdefault cannam@167: @unsepspaces cannam@167: } cannam@167: } cannam@167: cannam@167: % Make _ and + \other characters, temporarily. cannam@167: % This is canceled by @fixbackslash. cannam@167: @otherifyactive cannam@167: cannam@167: % If a .fmt file is being used, we don't want the `\input texinfo' to show up. cannam@167: % That is what \eatinput is for; after that, the `\' should revert to printing cannam@167: % a backslash. cannam@167: % cannam@167: @gdef@eatinput input texinfo{@fixbackslash} cannam@167: @global@let\ = @eatinput cannam@167: cannam@167: % On the other hand, perhaps the file did not have a `\input texinfo'. Then cannam@167: % the first `\' in the file would cause an error. This macro tries to fix cannam@167: % that, assuming it is called before the first `\' could plausibly occur. cannam@167: % Also turn back on active characters that might appear in the input cannam@167: % file name, in case not using a pre-dumped format. cannam@167: % cannam@167: @gdef@fixbackslash{% cannam@167: @ifx\@eatinput @let\ = @normalbackslash @fi cannam@167: @catcode`+=@active cannam@167: @catcode`@_=@active cannam@167: } cannam@167: cannam@167: % Say @foo, not \foo, in error messages. cannam@167: @escapechar = `@@ cannam@167: cannam@167: % These (along with & and #) are made active for url-breaking, so need cannam@167: % active definitions as the normal characters. cannam@167: @def@normaldot{.} cannam@167: @def@normalquest{?} cannam@167: @def@normalslash{/} cannam@167: cannam@167: % These look ok in all fonts, so just make them not special. cannam@167: % @hashchar{} gets its own user-level command, because of #line. cannam@167: @catcode`@& = @other @def@normalamp{&} cannam@167: @catcode`@# = @other @def@normalhash{#} cannam@167: @catcode`@% = @other @def@normalpercent{%} cannam@167: cannam@167: @let @hashchar = @normalhash cannam@167: cannam@167: @c Finally, make ` and ' active, so that txicodequoteundirected and cannam@167: @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we cannam@167: @c don't make ` and ' active, @code will not get them as active chars. cannam@167: @c Do this last of all since we use ` in the previous @catcode assignments. cannam@167: @catcode`@'=@active cannam@167: @catcode`@`=@active cannam@167: @markupsetuplqdefault cannam@167: @markupsetuprqdefault cannam@167: cannam@167: @c Local variables: cannam@167: @c eval: (add-hook 'write-file-hooks 'time-stamp) cannam@167: @c page-delimiter: "^\\\\message" cannam@167: @c time-stamp-start: "def\\\\texinfoversion{" cannam@167: @c time-stamp-format: "%:y-%02m-%02d.%02H" cannam@167: @c time-stamp-end: "}" cannam@167: @c End: cannam@167: cannam@167: @c vim:sw=2: cannam@167: cannam@167: @ignore cannam@167: arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 cannam@167: @end ignore