11773 lines
372 KiB
TeX
11773 lines
372 KiB
TeX
% texinfo.tex -- TeX macros to handle Texinfo files.
|
||
%
|
||
% Load plain if necessary, i.e., if running under initex.
|
||
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
|
||
%
|
||
\def\texinfoversion{2020-10-24.12}
|
||
%
|
||
% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc.
|
||
%
|
||
% This texinfo.tex file is free software: you can redistribute it and/or
|
||
% modify it under the terms of the GNU General Public License as
|
||
% published by the Free Software Foundation, either version 3 of the
|
||
% License, or (at your option) any later version.
|
||
%
|
||
% This texinfo.tex file is distributed in the hope that it will be
|
||
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
% General Public License for more details.
|
||
%
|
||
% You should have received a copy of the GNU General Public License
|
||
% along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
%
|
||
% As a special exception, when this file is read by TeX when processing
|
||
% a Texinfo source document, you may use the result without
|
||
% restriction. This Exception is an additional permission under section 7
|
||
% of the GNU General Public License, version 3 ("GPLv3").
|
||
%
|
||
% Please try the latest version of texinfo.tex before submitting bug
|
||
% reports; you can get the latest version from:
|
||
% https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
|
||
% https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
|
||
% https://www.gnu.org/software/texinfo/ (the Texinfo home page)
|
||
% The texinfo.tex in any given distribution could well be out
|
||
% of date, so if that's what you're using, please check.
|
||
%
|
||
% Send bug reports to bug-texinfo@gnu.org. Please include a
|
||
% complete document in each bug report with which we can reproduce the
|
||
% problem. Patches are, of course, greatly appreciated.
|
||
%
|
||
% To process a Texinfo manual with TeX, it's most reliable to use the
|
||
% texi2dvi shell script that comes with the distribution. For a simple
|
||
% manual foo.texi, however, you can get away with this:
|
||
% tex foo.texi
|
||
% texindex foo.??
|
||
% tex foo.texi
|
||
% tex foo.texi
|
||
% dvips foo.dvi -o # or whatever; this makes foo.ps.
|
||
% The extra TeX runs get the cross-reference information correct.
|
||
% Sometimes one run after texindex suffices, and sometimes you need more
|
||
% than two; texi2dvi does it as many times as necessary.
|
||
%
|
||
% It is possible to adapt texinfo.tex for other languages, to some
|
||
% extent. You can get the existing language-specific files from the
|
||
% full Texinfo distribution.
|
||
%
|
||
% The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
|
||
|
||
|
||
\message{Loading texinfo [version \texinfoversion]:}
|
||
|
||
% If in a .fmt file, print the version number
|
||
% and turn on active characters that we couldn't do earlier because
|
||
% they might have appeared in the input file name.
|
||
\everyjob{\message{[Texinfo version \texinfoversion]}%
|
||
\catcode`+=\active \catcode`\_=\active}
|
||
|
||
% LaTeX's \typeout. This ensures that the messages it is used for
|
||
% are identical in format to the corresponding ones from latex/pdflatex.
|
||
\def\typeout{\immediate\write17}%
|
||
|
||
\chardef\other=12
|
||
|
||
% We never want plain's \outer definition of \+ in Texinfo.
|
||
% For @tex, we can use \tabalign.
|
||
\let\+ = \relax
|
||
|
||
% Save some plain tex macros whose names we will redefine.
|
||
\let\ptexb=\b
|
||
\let\ptexbullet=\bullet
|
||
\let\ptexc=\c
|
||
\let\ptexcomma=\,
|
||
\let\ptexdot=\.
|
||
\let\ptexdots=\dots
|
||
\let\ptexend=\end
|
||
\let\ptexequiv=\equiv
|
||
\let\ptexexclam=\!
|
||
\let\ptexfootnote=\footnote
|
||
\let\ptexgtr=>
|
||
\let\ptexhat=^
|
||
\let\ptexi=\i
|
||
\let\ptexindent=\indent
|
||
\let\ptexinsert=\insert
|
||
\let\ptexlbrace=\{
|
||
\let\ptexless=<
|
||
\let\ptexnewwrite\newwrite
|
||
\let\ptexnoindent=\noindent
|
||
\let\ptexplus=+
|
||
\let\ptexraggedright=\raggedright
|
||
\let\ptexrbrace=\}
|
||
\let\ptexslash=\/
|
||
\let\ptexsp=\sp
|
||
\let\ptexstar=\*
|
||
\let\ptexsup=\sup
|
||
\let\ptext=\t
|
||
\let\ptextop=\top
|
||
{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
|
||
|
||
% If this character appears in an error message or help string, it
|
||
% starts a new line in the output.
|
||
\newlinechar = `^^J
|
||
|
||
% Use TeX 3.0's \inputlineno to get the line number, for better error
|
||
% messages, but if we're using an old version of TeX, don't do anything.
|
||
%
|
||
\ifx\inputlineno\thisisundefined
|
||
\let\linenumber = \empty % Pre-3.0.
|
||
\else
|
||
\def\linenumber{l.\the\inputlineno:\space}
|
||
\fi
|
||
|
||
% Set up fixed words for English if not already set.
|
||
\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
|
||
\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
|
||
\ifx\putworderror\undefined \gdef\putworderror{error}\fi
|
||
\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
|
||
\ifx\putwordin\undefined \gdef\putwordin{in}\fi
|
||
\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
|
||
\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
|
||
\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
|
||
\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
|
||
\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
|
||
\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
|
||
\ifx\putwordof\undefined \gdef\putwordof{of}\fi
|
||
\ifx\putwordon\undefined \gdef\putwordon{on}\fi
|
||
\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
|
||
\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
|
||
\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
|
||
\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
|
||
\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
|
||
\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
|
||
\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
|
||
%
|
||
\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
|
||
\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
|
||
\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
|
||
\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
|
||
\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
|
||
\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
|
||
\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
|
||
\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
|
||
\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
|
||
\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
|
||
\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
|
||
\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
|
||
%
|
||
\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
|
||
\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
|
||
\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
|
||
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
|
||
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
|
||
|
||
% Give the space character the catcode for a space.
|
||
\def\spaceisspace{\catcode`\ =10\relax}
|
||
|
||
% Likewise for ^^M, the end of line character.
|
||
\def\endlineisspace{\catcode13=10\relax}
|
||
|
||
\chardef\dashChar = `\-
|
||
\chardef\slashChar = `\/
|
||
\chardef\underChar = `\_
|
||
|
||
% Ignore a token.
|
||
%
|
||
\def\gobble#1{}
|
||
|
||
% The following is used inside several \edef's.
|
||
\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
|
||
|
||
% Hyphenation fixes.
|
||
\hyphenation{
|
||
Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
|
||
ap-pen-dix bit-map bit-maps
|
||
data-base data-bases eshell fall-ing half-way long-est man-u-script
|
||
man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
|
||
par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
|
||
spell-ing spell-ings
|
||
stand-alone strong-est time-stamp time-stamps which-ever white-space
|
||
wide-spread wrap-around
|
||
}
|
||
|
||
% Sometimes it is convenient to have everything in the transcript file
|
||
% and nothing on the terminal. We don't just call \tracingall here,
|
||
% since that produces some useless output on the terminal. We also make
|
||
% some effort to order the tracing commands to reduce output in the log
|
||
% file; cf. trace.sty in LaTeX.
|
||
%
|
||
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
|
||
\def\loggingall{%
|
||
\tracingstats2
|
||
\tracingpages1
|
||
\tracinglostchars2 % 2 gives us more in etex
|
||
\tracingparagraphs1
|
||
\tracingoutput1
|
||
\tracingmacros2
|
||
\tracingrestores1
|
||
\showboxbreadth\maxdimen \showboxdepth\maxdimen
|
||
\ifx\eTeXversion\thisisundefined\else % etex gives us more logging
|
||
\tracingscantokens1
|
||
\tracingifs1
|
||
\tracinggroups1
|
||
\tracingnesting2
|
||
\tracingassigns1
|
||
\fi
|
||
\tracingcommands3 % 3 gives us more in etex
|
||
\errorcontextlines16
|
||
}%
|
||
|
||
% @errormsg{MSG}. Do the index-like expansions on MSG, but if things
|
||
% aren't perfect, it's not the end of the world, being an error message,
|
||
% after all.
|
||
%
|
||
\def\errormsg{\begingroup \indexnofonts \doerrormsg}
|
||
\def\doerrormsg#1{\errmessage{#1}}
|
||
|
||
% add check for \lastpenalty to plain's definitions. If the last thing
|
||
% we did was a \nobreak, we don't want to insert more space.
|
||
%
|
||
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
|
||
\removelastskip\penalty-50\smallskip\fi\fi}
|
||
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
|
||
\removelastskip\penalty-100\medskip\fi\fi}
|
||
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
|
||
\removelastskip\penalty-200\bigskip\fi\fi}
|
||
|
||
% Output routine
|
||
%
|
||
|
||
% For a final copy, take out the rectangles
|
||
% that mark overfull boxes (in case you have decided
|
||
% that the text looks ok even though it passes the margin).
|
||
%
|
||
\def\finalout{\overfullrule=0pt }
|
||
|
||
\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
|
||
\newdimen\topandbottommargin \topandbottommargin=.75in
|
||
|
||
% Output a mark which sets \thischapter, \thissection and \thiscolor.
|
||
% We dump everything together because we only have one kind of mark.
|
||
% This works because we only use \botmark / \topmark, not \firstmark.
|
||
%
|
||
% A mark contains a subexpression of the \ifcase ... \fi construct.
|
||
% \get*marks macros below extract the needed part using \ifcase.
|
||
%
|
||
% Another complication is to let the user choose whether \thischapter
|
||
% (\thissection) refers to the chapter (section) in effect at the top
|
||
% of a page, or that at the bottom of a page.
|
||
|
||
% \domark is called twice inside \chapmacro, to add one
|
||
% mark before the section break, and one after.
|
||
% In the second call \prevchapterdefs is the same as \currentchapterdefs,
|
||
% and \prevsectiondefs is the same as \currentsectiondefs.
|
||
% Then if the page is not broken at the mark, some of the previous
|
||
% section appears on the page, and we can get the name of this section
|
||
% from \firstmark for @everyheadingmarks top.
|
||
% @everyheadingmarks bottom uses \botmark.
|
||
%
|
||
% See page 260 of The TeXbook.
|
||
\def\domark{%
|
||
\toks0=\expandafter{\currentchapterdefs}%
|
||
\toks2=\expandafter{\currentsectiondefs}%
|
||
\toks4=\expandafter{\prevchapterdefs}%
|
||
\toks6=\expandafter{\prevsectiondefs}%
|
||
\toks8=\expandafter{\currentcolordefs}%
|
||
\mark{%
|
||
\the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
|
||
\noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
|
||
\noexpand\else \the\toks8 % 2: color marks
|
||
}%
|
||
}
|
||
|
||
% \gettopheadingmarks, \getbottomheadingmarks,
|
||
% \getcolormarks - extract needed part of mark.
|
||
%
|
||
% \topmark doesn't work for the very first chapter (after the title
|
||
% page or the contents), so we use \firstmark there -- this gets us
|
||
% the mark with the chapter defs, unless the user sneaks in, e.g.,
|
||
% @setcolor (or @url, or @link, etc.) between @contents and the very
|
||
% first @chapter.
|
||
\def\gettopheadingmarks{%
|
||
\ifcase0\the\savedtopmark\fi
|
||
\ifx\thischapter\empty \ifcase0\firstmark\fi \fi
|
||
}
|
||
\def\getbottomheadingmarks{\ifcase1\botmark\fi}
|
||
\def\getcolormarks{\ifcase2\the\savedtopmark\fi}
|
||
|
||
% Avoid "undefined control sequence" errors.
|
||
\def\currentchapterdefs{}
|
||
\def\currentsectiondefs{}
|
||
\def\currentsection{}
|
||
\def\prevchapterdefs{}
|
||
\def\prevsectiondefs{}
|
||
\def\currentcolordefs{}
|
||
|
||
% Margin to add to right of even pages, to left of odd pages.
|
||
\newdimen\bindingoffset
|
||
\newdimen\normaloffset
|
||
\newdimen\txipagewidth \newdimen\txipageheight
|
||
|
||
% Main output routine.
|
||
%
|
||
\chardef\PAGE = 255
|
||
\newtoks\defaultoutput
|
||
\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
|
||
\output=\expandafter{\the\defaultoutput}
|
||
|
||
\newbox\headlinebox
|
||
\newbox\footlinebox
|
||
|
||
% When outputting the double column layout for indices, an output routine
|
||
% is run several times, which hides the original value of \topmark. This
|
||
% can lead to a page heading being output and duplicating the chapter heading
|
||
% of the index. Hence, save the contents of \topmark at the beginning of
|
||
% the output routine. The saved contents are valid until we actually
|
||
% \shipout a page.
|
||
%
|
||
% (We used to run a short output routine to actually set \topmark and
|
||
% \firstmark to the right values, but if this was called with an empty page
|
||
% containing whatsits for writing index entries, the whatsits would be thrown
|
||
% away and the index auxiliary file would remain empty.)
|
||
%
|
||
\newtoks\savedtopmark
|
||
\newif\iftopmarksaved
|
||
\topmarksavedtrue
|
||
\def\savetopmark{%
|
||
\iftopmarksaved\else
|
||
\global\savedtopmark=\expandafter{\topmark}%
|
||
\global\topmarksavedtrue
|
||
\fi
|
||
}
|
||
|
||
% \onepageout takes a vbox as an argument.
|
||
% \shipout a vbox for a single page, adding an optional header, footer
|
||
% and footnote. This also causes index entries for this page to be written
|
||
% to the auxiliary files.
|
||
%
|
||
\def\onepageout#1{%
|
||
\hoffset=\normaloffset
|
||
%
|
||
\ifodd\pageno \advance\hoffset by \bindingoffset
|
||
\else \advance\hoffset by -\bindingoffset\fi
|
||
%
|
||
\checkchapterpage
|
||
%
|
||
% Retrieve the information for the headings from the marks in the page,
|
||
% and call Plain TeX's \makeheadline and \makefootline, which use the
|
||
% values in \headline and \footline.
|
||
%
|
||
% Common context changes for both heading and footing.
|
||
% Do this outside of the \shipout so @code etc. will be expanded in
|
||
% the headline as they should be, not taken literally (outputting ''code).
|
||
\def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars}
|
||
%
|
||
\ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
|
||
\global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}%
|
||
\ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
|
||
\global\setbox\footlinebox = \vbox{\commonheadfootline \makefootline}%
|
||
%
|
||
{%
|
||
% Set context for writing to auxiliary files like index files.
|
||
% Have to do this stuff outside the \shipout because we want it to
|
||
% take effect in \write's, yet the group defined by the \vbox ends
|
||
% before the \shipout runs.
|
||
%
|
||
\atdummies % don't expand commands in the output.
|
||
\turnoffactive
|
||
\shipout\vbox{%
|
||
% Do this early so pdf references go to the beginning of the page.
|
||
\ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
|
||
%
|
||
\unvbox\headlinebox
|
||
\pagebody{#1}%
|
||
\ifdim\ht\footlinebox > 0pt
|
||
% Only leave this space if the footline is nonempty.
|
||
% (We lessened \vsize for it in \oddfootingyyy.)
|
||
% The \baselineskip=24pt in plain's \makefootline has no effect.
|
||
\vskip 24pt
|
||
\unvbox\footlinebox
|
||
\fi
|
||
%
|
||
}%
|
||
}%
|
||
\global\topmarksavedfalse
|
||
\advancepageno
|
||
\ifnum\outputpenalty>-20000 \else\dosupereject\fi
|
||
}
|
||
|
||
\newinsert\margin \dimen\margin=\maxdimen
|
||
|
||
% Main part of page, including any footnotes
|
||
\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
|
||
{\catcode`\@ =11
|
||
\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
|
||
% marginal hacks, juha@viisa.uucp (Juha Takala)
|
||
\ifvoid\margin\else % marginal info is present
|
||
\rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
|
||
\dimen@=\dp#1\relax \unvbox#1\relax
|
||
\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
|
||
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
|
||
}
|
||
|
||
% Check if we are on the first page of a chapter. Used for printing headings.
|
||
\newif\ifchapterpage
|
||
\def\checkchapterpage{%
|
||
% Get the chapter that was current at the end of the last page
|
||
\ifcase1\the\savedtopmark\fi
|
||
\let\prevchaptername\thischaptername
|
||
%
|
||
\ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
|
||
\let\curchaptername\thischaptername
|
||
%
|
||
\ifx\curchaptername\prevchaptername
|
||
\chapterpagefalse
|
||
\else
|
||
\chapterpagetrue
|
||
\fi
|
||
}
|
||
|
||
% Argument parsing
|
||
|
||
% Parse an argument, then pass it to #1. The argument is the rest of
|
||
% the input line (except we remove a trailing comment). #1 should be a
|
||
% macro which expects an ordinary undelimited TeX argument.
|
||
% For example, \def\foo{\parsearg\fooxxx}.
|
||
%
|
||
\def\parsearg{\parseargusing{}}
|
||
\def\parseargusing#1#2{%
|
||
\def\argtorun{#2}%
|
||
\begingroup
|
||
\obeylines
|
||
\spaceisspace
|
||
#1%
|
||
\parseargline\empty% Insert the \empty token, see \finishparsearg below.
|
||
}
|
||
|
||
{\obeylines %
|
||
\gdef\parseargline#1^^M{%
|
||
\endgroup % End of the group started in \parsearg.
|
||
\argremovecomment #1\comment\ArgTerm%
|
||
}%
|
||
}
|
||
|
||
% First remove any @comment, then any @c comment. Pass the result on to
|
||
% \argcheckspaces.
|
||
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
|
||
\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
|
||
|
||
% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
|
||
%
|
||
% \argremovec might leave us with trailing space, e.g.,
|
||
% @end itemize @c foo
|
||
% This space token undergoes the same procedure and is eventually removed
|
||
% by \finishparsearg.
|
||
%
|
||
\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
|
||
\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
|
||
\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
|
||
\def\temp{#3}%
|
||
\ifx\temp\empty
|
||
% Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
|
||
\let\temp\finishparsearg
|
||
\else
|
||
\let\temp\argcheckspaces
|
||
\fi
|
||
% Put the space token in:
|
||
\temp#1 #3\ArgTerm
|
||
}
|
||
|
||
% If a _delimited_ argument is enclosed in braces, they get stripped; so
|
||
% to get _exactly_ the rest of the line, we had to prevent such situation.
|
||
% We prepended an \empty token at the very beginning and we expand it now,
|
||
% just before passing the control to \argtorun.
|
||
% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
|
||
% either the null string, or it ends with \^^M---thus there is no danger
|
||
% that a pair of braces would be stripped.
|
||
%
|
||
% But first, we have to remove the trailing space token.
|
||
%
|
||
\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
|
||
|
||
|
||
% \parseargdef - define a command taking an argument on the line
|
||
%
|
||
% \parseargdef\foo{...}
|
||
% is roughly equivalent to
|
||
% \def\foo{\parsearg\Xfoo}
|
||
% \def\Xfoo#1{...}
|
||
\def\parseargdef#1{%
|
||
\expandafter \doparseargdef \csname\string#1\endcsname #1%
|
||
}
|
||
\def\doparseargdef#1#2{%
|
||
\def#2{\parsearg#1}%
|
||
\def#1##1%
|
||
}
|
||
|
||
% Several utility definitions with active space:
|
||
{
|
||
\obeyspaces
|
||
\gdef\obeyedspace{ }
|
||
|
||
% Make each space character in the input produce a normal interword
|
||
% space in the output. Don't allow a line break at this space, as this
|
||
% is used only in environments like @example, where each line of input
|
||
% should produce a line of output anyway.
|
||
%
|
||
\gdef\sepspaces{\obeyspaces\let =\tie}
|
||
|
||
% If an index command is used in an @example environment, any spaces
|
||
% therein should become regular spaces in the raw index file, not the
|
||
% expansion of \tie (\leavevmode \penalty \@M \ ).
|
||
\gdef\unsepspaces{\let =\space}
|
||
}
|
||
|
||
|
||
\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
|
||
|
||
% Define the framework for environments in texinfo.tex. It's used like this:
|
||
%
|
||
% \envdef\foo{...}
|
||
% \def\Efoo{...}
|
||
%
|
||
% It's the responsibility of \envdef to insert \begingroup before the
|
||
% actual body; @end closes the group after calling \Efoo. \envdef also
|
||
% defines \thisenv, so the current environment is known; @end checks
|
||
% whether the environment name matches. The \checkenv macro can also be
|
||
% used to check whether the current environment is the one expected.
|
||
%
|
||
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
|
||
% are not treated as environments; they don't open a group. (The
|
||
% implementation of @end takes care not to call \endgroup in this
|
||
% special case.)
|
||
|
||
|
||
% At run-time, environments start with this:
|
||
\def\startenvironment#1{\begingroup\def\thisenv{#1}}
|
||
% initialize
|
||
\let\thisenv\empty
|
||
|
||
% ... but they get defined via ``\envdef\foo{...}'':
|
||
\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
|
||
\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
|
||
|
||
% Check whether we're in the right environment:
|
||
\def\checkenv#1{%
|
||
\def\temp{#1}%
|
||
\ifx\thisenv\temp
|
||
\else
|
||
\badenverr
|
||
\fi
|
||
}
|
||
|
||
% Environment mismatch, #1 expected:
|
||
\def\badenverr{%
|
||
\errhelp = \EMsimple
|
||
\errmessage{This command can appear only \inenvironment\temp,
|
||
not \inenvironment\thisenv}%
|
||
}
|
||
\def\inenvironment#1{%
|
||
\ifx#1\empty
|
||
outside of any environment%
|
||
\else
|
||
in environment \expandafter\string#1%
|
||
\fi
|
||
}
|
||
|
||
% @end foo executes the definition of \Efoo.
|
||
% But first, it executes a specialized version of \checkenv
|
||
%
|
||
\parseargdef\end{%
|
||
\if 1\csname iscond.#1\endcsname
|
||
\else
|
||
% The general wording of \badenverr may not be ideal.
|
||
\expandafter\checkenv\csname#1\endcsname
|
||
\csname E#1\endcsname
|
||
\endgroup
|
||
\fi
|
||
}
|
||
|
||
\newhelp\EMsimple{Press RETURN to continue.}
|
||
|
||
|
||
% Be sure we're in horizontal mode when doing a tie, since we make space
|
||
% equivalent to this in @example-like environments. Otherwise, a space
|
||
% at the beginning of a line will start with \penalty -- and
|
||
% since \penalty is valid in vertical mode, we'd end up putting the
|
||
% penalty on the vertical list instead of in the new paragraph.
|
||
{\catcode`@ = 11
|
||
% Avoid using \@M directly, because that causes trouble
|
||
% if the definition is written into an index file.
|
||
\global\let\tiepenalty = \@M
|
||
\gdef\tie{\leavevmode\penalty\tiepenalty\ }
|
||
}
|
||
|
||
% @: forces normal size whitespace following.
|
||
\def\:{\spacefactor=1000 }
|
||
|
||
% @* forces a line break.
|
||
\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
|
||
|
||
% @/ allows a line break.
|
||
\let\/=\allowbreak
|
||
|
||
% @. is an end-of-sentence period.
|
||
\def\.{.\spacefactor=\endofsentencespacefactor\space}
|
||
|
||
% @! is an end-of-sentence bang.
|
||
\def\!{!\spacefactor=\endofsentencespacefactor\space}
|
||
|
||
% @? is an end-of-sentence query.
|
||
\def\?{?\spacefactor=\endofsentencespacefactor\space}
|
||
|
||
% @frenchspacing on|off says whether to put extra space after punctuation.
|
||
%
|
||
\def\onword{on}
|
||
\def\offword{off}
|
||
%
|
||
\parseargdef\frenchspacing{%
|
||
\def\temp{#1}%
|
||
\ifx\temp\onword \plainfrenchspacing
|
||
\else\ifx\temp\offword \plainnonfrenchspacing
|
||
\else
|
||
\errhelp = \EMsimple
|
||
\errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
|
||
\fi\fi
|
||
}
|
||
|
||
% @w prevents a word break. Without the \leavevmode, @w at the
|
||
% beginning of a paragraph, when TeX is still in vertical mode, would
|
||
% produce a whole line of output instead of starting the paragraph.
|
||
\def\w#1{\leavevmode\hbox{#1}}
|
||
|
||
% @group ... @end group forces ... to be all on one page, by enclosing
|
||
% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
|
||
% to keep its height that of a normal line. According to the rules for
|
||
% \topskip (p.114 of the TeXbook), the glue inserted is
|
||
% max (\topskip - \ht (first item), 0). If that height is large,
|
||
% therefore, no glue is inserted, and the space between the headline and
|
||
% the text is small, which looks bad.
|
||
%
|
||
% Another complication is that the group might be very large. This can
|
||
% cause the glue on the previous page to be unduly stretched, because it
|
||
% does not have much material. In this case, it's better to add an
|
||
% explicit \vfill so that the extra space is at the bottom. The
|
||
% threshold for doing this is if the group is more than \vfilllimit
|
||
% percent of a page (\vfilllimit can be changed inside of @tex).
|
||
%
|
||
\newbox\groupbox
|
||
\def\vfilllimit{0.7}
|
||
%
|
||
\envdef\group{%
|
||
\ifnum\catcode`\^^M=\active \else
|
||
\errhelp = \groupinvalidhelp
|
||
\errmessage{@group invalid in context where filling is enabled}%
|
||
\fi
|
||
\startsavinginserts
|
||
%
|
||
\setbox\groupbox = \vtop\bgroup
|
||
% Do @comment since we are called inside an environment such as
|
||
% @example, where each end-of-line in the input causes an
|
||
% end-of-line in the output. We don't want the end-of-line after
|
||
% the `@group' to put extra space in the output. Since @group
|
||
% should appear on a line by itself (according to the Texinfo
|
||
% manual), we don't worry about eating any user text.
|
||
\comment
|
||
}
|
||
%
|
||
% The \vtop produces a box with normal height and large depth; thus, TeX puts
|
||
% \baselineskip glue before it, and (when the next line of text is done)
|
||
% \lineskip glue after it. Thus, space below is not quite equal to space
|
||
% above. But it's pretty close.
|
||
\def\Egroup{%
|
||
% To get correct interline space between the last line of the group
|
||
% and the first line afterwards, we have to propagate \prevdepth.
|
||
\endgraf % Not \par, as it may have been set to \lisppar.
|
||
\global\dimen1 = \prevdepth
|
||
\egroup % End the \vtop.
|
||
\addgroupbox
|
||
\prevdepth = \dimen1
|
||
\checkinserts
|
||
}
|
||
|
||
\def\addgroupbox{
|
||
% \dimen0 is the vertical size of the group's box.
|
||
\dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
|
||
% \dimen2 is how much space is left on the page (more or less).
|
||
\dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
|
||
% if the group doesn't fit on the current page, and it's a big big
|
||
% group, force a page break.
|
||
\ifdim \dimen0 > \dimen2
|
||
\ifdim \pagetotal < \vfilllimit\txipageheight
|
||
\page
|
||
\fi
|
||
\fi
|
||
\box\groupbox
|
||
}
|
||
|
||
%
|
||
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
|
||
% message, so this ends up printing `@group can only ...'.
|
||
%
|
||
\newhelp\groupinvalidhelp{%
|
||
group can only be used in environments such as @example,^^J%
|
||
where each line of input produces a line of output.}
|
||
|
||
% @need space-in-mils
|
||
% forces a page break if there is not space-in-mils remaining.
|
||
|
||
\newdimen\mil \mil=0.001in
|
||
|
||
\parseargdef\need{%
|
||
% Ensure vertical mode, so we don't make a big box in the middle of a
|
||
% paragraph.
|
||
\par
|
||
%
|
||
% If the @need value is less than one line space, it's useless.
|
||
\dimen0 = #1\mil
|
||
\dimen2 = \ht\strutbox
|
||
\advance\dimen2 by \dp\strutbox
|
||
\ifdim\dimen0 > \dimen2
|
||
%
|
||
% Do a \strut just to make the height of this box be normal, so the
|
||
% normal leading is inserted relative to the preceding line.
|
||
% And a page break here is fine.
|
||
\vtop to #1\mil{\strut\vfil}%
|
||
%
|
||
% TeX does not even consider page breaks if a penalty added to the
|
||
% main vertical list is 10000 or more. But in order to see if the
|
||
% empty box we just added fits on the page, we must make it consider
|
||
% page breaks. On the other hand, we don't want to actually break the
|
||
% page after the empty box. So we use a penalty of 9999.
|
||
%
|
||
% There is an extremely small chance that TeX will actually break the
|
||
% page at this \penalty, if there are no other feasible breakpoints in
|
||
% sight. (If the user is using lots of big @group commands, which
|
||
% almost-but-not-quite fill up a page, TeX will have a hard time doing
|
||
% good page breaking, for example.) However, I could not construct an
|
||
% example where a page broke at this \penalty; if it happens in a real
|
||
% document, then we can reconsider our strategy.
|
||
\penalty9999
|
||
%
|
||
% Back up by the size of the box, whether we did a page break or not.
|
||
\kern -#1\mil
|
||
%
|
||
% Do not allow a page break right after this kern.
|
||
\nobreak
|
||
\fi
|
||
}
|
||
|
||
% @br forces paragraph break (and is undocumented).
|
||
|
||
\let\br = \par
|
||
|
||
% @page forces the start of a new page.
|
||
%
|
||
\def\page{\par\vfill\supereject}
|
||
|
||
% @exdent text....
|
||
% outputs text on separate line in roman font, starting at standard page margin
|
||
|
||
% This records the amount of indent in the innermost environment.
|
||
% That's how much \exdent should take out.
|
||
\newskip\exdentamount
|
||
|
||
% This defn is used inside fill environments such as @defun.
|
||
\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
|
||
|
||
% This defn is used inside nofill environments such as @example.
|
||
\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
|
||
\leftline{\hskip\leftskip{\rm#1}}}}
|
||
|
||
% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
|
||
% paragraph. For more general purposes, use the \margin insertion
|
||
% class. WHICH is `l' or `r'. Not documented, written for gawk manual.
|
||
%
|
||
\newskip\inmarginspacing \inmarginspacing=1cm
|
||
\def\strutdepth{\dp\strutbox}
|
||
%
|
||
\def\doinmargin#1#2{\strut\vadjust{%
|
||
\nobreak
|
||
\kern-\strutdepth
|
||
\vtop to \strutdepth{%
|
||
\baselineskip=\strutdepth
|
||
\vss
|
||
% if you have multiple lines of stuff to put here, you'll need to
|
||
% make the vbox yourself of the appropriate size.
|
||
\ifx#1l%
|
||
\llap{\ignorespaces #2\hskip\inmarginspacing}%
|
||
\else
|
||
\rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
|
||
\fi
|
||
\null
|
||
}%
|
||
}}
|
||
\def\inleftmargin{\doinmargin l}
|
||
\def\inrightmargin{\doinmargin r}
|
||
%
|
||
% @inmargin{TEXT [, RIGHT-TEXT]}
|
||
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
|
||
% else use TEXT for both).
|
||
%
|
||
\def\inmargin#1{\parseinmargin #1,,\finish}
|
||
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
|
||
\setbox0 = \hbox{\ignorespaces #2}%
|
||
\ifdim\wd0 > 0pt
|
||
\def\lefttext{#1}% have both texts
|
||
\def\righttext{#2}%
|
||
\else
|
||
\def\lefttext{#1}% have only one text
|
||
\def\righttext{#1}%
|
||
\fi
|
||
%
|
||
\ifodd\pageno
|
||
\def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
|
||
\else
|
||
\def\temp{\inleftmargin\lefttext}%
|
||
\fi
|
||
\temp
|
||
}
|
||
|
||
% @include FILE -- \input text of FILE.
|
||
%
|
||
\def\include{\parseargusing\filenamecatcodes\includezzz}
|
||
\def\includezzz#1{%
|
||
\pushthisfilestack
|
||
\def\thisfile{#1}%
|
||
{%
|
||
\makevalueexpandable % we want to expand any @value in FILE.
|
||
\turnoffactive % and allow special characters in the expansion
|
||
\indexnofonts % Allow `@@' and other weird things in file names.
|
||
\wlog{texinfo.tex: doing @include of #1^^J}%
|
||
\edef\temp{\noexpand\input #1 }%
|
||
%
|
||
% This trickery is to read FILE outside of a group, in case it makes
|
||
% definitions, etc.
|
||
\expandafter
|
||
}\temp
|
||
\popthisfilestack
|
||
}
|
||
\def\filenamecatcodes{%
|
||
\catcode`\\=\other
|
||
\catcode`~=\other
|
||
\catcode`^=\other
|
||
\catcode`_=\other
|
||
\catcode`|=\other
|
||
\catcode`<=\other
|
||
\catcode`>=\other
|
||
\catcode`+=\other
|
||
\catcode`-=\other
|
||
\catcode`\`=\other
|
||
\catcode`\'=\other
|
||
}
|
||
|
||
\def\pushthisfilestack{%
|
||
\expandafter\pushthisfilestackX\popthisfilestack\StackTerm
|
||
}
|
||
\def\pushthisfilestackX{%
|
||
\expandafter\pushthisfilestackY\thisfile\StackTerm
|
||
}
|
||
\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
|
||
\gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
|
||
}
|
||
|
||
\def\popthisfilestack{\errthisfilestackempty}
|
||
\def\errthisfilestackempty{\errmessage{Internal error:
|
||
the stack of filenames is empty.}}
|
||
%
|
||
\def\thisfile{}
|
||
|
||
% @center line
|
||
% outputs that line, centered.
|
||
%
|
||
\parseargdef\center{%
|
||
\ifhmode
|
||
\let\centersub\centerH
|
||
\else
|
||
\let\centersub\centerV
|
||
\fi
|
||
\centersub{\hfil \ignorespaces#1\unskip \hfil}%
|
||
\let\centersub\relax % don't let the definition persist, just in case
|
||
}
|
||
\def\centerH#1{{%
|
||
\hfil\break
|
||
\advance\hsize by -\leftskip
|
||
\advance\hsize by -\rightskip
|
||
\line{#1}%
|
||
\break
|
||
}}
|
||
%
|
||
\newcount\centerpenalty
|
||
\def\centerV#1{%
|
||
% The idea here is the same as in \startdefun, \cartouche, etc.: if
|
||
% @center is the first thing after a section heading, we need to wipe
|
||
% out the negative parskip inserted by \sectionheading, but still
|
||
% prevent a page break here.
|
||
\centerpenalty = \lastpenalty
|
||
\ifnum\centerpenalty>10000 \vskip\parskip \fi
|
||
\ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
|
||
\line{\kern\leftskip #1\kern\rightskip}%
|
||
}
|
||
|
||
% @sp n outputs n lines of vertical space
|
||
%
|
||
\parseargdef\sp{\vskip #1\baselineskip}
|
||
|
||
% @comment ...line which is ignored...
|
||
% @c is the same as @comment
|
||
% @ignore ... @end ignore is another way to write a comment
|
||
|
||
|
||
\def\c{\begingroup \catcode`\^^M=\active%
|
||
\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
|
||
\cxxx}
|
||
{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
|
||
%
|
||
\let\comment\c
|
||
|
||
% @paragraphindent NCHARS
|
||
% We'll use ems for NCHARS, close enough.
|
||
% NCHARS can also be the word `asis' or `none'.
|
||
% We cannot feasibly implement @paragraphindent asis, though.
|
||
%
|
||
\def\asisword{asis} % no translation, these are keywords
|
||
\def\noneword{none}
|
||
%
|
||
\parseargdef\paragraphindent{%
|
||
\def\temp{#1}%
|
||
\ifx\temp\asisword
|
||
\else
|
||
\ifx\temp\noneword
|
||
\defaultparindent = 0pt
|
||
\else
|
||
\defaultparindent = #1em
|
||
\fi
|
||
\fi
|
||
\parindent = \defaultparindent
|
||
}
|
||
|
||
% @exampleindent NCHARS
|
||
% We'll use ems for NCHARS like @paragraphindent.
|
||
% It seems @exampleindent asis isn't necessary, but
|
||
% I preserve it to make it similar to @paragraphindent.
|
||
\parseargdef\exampleindent{%
|
||
\def\temp{#1}%
|
||
\ifx\temp\asisword
|
||
\else
|
||
\ifx\temp\noneword
|
||
\lispnarrowing = 0pt
|
||
\else
|
||
\lispnarrowing = #1em
|
||
\fi
|
||
\fi
|
||
}
|
||
|
||
% @firstparagraphindent WORD
|
||
% If WORD is `none', then suppress indentation of the first paragraph
|
||
% after a section heading. If WORD is `insert', then do indent at such
|
||
% paragraphs.
|
||
%
|
||
% The paragraph indentation is suppressed or not by calling
|
||
% \suppressfirstparagraphindent, which the sectioning commands do.
|
||
% We switch the definition of this back and forth according to WORD.
|
||
% By default, we suppress indentation.
|
||
%
|
||
\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
|
||
\def\insertword{insert}
|
||
%
|
||
\parseargdef\firstparagraphindent{%
|
||
\def\temp{#1}%
|
||
\ifx\temp\noneword
|
||
\let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
|
||
\else\ifx\temp\insertword
|
||
\let\suppressfirstparagraphindent = \relax
|
||
\else
|
||
\errhelp = \EMsimple
|
||
\errmessage{Unknown @firstparagraphindent option `\temp'}%
|
||
\fi\fi
|
||
}
|
||
|
||
% Here is how we actually suppress indentation. Redefine \everypar to
|
||
% \kern backwards by \parindent, and then reset itself to empty.
|
||
%
|
||
% We also make \indent itself not actually do anything until the next
|
||
% paragraph.
|
||
%
|
||
\gdef\dosuppressfirstparagraphindent{%
|
||
\gdef\indent {\restorefirstparagraphindent \indent}%
|
||
\gdef\noindent{\restorefirstparagraphindent \noindent}%
|
||
\global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
|
||
}
|
||
%
|
||
\gdef\restorefirstparagraphindent{%
|
||
\global\let\indent = \ptexindent
|
||
\global\let\noindent = \ptexnoindent
|
||
\global\everypar = {}%
|
||
}
|
||
|
||
|
||
% @refill is a no-op.
|
||
\let\refill=\relax
|
||
|
||
% @setfilename INFO-FILENAME - ignored
|
||
\let\setfilename=\comment
|
||
|
||
% @bye.
|
||
\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend}
|
||
|
||
|
||
\message{pdf,}
|
||
% adobe `portable' document format
|
||
\newcount\tempnum
|
||
\newcount\lnkcount
|
||
\newtoks\filename
|
||
\newcount\filenamelength
|
||
\newcount\pgn
|
||
\newtoks\toksA
|
||
\newtoks\toksB
|
||
\newtoks\toksC
|
||
\newtoks\toksD
|
||
\newbox\boxA
|
||
\newbox\boxB
|
||
\newcount\countA
|
||
\newif\ifpdf
|
||
\newif\ifpdfmakepagedest
|
||
|
||
%
|
||
% For LuaTeX
|
||
%
|
||
|
||
\newif\iftxiuseunicodedestname
|
||
\txiuseunicodedestnamefalse % For pdfTeX etc.
|
||
|
||
\ifx\luatexversion\thisisundefined
|
||
\else
|
||
% Use Unicode destination names
|
||
\txiuseunicodedestnametrue
|
||
% Escape PDF strings with converting UTF-16 from UTF-8
|
||
\begingroup
|
||
\catcode`\%=12
|
||
\directlua{
|
||
function UTF16oct(str)
|
||
tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
|
||
for c in string.utfvalues(str) do
|
||
if c < 0x10000 then
|
||
tex.sprint(
|
||
string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
|
||
string.char(0x5c) .. string.char(0x25) .. '03o',
|
||
math.floor(c / 256), math.floor(c % 256)))
|
||
else
|
||
c = c - 0x10000
|
||
local c_hi = c / 1024 + 0xd800
|
||
local c_lo = c % 1024 + 0xdc00
|
||
tex.sprint(
|
||
string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
|
||
string.char(0x5c) .. string.char(0x25) .. '03o' ..
|
||
string.char(0x5c) .. string.char(0x25) .. '03o' ..
|
||
string.char(0x5c) .. string.char(0x25) .. '03o',
|
||
math.floor(c_hi / 256), math.floor(c_hi % 256),
|
||
math.floor(c_lo / 256), math.floor(c_lo % 256)))
|
||
end
|
||
end
|
||
end
|
||
}
|
||
\endgroup
|
||
\def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
|
||
% Escape PDF strings without converting
|
||
\begingroup
|
||
\directlua{
|
||
function PDFescstr(str)
|
||
for c in string.bytes(str) do
|
||
if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
|
||
tex.sprint(-2,
|
||
string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
|
||
c))
|
||
else
|
||
tex.sprint(-2, string.char(c))
|
||
end
|
||
end
|
||
end
|
||
}
|
||
% The -2 in the arguments here gives all the input to TeX catcode 12
|
||
% (other) or 10 (space), preventing undefined control sequence errors. See
|
||
% https://lists.gnu.org/archive/html/bug-texinfo/2019-08/msg00031.html
|
||
%
|
||
\endgroup
|
||
\def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
|
||
\ifnum\luatexversion>84
|
||
% For LuaTeX >= 0.85
|
||
\def\pdfdest{\pdfextension dest}
|
||
\let\pdfoutput\outputmode
|
||
\def\pdfliteral{\pdfextension literal}
|
||
\def\pdfcatalog{\pdfextension catalog}
|
||
\def\pdftexversion{\numexpr\pdffeedback version\relax}
|
||
\let\pdfximage\saveimageresource
|
||
\let\pdfrefximage\useimageresource
|
||
\let\pdflastximage\lastsavedimageresourceindex
|
||
\def\pdfendlink{\pdfextension endlink\relax}
|
||
\def\pdfoutline{\pdfextension outline}
|
||
\def\pdfstartlink{\pdfextension startlink}
|
||
\def\pdffontattr{\pdfextension fontattr}
|
||
\def\pdfobj{\pdfextension obj}
|
||
\def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
|
||
\let\pdfpagewidth\pagewidth
|
||
\let\pdfpageheight\pageheight
|
||
\edef\pdfhorigin{\pdfvariable horigin}
|
||
\edef\pdfvorigin{\pdfvariable vorigin}
|
||
\fi
|
||
\fi
|
||
|
||
% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
|
||
% can be set). So we test for \relax and 0 as well as being undefined.
|
||
\ifx\pdfoutput\thisisundefined
|
||
\else
|
||
\ifx\pdfoutput\relax
|
||
\else
|
||
\ifcase\pdfoutput
|
||
\else
|
||
\pdftrue
|
||
\fi
|
||
\fi
|
||
\fi
|
||
|
||
\newif\ifpdforxetex
|
||
\pdforxetexfalse
|
||
\ifpdf
|
||
\pdforxetextrue
|
||
\fi
|
||
\ifx\XeTeXrevision\thisisundefined\else
|
||
\pdforxetextrue
|
||
\fi
|
||
|
||
|
||
% Output page labels information.
|
||
% See PDF reference v.1.7 p.594, section 8.3.1.
|
||
\ifpdf
|
||
\def\pagelabels{%
|
||
\def\title{0 << /P (T-) /S /D >>}%
|
||
\edef\roman{\the\romancount << /S /r >>}%
|
||
\edef\arabic{\the\arabiccount << /S /D >>}%
|
||
%
|
||
% Page label ranges must be increasing. Remove any duplicates.
|
||
% (There is a slight chance of this being wrong if e.g. there is
|
||
% a @contents but no @titlepage, etc.)
|
||
%
|
||
\ifnum\romancount=0 \def\roman{}\fi
|
||
\ifnum\arabiccount=0 \def\title{}%
|
||
\else
|
||
\ifnum\romancount=\arabiccount \def\roman{}\fi
|
||
\fi
|
||
%
|
||
\ifnum\romancount<\arabiccount
|
||
\pdfcatalog{/PageLabels << /Nums [\title \roman \arabic ] >> }\relax
|
||
\else
|
||
\pdfcatalog{/PageLabels << /Nums [\title \arabic \roman ] >> }\relax
|
||
\fi
|
||
}
|
||
\else
|
||
\let\pagelabels\relax
|
||
\fi
|
||
|
||
\newcount\pagecount \pagecount=0
|
||
\newcount\romancount \romancount=0
|
||
\newcount\arabiccount \arabiccount=0
|
||
\ifpdf
|
||
\let\ptxadvancepageno\advancepageno
|
||
\def\advancepageno{%
|
||
\ptxadvancepageno\global\advance\pagecount by 1
|
||
}
|
||
\fi
|
||
|
||
|
||
% PDF uses PostScript string constants for the names of xref targets,
|
||
% for display in the outlines, and in other places. Thus, we have to
|
||
% double any backslashes. Otherwise, a name like "\node" will be
|
||
% interpreted as a newline (\n), followed by o, d, e. Not good.
|
||
%
|
||
% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
|
||
% related messages. The final outcome is that it is up to the TeX user
|
||
% to double the backslashes and otherwise make the string valid, so
|
||
% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
|
||
% do this reliably, so we use it.
|
||
|
||
% #1 is a control sequence in which to do the replacements,
|
||
% which we \xdef.
|
||
\def\txiescapepdf#1{%
|
||
\ifx\pdfescapestring\thisisundefined
|
||
% No primitive available; should we give a warning or log?
|
||
% Many times it won't matter.
|
||
\xdef#1{#1}%
|
||
\else
|
||
% The expandable \pdfescapestring primitive escapes parentheses,
|
||
% backslashes, and other special chars.
|
||
\xdef#1{\pdfescapestring{#1}}%
|
||
\fi
|
||
}
|
||
\def\txiescapepdfutfsixteen#1{%
|
||
\ifx\pdfescapestrutfsixteen\thisisundefined
|
||
% No UTF-16 converting macro available.
|
||
\txiescapepdf{#1}%
|
||
\else
|
||
\xdef#1{\pdfescapestrutfsixteen{#1}}%
|
||
\fi
|
||
}
|
||
|
||
\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
|
||
with PDF output, and none of those formats could be found. (.eps cannot
|
||
be supported due to the design of the PDF format; use regular TeX (DVI
|
||
output) for that.)}
|
||
|
||
\ifpdf
|
||
%
|
||
% Color manipulation macros using ideas from pdfcolor.tex,
|
||
% except using rgb instead of cmyk; the latter is said to render as a
|
||
% very dark gray on-screen and a very dark halftone in print, instead
|
||
% of actual black. The dark red here is dark enough to print on paper as
|
||
% nearly black, but still distinguishable for online viewing. We use
|
||
% black by default, though.
|
||
\def\rgbDarkRed{0.50 0.09 0.12}
|
||
\def\rgbBlack{0 0 0}
|
||
%
|
||
% rg sets the color for filling (usual text, etc.);
|
||
% RG sets the color for stroking (thin rules, e.g., normal _'s).
|
||
\def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
|
||
%
|
||
% Set color, and create a mark which defines \thiscolor accordingly,
|
||
% so that \makeheadline knows which color to restore.
|
||
\def\setcolor#1{%
|
||
\xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
|
||
\domark
|
||
\pdfsetcolor{#1}%
|
||
}
|
||
%
|
||
\def\maincolor{\rgbBlack}
|
||
\pdfsetcolor{\maincolor}
|
||
\edef\thiscolor{\maincolor}
|
||
\def\currentcolordefs{}
|
||
%
|
||
\def\makefootline{%
|
||
\baselineskip24pt
|
||
\line{\pdfsetcolor{\maincolor}\the\footline}%
|
||
}
|
||
%
|
||
\def\makeheadline{%
|
||
\vbox to 0pt{%
|
||
\vskip-22.5pt
|
||
\line{%
|
||
\vbox to8.5pt{}%
|
||
% Extract \thiscolor definition from the marks.
|
||
\getcolormarks
|
||
% Typeset the headline with \maincolor, then restore the color.
|
||
\pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
|
||
}%
|
||
\vss
|
||
}%
|
||
\nointerlineskip
|
||
}
|
||
%
|
||
%
|
||
\pdfcatalog{/PageMode /UseOutlines}
|
||
%
|
||
% #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
|
||
\def\dopdfimage#1#2#3{%
|
||
\def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
|
||
\def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
|
||
%
|
||
% pdftex (and the PDF format) support .pdf, .png, .jpg (among
|
||
% others). Let's try in that order, PDF first since if
|
||
% someone has a scalable image, presumably better to use that than a
|
||
% bitmap.
|
||
\let\pdfimgext=\empty
|
||
\begingroup
|
||
\openin 1 #1.pdf \ifeof 1
|
||
\openin 1 #1.PDF \ifeof 1
|
||
\openin 1 #1.png \ifeof 1
|
||
\openin 1 #1.jpg \ifeof 1
|
||
\openin 1 #1.jpeg \ifeof 1
|
||
\openin 1 #1.JPG \ifeof 1
|
||
\errhelp = \nopdfimagehelp
|
||
\errmessage{Could not find image file #1 for pdf}%
|
||
\else \gdef\pdfimgext{JPG}%
|
||
\fi
|
||
\else \gdef\pdfimgext{jpeg}%
|
||
\fi
|
||
\else \gdef\pdfimgext{jpg}%
|
||
\fi
|
||
\else \gdef\pdfimgext{png}%
|
||
\fi
|
||
\else \gdef\pdfimgext{PDF}%
|
||
\fi
|
||
\else \gdef\pdfimgext{pdf}%
|
||
\fi
|
||
\closein 1
|
||
\endgroup
|
||
%
|
||
% without \immediate, ancient pdftex seg faults when the same image is
|
||
% included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
|
||
\ifnum\pdftexversion < 14
|
||
\immediate\pdfimage
|
||
\else
|
||
\immediate\pdfximage
|
||
\fi
|
||
\ifdim \wd0 >0pt width \pdfimagewidth \fi
|
||
\ifdim \wd2 >0pt height \pdfimageheight \fi
|
||
\ifnum\pdftexversion<13
|
||
#1.\pdfimgext
|
||
\else
|
||
{#1.\pdfimgext}%
|
||
\fi
|
||
\ifnum\pdftexversion < 14 \else
|
||
\pdfrefximage \pdflastximage
|
||
\fi}
|
||
%
|
||
\def\setpdfdestname#1{{%
|
||
% We have to set dummies so commands such as @code, and characters
|
||
% such as \, aren't expanded when present in a section title.
|
||
\indexnofonts
|
||
\makevalueexpandable
|
||
\turnoffactive
|
||
\iftxiuseunicodedestname
|
||
\ifx \declaredencoding \latone
|
||
% Pass through Latin-1 characters.
|
||
% LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
|
||
\else
|
||
\ifx \declaredencoding \utfeight
|
||
% Pass through Unicode characters.
|
||
\else
|
||
% Use ASCII approximations in destination names.
|
||
\passthroughcharsfalse
|
||
\fi
|
||
\fi
|
||
\else
|
||
% Use ASCII approximations in destination names.
|
||
\passthroughcharsfalse
|
||
\fi
|
||
\def\pdfdestname{#1}%
|
||
\txiescapepdf\pdfdestname
|
||
}}
|
||
%
|
||
\def\setpdfoutlinetext#1{{%
|
||
\indexnofonts
|
||
\makevalueexpandable
|
||
\turnoffactive
|
||
\ifx \declaredencoding \latone
|
||
% The PDF format can use an extended form of Latin-1 in bookmark
|
||
% strings. See Appendix D of the PDF Reference, Sixth Edition, for
|
||
% the "PDFDocEncoding".
|
||
\passthroughcharstrue
|
||
% Pass through Latin-1 characters.
|
||
% LuaTeX: Convert to Unicode
|
||
% pdfTeX: Use Latin-1 as PDFDocEncoding
|
||
\def\pdfoutlinetext{#1}%
|
||
\else
|
||
\ifx \declaredencoding \utfeight
|
||
\ifx\luatexversion\thisisundefined
|
||
% For pdfTeX with UTF-8.
|
||
% TODO: the PDF format can use UTF-16 in bookmark strings,
|
||
% but the code for this isn't done yet.
|
||
% Use ASCII approximations.
|
||
\passthroughcharsfalse
|
||
\def\pdfoutlinetext{#1}%
|
||
\else
|
||
% For LuaTeX with UTF-8.
|
||
% Pass through Unicode characters for title texts.
|
||
\passthroughcharstrue
|
||
\def\pdfoutlinetext{#1}%
|
||
\fi
|
||
\else
|
||
% For non-Latin-1 or non-UTF-8 encodings.
|
||
% Use ASCII approximations.
|
||
\passthroughcharsfalse
|
||
\def\pdfoutlinetext{#1}%
|
||
\fi
|
||
\fi
|
||
% LuaTeX: Convert to UTF-16
|
||
% pdfTeX: Use Latin-1 as PDFDocEncoding
|
||
\txiescapepdfutfsixteen\pdfoutlinetext
|
||
}}
|
||
%
|
||
\def\pdfmkdest#1{%
|
||
\setpdfdestname{#1}%
|
||
\safewhatsit{\pdfdest name{\pdfdestname} xyz}%
|
||
}
|
||
%
|
||
% used to mark target names; must be expandable.
|
||
\def\pdfmkpgn#1{#1}
|
||
%
|
||
% by default, use black for everything.
|
||
\def\urlcolor{\rgbBlack}
|
||
\def\linkcolor{\rgbBlack}
|
||
\def\endlink{\setcolor{\maincolor}\pdfendlink}
|
||
%
|
||
% Adding outlines to PDF; macros for calculating structure of outlines
|
||
% come from Petr Olsak
|
||
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
|
||
\else \csname#1\endcsname \fi}
|
||
\def\advancenumber#1{\tempnum=\expnumber{#1}\relax
|
||
\advance\tempnum by 1
|
||
\expandafter\xdef\csname#1\endcsname{\the\tempnum}}
|
||
%
|
||
% #1 is the section text, which is what will be displayed in the
|
||
% outline by the pdf viewer. #2 is the pdf expression for the number
|
||
% of subentries (or empty, for subsubsections). #3 is the node text,
|
||
% which might be empty if this toc entry had no corresponding node.
|
||
% #4 is the page number
|
||
%
|
||
\def\dopdfoutline#1#2#3#4{%
|
||
% Generate a link to the node text if that exists; else, use the
|
||
% page number. We could generate a destination for the section
|
||
% text in the case where a section has no node, but it doesn't
|
||
% seem worth the trouble, since most documents are normally structured.
|
||
\setpdfoutlinetext{#1}
|
||
\setpdfdestname{#3}
|
||
\ifx\pdfdestname\empty
|
||
\def\pdfdestname{#4}%
|
||
\fi
|
||
%
|
||
\pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
|
||
}
|
||
%
|
||
\def\pdfmakeoutlines{%
|
||
\begingroup
|
||
% Read toc silently, to get counts of subentries for \pdfoutline.
|
||
\def\partentry##1##2##3##4{}% ignore parts in the outlines
|
||
\def\numchapentry##1##2##3##4{%
|
||
\def\thischapnum{##2}%
|
||
\def\thissecnum{0}%
|
||
\def\thissubsecnum{0}%
|
||
}%
|
||
\def\numsecentry##1##2##3##4{%
|
||
\advancenumber{chap\thischapnum}%
|
||
\def\thissecnum{##2}%
|
||
\def\thissubsecnum{0}%
|
||
}%
|
||
\def\numsubsecentry##1##2##3##4{%
|
||
\advancenumber{sec\thissecnum}%
|
||
\def\thissubsecnum{##2}%
|
||
}%
|
||
\def\numsubsubsecentry##1##2##3##4{%
|
||
\advancenumber{subsec\thissubsecnum}%
|
||
}%
|
||
\def\thischapnum{0}%
|
||
\def\thissecnum{0}%
|
||
\def\thissubsecnum{0}%
|
||
%
|
||
% use \def rather than \let here because we redefine \chapentry et
|
||
% al. a second time, below.
|
||
\def\appentry{\numchapentry}%
|
||
\def\appsecentry{\numsecentry}%
|
||
\def\appsubsecentry{\numsubsecentry}%
|
||
\def\appsubsubsecentry{\numsubsubsecentry}%
|
||
\def\unnchapentry{\numchapentry}%
|
||
\def\unnsecentry{\numsecentry}%
|
||
\def\unnsubsecentry{\numsubsecentry}%
|
||
\def\unnsubsubsecentry{\numsubsubsecentry}%
|
||
\readdatafile{toc}%
|
||
%
|
||
% Read toc second time, this time actually producing the outlines.
|
||
% The `-' means take the \expnumber as the absolute number of
|
||
% subentries, which we calculated on our first read of the .toc above.
|
||
%
|
||
% We use the node names as the destinations.
|
||
%
|
||
% Currently we prefix the section name with the section number
|
||
% for chapter and appendix headings only in order to avoid too much
|
||
% horizontal space being required in the PDF viewer.
|
||
\def\numchapentry##1##2##3##4{%
|
||
\dopdfoutline{##2 ##1}{count-\expnumber{chap##2}}{##3}{##4}}%
|
||
\def\unnchapentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
|
||
\def\numsecentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
|
||
\def\numsubsecentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
|
||
\def\numsubsubsecentry##1##2##3##4{% count is always zero
|
||
\dopdfoutline{##1}{}{##3}{##4}}%
|
||
%
|
||
% PDF outlines are displayed using system fonts, instead of
|
||
% document fonts. Therefore we cannot use special characters,
|
||
% since the encoding is unknown. For example, the eogonek from
|
||
% Latin 2 (0xea) gets translated to a | character. Info from
|
||
% Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
|
||
%
|
||
% TODO this right, we have to translate 8-bit characters to
|
||
% their "best" equivalent, based on the @documentencoding. Too
|
||
% much work for too little return. Just use the ASCII equivalents
|
||
% we use for the index sort strings.
|
||
%
|
||
\indexnofonts
|
||
\setupdatafile
|
||
% We can have normal brace characters in the PDF outlines, unlike
|
||
% Texinfo index files. So set that up.
|
||
\def\{{\lbracecharliteral}%
|
||
\def\}{\rbracecharliteral}%
|
||
\catcode`\\=\active \otherbackslash
|
||
\input \tocreadfilename
|
||
\endgroup
|
||
}
|
||
{\catcode`[=1 \catcode`]=2
|
||
\catcode`{=\other \catcode`}=\other
|
||
\gdef\lbracecharliteral[{]%
|
||
\gdef\rbracecharliteral[}]%
|
||
]
|
||
%
|
||
\def\skipspaces#1{\def\PP{#1}\def\D{|}%
|
||
\ifx\PP\D\let\nextsp\relax
|
||
\else\let\nextsp\skipspaces
|
||
\addtokens{\filename}{\PP}%
|
||
\advance\filenamelength by 1
|
||
\fi
|
||
\nextsp}
|
||
\def\getfilename#1{%
|
||
\filenamelength=0
|
||
% If we don't expand the argument now, \skipspaces will get
|
||
% snagged on things like "@value{foo}".
|
||
\edef\temp{#1}%
|
||
\expandafter\skipspaces\temp|\relax
|
||
}
|
||
\ifnum\pdftexversion < 14
|
||
\let \startlink \pdfannotlink
|
||
\else
|
||
\let \startlink \pdfstartlink
|
||
\fi
|
||
% make a live url in pdf output.
|
||
\def\pdfurl#1{%
|
||
\begingroup
|
||
% it seems we really need yet another set of dummies; have not
|
||
% tried to figure out what each command should do in the context
|
||
% of @url. for now, just make @/ a no-op, that's the only one
|
||
% people have actually reported a problem with.
|
||
%
|
||
\normalturnoffactive
|
||
\def\@{@}%
|
||
\let\/=\empty
|
||
\makevalueexpandable
|
||
% do we want to go so far as to use \indexnofonts instead of just
|
||
% special-casing \var here?
|
||
\def\var##1{##1}%
|
||
%
|
||
\leavevmode\setcolor{\urlcolor}%
|
||
\startlink attr{/Border [0 0 0]}%
|
||
user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
|
||
\endgroup}
|
||
% \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
|
||
% be a simple number, or a list of numbers in the case of an index
|
||
% entry.
|
||
\def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
|
||
\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
|
||
\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
|
||
\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
|
||
\def\maketoks{%
|
||
\expandafter\poptoks\the\toksA|ENDTOKS|\relax
|
||
\ifx\first0\adn0
|
||
\else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
|
||
\else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
|
||
\else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
|
||
\else
|
||
\ifnum0=\countA\else\makelink\fi
|
||
\ifx\first.\let\next=\done\else
|
||
\let\next=\maketoks
|
||
\addtokens{\toksB}{\the\toksD}
|
||
\ifx\first,\addtokens{\toksB}{\space}\fi
|
||
\fi
|
||
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
|
||
\next}
|
||
\def\makelink{\addtokens{\toksB}%
|
||
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
|
||
\def\pdflink#1{%
|
||
\startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
|
||
\setcolor{\linkcolor}#1\endlink}
|
||
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
|
||
\else
|
||
% non-pdf mode
|
||
\let\pdfmkdest = \gobble
|
||
\let\pdfurl = \gobble
|
||
\let\endlink = \relax
|
||
\let\setcolor = \gobble
|
||
\let\pdfsetcolor = \gobble
|
||
\let\pdfmakeoutlines = \relax
|
||
\fi % \ifx\pdfoutput
|
||
|
||
%
|
||
% For XeTeX
|
||
%
|
||
\ifx\XeTeXrevision\thisisundefined
|
||
\else
|
||
%
|
||
% XeTeX version check
|
||
%
|
||
\ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
|
||
% TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
|
||
% It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
|
||
% For avoiding PDF destination name replacement, we use this special
|
||
% instead of xdvipdfmx's command line option `-C 0x0010'.
|
||
\special{dvipdfmx:config C 0x0010}
|
||
% XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
|
||
% It can handle Unicode destination names for PDF.
|
||
\txiuseunicodedestnametrue
|
||
\else
|
||
% XeTeX < 0.99996 (TeX Live < 2016) cannot use the
|
||
% `dvipdfmx:config' special.
|
||
% So for avoiding PDF destination name replacement,
|
||
% xdvipdfmx's command line option `-C 0x0010' is necessary.
|
||
%
|
||
% XeTeX < 0.99995 can not handle Unicode destination names for PDF
|
||
% because xdvipdfmx 20150315 has a UTF-16 conversion issue.
|
||
% It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
|
||
\txiuseunicodedestnamefalse
|
||
\fi
|
||
%
|
||
% Color support
|
||
%
|
||
\def\rgbDarkRed{0.50 0.09 0.12}
|
||
\def\rgbBlack{0 0 0}
|
||
%
|
||
\def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
|
||
%
|
||
% Set color, and create a mark which defines \thiscolor accordingly,
|
||
% so that \makeheadline knows which color to restore.
|
||
\def\setcolor#1{%
|
||
\xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
|
||
\domark
|
||
\pdfsetcolor{#1}%
|
||
}
|
||
%
|
||
\def\maincolor{\rgbBlack}
|
||
\pdfsetcolor{\maincolor}
|
||
\edef\thiscolor{\maincolor}
|
||
\def\currentcolordefs{}
|
||
%
|
||
\def\makefootline{%
|
||
\baselineskip24pt
|
||
\line{\pdfsetcolor{\maincolor}\the\footline}%
|
||
}
|
||
%
|
||
\def\makeheadline{%
|
||
\vbox to 0pt{%
|
||
\vskip-22.5pt
|
||
\line{%
|
||
\vbox to8.5pt{}%
|
||
% Extract \thiscolor definition from the marks.
|
||
\getcolormarks
|
||
% Typeset the headline with \maincolor, then restore the color.
|
||
\pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
|
||
}%
|
||
\vss
|
||
}%
|
||
\nointerlineskip
|
||
}
|
||
%
|
||
% PDF outline support
|
||
%
|
||
% Emulate pdfTeX primitive
|
||
\def\pdfdest name#1 xyz{%
|
||
\special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
|
||
}
|
||
%
|
||
\def\setpdfdestname#1{{%
|
||
% We have to set dummies so commands such as @code, and characters
|
||
% such as \, aren't expanded when present in a section title.
|
||
\indexnofonts
|
||
\makevalueexpandable
|
||
\turnoffactive
|
||
\iftxiuseunicodedestname
|
||
% Pass through Unicode characters.
|
||
\else
|
||
% Use ASCII approximations in destination names.
|
||
\passthroughcharsfalse
|
||
\fi
|
||
\def\pdfdestname{#1}%
|
||
\txiescapepdf\pdfdestname
|
||
}}
|
||
%
|
||
\def\setpdfoutlinetext#1{{%
|
||
\turnoffactive
|
||
% Always use Unicode characters in title texts.
|
||
\def\pdfoutlinetext{#1}%
|
||
% For XeTeX, xdvipdfmx converts to UTF-16.
|
||
% So we do not convert.
|
||
\txiescapepdf\pdfoutlinetext
|
||
}}
|
||
%
|
||
\def\pdfmkdest#1{%
|
||
\setpdfdestname{#1}%
|
||
\safewhatsit{\pdfdest name{\pdfdestname} xyz}%
|
||
}
|
||
%
|
||
% by default, use black for everything.
|
||
\def\urlcolor{\rgbBlack}
|
||
\def\linkcolor{\rgbBlack}
|
||
\def\endlink{\setcolor{\maincolor}\pdfendlink}
|
||
%
|
||
\def\dopdfoutline#1#2#3#4{%
|
||
\setpdfoutlinetext{#1}
|
||
\setpdfdestname{#3}
|
||
\ifx\pdfdestname\empty
|
||
\def\pdfdestname{#4}%
|
||
\fi
|
||
%
|
||
\special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
|
||
<< /S /GoTo /D (\pdfdestname) >> >> }%
|
||
}
|
||
%
|
||
\def\pdfmakeoutlines{%
|
||
\begingroup
|
||
%
|
||
% For XeTeX, counts of subentries are not necessary.
|
||
% Therefore, we read toc only once.
|
||
%
|
||
% We use node names as destinations.
|
||
%
|
||
% Currently we prefix the section name with the section number
|
||
% for chapter and appendix headings only in order to avoid too much
|
||
% horizontal space being required in the PDF viewer.
|
||
\def\partentry##1##2##3##4{}% ignore parts in the outlines
|
||
\def\numchapentry##1##2##3##4{%
|
||
\dopdfoutline{##2 ##1}{1}{##3}{##4}}%
|
||
\def\numsecentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{2}{##3}{##4}}%
|
||
\def\numsubsecentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{3}{##3}{##4}}%
|
||
\def\numsubsubsecentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{4}{##3}{##4}}%
|
||
%
|
||
\let\appentry\numchapentry%
|
||
\let\appsecentry\numsecentry%
|
||
\let\appsubsecentry\numsubsecentry%
|
||
\let\appsubsubsecentry\numsubsubsecentry%
|
||
\def\unnchapentry##1##2##3##4{%
|
||
\dopdfoutline{##1}{1}{##3}{##4}}%
|
||
\let\unnsecentry\numsecentry%
|
||
\let\unnsubsecentry\numsubsecentry%
|
||
\let\unnsubsubsecentry\numsubsubsecentry%
|
||
%
|
||
% For XeTeX, xdvipdfmx converts strings to UTF-16.
|
||
% Therefore, the encoding and the language may not be considered.
|
||
%
|
||
\indexnofonts
|
||
\setupdatafile
|
||
% We can have normal brace characters in the PDF outlines, unlike
|
||
% Texinfo index files. So set that up.
|
||
\def\{{\lbracecharliteral}%
|
||
\def\}{\rbracecharliteral}%
|
||
\catcode`\\=\active \otherbackslash
|
||
\input \tocreadfilename
|
||
\endgroup
|
||
}
|
||
{\catcode`[=1 \catcode`]=2
|
||
\catcode`{=\other \catcode`}=\other
|
||
\gdef\lbracecharliteral[{]%
|
||
\gdef\rbracecharliteral[}]%
|
||
]
|
||
|
||
\special{pdf:docview << /PageMode /UseOutlines >> }
|
||
% ``\special{pdf:tounicode ...}'' is not necessary
|
||
% because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
|
||
% However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
|
||
% ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
|
||
% It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
|
||
%
|
||
\def\skipspaces#1{\def\PP{#1}\def\D{|}%
|
||
\ifx\PP\D\let\nextsp\relax
|
||
\else\let\nextsp\skipspaces
|
||
\addtokens{\filename}{\PP}%
|
||
\advance\filenamelength by 1
|
||
\fi
|
||
\nextsp}
|
||
\def\getfilename#1{%
|
||
\filenamelength=0
|
||
% If we don't expand the argument now, \skipspaces will get
|
||
% snagged on things like "@value{foo}".
|
||
\edef\temp{#1}%
|
||
\expandafter\skipspaces\temp|\relax
|
||
}
|
||
% make a live url in pdf output.
|
||
\def\pdfurl#1{%
|
||
\begingroup
|
||
% it seems we really need yet another set of dummies; have not
|
||
% tried to figure out what each command should do in the context
|
||
% of @url. for now, just make @/ a no-op, that's the only one
|
||
% people have actually reported a problem with.
|
||
%
|
||
\normalturnoffactive
|
||
\def\@{@}%
|
||
\let\/=\empty
|
||
\makevalueexpandable
|
||
% do we want to go so far as to use \indexnofonts instead of just
|
||
% special-casing \var here?
|
||
\def\var##1{##1}%
|
||
%
|
||
\leavevmode\setcolor{\urlcolor}%
|
||
\special{pdf:bann << /Border [0 0 0]
|
||
/Subtype /Link /A << /S /URI /URI (#1) >> >>}%
|
||
\endgroup}
|
||
\def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
|
||
\def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
|
||
\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
|
||
\def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
|
||
\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
|
||
\def\maketoks{%
|
||
\expandafter\poptoks\the\toksA|ENDTOKS|\relax
|
||
\ifx\first0\adn0
|
||
\else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
|
||
\else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
|
||
\else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
|
||
\else
|
||
\ifnum0=\countA\else\makelink\fi
|
||
\ifx\first.\let\next=\done\else
|
||
\let\next=\maketoks
|
||
\addtokens{\toksB}{\the\toksD}
|
||
\ifx\first,\addtokens{\toksB}{\space}\fi
|
||
\fi
|
||
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
|
||
\next}
|
||
\def\makelink{\addtokens{\toksB}%
|
||
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
|
||
\def\pdflink#1{%
|
||
\special{pdf:bann << /Border [0 0 0]
|
||
/Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
|
||
\setcolor{\linkcolor}#1\endlink}
|
||
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
|
||
%
|
||
%
|
||
% @image support
|
||
%
|
||
% #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
|
||
\def\doxeteximage#1#2#3{%
|
||
\def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
|
||
\def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
|
||
%
|
||
% XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
|
||
% others). Let's try in that order, PDF first since if
|
||
% someone has a scalable image, presumably better to use that than a
|
||
% bitmap.
|
||
\let\xeteximgext=\empty
|
||
\begingroup
|
||
\openin 1 #1.pdf \ifeof 1
|
||
\openin 1 #1.PDF \ifeof 1
|
||
\openin 1 #1.png \ifeof 1
|
||
\openin 1 #1.jpg \ifeof 1
|
||
\openin 1 #1.jpeg \ifeof 1
|
||
\openin 1 #1.JPG \ifeof 1
|
||
\errmessage{Could not find image file #1 for XeTeX}%
|
||
\else \gdef\xeteximgext{JPG}%
|
||
\fi
|
||
\else \gdef\xeteximgext{jpeg}%
|
||
\fi
|
||
\else \gdef\xeteximgext{jpg}%
|
||
\fi
|
||
\else \gdef\xeteximgext{png}%
|
||
\fi
|
||
\else \gdef\xeteximgext{PDF}%
|
||
\fi
|
||
\else \gdef\xeteximgext{pdf}%
|
||
\fi
|
||
\closein 1
|
||
\endgroup
|
||
%
|
||
\def\xetexpdfext{pdf}%
|
||
\ifx\xeteximgext\xetexpdfext
|
||
\XeTeXpdffile "#1".\xeteximgext ""
|
||
\else
|
||
\def\xetexpdfext{PDF}%
|
||
\ifx\xeteximgext\xetexpdfext
|
||
\XeTeXpdffile "#1".\xeteximgext ""
|
||
\else
|
||
\XeTeXpicfile "#1".\xeteximgext ""
|
||
\fi
|
||
\fi
|
||
\ifdim \wd0 >0pt width \xeteximagewidth \fi
|
||
\ifdim \wd2 >0pt height \xeteximageheight \fi \relax
|
||
}
|
||
\fi
|
||
|
||
|
||
%
|
||
\message{fonts,}
|
||
|
||
% Set the baselineskip to #1, and the lineskip and strut size
|
||
% correspondingly. There is no deep meaning behind these magic numbers
|
||
% used as factors; they just match (closely enough) what Knuth defined.
|
||
%
|
||
\def\lineskipfactor{.08333}
|
||
\def\strutheightpercent{.70833}
|
||
\def\strutdepthpercent {.29167}
|
||
%
|
||
% can get a sort of poor man's double spacing by redefining this.
|
||
\def\baselinefactor{1}
|
||
%
|
||
\newdimen\textleading
|
||
\def\setleading#1{%
|
||
\dimen0 = #1\relax
|
||
\normalbaselineskip = \baselinefactor\dimen0
|
||
\normallineskip = \lineskipfactor\normalbaselineskip
|
||
\normalbaselines
|
||
\setbox\strutbox =\hbox{%
|
||
\vrule width0pt height\strutheightpercent\baselineskip
|
||
depth \strutdepthpercent \baselineskip
|
||
}%
|
||
}
|
||
|
||
% PDF CMaps. See also LaTeX's t1.cmap.
|
||
%
|
||
% do nothing with this by default.
|
||
\expandafter\let\csname cmapOT1\endcsname\gobble
|
||
\expandafter\let\csname cmapOT1IT\endcsname\gobble
|
||
\expandafter\let\csname cmapOT1TT\endcsname\gobble
|
||
|
||
% if we are producing pdf, and we have \pdffontattr, then define cmaps.
|
||
% (\pdffontattr was introduced many years ago, but people still run
|
||
% older pdftex's; it's easy to conditionalize, so we do.)
|
||
\ifpdf \ifx\pdffontattr\thisisundefined \else
|
||
\begingroup
|
||
\catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
|
||
\catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
|
||
%%DocumentNeededResources: ProcSet (CIDInit)
|
||
%%IncludeResource: ProcSet (CIDInit)
|
||
%%BeginResource: CMap (TeX-OT1-0)
|
||
%%Title: (TeX-OT1-0 TeX OT1 0)
|
||
%%Version: 1.000
|
||
%%EndComments
|
||
/CIDInit /ProcSet findresource begin
|
||
12 dict begin
|
||
begincmap
|
||
/CIDSystemInfo
|
||
<< /Registry (TeX)
|
||
/Ordering (OT1)
|
||
/Supplement 0
|
||
>> def
|
||
/CMapName /TeX-OT1-0 def
|
||
/CMapType 2 def
|
||
1 begincodespacerange
|
||
<00> <7F>
|
||
endcodespacerange
|
||
8 beginbfrange
|
||
<00> <01> <0393>
|
||
<09> <0A> <03A8>
|
||
<23> <26> <0023>
|
||
<28> <3B> <0028>
|
||
<3F> <5B> <003F>
|
||
<5D> <5E> <005D>
|
||
<61> <7A> <0061>
|
||
<7B> <7C> <2013>
|
||
endbfrange
|
||
40 beginbfchar
|
||
<02> <0398>
|
||
<03> <039B>
|
||
<04> <039E>
|
||
<05> <03A0>
|
||
<06> <03A3>
|
||
<07> <03D2>
|
||
<08> <03A6>
|
||
<0B> <00660066>
|
||
<0C> <00660069>
|
||
<0D> <0066006C>
|
||
<0E> <006600660069>
|
||
<0F> <00660066006C>
|
||
<10> <0131>
|
||
<11> <0237>
|
||
<12> <0060>
|
||
<13> <00B4>
|
||
<14> <02C7>
|
||
<15> <02D8>
|
||
<16> <00AF>
|
||
<17> <02DA>
|
||
<18> <00B8>
|
||
<19> <00DF>
|
||
<1A> <00E6>
|
||
<1B> <0153>
|
||
<1C> <00F8>
|
||
<1D> <00C6>
|
||
<1E> <0152>
|
||
<1F> <00D8>
|
||
<21> <0021>
|
||
<22> <201D>
|
||
<27> <2019>
|
||
<3C> <00A1>
|
||
<3D> <003D>
|
||
<3E> <00BF>
|
||
<5C> <201C>
|
||
<5F> <02D9>
|
||
<60> <2018>
|
||
<7D> <02DD>
|
||
<7E> <007E>
|
||
<7F> <00A8>
|
||
endbfchar
|
||
endcmap
|
||
CMapName currentdict /CMap defineresource pop
|
||
end
|
||
end
|
||
%%EndResource
|
||
%%EOF
|
||
}\endgroup
|
||
\expandafter\edef\csname cmapOT1\endcsname#1{%
|
||
\pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
|
||
}%
|
||
%
|
||
% \cmapOT1IT
|
||
\begingroup
|
||
\catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
|
||
\catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
|
||
%%DocumentNeededResources: ProcSet (CIDInit)
|
||
%%IncludeResource: ProcSet (CIDInit)
|
||
%%BeginResource: CMap (TeX-OT1IT-0)
|
||
%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
|
||
%%Version: 1.000
|
||
%%EndComments
|
||
/CIDInit /ProcSet findresource begin
|
||
12 dict begin
|
||
begincmap
|
||
/CIDSystemInfo
|
||
<< /Registry (TeX)
|
||
/Ordering (OT1IT)
|
||
/Supplement 0
|
||
>> def
|
||
/CMapName /TeX-OT1IT-0 def
|
||
/CMapType 2 def
|
||
1 begincodespacerange
|
||
<00> <7F>
|
||
endcodespacerange
|
||
8 beginbfrange
|
||
<00> <01> <0393>
|
||
<09> <0A> <03A8>
|
||
<25> <26> <0025>
|
||
<28> <3B> <0028>
|
||
<3F> <5B> <003F>
|
||
<5D> <5E> <005D>
|
||
<61> <7A> <0061>
|
||
<7B> <7C> <2013>
|
||
endbfrange
|
||
42 beginbfchar
|
||
<02> <0398>
|
||
<03> <039B>
|
||
<04> <039E>
|
||
<05> <03A0>
|
||
<06> <03A3>
|
||
<07> <03D2>
|
||
<08> <03A6>
|
||
<0B> <00660066>
|
||
<0C> <00660069>
|
||
<0D> <0066006C>
|
||
<0E> <006600660069>
|
||
<0F> <00660066006C>
|
||
<10> <0131>
|
||
<11> <0237>
|
||
<12> <0060>
|
||
<13> <00B4>
|
||
<14> <02C7>
|
||
<15> <02D8>
|
||
<16> <00AF>
|
||
<17> <02DA>
|
||
<18> <00B8>
|
||
<19> <00DF>
|
||
<1A> <00E6>
|
||
<1B> <0153>
|
||
<1C> <00F8>
|
||
<1D> <00C6>
|
||
<1E> <0152>
|
||
<1F> <00D8>
|
||
<21> <0021>
|
||
<22> <201D>
|
||
<23> <0023>
|
||
<24> <00A3>
|
||
<27> <2019>
|
||
<3C> <00A1>
|
||
<3D> <003D>
|
||
<3E> <00BF>
|
||
<5C> <201C>
|
||
<5F> <02D9>
|
||
<60> <2018>
|
||
<7D> <02DD>
|
||
<7E> <007E>
|
||
<7F> <00A8>
|
||
endbfchar
|
||
endcmap
|
||
CMapName currentdict /CMap defineresource pop
|
||
end
|
||
end
|
||
%%EndResource
|
||
%%EOF
|
||
}\endgroup
|
||
\expandafter\edef\csname cmapOT1IT\endcsname#1{%
|
||
\pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
|
||
}%
|
||
%
|
||
% \cmapOT1TT
|
||
\begingroup
|
||
\catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
|
||
\catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
|
||
%%DocumentNeededResources: ProcSet (CIDInit)
|
||
%%IncludeResource: ProcSet (CIDInit)
|
||
%%BeginResource: CMap (TeX-OT1TT-0)
|
||
%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
|
||
%%Version: 1.000
|
||
%%EndComments
|
||
/CIDInit /ProcSet findresource begin
|
||
12 dict begin
|
||
begincmap
|
||
/CIDSystemInfo
|
||
<< /Registry (TeX)
|
||
/Ordering (OT1TT)
|
||
/Supplement 0
|
||
>> def
|
||
/CMapName /TeX-OT1TT-0 def
|
||
/CMapType 2 def
|
||
1 begincodespacerange
|
||
<00> <7F>
|
||
endcodespacerange
|
||
5 beginbfrange
|
||
<00> <01> <0393>
|
||
<09> <0A> <03A8>
|
||
<21> <26> <0021>
|
||
<28> <5F> <0028>
|
||
<61> <7E> <0061>
|
||
endbfrange
|
||
32 beginbfchar
|
||
<02> <0398>
|
||
<03> <039B>
|
||
<04> <039E>
|
||
<05> <03A0>
|
||
<06> <03A3>
|
||
<07> <03D2>
|
||
<08> <03A6>
|
||
<0B> <2191>
|
||
<0C> <2193>
|
||
<0D> <0027>
|
||
<0E> <00A1>
|
||
<0F> <00BF>
|
||
<10> <0131>
|
||
<11> <0237>
|
||
<12> <0060>
|
||
<13> <00B4>
|
||
<14> <02C7>
|
||
<15> <02D8>
|
||
<16> <00AF>
|
||
<17> <02DA>
|
||
<18> <00B8>
|
||
<19> <00DF>
|
||
<1A> <00E6>
|
||
<1B> <0153>
|
||
<1C> <00F8>
|
||
<1D> <00C6>
|
||
<1E> <0152>
|
||
<1F> <00D8>
|
||
<20> <2423>
|
||
<27> <2019>
|
||
<60> <2018>
|
||
<7F> <00A8>
|
||
endbfchar
|
||
endcmap
|
||
CMapName currentdict /CMap defineresource pop
|
||
end
|
||
end
|
||
%%EndResource
|
||
%%EOF
|
||
}\endgroup
|
||
\expandafter\edef\csname cmapOT1TT\endcsname#1{%
|
||
\pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
|
||
}%
|
||
\fi\fi
|
||
|
||
|
||
% Set the font macro #1 to the font named \fontprefix#2.
|
||
% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
|
||
% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
|
||
% Example:
|
||
% #1 = \textrm
|
||
% #2 = \rmshape
|
||
% #3 = 10
|
||
% #4 = \mainmagstep
|
||
% #5 = OT1
|
||
%
|
||
\def\setfont#1#2#3#4#5{%
|
||
\font#1=\fontprefix#2#3 scaled #4
|
||
\csname cmap#5\endcsname#1%
|
||
}
|
||
% This is what gets called when #5 of \setfont is empty.
|
||
\let\cmap\gobble
|
||
%
|
||
% (end of cmaps)
|
||
|
||
% Use cm as the default font prefix.
|
||
% To specify the font prefix, you must define \fontprefix
|
||
% before you read in texinfo.tex.
|
||
\ifx\fontprefix\thisisundefined
|
||
\def\fontprefix{cm}
|
||
\fi
|
||
% Support font families that don't use the same naming scheme as CM.
|
||
\def\rmshape{r}
|
||
\def\rmbshape{bx} % where the normal face is bold
|
||
\def\bfshape{b}
|
||
\def\bxshape{bx}
|
||
\def\ttshape{tt}
|
||
\def\ttbshape{tt}
|
||
\def\ttslshape{sltt}
|
||
\def\itshape{ti}
|
||
\def\itbshape{bxti}
|
||
\def\slshape{sl}
|
||
\def\slbshape{bxsl}
|
||
\def\sfshape{ss}
|
||
\def\sfbshape{ss}
|
||
\def\scshape{csc}
|
||
\def\scbshape{csc}
|
||
|
||
% Definitions for a main text size of 11pt. (The default in Texinfo.)
|
||
%
|
||
\def\definetextfontsizexi{%
|
||
% Text fonts (11.2pt, magstep1).
|
||
\def\textnominalsize{11pt}
|
||
\edef\mainmagstep{\magstephalf}
|
||
\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
|
||
\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
|
||
\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
|
||
\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
|
||
\font\texti=cmmi10 scaled \mainmagstep
|
||
\font\textsy=cmsy10 scaled \mainmagstep
|
||
\def\textecsize{1095}
|
||
|
||
% A few fonts for @defun names and args.
|
||
\setfont\defbf\bfshape{10}{\magstep1}{OT1}
|
||
\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
|
||
\setfont\defsl\slshape{10}{\magstep1}{OT1}
|
||
\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
|
||
\def\df{\let\ttfont=\deftt \let\bffont = \defbf
|
||
\let\ttslfont=\defttsl \let\slfont=\defsl \bf}
|
||
|
||
% Fonts for indices, footnotes, small examples (9pt).
|
||
\def\smallnominalsize{9pt}
|
||
\setfont\smallrm\rmshape{9}{1000}{OT1}
|
||
\setfont\smalltt\ttshape{9}{1000}{OT1TT}
|
||
\setfont\smallbf\bfshape{10}{900}{OT1}
|
||
\setfont\smallit\itshape{9}{1000}{OT1IT}
|
||
\setfont\smallsl\slshape{9}{1000}{OT1}
|
||
\setfont\smallsf\sfshape{9}{1000}{OT1}
|
||
\setfont\smallsc\scshape{10}{900}{OT1}
|
||
\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
|
||
\font\smalli=cmmi9
|
||
\font\smallsy=cmsy9
|
||
\def\smallecsize{0900}
|
||
|
||
% Fonts for small examples (8pt).
|
||
\def\smallernominalsize{8pt}
|
||
\setfont\smallerrm\rmshape{8}{1000}{OT1}
|
||
\setfont\smallertt\ttshape{8}{1000}{OT1TT}
|
||
\setfont\smallerbf\bfshape{10}{800}{OT1}
|
||
\setfont\smallerit\itshape{8}{1000}{OT1IT}
|
||
\setfont\smallersl\slshape{8}{1000}{OT1}
|
||
\setfont\smallersf\sfshape{8}{1000}{OT1}
|
||
\setfont\smallersc\scshape{10}{800}{OT1}
|
||
\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
|
||
\font\smalleri=cmmi8
|
||
\font\smallersy=cmsy8
|
||
\def\smallerecsize{0800}
|
||
|
||
% Fonts for math mode superscripts (7pt).
|
||
\def\sevennominalsize{7pt}
|
||
\setfont\sevenrm\rmshape{7}{1000}{OT1}
|
||
\setfont\seventt\ttshape{10}{700}{OT1TT}
|
||
\setfont\sevenbf\bfshape{10}{700}{OT1}
|
||
\setfont\sevenit\itshape{7}{1000}{OT1IT}
|
||
\setfont\sevensl\slshape{10}{700}{OT1}
|
||
\setfont\sevensf\sfshape{10}{700}{OT1}
|
||
\setfont\sevensc\scshape{10}{700}{OT1}
|
||
\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
|
||
\font\seveni=cmmi7
|
||
\font\sevensy=cmsy7
|
||
\def\sevenecsize{0700}
|
||
|
||
% Fonts for title page (20.4pt):
|
||
\def\titlenominalsize{20pt}
|
||
\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
|
||
\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
|
||
\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
|
||
\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
|
||
\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
|
||
\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
|
||
\let\titlebf=\titlerm
|
||
\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
|
||
\font\titlei=cmmi12 scaled \magstep3
|
||
\font\titlesy=cmsy10 scaled \magstep4
|
||
\def\titleecsize{2074}
|
||
|
||
% Chapter (and unnumbered) fonts (17.28pt).
|
||
\def\chapnominalsize{17pt}
|
||
\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
|
||
\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
|
||
\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
|
||
\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
|
||
\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
|
||
\setfont\chapsf\sfbshape{17}{1000}{OT1}
|
||
\let\chapbf=\chaprm
|
||
\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
|
||
\font\chapi=cmmi12 scaled \magstep2
|
||
\font\chapsy=cmsy10 scaled \magstep3
|
||
\def\chapecsize{1728}
|
||
|
||
% Section fonts (14.4pt).
|
||
\def\secnominalsize{14pt}
|
||
\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
|
||
\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
|
||
\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
|
||
\setfont\secsl\slbshape{10}{\magstep2}{OT1}
|
||
\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
|
||
\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
|
||
\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
|
||
\let\secbf\secrm
|
||
\setfont\secsc\scbshape{10}{\magstep2}{OT1}
|
||
\font\seci=cmmi12 scaled \magstep1
|
||
\font\secsy=cmsy10 scaled \magstep2
|
||
\def\sececsize{1440}
|
||
|
||
% Subsection fonts (13.15pt).
|
||
\def\ssecnominalsize{13pt}
|
||
\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
|
||
\setfont\ssecit\itbshape{10}{1315}{OT1IT}
|
||
\setfont\ssecsl\slbshape{10}{1315}{OT1}
|
||
\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
|
||
\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
|
||
\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
|
||
\let\ssecbf\ssecrm
|
||
\setfont\ssecsc\scbshape{10}{1315}{OT1}
|
||
\font\sseci=cmmi12 scaled \magstephalf
|
||
\font\ssecsy=cmsy10 scaled 1315
|
||
\def\ssececsize{1200}
|
||
|
||
% Reduced fonts for @acronym in text (10pt).
|
||
\def\reducednominalsize{10pt}
|
||
\setfont\reducedrm\rmshape{10}{1000}{OT1}
|
||
\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
|
||
\setfont\reducedbf\bfshape{10}{1000}{OT1}
|
||
\setfont\reducedit\itshape{10}{1000}{OT1IT}
|
||
\setfont\reducedsl\slshape{10}{1000}{OT1}
|
||
\setfont\reducedsf\sfshape{10}{1000}{OT1}
|
||
\setfont\reducedsc\scshape{10}{1000}{OT1}
|
||
\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
|
||
\font\reducedi=cmmi10
|
||
\font\reducedsy=cmsy10
|
||
\def\reducedecsize{1000}
|
||
|
||
\textleading = 13.2pt % line spacing for 11pt CM
|
||
\textfonts % reset the current fonts
|
||
\rm
|
||
} % end of 11pt text font size definitions, \definetextfontsizexi
|
||
|
||
|
||
% Definitions to make the main text be 10pt Computer Modern, with
|
||
% section, chapter, etc., sizes following suit. This is for the GNU
|
||
% Press printing of the Emacs 22 manual. Maybe other manuals in the
|
||
% future. Used with @smallbook, which sets the leading to 12pt.
|
||
%
|
||
\def\definetextfontsizex{%
|
||
% Text fonts (10pt).
|
||
\def\textnominalsize{10pt}
|
||
\edef\mainmagstep{1000}
|
||
\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
|
||
\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
|
||
\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
|
||
\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
|
||
\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
|
||
\font\texti=cmmi10 scaled \mainmagstep
|
||
\font\textsy=cmsy10 scaled \mainmagstep
|
||
\def\textecsize{1000}
|
||
|
||
% A few fonts for @defun names and args.
|
||
\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
|
||
\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
|
||
\setfont\defsl\slshape{10}{\magstephalf}{OT1}
|
||
\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
|
||
\def\df{\let\ttfont=\deftt \let\bffont = \defbf
|
||
\let\slfont=\defsl \let\ttslfont=\defttsl \bf}
|
||
|
||
% Fonts for indices, footnotes, small examples (9pt).
|
||
\def\smallnominalsize{9pt}
|
||
\setfont\smallrm\rmshape{9}{1000}{OT1}
|
||
\setfont\smalltt\ttshape{9}{1000}{OT1TT}
|
||
\setfont\smallbf\bfshape{10}{900}{OT1}
|
||
\setfont\smallit\itshape{9}{1000}{OT1IT}
|
||
\setfont\smallsl\slshape{9}{1000}{OT1}
|
||
\setfont\smallsf\sfshape{9}{1000}{OT1}
|
||
\setfont\smallsc\scshape{10}{900}{OT1}
|
||
\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
|
||
\font\smalli=cmmi9
|
||
\font\smallsy=cmsy9
|
||
\def\smallecsize{0900}
|
||
|
||
% Fonts for small examples (8pt).
|
||
\def\smallernominalsize{8pt}
|
||
\setfont\smallerrm\rmshape{8}{1000}{OT1}
|
||
\setfont\smallertt\ttshape{8}{1000}{OT1TT}
|
||
\setfont\smallerbf\bfshape{10}{800}{OT1}
|
||
\setfont\smallerit\itshape{8}{1000}{OT1IT}
|
||
\setfont\smallersl\slshape{8}{1000}{OT1}
|
||
\setfont\smallersf\sfshape{8}{1000}{OT1}
|
||
\setfont\smallersc\scshape{10}{800}{OT1}
|
||
\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
|
||
\font\smalleri=cmmi8
|
||
\font\smallersy=cmsy8
|
||
\def\smallerecsize{0800}
|
||
|
||
% Fonts for math mode superscripts (7pt).
|
||
\def\sevennominalsize{7pt}
|
||
\setfont\sevenrm\rmshape{7}{1000}{OT1}
|
||
\setfont\seventt\ttshape{10}{700}{OT1TT}
|
||
\setfont\sevenbf\bfshape{10}{700}{OT1}
|
||
\setfont\sevenit\itshape{7}{1000}{OT1IT}
|
||
\setfont\sevensl\slshape{10}{700}{OT1}
|
||
\setfont\sevensf\sfshape{10}{700}{OT1}
|
||
\setfont\sevensc\scshape{10}{700}{OT1}
|
||
\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
|
||
\font\seveni=cmmi7
|
||
\font\sevensy=cmsy7
|
||
\def\sevenecsize{0700}
|
||
|
||
% Fonts for title page (20.4pt):
|
||
\def\titlenominalsize{20pt}
|
||
\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
|
||
\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
|
||
\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
|
||
\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
|
||
\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
|
||
\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
|
||
\let\titlebf=\titlerm
|
||
\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
|
||
\font\titlei=cmmi12 scaled \magstep3
|
||
\font\titlesy=cmsy10 scaled \magstep4
|
||
\def\titleecsize{2074}
|
||
|
||
% Chapter fonts (14.4pt).
|
||
\def\chapnominalsize{14pt}
|
||
\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
|
||
\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
|
||
\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
|
||
\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
|
||
\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
|
||
\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
|
||
\let\chapbf\chaprm
|
||
\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
|
||
\font\chapi=cmmi12 scaled \magstep1
|
||
\font\chapsy=cmsy10 scaled \magstep2
|
||
\def\chapecsize{1440}
|
||
|
||
% Section fonts (12pt).
|
||
\def\secnominalsize{12pt}
|
||
\setfont\secrm\rmbshape{12}{1000}{OT1}
|
||
\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
|
||
\setfont\secsl\slbshape{10}{\magstep1}{OT1}
|
||
\setfont\sectt\ttbshape{12}{1000}{OT1TT}
|
||
\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
|
||
\setfont\secsf\sfbshape{12}{1000}{OT1}
|
||
\let\secbf\secrm
|
||
\setfont\secsc\scbshape{10}{\magstep1}{OT1}
|
||
\font\seci=cmmi12
|
||
\font\secsy=cmsy10 scaled \magstep1
|
||
\def\sececsize{1200}
|
||
|
||
% Subsection fonts (10pt).
|
||
\def\ssecnominalsize{10pt}
|
||
\setfont\ssecrm\rmbshape{10}{1000}{OT1}
|
||
\setfont\ssecit\itbshape{10}{1000}{OT1IT}
|
||
\setfont\ssecsl\slbshape{10}{1000}{OT1}
|
||
\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
|
||
\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
|
||
\setfont\ssecsf\sfbshape{10}{1000}{OT1}
|
||
\let\ssecbf\ssecrm
|
||
\setfont\ssecsc\scbshape{10}{1000}{OT1}
|
||
\font\sseci=cmmi10
|
||
\font\ssecsy=cmsy10
|
||
\def\ssececsize{1000}
|
||
|
||
% Reduced fonts for @acronym in text (9pt).
|
||
\def\reducednominalsize{9pt}
|
||
\setfont\reducedrm\rmshape{9}{1000}{OT1}
|
||
\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
|
||
\setfont\reducedbf\bfshape{10}{900}{OT1}
|
||
\setfont\reducedit\itshape{9}{1000}{OT1IT}
|
||
\setfont\reducedsl\slshape{9}{1000}{OT1}
|
||
\setfont\reducedsf\sfshape{9}{1000}{OT1}
|
||
\setfont\reducedsc\scshape{10}{900}{OT1}
|
||
\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
|
||
\font\reducedi=cmmi9
|
||
\font\reducedsy=cmsy9
|
||
\def\reducedecsize{0900}
|
||
|
||
\divide\parskip by 2 % reduce space between paragraphs
|
||
\textleading = 12pt % line spacing for 10pt CM
|
||
\textfonts % reset the current fonts
|
||
\rm
|
||
} % end of 10pt text font size definitions, \definetextfontsizex
|
||
|
||
% Fonts for short table of contents.
|
||
\setfont\shortcontrm\rmshape{12}{1000}{OT1}
|
||
\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
|
||
\setfont\shortcontsl\slshape{12}{1000}{OT1}
|
||
\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
|
||
|
||
|
||
% We provide the user-level command
|
||
% @fonttextsize 10
|
||
% (or 11) to redefine the text font size. pt is assumed.
|
||
%
|
||
\def\xiword{11}
|
||
\def\xword{10}
|
||
\def\xwordpt{10pt}
|
||
%
|
||
\parseargdef\fonttextsize{%
|
||
\def\textsizearg{#1}%
|
||
%\wlog{doing @fonttextsize \textsizearg}%
|
||
%
|
||
% Set \globaldefs so that documents can use this inside @tex, since
|
||
% makeinfo 4.8 does not support it, but we need it nonetheless.
|
||
%
|
||
\begingroup \globaldefs=1
|
||
\ifx\textsizearg\xword \definetextfontsizex
|
||
\else \ifx\textsizearg\xiword \definetextfontsizexi
|
||
\else
|
||
\errhelp=\EMsimple
|
||
\errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
|
||
\fi\fi
|
||
\endgroup
|
||
}
|
||
|
||
%
|
||
% Change the current font style to #1, remembering it in \curfontstyle.
|
||
% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
|
||
% italics, not bold italics.
|
||
%
|
||
\def\setfontstyle#1{%
|
||
\def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
|
||
\csname #1font\endcsname % change the current font
|
||
}
|
||
|
||
\def\rm{\fam=0 \setfontstyle{rm}}
|
||
\def\it{\fam=\itfam \setfontstyle{it}}
|
||
\def\sl{\fam=\slfam \setfontstyle{sl}}
|
||
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
|
||
\def\tt{\fam=\ttfam \setfontstyle{tt}}\def\ttstylename{tt}
|
||
|
||
% Texinfo sort of supports the sans serif font style, which plain TeX does not.
|
||
% So we set up a \sf.
|
||
\newfam\sffam
|
||
\def\sf{\fam=\sffam \setfontstyle{sf}}
|
||
|
||
% We don't need math for this font style.
|
||
\def\ttsl{\setfontstyle{ttsl}}
|
||
|
||
|
||
% In order for the font changes to affect most math symbols and letters,
|
||
% we have to define the \textfont of the standard families.
|
||
% We don't bother to reset \scriptscriptfont; awaiting user need.
|
||
%
|
||
\def\resetmathfonts{%
|
||
\textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
|
||
\textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
|
||
\textfont\ttfam=\ttfont \textfont\sffam=\sffont
|
||
%
|
||
% Fonts for superscript. Note that the 7pt fonts are used regardless
|
||
% of the current font size.
|
||
\scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
|
||
\scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
|
||
\scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
|
||
\scriptfont\sffam=\sevensf
|
||
}
|
||
|
||
%
|
||
|
||
% The font-changing commands (all called \...fonts) redefine the meanings
|
||
% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
|
||
% to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
|
||
% commands hardwire \STYLEfont to set the current font.
|
||
%
|
||
% The fonts used for \ifont are for "math italics" (\itfont is for italics
|
||
% in regular text). \syfont is also used in math mode only.
|
||
%
|
||
% Each font-changing command also sets the names \lsize (one size lower)
|
||
% and \lllsize (three sizes lower). These relative commands are used
|
||
% in, e.g., the LaTeX logo and acronyms.
|
||
%
|
||
% This all needs generalizing, badly.
|
||
%
|
||
|
||
\def\assignfonts#1{%
|
||
\expandafter\let\expandafter\rmfont\csname #1rm\endcsname
|
||
\expandafter\let\expandafter\itfont\csname #1it\endcsname
|
||
\expandafter\let\expandafter\slfont\csname #1sl\endcsname
|
||
\expandafter\let\expandafter\bffont\csname #1bf\endcsname
|
||
\expandafter\let\expandafter\ttfont\csname #1tt\endcsname
|
||
\expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
|
||
\expandafter\let\expandafter\sffont \csname #1sf\endcsname
|
||
\expandafter\let\expandafter\ifont \csname #1i\endcsname
|
||
\expandafter\let\expandafter\syfont \csname #1sy\endcsname
|
||
\expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
|
||
}
|
||
|
||
\newif\ifrmisbold
|
||
|
||
% Select smaller font size with the current style. Used to change font size
|
||
% in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
|
||
% normal roman text, also use bold fonts for roman text in the smaller size.
|
||
\def\switchtolllsize{%
|
||
\expandafter\assignfonts\expandafter{\lllsize}%
|
||
\ifrmisbold
|
||
\let\rmfont\bffont
|
||
\fi
|
||
\csname\curfontstyle\endcsname
|
||
}%
|
||
|
||
\def\switchtolsize{%
|
||
\expandafter\assignfonts\expandafter{\lsize}%
|
||
\ifrmisbold
|
||
\let\rmfont\bffont
|
||
\fi
|
||
\csname\curfontstyle\endcsname
|
||
}%
|
||
|
||
\def\definefontsetatsize#1#2#3#4#5{%
|
||
\expandafter\def\csname #1fonts\endcsname{%
|
||
\def\curfontsize{#1}%
|
||
\def\lsize{#2}\def\lllsize{#3}%
|
||
\csname rmisbold#5\endcsname
|
||
\assignfonts{#1}%
|
||
\resetmathfonts
|
||
\setleading{#4}%
|
||
}}
|
||
|
||
\definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
|
||
\definefontsetatsize{title} {chap} {subsec} {27pt} {true}
|
||
\definefontsetatsize{chap} {sec} {text} {19pt} {true}
|
||
\definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
|
||
\definefontsetatsize{ssec} {text} {small} {15pt} {true}
|
||
\definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
|
||
\definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
|
||
\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
|
||
|
||
\def\titlefont#1{{\titlefonts\rm #1}}
|
||
\let\subsecfonts = \ssecfonts
|
||
\let\subsubsecfonts = \ssecfonts
|
||
|
||
% Define these just so they can be easily changed for other fonts.
|
||
\def\angleleft{$\langle$}
|
||
\def\angleright{$\rangle$}
|
||
|
||
% Set the fonts to use with the @small... environments.
|
||
\let\smallexamplefonts = \smallfonts
|
||
|
||
% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
|
||
% can fit this many characters:
|
||
% 8.5x11=86 smallbook=72 a4=90 a5=69
|
||
% If we use \scriptfonts (8pt), then we can fit this many characters:
|
||
% 8.5x11=90+ smallbook=80 a4=90+ a5=77
|
||
% For me, subjectively, the few extra characters that fit aren't worth
|
||
% the additional smallness of 8pt. So I'm making the default 9pt.
|
||
%
|
||
% By the way, for comparison, here's what fits with @example (10pt):
|
||
% 8.5x11=71 smallbook=60 a4=75 a5=58
|
||
% --karl, 24jan03.
|
||
|
||
% Set up the default fonts, so we can use them for creating boxes.
|
||
%
|
||
\definetextfontsizexi
|
||
|
||
|
||
\message{markup,}
|
||
|
||
% Check if we are currently using a typewriter font. Since all the
|
||
% Computer Modern typewriter fonts have zero interword stretch (and
|
||
% shrink), and it is reasonable to expect all typewriter fonts to have
|
||
% this property, we can check that font parameter.
|
||
%
|
||
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
|
||
|
||
% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
|
||
% define and register \INITMACRO to be called on markup style changes.
|
||
% \INITMACRO can check \currentmarkupstyle for the innermost
|
||
% style.
|
||
|
||
\let\currentmarkupstyle\empty
|
||
|
||
\def\setupmarkupstyle#1{%
|
||
\def\currentmarkupstyle{#1}%
|
||
\markupstylesetup
|
||
}
|
||
|
||
\let\markupstylesetup\empty
|
||
|
||
\def\defmarkupstylesetup#1{%
|
||
\expandafter\def\expandafter\markupstylesetup
|
||