/contrib/groff/doc/texinfo.tex

https://bitbucket.org/freebsd/freebsd-head/ · TeX · 7086 lines · 4032 code · 590 blank · 2464 comment · 6 complexity · 134d44e7458e72b57c3cd4812ecd6b98 MD5 · raw file

Large files are truncated click here to view the full file

  1. % texinfo.tex -- TeX macros to handle Texinfo files.
  2. %
  3. % Load plain if necessary, i.e., if running under initex.
  4. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
  5. %
  6. \def\texinfoversion{2004-11-25.16}
  7. %
  8. % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
  9. % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
  10. % Foundation, Inc.
  11. %
  12. % This texinfo.tex file is free software; you can redistribute it and/or
  13. % modify it under the terms of the GNU General Public License as
  14. % published by the Free Software Foundation; either version 2, or (at
  15. % your option) any later version.
  16. %
  17. % This texinfo.tex file is distributed in the hope that it will be
  18. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  19. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. % General Public License for more details.
  21. %
  22. % You should have received a copy of the GNU General Public License
  23. % along with this texinfo.tex file; see the file COPYING. If not, write
  24. % to the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor,
  25. % Boston, MA 02110-1301, USA.
  26. %
  27. % As a special exception, when this file is read by TeX when processing
  28. % a Texinfo source document, you may use the result without
  29. % restriction. (This has been our intent since Texinfo was invented.)
  30. %
  31. % Please try the latest version of texinfo.tex before submitting bug
  32. % reports; you can get the latest version from:
  33. % http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
  34. % ftp://tug.org/tex/texinfo.tex
  35. % (and all CTAN mirrors, see http://www.ctan.org).
  36. % The texinfo.tex in any given distribution could well be out
  37. % of date, so if that's what you're using, please check.
  38. %
  39. % Send bug reports to bug-texinfo@gnu.org. Please include including a
  40. % complete document in each bug report with which we can reproduce the
  41. % problem. Patches are, of course, greatly appreciated.
  42. %
  43. % To process a Texinfo manual with TeX, it's most reliable to use the
  44. % texi2dvi shell script that comes with the distribution. For a simple
  45. % manual foo.texi, however, you can get away with this:
  46. % tex foo.texi
  47. % texindex foo.??
  48. % tex foo.texi
  49. % tex foo.texi
  50. % dvips foo.dvi -o # or whatever; this makes foo.ps.
  51. % The extra TeX runs get the cross-reference information correct.
  52. % Sometimes one run after texindex suffices, and sometimes you need more
  53. % than two; texi2dvi does it as many times as necessary.
  54. %
  55. % It is possible to adapt texinfo.tex for other languages, to some
  56. % extent. You can get the existing language-specific files from the
  57. % full Texinfo distribution.
  58. %
  59. % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  60. \message{Loading texinfo [version \texinfoversion]:}
  61. % If in a .fmt file, print the version number
  62. % and turn on active characters that we couldn't do earlier because
  63. % they might have appeared in the input file name.
  64. \everyjob{\message{[Texinfo version \texinfoversion]}%
  65. \catcode`+=\active \catcode`\_=\active}
  66. \message{Basics,}
  67. \chardef\other=12
  68. % We never want plain's \outer definition of \+ in Texinfo.
  69. % For @tex, we can use \tabalign.
  70. \let\+ = \relax
  71. % Save some plain tex macros whose names we will redefine.
  72. \let\ptexb=\b
  73. \let\ptexbullet=\bullet
  74. \let\ptexc=\c
  75. \let\ptexcomma=\,
  76. \let\ptexdot=\.
  77. \let\ptexdots=\dots
  78. \let\ptexend=\end
  79. \let\ptexequiv=\equiv
  80. \let\ptexexclam=\!
  81. \let\ptexfootnote=\footnote
  82. \let\ptexgtr=>
  83. \let\ptexhat=^
  84. \let\ptexi=\i
  85. \let\ptexindent=\indent
  86. \let\ptexinsert=\insert
  87. \let\ptexlbrace=\{
  88. \let\ptexless=<
  89. \let\ptexnewwrite\newwrite
  90. \let\ptexnoindent=\noindent
  91. \let\ptexplus=+
  92. \let\ptexrbrace=\}
  93. \let\ptexslash=\/
  94. \let\ptexstar=\*
  95. \let\ptext=\t
  96. % If this character appears in an error message or help string, it
  97. % starts a new line in the output.
  98. \newlinechar = `^^J
  99. % Use TeX 3.0's \inputlineno to get the line number, for better error
  100. % messages, but if we're using an old version of TeX, don't do anything.
  101. %
  102. \ifx\inputlineno\thisisundefined
  103. \let\linenumber = \empty % Pre-3.0.
  104. \else
  105. \def\linenumber{l.\the\inputlineno:\space}
  106. \fi
  107. % Set up fixed words for English if not already set.
  108. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  109. \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
  110. \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
  111. \ifx\putwordin\undefined \gdef\putwordin{in}\fi
  112. \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  113. \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  114. \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
  115. \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  116. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  117. \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
  118. \ifx\putwordof\undefined \gdef\putwordof{of}\fi
  119. \ifx\putwordon\undefined \gdef\putwordon{on}\fi
  120. \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
  121. \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
  122. \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
  123. \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
  124. \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
  125. \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
  126. \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
  127. %
  128. \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  129. \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  130. \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  131. \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  132. \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  133. \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  134. \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  135. \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  136. \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  137. \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  138. \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  139. \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  140. %
  141. \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
  142. \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
  143. \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
  144. \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
  145. \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
  146. % In some macros, we cannot use the `\? notation---the left quote is
  147. % in some cases the escape char.
  148. \chardef\colonChar = `\:
  149. \chardef\commaChar = `\,
  150. \chardef\dotChar = `\.
  151. \chardef\exclamChar= `\!
  152. \chardef\questChar = `\?
  153. \chardef\semiChar = `\;
  154. \chardef\underChar = `\_
  155. \chardef\spaceChar = `\ %
  156. \chardef\spacecat = 10
  157. \def\spaceisspace{\catcode\spaceChar=\spacecat}
  158. % Ignore a token.
  159. %
  160. \def\gobble#1{}
  161. % The following is used inside several \edef's.
  162. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
  163. % Hyphenation fixes.
  164. \hyphenation{
  165. Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  166. ap-pen-dix bit-map bit-maps
  167. data-base data-bases eshell fall-ing half-way long-est man-u-script
  168. man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  169. par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  170. spell-ing spell-ings
  171. stand-alone strong-est time-stamp time-stamps which-ever white-space
  172. wide-spread wrap-around
  173. }
  174. % Margin to add to right of even pages, to left of odd pages.
  175. \newdimen\bindingoffset
  176. \newdimen\normaloffset
  177. \newdimen\pagewidth \newdimen\pageheight
  178. % For a final copy, take out the rectangles
  179. % that mark overfull boxes (in case you have decided
  180. % that the text looks ok even though it passes the margin).
  181. %
  182. \def\finalout{\overfullrule=0pt}
  183. % @| inserts a changebar to the left of the current line. It should
  184. % surround any changed text. This approach does *not* work if the
  185. % change spans more than two lines of output. To handle that, we would
  186. % have adopt a much more difficult approach (putting marks into the main
  187. % vertical list for the beginning and end of each change).
  188. %
  189. \def\|{%
  190. % \vadjust can only be used in horizontal mode.
  191. \leavevmode
  192. %
  193. % Append this vertical mode material after the current line in the output.
  194. \vadjust{%
  195. % We want to insert a rule with the height and depth of the current
  196. % leading; that is exactly what \strutbox is supposed to record.
  197. \vskip-\baselineskip
  198. %
  199. % \vadjust-items are inserted at the left edge of the type. So
  200. % the \llap here moves out into the left-hand margin.
  201. \llap{%
  202. %
  203. % For a thicker or thinner bar, change the `1pt'.
  204. \vrule height\baselineskip width1pt
  205. %
  206. % This is the space between the bar and the text.
  207. \hskip 12pt
  208. }%
  209. }%
  210. }
  211. % Sometimes it is convenient to have everything in the transcript file
  212. % and nothing on the terminal. We don't just call \tracingall here,
  213. % since that produces some useless output on the terminal. We also make
  214. % some effort to order the tracing commands to reduce output in the log
  215. % file; cf. trace.sty in LaTeX.
  216. %
  217. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  218. \def\loggingall{%
  219. \tracingstats2
  220. \tracingpages1
  221. \tracinglostchars2 % 2 gives us more in etex
  222. \tracingparagraphs1
  223. \tracingoutput1
  224. \tracingmacros2
  225. \tracingrestores1
  226. \showboxbreadth\maxdimen \showboxdepth\maxdimen
  227. \ifx\eTeXversion\undefined\else % etex gives us more logging
  228. \tracingscantokens1
  229. \tracingifs1
  230. \tracinggroups1
  231. \tracingnesting2
  232. \tracingassigns1
  233. \fi
  234. \tracingcommands3 % 3 gives us more in etex
  235. \errorcontextlines16
  236. }%
  237. % add check for \lastpenalty to plain's definitions. If the last thing
  238. % we did was a \nobreak, we don't want to insert more space.
  239. %
  240. \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  241. \removelastskip\penalty-50\smallskip\fi\fi}
  242. \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  243. \removelastskip\penalty-100\medskip\fi\fi}
  244. \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  245. \removelastskip\penalty-200\bigskip\fi\fi}
  246. % For @cropmarks command.
  247. % Do @cropmarks to get crop marks.
  248. %
  249. \newif\ifcropmarks
  250. \let\cropmarks = \cropmarkstrue
  251. %
  252. % Dimensions to add cropmarks at corners.
  253. % Added by P. A. MacKay, 12 Nov. 1986
  254. %
  255. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  256. \newdimen\cornerlong \cornerlong=1pc
  257. \newdimen\cornerthick \cornerthick=.3pt
  258. \newdimen\topandbottommargin \topandbottommargin=.75in
  259. % Main output routine.
  260. \chardef\PAGE = 255
  261. \output = {\onepageout{\pagecontents\PAGE}}
  262. \newbox\headlinebox
  263. \newbox\footlinebox
  264. % \onepageout takes a vbox as an argument. Note that \pagecontents
  265. % does insertions, but you have to call it yourself.
  266. \def\onepageout#1{%
  267. \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  268. %
  269. \ifodd\pageno \advance\hoffset by \bindingoffset
  270. \else \advance\hoffset by -\bindingoffset\fi
  271. %
  272. % Do this outside of the \shipout so @code etc. will be expanded in
  273. % the headline as they should be, not taken literally (outputting ''code).
  274. \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
  275. \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
  276. %
  277. {%
  278. % Have to do this stuff outside the \shipout because we want it to
  279. % take effect in \write's, yet the group defined by the \vbox ends
  280. % before the \shipout runs.
  281. %
  282. \escapechar = `\\ % use backslash in output files.
  283. \indexdummies % don't expand commands in the output.
  284. \normalturnoffactive % \ in index entries must not stay \, e.g., if
  285. % the page break happens to be in the middle of an example.
  286. \shipout\vbox{%
  287. % Do this early so pdf references go to the beginning of the page.
  288. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
  289. %
  290. \ifcropmarks \vbox to \outervsize\bgroup
  291. \hsize = \outerhsize
  292. \vskip-\topandbottommargin
  293. \vtop to0pt{%
  294. \line{\ewtop\hfil\ewtop}%
  295. \nointerlineskip
  296. \line{%
  297. \vbox{\moveleft\cornerthick\nstop}%
  298. \hfill
  299. \vbox{\moveright\cornerthick\nstop}%
  300. }%
  301. \vss}%
  302. \vskip\topandbottommargin
  303. \line\bgroup
  304. \hfil % center the page within the outer (page) hsize.
  305. \ifodd\pageno\hskip\bindingoffset\fi
  306. \vbox\bgroup
  307. \fi
  308. %
  309. \unvbox\headlinebox
  310. \pagebody{#1}%
  311. \ifdim\ht\footlinebox > 0pt
  312. % Only leave this space if the footline is nonempty.
  313. % (We lessened \vsize for it in \oddfootingxxx.)
  314. % The \baselineskip=24pt in plain's \makefootline has no effect.
  315. \vskip 2\baselineskip
  316. \unvbox\footlinebox
  317. \fi
  318. %
  319. \ifcropmarks
  320. \egroup % end of \vbox\bgroup
  321. \hfil\egroup % end of (centering) \line\bgroup
  322. \vskip\topandbottommargin plus1fill minus1fill
  323. \boxmaxdepth = \cornerthick
  324. \vbox to0pt{\vss
  325. \line{%
  326. \vbox{\moveleft\cornerthick\nsbot}%
  327. \hfill
  328. \vbox{\moveright\cornerthick\nsbot}%
  329. }%
  330. \nointerlineskip
  331. \line{\ewbot\hfil\ewbot}%
  332. }%
  333. \egroup % \vbox from first cropmarks clause
  334. \fi
  335. }% end of \shipout\vbox
  336. }% end of group with \normalturnoffactive
  337. \advancepageno
  338. \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  339. }
  340. \newinsert\margin \dimen\margin=\maxdimen
  341. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  342. {\catcode`\@ =11
  343. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  344. % marginal hacks, juha@viisa.uucp (Juha Takala)
  345. \ifvoid\margin\else % marginal info is present
  346. \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  347. \dimen@=\dp#1 \unvbox#1
  348. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  349. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  350. }
  351. % Here are the rules for the cropmarks. Note that they are
  352. % offset so that the space between them is truly \outerhsize or \outervsize
  353. % (P. A. MacKay, 12 November, 1986)
  354. %
  355. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  356. \def\nstop{\vbox
  357. {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  358. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  359. \def\nsbot{\vbox
  360. {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  361. % Parse an argument, then pass it to #1. The argument is the rest of
  362. % the input line (except we remove a trailing comment). #1 should be a
  363. % macro which expects an ordinary undelimited TeX argument.
  364. %
  365. \def\parsearg{\parseargusing{}}
  366. \def\parseargusing#1#2{%
  367. \def\next{#2}%
  368. \begingroup
  369. \obeylines
  370. \spaceisspace
  371. #1%
  372. \parseargline\empty% Insert the \empty token, see \finishparsearg below.
  373. }
  374. {\obeylines %
  375. \gdef\parseargline#1^^M{%
  376. \endgroup % End of the group started in \parsearg.
  377. \argremovecomment #1\comment\ArgTerm%
  378. }%
  379. }
  380. % First remove any @comment, then any @c comment.
  381. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
  382. \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
  383. % Each occurence of `\^^M' or `<space>\^^M' is replaced by a single space.
  384. %
  385. % \argremovec might leave us with trailing space, e.g.,
  386. % @end itemize @c foo
  387. % This space token undergoes the same procedure and is eventually removed
  388. % by \finishparsearg.
  389. %
  390. \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
  391. \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
  392. \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  393. \def\temp{#3}%
  394. \ifx\temp\empty
  395. % We cannot use \next here, as it holds the macro to run;
  396. % thus we reuse \temp.
  397. \let\temp\finishparsearg
  398. \else
  399. \let\temp\argcheckspaces
  400. \fi
  401. % Put the space token in:
  402. \temp#1 #3\ArgTerm
  403. }
  404. % If a _delimited_ argument is enclosed in braces, they get stripped; so
  405. % to get _exactly_ the rest of the line, we had to prevent such situation.
  406. % We prepended an \empty token at the very beginning and we expand it now,
  407. % just before passing the control to \next.
  408. % (Similarily, we have to think about #3 of \argcheckspacesY above: it is
  409. % either the null string, or it ends with \^^M---thus there is no danger
  410. % that a pair of braces would be stripped.
  411. %
  412. % But first, we have to remove the trailing space token.
  413. %
  414. \def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
  415. % \parseargdef\foo{...}
  416. % is roughly equivalent to
  417. % \def\foo{\parsearg\Xfoo}
  418. % \def\Xfoo#1{...}
  419. %
  420. % Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
  421. % favourite TeX trick. --kasal, 16nov03
  422. \def\parseargdef#1{%
  423. \expandafter \doparseargdef \csname\string#1\endcsname #1%
  424. }
  425. \def\doparseargdef#1#2{%
  426. \def#2{\parsearg#1}%
  427. \def#1##1%
  428. }
  429. % Several utility definitions with active space:
  430. {
  431. \obeyspaces
  432. \gdef\obeyedspace{ }
  433. % Make each space character in the input produce a normal interword
  434. % space in the output. Don't allow a line break at this space, as this
  435. % is used only in environments like @example, where each line of input
  436. % should produce a line of output anyway.
  437. %
  438. \gdef\sepspaces{\obeyspaces\let =\tie}
  439. % If an index command is used in an @example environment, any spaces
  440. % therein should become regular spaces in the raw index file, not the
  441. % expansion of \tie (\leavevmode \penalty \@M \ ).
  442. \gdef\unsepspaces{\let =\space}
  443. }
  444. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  445. % Define the framework for environments in texinfo.tex. It's used like this:
  446. %
  447. % \envdef\foo{...}
  448. % \def\Efoo{...}
  449. %
  450. % It's the responsibility of \envdef to insert \begingroup before the
  451. % actual body; @end closes the group after calling \Efoo. \envdef also
  452. % defines \thisenv, so the current environment is known; @end checks
  453. % whether the environment name matches. The \checkenv macro can also be
  454. % used to check whether the current environment is the one expected.
  455. %
  456. % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
  457. % are not treated as enviroments; they don't open a group. (The
  458. % implementation of @end takes care not to call \endgroup in this
  459. % special case.)
  460. % At runtime, environments start with this:
  461. \def\startenvironment#1{\begingroup\def\thisenv{#1}}
  462. % initialize
  463. \let\thisenv\empty
  464. % ... but they get defined via ``\envdef\foo{...}'':
  465. \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
  466. \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
  467. % Check whether we're in the right environment:
  468. \def\checkenv#1{%
  469. \def\temp{#1}%
  470. \ifx\thisenv\temp
  471. \else
  472. \badenverr
  473. \fi
  474. }
  475. % Evironment mismatch, #1 expected:
  476. \def\badenverr{%
  477. \errhelp = \EMsimple
  478. \errmessage{This command can appear only \inenvironment\temp,
  479. not \inenvironment\thisenv}%
  480. }
  481. \def\inenvironment#1{%
  482. \ifx#1\empty
  483. out of any environment%
  484. \else
  485. in environment \expandafter\string#1%
  486. \fi
  487. }
  488. % @end foo executes the definition of \Efoo.
  489. % But first, it executes a specialized version of \checkenv
  490. %
  491. \parseargdef\end{%
  492. \if 1\csname iscond.#1\endcsname
  493. \else
  494. % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
  495. \expandafter\checkenv\csname#1\endcsname
  496. \csname E#1\endcsname
  497. \endgroup
  498. \fi
  499. }
  500. \newhelp\EMsimple{Press RETURN to continue.}
  501. %% Simple single-character @ commands
  502. % @@ prints an @
  503. % Kludge this until the fonts are right (grr).
  504. \def\@{{\tt\char64}}
  505. % This is turned off because it was never documented
  506. % and you can use @w{...} around a quote to suppress ligatures.
  507. %% Define @` and @' to be the same as ` and '
  508. %% but suppressing ligatures.
  509. %\def\`{{`}}
  510. %\def\'{{'}}
  511. % Used to generate quoted braces.
  512. \def\mylbrace {{\tt\char123}}
  513. \def\myrbrace {{\tt\char125}}
  514. \let\{=\mylbrace
  515. \let\}=\myrbrace
  516. \begingroup
  517. % Definitions to produce \{ and \} commands for indices,
  518. % and @{ and @} for the aux file.
  519. \catcode`\{ = \other \catcode`\} = \other
  520. \catcode`\[ = 1 \catcode`\] = 2
  521. \catcode`\! = 0 \catcode`\\ = \other
  522. !gdef!lbracecmd[\{]%
  523. !gdef!rbracecmd[\}]%
  524. !gdef!lbraceatcmd[@{]%
  525. !gdef!rbraceatcmd[@}]%
  526. !endgroup
  527. % @comma{} to avoid , parsing problems.
  528. \let\comma = ,
  529. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  530. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  531. \let\, = \c
  532. \let\dotaccent = \.
  533. \def\ringaccent#1{{\accent23 #1}}
  534. \let\tieaccent = \t
  535. \let\ubaraccent = \b
  536. \let\udotaccent = \d
  537. % Other special characters: @questiondown @exclamdown @ordf @ordm
  538. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  539. \def\questiondown{?`}
  540. \def\exclamdown{!`}
  541. \def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
  542. \def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
  543. % Dotless i and dotless j, used for accents.
  544. \def\imacro{i}
  545. \def\jmacro{j}
  546. \def\dotless#1{%
  547. \def\temp{#1}%
  548. \ifx\temp\imacro \ptexi
  549. \else\ifx\temp\jmacro \j
  550. \else \errmessage{@dotless can be used only with i or j}%
  551. \fi\fi
  552. }
  553. % The \TeX{} logo, as in plain, but resetting the spacing so that a
  554. % period following counts as ending a sentence. (Idea found in latex.)
  555. %
  556. \edef\TeX{\TeX \spacefactor=1000 }
  557. % @LaTeX{} logo. Not quite the same results as the definition in
  558. % latex.ltx, since we use a different font for the raised A; it's most
  559. % convenient for us to use an explicitly smaller font, rather than using
  560. % the \scriptstyle font (since we don't reset \scriptstyle and
  561. % \scriptscriptstyle).
  562. %
  563. \def\LaTeX{%
  564. L\kern-.36em
  565. {\setbox0=\hbox{T}%
  566. \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
  567. \kern-.15em
  568. \TeX
  569. }
  570. % Be sure we're in horizontal mode when doing a tie, since we make space
  571. % equivalent to this in @example-like environments. Otherwise, a space
  572. % at the beginning of a line will start with \penalty -- and
  573. % since \penalty is valid in vertical mode, we'd end up putting the
  574. % penalty on the vertical list instead of in the new paragraph.
  575. {\catcode`@ = 11
  576. % Avoid using \@M directly, because that causes trouble
  577. % if the definition is written into an index file.
  578. \global\let\tiepenalty = \@M
  579. \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  580. }
  581. % @: forces normal size whitespace following.
  582. \def\:{\spacefactor=1000 }
  583. % @* forces a line break.
  584. \def\*{\hfil\break\hbox{}\ignorespaces}
  585. % @/ allows a line break.
  586. \let\/=\allowbreak
  587. % @. is an end-of-sentence period.
  588. \def\.{.\spacefactor=3000 }
  589. % @! is an end-of-sentence bang.
  590. \def\!{!\spacefactor=3000 }
  591. % @? is an end-of-sentence query.
  592. \def\?{?\spacefactor=3000 }
  593. % @w prevents a word break. Without the \leavevmode, @w at the
  594. % beginning of a paragraph, when TeX is still in vertical mode, would
  595. % produce a whole line of output instead of starting the paragraph.
  596. \def\w#1{\leavevmode\hbox{#1}}
  597. % @group ... @end group forces ... to be all on one page, by enclosing
  598. % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
  599. % to keep its height that of a normal line. According to the rules for
  600. % \topskip (p.114 of the TeXbook), the glue inserted is
  601. % max (\topskip - \ht (first item), 0). If that height is large,
  602. % therefore, no glue is inserted, and the space between the headline and
  603. % the text is small, which looks bad.
  604. %
  605. % Another complication is that the group might be very large. This can
  606. % cause the glue on the previous page to be unduly stretched, because it
  607. % does not have much material. In this case, it's better to add an
  608. % explicit \vfill so that the extra space is at the bottom. The
  609. % threshold for doing this is if the group is more than \vfilllimit
  610. % percent of a page (\vfilllimit can be changed inside of @tex).
  611. %
  612. \newbox\groupbox
  613. \def\vfilllimit{0.7}
  614. %
  615. \envdef\group{%
  616. \ifnum\catcode`\^^M=\active \else
  617. \errhelp = \groupinvalidhelp
  618. \errmessage{@group invalid in context where filling is enabled}%
  619. \fi
  620. \startsavinginserts
  621. %
  622. \setbox\groupbox = \vtop\bgroup
  623. % Do @comment since we are called inside an environment such as
  624. % @example, where each end-of-line in the input causes an
  625. % end-of-line in the output. We don't want the end-of-line after
  626. % the `@group' to put extra space in the output. Since @group
  627. % should appear on a line by itself (according to the Texinfo
  628. % manual), we don't worry about eating any user text.
  629. \comment
  630. }
  631. %
  632. % The \vtop produces a box with normal height and large depth; thus, TeX puts
  633. % \baselineskip glue before it, and (when the next line of text is done)
  634. % \lineskip glue after it. Thus, space below is not quite equal to space
  635. % above. But it's pretty close.
  636. \def\Egroup{%
  637. % To get correct interline space between the last line of the group
  638. % and the first line afterwards, we have to propagate \prevdepth.
  639. \endgraf % Not \par, as it may have been set to \lisppar.
  640. \global\dimen1 = \prevdepth
  641. \egroup % End the \vtop.
  642. % \dimen0 is the vertical size of the group's box.
  643. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
  644. % \dimen2 is how much space is left on the page (more or less).
  645. \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
  646. % if the group doesn't fit on the current page, and it's a big big
  647. % group, force a page break.
  648. \ifdim \dimen0 > \dimen2
  649. \ifdim \pagetotal < \vfilllimit\pageheight
  650. \page
  651. \fi
  652. \fi
  653. \box\groupbox
  654. \prevdepth = \dimen1
  655. \checkinserts
  656. }
  657. %
  658. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  659. % message, so this ends up printing `@group can only ...'.
  660. %
  661. \newhelp\groupinvalidhelp{%
  662. group can only be used in environments such as @example,^^J%
  663. where each line of input produces a line of output.}
  664. % @need space-in-mils
  665. % forces a page break if there is not space-in-mils remaining.
  666. \newdimen\mil \mil=0.001in
  667. % Old definition--didn't work.
  668. %\parseargdef\need{\par %
  669. %% This method tries to make TeX break the page naturally
  670. %% if the depth of the box does not fit.
  671. %{\baselineskip=0pt%
  672. %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
  673. %\prevdepth=-1000pt
  674. %}}
  675. \parseargdef\need{%
  676. % Ensure vertical mode, so we don't make a big box in the middle of a
  677. % paragraph.
  678. \par
  679. %
  680. % If the @need value is less than one line space, it's useless.
  681. \dimen0 = #1\mil
  682. \dimen2 = \ht\strutbox
  683. \advance\dimen2 by \dp\strutbox
  684. \ifdim\dimen0 > \dimen2
  685. %
  686. % Do a \strut just to make the height of this box be normal, so the
  687. % normal leading is inserted relative to the preceding line.
  688. % And a page break here is fine.
  689. \vtop to #1\mil{\strut\vfil}%
  690. %
  691. % TeX does not even consider page breaks if a penalty added to the
  692. % main vertical list is 10000 or more. But in order to see if the
  693. % empty box we just added fits on the page, we must make it consider
  694. % page breaks. On the other hand, we don't want to actually break the
  695. % page after the empty box. So we use a penalty of 9999.
  696. %
  697. % There is an extremely small chance that TeX will actually break the
  698. % page at this \penalty, if there are no other feasible breakpoints in
  699. % sight. (If the user is using lots of big @group commands, which
  700. % almost-but-not-quite fill up a page, TeX will have a hard time doing
  701. % good page breaking, for example.) However, I could not construct an
  702. % example where a page broke at this \penalty; if it happens in a real
  703. % document, then we can reconsider our strategy.
  704. \penalty9999
  705. %
  706. % Back up by the size of the box, whether we did a page break or not.
  707. \kern -#1\mil
  708. %
  709. % Do not allow a page break right after this kern.
  710. \nobreak
  711. \fi
  712. }
  713. % @br forces paragraph break (and is undocumented).
  714. \let\br = \par
  715. % @page forces the start of a new page.
  716. %
  717. \def\page{\par\vfill\supereject}
  718. % @exdent text....
  719. % outputs text on separate line in roman font, starting at standard page margin
  720. % This records the amount of indent in the innermost environment.
  721. % That's how much \exdent should take out.
  722. \newskip\exdentamount
  723. % This defn is used inside fill environments such as @defun.
  724. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
  725. % This defn is used inside nofill environments such as @example.
  726. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  727. \leftline{\hskip\leftskip{\rm#1}}}}
  728. % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  729. % paragraph. For more general purposes, use the \margin insertion
  730. % class. WHICH is `l' or `r'.
  731. %
  732. \newskip\inmarginspacing \inmarginspacing=1cm
  733. \def\strutdepth{\dp\strutbox}
  734. %
  735. \def\doinmargin#1#2{\strut\vadjust{%
  736. \nobreak
  737. \kern-\strutdepth
  738. \vtop to \strutdepth{%
  739. \baselineskip=\strutdepth
  740. \vss
  741. % if you have multiple lines of stuff to put here, you'll need to
  742. % make the vbox yourself of the appropriate size.
  743. \ifx#1l%
  744. \llap{\ignorespaces #2\hskip\inmarginspacing}%
  745. \else
  746. \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  747. \fi
  748. \null
  749. }%
  750. }}
  751. \def\inleftmargin{\doinmargin l}
  752. \def\inrightmargin{\doinmargin r}
  753. %
  754. % @inmargin{TEXT [, RIGHT-TEXT]}
  755. % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  756. % else use TEXT for both).
  757. %
  758. \def\inmargin#1{\parseinmargin #1,,\finish}
  759. \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  760. \setbox0 = \hbox{\ignorespaces #2}%
  761. \ifdim\wd0 > 0pt
  762. \def\lefttext{#1}% have both texts
  763. \def\righttext{#2}%
  764. \else
  765. \def\lefttext{#1}% have only one text
  766. \def\righttext{#1}%
  767. \fi
  768. %
  769. \ifodd\pageno
  770. \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  771. \else
  772. \def\temp{\inleftmargin\lefttext}%
  773. \fi
  774. \temp
  775. }
  776. % @include file insert text of that file as input.
  777. %
  778. \def\include{\parseargusing\filenamecatcodes\includezzz}
  779. \def\includezzz#1{%
  780. \pushthisfilestack
  781. \def\thisfile{#1}%
  782. {%
  783. \makevalueexpandable
  784. \def\temp{\input #1 }%
  785. \expandafter
  786. }\temp
  787. \popthisfilestack
  788. }
  789. \def\filenamecatcodes{%
  790. \catcode`\\=\other
  791. \catcode`~=\other
  792. \catcode`^=\other
  793. \catcode`_=\other
  794. \catcode`|=\other
  795. \catcode`<=\other
  796. \catcode`>=\other
  797. \catcode`+=\other
  798. \catcode`-=\other
  799. }
  800. \def\pushthisfilestack{%
  801. \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
  802. }
  803. \def\pushthisfilestackX{%
  804. \expandafter\pushthisfilestackY\thisfile\StackTerm
  805. }
  806. \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  807. \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
  808. }
  809. \def\popthisfilestack{\errthisfilestackempty}
  810. \def\errthisfilestackempty{\errmessage{Internal error:
  811. the stack of filenames is empty.}}
  812. \def\thisfile{}
  813. % @center line
  814. % outputs that line, centered.
  815. %
  816. \parseargdef\center{%
  817. \ifhmode
  818. \let\next\centerH
  819. \else
  820. \let\next\centerV
  821. \fi
  822. \next{\hfil \ignorespaces#1\unskip \hfil}%
  823. }
  824. \def\centerH#1{%
  825. {%
  826. \hfil\break
  827. \advance\hsize by -\leftskip
  828. \advance\hsize by -\rightskip
  829. \line{#1}%
  830. \break
  831. }%
  832. }
  833. \def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
  834. % @sp n outputs n lines of vertical space
  835. \parseargdef\sp{\vskip #1\baselineskip}
  836. % @comment ...line which is ignored...
  837. % @c is the same as @comment
  838. % @ignore ... @end ignore is another way to write a comment
  839. \def\comment{\begingroup \catcode`\^^M=\other%
  840. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  841. \commentxxx}
  842. {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
  843. \let\c=\comment
  844. % @paragraphindent NCHARS
  845. % We'll use ems for NCHARS, close enough.
  846. % NCHARS can also be the word `asis' or `none'.
  847. % We cannot feasibly implement @paragraphindent asis, though.
  848. %
  849. \def\asisword{asis} % no translation, these are keywords
  850. \def\noneword{none}
  851. %
  852. \parseargdef\paragraphindent{%
  853. \def\temp{#1}%
  854. \ifx\temp\asisword
  855. \else
  856. \ifx\temp\noneword
  857. \defaultparindent = 0pt
  858. \else
  859. \defaultparindent = #1em
  860. \fi
  861. \fi
  862. \parindent = \defaultparindent
  863. }
  864. % @exampleindent NCHARS
  865. % We'll use ems for NCHARS like @paragraphindent.
  866. % It seems @exampleindent asis isn't necessary, but
  867. % I preserve it to make it similar to @paragraphindent.
  868. \parseargdef\exampleindent{%
  869. \def\temp{#1}%
  870. \ifx\temp\asisword
  871. \else
  872. \ifx\temp\noneword
  873. \lispnarrowing = 0pt
  874. \else
  875. \lispnarrowing = #1em
  876. \fi
  877. \fi
  878. }
  879. % @firstparagraphindent WORD
  880. % If WORD is `none', then suppress indentation of the first paragraph
  881. % after a section heading. If WORD is `insert', then do indent at such
  882. % paragraphs.
  883. %
  884. % The paragraph indentation is suppressed or not by calling
  885. % \suppressfirstparagraphindent, which the sectioning commands do.
  886. % We switch the definition of this back and forth according to WORD.
  887. % By default, we suppress indentation.
  888. %
  889. \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
  890. \def\insertword{insert}
  891. %
  892. \parseargdef\firstparagraphindent{%
  893. \def\temp{#1}%
  894. \ifx\temp\noneword
  895. \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  896. \else\ifx\temp\insertword
  897. \let\suppressfirstparagraphindent = \relax
  898. \else
  899. \errhelp = \EMsimple
  900. \errmessage{Unknown @firstparagraphindent option `\temp'}%
  901. \fi\fi
  902. }
  903. % Here is how we actually suppress indentation. Redefine \everypar to
  904. % \kern backwards by \parindent, and then reset itself to empty.
  905. %
  906. % We also make \indent itself not actually do anything until the next
  907. % paragraph.
  908. %
  909. \gdef\dosuppressfirstparagraphindent{%
  910. \gdef\indent{%
  911. \restorefirstparagraphindent
  912. \indent
  913. }%
  914. \gdef\noindent{%
  915. \restorefirstparagraphindent
  916. \noindent
  917. }%
  918. \global\everypar = {%
  919. \kern -\parindent
  920. \restorefirstparagraphindent
  921. }%
  922. }
  923. \gdef\restorefirstparagraphindent{%
  924. \global \let \indent = \ptexindent
  925. \global \let \noindent = \ptexnoindent
  926. \global \everypar = {}%
  927. }
  928. % @asis just yields its argument. Used with @table, for example.
  929. %
  930. \def\asis#1{#1}
  931. % @math outputs its argument in math mode.
  932. %
  933. % One complication: _ usually means subscripts, but it could also mean
  934. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  935. % _ active, and distinguish by seeing if the current family is \slfam,
  936. % which is what @var uses.
  937. {
  938. \catcode\underChar = \active
  939. \gdef\mathunderscore{%
  940. \catcode\underChar=\active
  941. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  942. }
  943. }
  944. % Another complication: we want \\ (and @\) to output a \ character.
  945. % FYI, plain.tex uses \\ as a temporary control sequence (why?), but
  946. % this is not advertised and we don't care. Texinfo does not
  947. % otherwise define @\.
  948. %
  949. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  950. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  951. %
  952. \def\math{%
  953. \tex
  954. \mathunderscore
  955. \let\\ = \mathbackslash
  956. \mathactive
  957. $\finishmath
  958. }
  959. \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
  960. % Some active characters (such as <) are spaced differently in math.
  961. % We have to reset their definitions in case the @math was an argument
  962. % to a command which sets the catcodes (such as @item or @section).
  963. %
  964. {
  965. \catcode`^ = \active
  966. \catcode`< = \active
  967. \catcode`> = \active
  968. \catcode`+ = \active
  969. \gdef\mathactive{%
  970. \let^ = \ptexhat
  971. \let< = \ptexless
  972. \let> = \ptexgtr
  973. \let+ = \ptexplus
  974. }
  975. }
  976. % @bullet and @minus need the same treatment as @math, just above.
  977. \def\bullet{$\ptexbullet$}
  978. \def\minus{$-$}
  979. % @dots{} outputs an ellipsis using the current font.
  980. % We do .5em per period so that it has the same spacing in a typewriter
  981. % font as three actual period characters.
  982. %
  983. \def\dots{%
  984. \leavevmode
  985. \hbox to 1.5em{%
  986. \hskip 0pt plus 0.25fil
  987. .\hfil.\hfil.%
  988. \hskip 0pt plus 0.5fil
  989. }%
  990. }
  991. % @enddots{} is an end-of-sentence ellipsis.
  992. %
  993. \def\enddots{%
  994. \dots
  995. \spacefactor=3000
  996. }
  997. % @comma{} is so commas can be inserted into text without messing up
  998. % Texinfo's parsing.
  999. %
  1000. \let\comma = ,
  1001. % @refill is a no-op.
  1002. \let\refill=\relax
  1003. % If working on a large document in chapters, it is convenient to
  1004. % be able to disable indexing, cross-referencing, and contents, for test runs.
  1005. % This is done with @novalidate (before @setfilename).
  1006. %
  1007. \newif\iflinks \linkstrue % by default we want the aux files.
  1008. \let\novalidate = \linksfalse
  1009. % @setfilename is done at the beginning of every texinfo file.
  1010. % So open here the files we need to have open while reading the input.
  1011. % This makes it possible to make a .fmt file for texinfo.
  1012. \def\setfilename{%
  1013. \fixbackslash % Turn off hack to swallow `\input texinfo'.
  1014. \iflinks
  1015. \tryauxfile
  1016. % Open the new aux file. TeX will close it automatically at exit.
  1017. \immediate\openout\auxfile=\jobname.aux
  1018. \fi % \openindices needs to do some work in any case.
  1019. \openindices
  1020. \let\setfilename=\comment % Ignore extra @setfilename cmds.
  1021. %
  1022. % If texinfo.cnf is present on the system, read it.
  1023. % Useful for site-wide @afourpaper, etc.
  1024. \openin 1 texinfo.cnf
  1025. \ifeof 1 \else \input texinfo.cnf \fi
  1026. \closein 1
  1027. %
  1028. \comment % Ignore the actual filename.
  1029. }
  1030. % Called from \setfilename.
  1031. %
  1032. \def\openindices{%
  1033. \newindex{cp}%
  1034. \newcodeindex{fn}%
  1035. \newcodeindex{vr}%
  1036. \newcodeindex{tp}%
  1037. \newcodeindex{ky}%
  1038. \newcodeindex{pg}%
  1039. }
  1040. % @bye.
  1041. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  1042. \message{pdf,}
  1043. % adobe `portable' document format
  1044. \newcount\tempnum
  1045. \newcount\lnkcount
  1046. \newtoks\filename
  1047. \newcount\filenamelength
  1048. \newcount\pgn
  1049. \newtoks\toksA
  1050. \newtoks\toksB
  1051. \newtoks\toksC
  1052. \newtoks\toksD
  1053. \newbox\boxA
  1054. \newcount\countA
  1055. \newif\ifpdf
  1056. \newif\ifpdfmakepagedest
  1057. % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
  1058. % can be set). So we test for \relax and 0 as well as \undefined,
  1059. % borrowed from ifpdf.sty.
  1060. \ifx\pdfoutput\undefined
  1061. \else
  1062. \ifx\pdfoutput\relax
  1063. \else
  1064. \ifcase\pdfoutput
  1065. \else
  1066. \pdftrue
  1067. \fi
  1068. \fi
  1069. \fi
  1070. %
  1071. \ifpdf
  1072. \input pdfcolor
  1073. \pdfcatalog{/PageMode /UseOutlines}%
  1074. \def\dopdfimage#1#2#3{%
  1075. \def\imagewidth{#2}%
  1076. \def\imageheight{#3}%
  1077. % without \immediate, pdftex seg faults when the same image is
  1078. % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
  1079. \ifnum\pdftexversion < 14
  1080. \immediate\pdfimage
  1081. \else
  1082. \immediate\pdfximage
  1083. \fi
  1084. \ifx\empty\imagewidth\else width \imagewidth \fi
  1085. \ifx\empty\imageheight\else height \imageheight \fi
  1086. \ifnum\pdftexversion<13
  1087. #1.pdf%
  1088. \else
  1089. {#1.pdf}%
  1090. \fi
  1091. \ifnum\pdftexversion < 14 \else
  1092. \pdfrefximage \pdflastximage
  1093. \fi}
  1094. \def\pdfmkdest#1{{%
  1095. % We have to set dummies so commands such as @code in a section title
  1096. % aren't expanded.
  1097. \atdummies
  1098. \normalturnoffactive
  1099. \pdfdest name{#1} xyz%
  1100. }}
  1101. \def\pdfmkpgn#1{#1}
  1102. \let\linkcolor = \Blue % was Cyan, but that seems light?
  1103. \def\endlink{\Black\pdfendlink}
  1104. % Adding outlines to PDF; macros for calculating structure of outlines
  1105. % come from Petr Olsak
  1106. \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  1107. \else \csname#1\endcsname \fi}
  1108. \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  1109. \advance\tempnum by 1
  1110. \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  1111. %
  1112. % #1 is the section text. #2 is the pdf expression for the number
  1113. % of subentries (or empty, for subsubsections). #3 is the node
  1114. % text, which might be empty if this toc entry had no
  1115. % corresponding node. #4 is the page number.
  1116. %
  1117. \def\dopdfoutline#1#2#3#4{%
  1118. % Generate a link to the node text if that exists; else, use the
  1119. % page number. We could generate a destination for the section
  1120. % text in the case where a section has no node, but it doesn't
  1121. % seem worthwhile, since most documents are normally structured.
  1122. \def\pdfoutlinedest{#3}%
  1123. \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}\fi
  1124. %
  1125. \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{#1}%
  1126. }
  1127. %
  1128. \def\pdfmakeoutlines{%
  1129. \begingroup
  1130. % Thanh's hack / proper braces in bookmarks
  1131. \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
  1132. \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
  1133. %
  1134. % Read toc silently, to get counts of subentries for \pdfoutline.
  1135. \def\numchapentry##1##2##3##4{%
  1136. \def\thischapnum{##2}%
  1137. \def\thissecnum{0}%
  1138. \def\thissubsecnum{0}%
  1139. }%
  1140. \def\numsecentry##1##2##3##4{%
  1141. \advancenumber{chap\thischapnum}%
  1142. \def\thissecnum{##2}%
  1143. \def\thissubsecnum{0}%
  1144. }%
  1145. \def\numsubsecentry##1##2##3##4{%
  1146. \advancenumber{sec\thissecnum}%
  1147. \def\thissubsecnum{##2}%
  1148. }%
  1149. \def\numsubsubsecentry##1##2##3##4{%
  1150. \advancenumber{subsec\thissubsecnum}%
  1151. }%
  1152. \def\thischapnum{0}%
  1153. \def\thissecnum{0}%
  1154. \def\thissubsecnum{0}%
  1155. %
  1156. % use \def rather than \let here because we redefine \chapentry et
  1157. % al. a second time, below.
  1158. \def\appentry{\numchapentry}%
  1159. \def\appsecentry{\numsecentry}%
  1160. \def\appsubsecentry{\numsubsecentry}%
  1161. \def\appsubsubsecentry{\numsubsubsecentry}%
  1162. \def\unnchapentry{\numchapentry}%
  1163. \def\unnsecentry{\numsecentry}%
  1164. \def\unnsubsecentry{\numsubsecentry}%
  1165. \def\unnsubsubsecentry{\numsubsubsecentry}%
  1166. \input \jobname.toc
  1167. %
  1168. % Read toc second time, this time actually producing the outlines.
  1169. % The `-' means take the \expnumber as the absolute number of
  1170. % subentries, which we calculated on our first read of the .toc above.
  1171. %
  1172. % We use the node names as the destinations.
  1173. \def\numchapentry##1##2##3##4{%
  1174. \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
  1175. \def\numsecentry##1##2##3##4{%
  1176. \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
  1177. \def\numsubsecentry##1##2##3##4{%
  1178. \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
  1179. \def\numsubsubsecentry##1##2##3##4{% count is always zero
  1180. \dopdfoutline{##1}{}{##3}{##4}}%
  1181. %
  1182. % PDF outlines are displayed using system fonts, instead of
  1183. % document fonts. Therefore we cannot use special characters,
  1184. % since the encoding is unknown. For example, the eogonek from
  1185. % Latin 2 (0xea) gets translated to a | character. Info from
  1186. % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
  1187. %
  1188. % xx to do this right, we have to translate 8-bit characters to
  1189. % their "best" equivalent, based on the @documentencoding. Right
  1190. % now, I guess we'll just let the pdf reader have its way.
  1191. \indexnofonts
  1192. \turnoffactive
  1193. \input \jobname.toc
  1194. \endgroup
  1195. }
  1196. %
  1197. \def\makelinks #1,{%
  1198. \def\params{#1}\def\E{END}%
  1199. \ifx\params\E
  1200. \let\nextmakelinks=\relax
  1201. \else
  1202. \let\nextmakelinks=\makelinks
  1203. \ifnum\lnkcount>0,\fi
  1204. \picknum{#1}%
  1205. \startlink attr{/Border [0 0 0]}
  1206. goto name{\pdfmkpgn{\the\pgn}}%
  1207. \linkcolor #1%
  1208. \advance\lnkcount by 1%
  1209. \endlink
  1210. \fi
  1211. \nextmakelinks
  1212. }
  1213. \def\picknum#1{\expandafter\pn#1}
  1214. \def\pn#1{%
  1215. \def\p{#1}%
  1216. \ifx\p\lbrace
  1217. \let\nextpn=\ppn
  1218. \else
  1219. \let\nextpn=\ppnn
  1220. \def\first{#1}
  1221. \fi
  1222. \nextpn
  1223. }
  1224. \def\ppn#1{\pgn=#1\gobble}
  1225. \def\ppnn{\pgn=\first}
  1226. \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
  1227. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1228. \ifx\PP\D\let\nextsp\relax
  1229. \else\let\nextsp\skipspaces
  1230. \ifx\p\space\else\addtokens{\filename}{\PP}%
  1231. \advance\filenamelength by 1
  1232. \fi
  1233. \fi
  1234. \nextsp}
  1235. \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
  1236. \ifnum\pdftexversion < 14
  1237. \let \startlink \pdfannotlink
  1238. \else
  1239. \let \startlink \pdfstartlink
  1240. \fi
  1241. \def\pdfurl#1{%
  1242. \begingroup
  1243. \normalturnoffactive\def\@{@}%
  1244. \makevalueexpandable
  1245. \leavevmode\Red
  1246. \startlink attr{/Border [0 0 0]}%
  1247. user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1248. \endgroup}
  1249. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1250. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1251. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1252. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1253. \def\maketoks{%
  1254. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1255. \ifx\first0\adn0
  1256. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1257. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1258. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1259. \else
  1260. \ifnum0=\countA\else\makelink\fi
  1261. \ifx\first.\let\next=\done\else
  1262. \let\next=\maketoks
  1263. \addtokens{\toksB}{\the\toksD}
  1264. \ifx\first,\addtokens{\toksB}{\space}\fi
  1265. \fi
  1266. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1267. \next}
  1268. \def\makelink{\addtokens{\toksB}%
  1269. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1270. \def\pdflink#1{%
  1271. \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1272. \linkcolor #1\endlink}
  1273. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1274. \else
  1275. \let\pdfmkdest = \gobble
  1276. \let\pdfurl = \gobble
  1277. \let\endlink = \relax
  1278. \let\linkcolor = \relax
  1279. \let\pdfmakeoutlines = \relax
  1280. \fi % \ifx\pdfoutput
  1281. \message{fonts,}
  1282. % Change the current font style to #1, remembering it in \curfontstyle.
  1283. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
  1284. % italics, not bold italics.
  1285. %
  1286. \def\setfontstyle#1{%
  1287. \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
  1288. \csname ten#1\endcsname % change the current font
  1289. }
  1290. % Select #1 fonts with the current style.
  1291. %
  1292. \def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
  1293. \def\rm{\fam=0 \setfontstyle{rm}}
  1294. \def\it{\fam=\itfam \setfontstyle{it}}
  1295. \def\sl{\fam=\slfam \setfontstyle{sl}}
  1296. \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
  1297. \def\tt{\fam=\ttfam \setfontstyle{tt}}
  1298. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  1299. % So we set up a \sf.
  1300. \newfam\sffam
  1301. \def\sf{\fam=\sffam \setfontstyle{sf}}
  1302. \let\li = \sf % Sometimes we call it \li, not \sf.
  1303. % We don't need math for this font style.
  1304. \def\ttsl{\setfontstyle{ttsl}}
  1305. % Default leading.
  1306. \newdimen\textleading \textleading = 13.2pt
  1307. % Set the baselineskip to #1, and the lineskip and strut size
  1308. % correspondingly. There is no deep meaning behind these magic numbers
  1309. % used as factors; they just match (closely enough) what Knuth defined.
  1310. %
  1311. \def\lineskipfactor{.08333}
  1312. \def\strutheightpercent{.70833}
  1313. \def\strutdepthpercent {.29167}
  1314. %
  1315. \def\setleading#1{%
  1316. \normalbaselineskip = #1\relax
  1317. \normallineskip = \lineskipfactor\normalbaselineskip
  1318. \normalbaselines
  1319. \setbox\strutbox =\hbox{%
  1320. \vrule width0pt height\strutheightpercent\baselineskip
  1321. depth \strutdepthpercent \baselineskip
  1322. }%
  1323. }
  1324. % Set the font macro #1 to the font named #2, adding on the
  1325. % specified font prefix (normally `cm').
  1326. % #3 is the font's design size, #4 is a scale factor
  1327. \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
  1328. % Use cm as the default font prefix.
  1329. % To specify the font prefix, you must define \fontprefix
  1330. % before you read in texinfo.tex.
  1331. \ifx\fontprefix\undefined
  1332. \def\fontprefix{cm}
  1333. \fi
  1334. % Support font families that don't use the same naming scheme as CM.
  1335. \def\rmshape{r}
  1336. \def\rmbshape{bx} %where the normal face is bold
  1337. \def\bfshape{b}
  1338. \def\bxshape{bx}
  1339. \def\ttshape{tt}
  1340. \def\ttbshape{tt}
  1341. \def\ttslshape{sltt}
  1342. \def\itshape{ti}
  1343. \def\itbshape{bxti}
  1344. \def\slshape{sl}
  1345. \def\slbshape{bxsl}
  1346. \def\sfshape{ss}
  1347. \def\sfbshape{ss}
  1348. \def\scshape{csc}
  1349. \def\scbshape{csc}
  1350. % Text fonts (11.2pt, magstep1).
  1351. \def\textnominalsize{11pt}
  1352. \edef\mainmagstep{\magstephalf}
  1353. \setfont\textrm\rmshape{10}{\mainmagstep}
  1354. \setfont\texttt\ttshape{10}{\mainmagstep}
  1355. \setfont\textbf\bfshape{10}{\mainmagstep}
  1356. \setfont\textit\itshape{10}{\mainmagstep}
  1357. \setfont\textsl\slshape{10}{\mainmagstep}
  1358. \setfont\textsf\sfshape{10}{\mainmagstep}
  1359. \setfont\textsc\scshape{10}{\mainmagstep}
  1360. \setfont\textttsl\ttslshape{10}{\mainmagstep}
  1361. \font\texti=cmmi10 scaled \mainmagstep
  1362. \font\textsy=cmsy10 scaled \mainmagstep
  1363. % A few fonts for @defun names and args.
  1364. \setfont\defbf\bfshape{10}{\magstep1}
  1365. \setfont\deftt\ttshape{10}{\magstep1}
  1366. \setfont\defttsl\ttslshape{10}{\magstep1}
  1367. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
  1368. % Fonts for indices, footnotes, small examples (9pt).
  1369. \def\smallnominalsize{9pt}
  1370. \setfont\smallrm\rmshape{9}{1000}
  1371. \setfont\smalltt\ttshape{9}{1000}
  1372. \setfont\smallbf\bfshape{10}{900}
  1373. \setfont\smallit\itshape{9}{1000}
  1374. \setfont\smallsl\slshape{9}{1000}
  1375. \setfont\smallsf\sfshape{9}{1000}
  1376. \setfont\smallsc\scshape{10}{900}
  1377. \setfont\smallttsl\ttslshape{10}{900}
  1378. \font\smalli=cmmi9
  1379. \font\smallsy=cmsy9
  1380. % Fonts for small examples (8pt).
  1381. \def\smallernominalsize{8pt}
  1382. \setfont\smallerrm\rmshape{8}{1000}
  1383. \setfont\smallertt\ttshape{8}{1000}
  1384. \setfont\smallerbf\bfshape{10}{800}
  1385. \setfont\smallerit\itshape{8}{1000}
  1386. \setfont\smallersl\slshape{8}{1000}
  1387. \setfont\smallersf\sfshape{8}{1000}
  1388. \setfont\smallersc\scshape{10}{800}
  1389. \setfont\smallerttsl\ttslshape{10}{800}
  1390. \font\smalleri=cmmi8
  1391. \font\smallersy=cmsy8
  1392. % Fonts for title page (20.4pt):
  1393. \def\titlenominalsize{20pt}
  1394. \setfont\titlerm\rmbshape{12}{\magstep3}
  1395. \setfont\titleit\itbshape{10}{\magstep4}
  1396. \setfont\titlesl\slbshape{10}{\magstep4}
  1397. \setfont\titlett\ttbshape{12}{\magstep3}
  1398. \setfont\titlettsl\ttslshape{10}{\magstep4}
  1399. \setfont\titlesf\sfbshape{17}{\magstep1}
  1400. \let\titlebf=\titlerm
  1401. \setfont\titlesc\scbshape{10}{\magstep4}
  1402. \font\titlei=cmmi12 scaled \magstep3
  1403. \font\titlesy=cmsy10 scaled \magstep4
  1404. \def\authorrm{\secrm}
  1405. \def\authortt{\sectt}
  1406. % Chapter (and unnumbered) fonts (17.28pt).
  1407. \def\chapnominalsize{17pt}
  1408. \setfont\chaprm\rmbshape{12}{\magstep2}
  1409. \setfont\chapit\itbshape{10}{\magstep3}
  1410. \setfont\chapsl\slbshape{10}{\magstep3}
  1411. \setfont\chaptt\ttbshape{12}{\magstep2}
  1412. \setfont\chapttsl\ttslshape{10}{\magstep3}
  1413. \setfont\chapsf\sfbshape{17}{1000}
  1414. \let\chapbf=\chaprm
  1415. \setfont\chapsc\scbshape{10}{\magstep3}
  1416. \font\chapi=cmmi12 scaled \magstep2
  1417. \font\chapsy=cmsy10 scaled \magstep3
  1418. % Section fonts (14.4pt).
  1419. \def\secnominalsize{14pt}
  1420. \setfont\secrm\rmbshape{12}{\magstep1}
  1421. \setfont\secit\itbshape{10}{\magstep2}
  1422. \setfont\secsl\slbshape{10}{\magstep2}
  1423. \setfont\sectt\ttbshape{12}{\magstep1}
  1424. \setfont\secttsl\ttslshape{10}{\magstep2}
  1425. \setfont\secsf\sfbshape{12}{\magstep1}
  1426. \let\secbf\secrm
  1427. \setfont\secsc\scbshape{10}{\magstep2}
  1428. \font\seci=cmmi12 scaled \magste…