Mercurial > hg > octave-lyh
comparison doc/texinfo.tex @ 2992:53b38bf1d443
[project @ 1997-05-20 19:48:00 by jwe]
author | jwe |
---|---|
date | Tue, 20 May 1997 19:48:00 +0000 |
parents | 62dc317d97b9 |
children | 6929a31e7624 |
comparison
equal
deleted
inserted
replaced
2991:fc751d2a99fd | 2992:53b38bf1d443 |
---|---|
1 %% TeX macros to handle Texinfo files. | 1 %% TeX macros to handle Texinfo files. |
2 %% $Id: texinfo.tex,v 1.6 1997-03-01 02:54:43 jwe Exp $ | 2 %% $Id: texinfo.tex,v 1.7 1997-05-20 19:48:00 jwe Exp $ |
3 | 3 |
4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, | 4 % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, |
5 % 94, 95, 96, 97 Free Software Foundation, Inc. | 5 % 94, 95, 96, 97 Free Software Foundation, Inc. |
6 | 6 |
7 %This texinfo.tex file is free software; you can redistribute it and/or | 7 %This texinfo.tex file is free software; you can redistribute it and/or |
34 % Added by gildea November 1993. | 34 % Added by gildea November 1993. |
35 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi | 35 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
36 | 36 |
37 % This automatically updates the version number based on RCS. | 37 % This automatically updates the version number based on RCS. |
38 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} | 38 \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} |
39 \deftexinfoversion$Revision: 1.6 $ | 39 \deftexinfoversion$Revision: 1.7 $ |
40 \message{Loading texinfo package [Version \texinfoversion]:} | 40 \message{Loading texinfo package [Version \texinfoversion]:} |
41 | 41 |
42 % If in a .fmt file, print the version number | 42 % If in a .fmt file, print the version number |
43 % and turn on active characters that we couldn't do earlier because | 43 % and turn on active characters that we couldn't do earlier because |
44 % they might have appeared in the input file name. | 44 % they might have appeared in the input file name. |
116 \tracingpages1 \tracingoutput1 \tracinglostchars1 | 116 \tracingpages1 \tracingoutput1 \tracinglostchars1 |
117 \tracingmacros2 \tracingparagraphs1 \tracingrestores1 | 117 \tracingmacros2 \tracingparagraphs1 \tracingrestores1 |
118 \showboxbreadth\maxdimen\showboxdepth\maxdimen | 118 \showboxbreadth\maxdimen\showboxdepth\maxdimen |
119 }% | 119 }% |
120 | 120 |
121 %---------------------Begin change----------------------- | 121 % For @cropmarks command. |
122 % | 122 % Do @cropmarks to get crop marks. |
123 %%%% For @cropmarks command. | 123 % |
124 % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986 | 124 \newif\ifcropmarks |
125 \let\cropmarks = \cropmarkstrue | |
126 % | |
127 % Dimensions to add cropmarks at corners. | |
128 % Added by P. A. MacKay, 12 Nov. 1986 | |
125 % | 129 % |
126 \newdimen\cornerlong \newdimen\cornerthick | 130 \newdimen\cornerlong \newdimen\cornerthick |
127 \newdimen \topandbottommargin | 131 \newdimen\topandbottommargin |
128 \newdimen \outerhsize \newdimen \outervsize | 132 \newdimen\outerhsize \newdimen\outervsize |
129 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks | 133 \cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks |
130 \outerhsize=7in | 134 \outerhsize=7in |
131 %\outervsize=9.5in | 135 %\outervsize=9.5in |
132 % Alternative @smallbook page size is 9.25in | 136 % Alternative @smallbook page size is 9.25in |
133 \outervsize=9.25in | 137 \outervsize=9.25in |
134 \topandbottommargin=.75in | 138 \topandbottommargin=.75in |
135 % | |
136 %---------------------End change----------------------- | |
137 | 139 |
138 % Main output routine. | 140 % Main output routine. |
139 \chardef\PAGE = 255 | 141 \chardef\PAGE = 255 |
140 \output = {\onepageout{\pagecontents\PAGE}} | 142 \output = {\onepageout{\pagecontents\PAGE}} |
141 | 143 |
142 \newbox\headlinebox \newbox\footlinebox | 144 \newbox\headlinebox |
145 \newbox\footlinebox | |
143 | 146 |
144 % \onepageout takes a vbox as an argument. Note that \pagecontents | 147 % \onepageout takes a vbox as an argument. Note that \pagecontents |
145 % does insertions, but you have to call it yourself. | 148 % does insertions, but you have to call it yourself. |
146 \def\onepageout#1{% | 149 \def\onepageout#1{% |
147 \hoffset=\normaloffset | 150 \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi |
151 % | |
148 \ifodd\pageno \advance\hoffset by \bindingoffset | 152 \ifodd\pageno \advance\hoffset by \bindingoffset |
149 \else \advance\hoffset by -\bindingoffset\fi | 153 \else \advance\hoffset by -\bindingoffset\fi |
150 % | 154 % |
151 % Do this outside of the \shipout so @code etc. will be expanded in | 155 % Do this outside of the \shipout so @code etc. will be expanded in |
152 % the headline as they should be, not taken literally (outputting ''code). | 156 % the headline as they should be, not taken literally (outputting ''code). |
161 \escapechar = `\\ % use backslash in output files. | 165 \escapechar = `\\ % use backslash in output files. |
162 \indexdummies % don't expand commands in the output. | 166 \indexdummies % don't expand commands in the output. |
163 \normalturnoffactive % \ in index entries must not stay \, e.g., if | 167 \normalturnoffactive % \ in index entries must not stay \, e.g., if |
164 % the page break happens to be in the middle of an example. | 168 % the page break happens to be in the middle of an example. |
165 \shipout\vbox{% | 169 \shipout\vbox{% |
170 \ifcropmarks \vbox to \outervsize\bgroup | |
171 \hsize = \outerhsize | |
172 \line{\ewtop\hfil\ewtop}% | |
173 \nointerlineskip | |
174 \line{% | |
175 \vbox{\moveleft\cornerthick\nstop}% | |
176 \hfill | |
177 \vbox{\moveright\cornerthick\nstop}% | |
178 }% | |
179 \vskip\topandbottommargin | |
180 \line\bgroup | |
181 \hfil % center the page within the outer (page) hsize. | |
182 \ifodd\pageno\hskip\bindingoffset\fi | |
183 \vbox\bgroup | |
184 \fi | |
185 % | |
166 \unvbox\headlinebox | 186 \unvbox\headlinebox |
167 \pagebody{#1}% | 187 \pagebody{#1}% |
168 \unvbox\footlinebox | 188 \unvbox\footlinebox |
169 }% | 189 % |
170 }% | 190 \ifcropmarks |
191 \egroup % end of \vbox\bgroup | |
192 \hfil\egroup % end of (centering) \line\bgroup | |
193 \vskip\topandbottommargin plus1fill minus1fill | |
194 \boxmaxdepth = \cornerthick | |
195 \line{% | |
196 \vbox{\moveleft\cornerthick\nsbot}% | |
197 \hfill | |
198 \vbox{\moveright\cornerthick\nsbot}% | |
199 }% | |
200 \nointerlineskip | |
201 \line{\ewbot\hfil\ewbot}% | |
202 \egroup % \vbox from first cropmarks clause | |
203 \fi | |
204 }% end of \shipout\vbox | |
205 }% end of group with \turnoffactive | |
171 \advancepageno | 206 \advancepageno |
172 \ifnum\outputpenalty>-20000 \else\dosupereject\fi | 207 \ifnum\outputpenalty>-20000 \else\dosupereject\fi |
173 } | 208 } |
174 | |
175 %%%% For @cropmarks command %%%% | |
176 | |
177 % Here is a modification of the main output routine for Near East Publications | |
178 % This provides right-angle cropmarks at all four corners. | |
179 % The contents of the page are centerlined into the cropmarks, | |
180 % and any desired binding offset is added as an \hskip on either | |
181 % site of the centerlined box. (P. A. MacKay, 12 November, 1986) | |
182 % | |
183 \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up | |
184 {\escapechar=`\\\relax % makes sure backslash is used in output files. | |
185 \shipout | |
186 \vbox to \outervsize{\hsize=\outerhsize | |
187 \vbox{\line{\ewtop\hfill\ewtop}} | |
188 \nointerlineskip | |
189 \line{\vbox{\moveleft\cornerthick\nstop} | |
190 \hfill | |
191 \vbox{\moveright\cornerthick\nstop}} | |
192 \vskip \topandbottommargin | |
193 \centerline{\ifodd\pageno\hskip\bindingoffset\fi | |
194 \vbox{ | |
195 {\let\hsize=\pagewidth \makeheadline} | |
196 \pagebody{#1} | |
197 {\let\hsize=\pagewidth \makefootline}} | |
198 \ifodd\pageno\else\hskip\bindingoffset\fi} | |
199 \vskip \topandbottommargin plus1fill minus1fill | |
200 \boxmaxdepth\cornerthick | |
201 \line{\vbox{\moveleft\cornerthick\nsbot} | |
202 \hfill | |
203 \vbox{\moveright\cornerthick\nsbot}} | |
204 \nointerlineskip | |
205 \vbox{\line{\ewbot\hfill\ewbot}} | |
206 }} | |
207 \advancepageno | |
208 \ifnum\outputpenalty>-20000 \else\dosupereject\fi} | |
209 % | |
210 % Do @cropmarks to get crop marks | |
211 \def\cropmarks{\let\onepageout=\croppageout } | |
212 | 209 |
213 \newinsert\margin \dimen\margin=\maxdimen | 210 \newinsert\margin \dimen\margin=\maxdimen |
214 | 211 |
215 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} | 212 \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} |
216 {\catcode`\@ =11 | 213 {\catcode`\@ =11 |
221 \dimen@=\dp#1 \unvbox#1 | 218 \dimen@=\dp#1 \unvbox#1 |
222 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi | 219 \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi |
223 \ifr@ggedbottom \kern-\dimen@ \vfil \fi} | 220 \ifr@ggedbottom \kern-\dimen@ \vfil \fi} |
224 } | 221 } |
225 | 222 |
226 % | |
227 % Here are the rules for the cropmarks. Note that they are | 223 % Here are the rules for the cropmarks. Note that they are |
228 % offset so that the space between them is truly \outerhsize or \outervsize | 224 % offset so that the space between them is truly \outerhsize or \outervsize |
229 % (P. A. MacKay, 12 November, 1986) | 225 % (P. A. MacKay, 12 November, 1986) |
230 % | 226 % |
231 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} | 227 \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} |
2238 \def\,##1{\realbackslash ,{##1}}% | 2234 \def\,##1{\realbackslash ,{##1}}% |
2239 \def\t##1{\realbackslash t {##1}}% | 2235 \def\t##1{\realbackslash t {##1}}% |
2240 \def\r##1{\realbackslash r {##1}}% | 2236 \def\r##1{\realbackslash r {##1}}% |
2241 \def\i##1{\realbackslash i {##1}}% | 2237 \def\i##1{\realbackslash i {##1}}% |
2242 \def\b##1{\realbackslash b {##1}}% | 2238 \def\b##1{\realbackslash b {##1}}% |
2239 \def\sc##1{\realbackslash sc {##1}}% | |
2243 \def\cite##1{\realbackslash cite {##1}}% | 2240 \def\cite##1{\realbackslash cite {##1}}% |
2244 \def\key##1{\realbackslash key {##1}}% | 2241 \def\key##1{\realbackslash key {##1}}% |
2245 \def\file##1{\realbackslash file {##1}}% | 2242 \def\file##1{\realbackslash file {##1}}% |
2246 \def\var##1{\realbackslash var {##1}}% | 2243 \def\var##1{\realbackslash var {##1}}% |
2247 \def\kbd##1{\realbackslash kbd {##1}}% | 2244 \def\kbd##1{\realbackslash kbd {##1}}% |
2409 \gdef\cindexsub "#1" #2^^M{\endgroup % | 2406 \gdef\cindexsub "#1" #2^^M{\endgroup % |
2410 \dosubind{cp}{#2}{#1}}} | 2407 \dosubind{cp}{#2}{#1}}} |
2411 | 2408 |
2412 % Define the macros used in formatting output of the sorted index material. | 2409 % Define the macros used in formatting output of the sorted index material. |
2413 | 2410 |
2414 % This is what you call to cause a particular index to get printed. | 2411 % @printindex causes a particular index (the ??s file) to get printed. |
2415 % Write | 2412 % It does not print any chapter heading (usually an @unnumbered). |
2416 % @unnumbered Function Index | 2413 % |
2417 % @printindex fn | |
2418 | |
2419 \def\printindex{\parsearg\doprintindex} | 2414 \def\printindex{\parsearg\doprintindex} |
2420 | |
2421 \def\doprintindex#1{\begingroup | 2415 \def\doprintindex#1{\begingroup |
2422 \dobreak \chapheadingskip{10000}% | 2416 \dobreak \chapheadingskip{10000}% |
2423 % | 2417 % |
2424 \indexfonts \rm | 2418 \indexfonts \rm |
2425 \tolerance = 9500 | 2419 \tolerance = 9500 |
2426 \indexbreaks | 2420 \indexbreaks |
2427 \def\indexbackslash{\rawbackslashxx}% | |
2428 % Index files are almost Texinfo source, but we use \ as the escape | |
2429 % character. It would be better to use @, but that's too big a change | |
2430 % to make right now. | |
2431 \catcode`\\ = 0 | |
2432 \catcode`\@ = 11 | |
2433 \escapechar = `\\ | |
2434 \begindoublecolumns | |
2435 % | 2421 % |
2436 % See if the index file exists and is nonempty. | 2422 % See if the index file exists and is nonempty. |
2437 \openin 1 \jobname.#1s | 2423 \openin 1 \jobname.#1s |
2438 \ifeof 1 | 2424 \ifeof 1 |
2439 % \enddoublecolumns gets confused if there is no text in the index, | 2425 % \enddoublecolumns gets confused if there is no text in the index, |
2448 % it can discover if there is anything in it. | 2434 % it can discover if there is anything in it. |
2449 \read 1 to \temp | 2435 \read 1 to \temp |
2450 \ifeof 1 | 2436 \ifeof 1 |
2451 (Index is empty) | 2437 (Index is empty) |
2452 \else | 2438 \else |
2439 % Index files are almost Texinfo source, but we use \ as the escape | |
2440 % character. It would be better to use @, but that's too big a change | |
2441 % to make right now. | |
2442 \def\indexbackslash{\rawbackslashxx}% | |
2443 \catcode`\\ = 0 | |
2444 \catcode`\@ = 11 | |
2445 \escapechar = `\\ | |
2446 \begindoublecolumns | |
2453 \input \jobname.#1s | 2447 \input \jobname.#1s |
2448 \enddoublecolumns | |
2454 \fi | 2449 \fi |
2455 \fi | 2450 \fi |
2456 \closein 1 | 2451 \closein 1 |
2457 \enddoublecolumns | |
2458 \endgroup} | 2452 \endgroup} |
2459 | 2453 |
2460 % These macros are used by the sorted index file itself. | 2454 % These macros are used by the sorted index file itself. |
2461 % Change them to control the appearance of the index. | 2455 % Change them to control the appearance of the index. |
2462 | 2456 |
2554 \newbox\partialpage | 2548 \newbox\partialpage |
2555 \newdimen\doublecolumnhsize | 2549 \newdimen\doublecolumnhsize |
2556 | 2550 |
2557 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns | 2551 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns |
2558 % Grab any single-column material above us. | 2552 % Grab any single-column material above us. |
2559 \output = {\global\setbox\partialpage | 2553 \output = {\global\setbox\partialpage = \vbox{% |
2560 =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}% | 2554 % |
2555 % Here is a possibility not foreseen in manmac: if we accumulate a | |
2556 % whole lot of material, we might end up calling this \output | |
2557 % routine twice in a row (see the doublecol-lose test, which is | |
2558 % essentially a couple of indexes with @setchapternewpage off). In | |
2559 % that case, we must prevent the second \partialpage from | |
2560 % simply overwriting the first, causing us to lose the page. | |
2561 % This will preserve it until a real output routine can ship it | |
2562 % out. Generally, \partialpage will be empty when this runs and | |
2563 % this will be a no-op. | |
2564 \unvbox\partialpage | |
2565 % | |
2566 % Unvbox the main output page. | |
2567 \unvbox255 | |
2568 \kern-\topskip \kern\baselineskip | |
2569 }}% | |
2561 \eject | 2570 \eject |
2562 % | 2571 % |
2563 % Now switch to the double-column output routine. | 2572 % Use the double-column output routine for subsequent pages. |
2564 \output={\doublecolumnout}% | 2573 \output = {\doublecolumnout}% |
2565 % | 2574 % |
2566 % Change the page size parameters. We could do this once outside this | 2575 % Change the page size parameters. We could do this once outside this |
2567 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 | 2576 % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 |
2568 % format, but then we repeat the same computation. Repeating a couple | 2577 % format, but then we repeat the same computation. Repeating a couple |
2569 % of assignments once per index is clearly meaningless for the | 2578 % of assignments once per index is clearly meaningless for the |
2570 % execution time, so we may as well do it once. | 2579 % execution time, so we may as well do it in one place. |
2571 % | 2580 % |
2572 % First we halve the line length, less a little for the gutter between | 2581 % First we halve the line length, less a little for the gutter between |
2573 % the columns. We compute the gutter based on the line length, so it | 2582 % the columns. We compute the gutter based on the line length, so it |
2574 % changes automatically with the paper format. The magic constant | 2583 % changes automatically with the paper format. The magic constant |
2575 % below is chosen so that the gutter has the same value (well, +- < | 2584 % below is chosen so that the gutter has the same value (well, +-<1pt) |
2576 % 1pt) as it did when we hard-coded it. | 2585 % as it did when we hard-coded it. |
2577 % | 2586 % |
2578 % We put the result in a separate register, \doublecolumhsize, so we | 2587 % We put the result in a separate register, \doublecolumhsize, so we |
2579 % can restore it in \pagesofar, after \hsize itself has (potentially) | 2588 % can restore it in \pagesofar, after \hsize itself has (potentially) |
2580 % been clobbered. | 2589 % been clobbered. |
2581 % | 2590 % |
2592 \splittopskip=\topskip \splitmaxdepth=\maxdepth | 2601 \splittopskip=\topskip \splitmaxdepth=\maxdepth |
2593 % Get the available space for the double columns -- the normal | 2602 % Get the available space for the double columns -- the normal |
2594 % (undoubled) page height minus any material left over from the | 2603 % (undoubled) page height minus any material left over from the |
2595 % previous page. | 2604 % previous page. |
2596 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage | 2605 \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage |
2597 % box0 will be the left-hand column, box1 the right. | 2606 % box0 will be the left-hand column, box2 the right. |
2598 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ | 2607 \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ |
2599 \onepageout\pagesofar | 2608 \onepageout\pagesofar |
2600 \unvbox255 \penalty\outputpenalty | 2609 \unvbox255 |
2610 \penalty\outputpenalty | |
2601 } | 2611 } |
2602 \def\pagesofar{% | 2612 \def\pagesofar{% |
2603 % The contents of the output page -- any previous material, | 2613 % Re-output the contents of the output page -- any previous material, |
2604 % followed by the two boxes we just split. | 2614 % followed by the two boxes we just split. |
2605 \unvbox\partialpage | 2615 \unvbox\partialpage |
2606 \hsize = \doublecolumnhsize | 2616 \hsize = \doublecolumnhsize |
2607 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% | 2617 \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% |
2608 } | 2618 } |
2609 \def\enddoublecolumns{% | 2619 \def\enddoublecolumns{% |
2610 \output={\balancecolumns}\eject % split what we have | 2620 \output = {\balancecolumns}\eject % split what we have |
2611 \endgroup | 2621 \endgroup % started in \begindoublecolumns |
2622 % | |
2612 % Back to normal single-column typesetting, but take account of the | 2623 % Back to normal single-column typesetting, but take account of the |
2613 % fact that we just accumulated some stuff on the output page. | 2624 % fact that we just accumulated some stuff on the output page. |
2614 \pagegoal=\vsize | 2625 \pagegoal = \vsize |
2615 } | 2626 } |
2616 \def\balancecolumns{% | 2627 \def\balancecolumns{% |
2617 % Called on the last page of the double column material. | 2628 % Called at the end of the double column material. |
2618 \setbox0=\vbox{\unvbox255}% | 2629 \setbox0 = \vbox{\unvbox255}% |
2619 \dimen@ = \ht0 | 2630 \dimen@ = \ht0 |
2620 \advance\dimen@ by \topskip | 2631 \advance\dimen@ by \topskip |
2621 \advance\dimen@ by-\baselineskip | 2632 \advance\dimen@ by-\baselineskip |
2622 \divide\dimen@ by 2 | 2633 \divide\dimen@ by 2 |
2623 \splittopskip = \topskip | 2634 \splittopskip = \topskip |
2624 % Loop until we get a decent breakpoint. | 2635 % Loop until we get a decent breakpoint. |
2625 {\vbadness=10000 \loop \global\setbox3=\copy0 | 2636 {\vbadness=10000 \loop |
2637 \global\setbox3=\copy0 | |
2626 \global\setbox1=\vsplit3 to\dimen@ | 2638 \global\setbox1=\vsplit3 to\dimen@ |
2627 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}% | 2639 \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt |
2640 \repeat}% | |
2628 \setbox0=\vbox to\dimen@{\unvbox1}% | 2641 \setbox0=\vbox to\dimen@{\unvbox1}% |
2629 \setbox2=\vbox to\dimen@{\unvbox3}% | 2642 \setbox2=\vbox to\dimen@{\unvbox3}% |
2630 \pagesofar | 2643 \pagesofar |
2631 } | 2644 } |
2632 \catcode `\@=\other | 2645 \catcode`\@ = \other |
2633 | 2646 |
2634 | 2647 |
2635 \message{sectioning,} | 2648 \message{sectioning,} |
2636 % Define chapters, sections, etc. | 2649 % Define chapters, sections, etc. |
2637 | 2650 |
2638 \newcount \chapno | 2651 \newcount\chapno |
2639 \newcount \secno \secno=0 | 2652 \newcount\secno \secno=0 |
2640 \newcount \subsecno \subsecno=0 | 2653 \newcount\subsecno \subsecno=0 |
2641 \newcount \subsubsecno \subsubsecno=0 | 2654 \newcount\subsubsecno \subsubsecno=0 |
2642 | 2655 |
2643 % This counter is funny since it counts through charcodes of letters A, B, ... | 2656 % This counter is funny since it counts through charcodes of letters A, B, ... |
2644 \newcount \appendixno \appendixno = `\@ | 2657 \newcount\appendixno \appendixno = `\@ |
2645 \def\appendixletter{\char\the\appendixno} | 2658 \def\appendixletter{\char\the\appendixno} |
2646 | 2659 |
2647 \newwrite \contentsfile | 2660 \newwrite\contentsfile |
2648 % This is called from \setfilename. | 2661 % This is called from \setfilename. |
2649 \def\opencontents{\openout \contentsfile = \jobname.toc} | 2662 \def\opencontents{\openout\contentsfile = \jobname.toc } |
2650 | 2663 |
2651 % Each @chapter defines this as the name of the chapter. | 2664 % Each @chapter defines this as the name of the chapter. |
2652 % page headings and footings can use it. @section does likewise | 2665 % page headings and footings can use it. @section does likewise |
2653 | 2666 |
2654 \def\thischapter{} \def\thissection{} | 2667 \def\thischapter{} \def\thissection{} |
2655 \def\seccheck#1{\if \pageno<0 % | 2668 \def\seccheck#1{\ifnum \pageno<0 |
2656 \errmessage{@#1 not allowed after generating table of contents}\fi | 2669 \errmessage{@#1 not allowed after generating table of contents}% |
2657 % | 2670 \fi} |
2658 } | |
2659 | 2671 |
2660 \def\chapternofonts{% | 2672 \def\chapternofonts{% |
2661 \let\rawbackslash=\relax% | 2673 \let\rawbackslash=\relax% |
2662 \let\frenchspacing=\relax% | 2674 \let\frenchspacing=\relax% |
2663 \def\result{\realbackslash result} | 2675 \def\result{\realbackslash result}% |
2664 \def\equiv{\realbackslash equiv} | 2676 \def\equiv{\realbackslash equiv}% |
2665 \def\expansion{\realbackslash expansion} | 2677 \def\expansion{\realbackslash expansion}% |
2666 \def\print{\realbackslash print} | 2678 \def\print{\realbackslash print}% |
2667 \def\TeX{\realbackslash TeX} | 2679 \def\TeX{\realbackslash TeX}% |
2668 \def\dots{\realbackslash dots} | 2680 \def\dots{\realbackslash dots}% |
2669 \def\copyright{\realbackslash copyright} | 2681 \def\copyright{\realbackslash copyright}% |
2670 \def\tt{\realbackslash tt} | 2682 \def\tt{\realbackslash tt}% |
2671 \def\bf{\realbackslash bf } | 2683 \def\bf{\realbackslash bf}% |
2672 \def\w{\realbackslash w} | 2684 \def\w{\realbackslash w}% |
2673 \def\less{\realbackslash less} | 2685 \def\less{\realbackslash less}% |
2674 \def\gtr{\realbackslash gtr} | 2686 \def\gtr{\realbackslash gtr}% |
2675 \def\hat{\realbackslash hat} | 2687 \def\hat{\realbackslash hat}% |
2676 \def\char{\realbackslash char} | 2688 \def\char{\realbackslash char}% |
2677 \def\tclose##1{\realbackslash tclose {##1}} | 2689 \def\tclose##1{\realbackslash tclose{##1}}% |
2678 \def\code##1{\realbackslash code {##1}} | 2690 \def\code##1{\realbackslash code{##1}}% |
2679 \def\samp##1{\realbackslash samp {##1}} | 2691 \def\samp##1{\realbackslash samp{##1}}% |
2680 \def\r##1{\realbackslash r {##1}} | 2692 \def\r##1{\realbackslash r{##1}}% |
2681 \def\b##1{\realbackslash b {##1}} | 2693 \def\b##1{\realbackslash b{##1}}% |
2682 \def\key##1{\realbackslash key {##1}} | 2694 \def\key##1{\realbackslash key{##1}}% |
2683 \def\file##1{\realbackslash file {##1}} | 2695 \def\file##1{\realbackslash file{##1}}% |
2684 \def\kbd##1{\realbackslash kbd {##1}} | 2696 \def\kbd##1{\realbackslash kbd{##1}}% |
2685 % These are redefined because @smartitalic wouldn't work inside xdef. | 2697 % These are redefined because @smartitalic wouldn't work inside xdef. |
2686 \def\i##1{\realbackslash i {##1}} | 2698 \def\i##1{\realbackslash i{##1}}% |
2687 \def\cite##1{\realbackslash cite {##1}} | 2699 \def\cite##1{\realbackslash cite{##1}}% |
2688 \def\var##1{\realbackslash var {##1}} | 2700 \def\var##1{\realbackslash var{##1}}% |
2689 \def\emph##1{\realbackslash emph {##1}} | 2701 \def\emph##1{\realbackslash emph{##1}}% |
2690 \def\dfn##1{\realbackslash dfn {##1}} | 2702 \def\dfn##1{\realbackslash dfn{##1}}% |
2691 } | 2703 } |
2692 | 2704 |
2693 \newcount\absseclevel % used to calculate proper heading level | 2705 \newcount\absseclevel % used to calculate proper heading level |
2694 \newcount\secbase\secbase=0 % @raise/lowersections modify this count | 2706 \newcount\secbase\secbase=0 % @raise/lowersections modify this count |
2695 | 2707 |
2772 \gdef\thischaptername{#1}% | 2784 \gdef\thischaptername{#1}% |
2773 % We don't substitute the actual chapter name into \thischapter | 2785 % We don't substitute the actual chapter name into \thischapter |
2774 % because we don't want its macros evaluated now. | 2786 % because we don't want its macros evaluated now. |
2775 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% | 2787 \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% |
2776 {\chapternofonts% | 2788 {\chapternofonts% |
2777 \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}% | 2789 \toks0 = {#1}% |
2790 \edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}% | |
2778 \escapechar=`\\% | 2791 \escapechar=`\\% |
2779 \write \contentsfile \temp % | 2792 \write \contentsfile \temp % |
2780 \donoderef % | 2793 \donoderef % |
2781 \global\let\section = \numberedsec | 2794 \global\let\section = \numberedsec |
2782 \global\let\subsection = \numberedsubsec | 2795 \global\let\subsection = \numberedsubsec |
2791 \chapmacro {#1}{\putwordAppendix{} \appendixletter}% | 2804 \chapmacro {#1}{\putwordAppendix{} \appendixletter}% |
2792 \gdef\thissection{#1}% | 2805 \gdef\thissection{#1}% |
2793 \gdef\thischaptername{#1}% | 2806 \gdef\thischaptername{#1}% |
2794 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% | 2807 \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% |
2795 {\chapternofonts% | 2808 {\chapternofonts% |
2796 \edef\temp{{\realbackslash chapentry | 2809 \toks0 = {#1}% |
2797 {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}% | 2810 \edef\temp{{\realbackslash chapentry{\the\toks0}% |
2811 {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}% | |
2798 \escapechar=`\\% | 2812 \escapechar=`\\% |
2799 \write \contentsfile \temp % | 2813 \write \contentsfile \temp % |
2800 \appendixnoderef % | 2814 \appendixnoderef % |
2801 \global\let\section = \appendixsec | 2815 \global\let\section = \appendixsec |
2802 \global\let\subsection = \appendixsubsec | 2816 \global\let\subsection = \appendixsubsec |
2826 \toks0 = {#1}\message{(\the\toks0)}% | 2840 \toks0 = {#1}\message{(\the\toks0)}% |
2827 % | 2841 % |
2828 \unnumbchapmacro {#1}% | 2842 \unnumbchapmacro {#1}% |
2829 \gdef\thischapter{#1}\gdef\thissection{#1}% | 2843 \gdef\thischapter{#1}\gdef\thissection{#1}% |
2830 {\chapternofonts% | 2844 {\chapternofonts% |
2831 \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}% | 2845 \toks0 = {#1}% |
2846 \edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}% | |
2832 \escapechar=`\\% | 2847 \escapechar=`\\% |
2833 \write \contentsfile \temp % | 2848 \write \contentsfile \temp % |
2834 \unnumbnoderef % | 2849 \unnumbnoderef % |
2835 \global\let\section = \unnumberedsec | 2850 \global\let\section = \unnumberedsec |
2836 \global\let\subsection = \unnumberedsubsec | 2851 \global\let\subsection = \unnumberedsubsec |
2841 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz | 2856 \def\secyyy #1{\numhead1{#1}} % normally calls seczzz |
2842 \def\seczzz #1{\seccheck{section}% | 2857 \def\seczzz #1{\seccheck{section}% |
2843 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % | 2858 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % |
2844 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% | 2859 \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% |
2845 {\chapternofonts% | 2860 {\chapternofonts% |
2861 \toks0 = {#1}% | |
2846 \edef\temp{{\realbackslash secentry % | 2862 \edef\temp{{\realbackslash secentry % |
2847 {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}% | 2863 {\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}% |
2848 \escapechar=`\\% | 2864 \escapechar=`\\% |
2849 \write \contentsfile \temp % | 2865 \write \contentsfile \temp % |
2850 \donoderef % | 2866 \donoderef % |
2851 \penalty 10000 % | 2867 \penalty 10000 % |
2852 }} | 2868 }} |
2856 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz | 2872 \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz |
2857 \def\appendixsectionzzz #1{\seccheck{appendixsection}% | 2873 \def\appendixsectionzzz #1{\seccheck{appendixsection}% |
2858 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % | 2874 \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % |
2859 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% | 2875 \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% |
2860 {\chapternofonts% | 2876 {\chapternofonts% |
2877 \toks0 = {#1}% | |
2861 \edef\temp{{\realbackslash secentry % | 2878 \edef\temp{{\realbackslash secentry % |
2862 {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}% | 2879 {\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}% |
2863 \escapechar=`\\% | 2880 \escapechar=`\\% |
2864 \write \contentsfile \temp % | 2881 \write \contentsfile \temp % |
2865 \appendixnoderef % | 2882 \appendixnoderef % |
2866 \penalty 10000 % | 2883 \penalty 10000 % |
2867 }} | 2884 }} |
2869 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} | 2886 \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} |
2870 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz | 2887 \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz |
2871 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}% | 2888 \def\unnumberedseczzz #1{\seccheck{unnumberedsec}% |
2872 \plainsecheading {#1}\gdef\thissection{#1}% | 2889 \plainsecheading {#1}\gdef\thissection{#1}% |
2873 {\chapternofonts% | 2890 {\chapternofonts% |
2874 \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}% | 2891 \toks0 = {#1}% |
2892 \edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}% | |
2875 \escapechar=`\\% | 2893 \escapechar=`\\% |
2876 \write \contentsfile \temp % | 2894 \write \contentsfile \temp % |
2877 \unnumbnoderef % | 2895 \unnumbnoderef % |
2878 \penalty 10000 % | 2896 \penalty 10000 % |
2879 }} | 2897 }} |
2882 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz | 2900 \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz |
2883 \def\numberedsubseczzz #1{\seccheck{subsection}% | 2901 \def\numberedsubseczzz #1{\seccheck{subsection}% |
2884 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % | 2902 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % |
2885 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% | 2903 \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% |
2886 {\chapternofonts% | 2904 {\chapternofonts% |
2905 \toks0 = {#1}% | |
2887 \edef\temp{{\realbackslash subsecentry % | 2906 \edef\temp{{\realbackslash subsecentry % |
2888 {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% | 2907 {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% |
2889 \escapechar=`\\% | 2908 \escapechar=`\\% |
2890 \write \contentsfile \temp % | 2909 \write \contentsfile \temp % |
2891 \donoderef % | 2910 \donoderef % |
2892 \penalty 10000 % | 2911 \penalty 10000 % |
2893 }} | 2912 }} |
2896 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz | 2915 \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz |
2897 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}% | 2916 \def\appendixsubseczzz #1{\seccheck{appendixsubsec}% |
2898 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % | 2917 \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % |
2899 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% | 2918 \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% |
2900 {\chapternofonts% | 2919 {\chapternofonts% |
2920 \toks0 = {#1}% | |
2901 \edef\temp{{\realbackslash subsecentry % | 2921 \edef\temp{{\realbackslash subsecentry % |
2902 {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% | 2922 {\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}% |
2903 \escapechar=`\\% | 2923 \escapechar=`\\% |
2904 \write \contentsfile \temp % | 2924 \write \contentsfile \temp % |
2905 \appendixnoderef % | 2925 \appendixnoderef % |
2906 \penalty 10000 % | 2926 \penalty 10000 % |
2907 }} | 2927 }} |
2909 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} | 2929 \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} |
2910 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz | 2930 \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz |
2911 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}% | 2931 \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}% |
2912 \plainsubsecheading {#1}\gdef\thissection{#1}% | 2932 \plainsubsecheading {#1}\gdef\thissection{#1}% |
2913 {\chapternofonts% | 2933 {\chapternofonts% |
2914 \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}% | 2934 \toks0 = {#1}% |
2935 \edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}% | |
2915 \escapechar=`\\% | 2936 \escapechar=`\\% |
2916 \write \contentsfile \temp % | 2937 \write \contentsfile \temp % |
2917 \unnumbnoderef % | 2938 \unnumbnoderef % |
2918 \penalty 10000 % | 2939 \penalty 10000 % |
2919 }} | 2940 }} |
2923 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}% | 2944 \def\numberedsubsubseczzz #1{\seccheck{subsubsection}% |
2924 \gdef\thissection{#1}\global\advance \subsubsecno by 1 % | 2945 \gdef\thissection{#1}\global\advance \subsubsecno by 1 % |
2925 \subsubsecheading {#1} | 2946 \subsubsecheading {#1} |
2926 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% | 2947 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% |
2927 {\chapternofonts% | 2948 {\chapternofonts% |
2928 \edef\temp{{\realbackslash subsubsecentry % | 2949 \toks0 = {#1}% |
2929 {#1} | 2950 \edef\temp{{\realbackslash subsubsecentry{\the\toks0} |
2930 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno} | 2951 {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno} |
2931 {\noexpand\folio}}}% | 2952 {\noexpand\folio}}}% |
2932 \escapechar=`\\% | 2953 \escapechar=`\\% |
2933 \write \contentsfile \temp % | 2954 \write \contentsfile \temp % |
2934 \donoderef % | 2955 \donoderef % |
2940 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}% | 2961 \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}% |
2941 \gdef\thissection{#1}\global\advance \subsubsecno by 1 % | 2962 \gdef\thissection{#1}\global\advance \subsubsecno by 1 % |
2942 \subsubsecheading {#1} | 2963 \subsubsecheading {#1} |
2943 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% | 2964 {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% |
2944 {\chapternofonts% | 2965 {\chapternofonts% |
2945 \edef\temp{{\realbackslash subsubsecentry{#1}% | 2966 \toks0 = {#1}% |
2967 \edef\temp{{\realbackslash subsubsecentry{\the\toks0}% | |
2946 {\appendixletter} | 2968 {\appendixletter} |
2947 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}% | 2969 {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}% |
2948 \escapechar=`\\% | 2970 \escapechar=`\\% |
2949 \write \contentsfile \temp % | 2971 \write \contentsfile \temp % |
2950 \appendixnoderef % | 2972 \appendixnoderef % |
2954 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} | 2976 \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} |
2955 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz | 2977 \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz |
2956 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}% | 2978 \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}% |
2957 \plainsubsubsecheading {#1}\gdef\thissection{#1}% | 2979 \plainsubsubsecheading {#1}\gdef\thissection{#1}% |
2958 {\chapternofonts% | 2980 {\chapternofonts% |
2959 \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}% | 2981 \toks0 = {#1}% |
2982 \edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}% | |
2960 \escapechar=`\\% | 2983 \escapechar=`\\% |
2961 \write \contentsfile \temp % | 2984 \write \contentsfile \temp % |
2962 \unnumbnoderef % | 2985 \unnumbnoderef % |
2963 \penalty 10000 % | 2986 \penalty 10000 % |
2964 }} | 2987 }} |
3392 \let\{=\ptexlbrace | 3415 \let\{=\ptexlbrace |
3393 \let\}=\ptexrbrace | 3416 \let\}=\ptexrbrace |
3394 \let\.=\ptexdot | 3417 \let\.=\ptexdot |
3395 \let\*=\ptexstar | 3418 \let\*=\ptexstar |
3396 \let\dots=\ptexdots | 3419 \let\dots=\ptexdots |
3397 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}} | 3420 \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% |
3398 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi} | 3421 \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% |
3399 \def\@{@}% | 3422 \def\@{@}% |
3400 \let\bullet=\ptexbullet | 3423 \let\bullet=\ptexbullet |
3401 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext | 3424 \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext |
3402 % | 3425 % |
3403 \let\Etex=\endgroup} | 3426 \let\Etex=\endgroup} |