1 | %% BEGIN fancybox.sty |
---|
2 | %% |
---|
3 | %% With corrections and suggestions from: |
---|
4 | %% - Marcin Wolinski <wolinski@melkor.mimuw.edu.pl> |
---|
5 | %% - Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de> |
---|
6 | %% |
---|
7 | \def\fileversion{1.3} |
---|
8 | \def\filedate{2000/09/19} |
---|
9 | % DG/SR modification begin - September 19, 2000 |
---|
10 | % (suggested by Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de>) |
---|
11 | \@ifundefined{ProvidesPackage}{}{% |
---|
12 | \ProvidesPackage{fancybox}[\filedate\space\fileversion]} |
---|
13 | % DG/SR modification end |
---|
14 | % DG/SR modification begin - May 16, 1997 |
---|
15 | \providecommand\@begindvi{} % For rather old versions of LaTeX 2e |
---|
16 | % DG/SR modification end |
---|
17 | % DG/SR modification begin - Feb. 27, 1997 |
---|
18 | % Now defined only in latex209.def |
---|
19 | \def\@lquote{\leavevmode{\kern\z@}`} |
---|
20 | % DG/SR modification end |
---|
21 | %% |
---|
22 | %% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU |
---|
23 | %% |
---|
24 | %% DESCRIPTION: |
---|
25 | %% fancybox.sty is a LaTeX style option, consisting of: |
---|
26 | %% * Variants of \fbox: \shadowbox, \doublebox, \ovalbox, \Ovalbox. |
---|
27 | %% * Helpful tools for using box macros. |
---|
28 | %% * Extensive documentation about how to use box macros. |
---|
29 | %% * Flexible verbatim macros. |
---|
30 | %% |
---|
31 | %% INSTALLATION: |
---|
32 | %% Put this file where your TeX looks for inputs. |
---|
33 | %% |
---|
34 | %% DOCUMENTATION: |
---|
35 | %% See fancybox.doc, which might be appended to this file. |
---|
36 | %% |
---|
37 | %% COPYING: |
---|
38 | %% The files of this package "fancybox" are released under the Artistic |
---|
39 | %% License. A copy of that license is included in the file atristic.txt. |
---|
40 | %% The package consists of the following files: |
---|
41 | %% fancybox.doc |
---|
42 | %% fancybox.sty |
---|
43 | %% |
---|
44 | %% CODE: |
---|
45 | \expandafter\ifx\csname fb@framepage\endcsname\relax\else |
---|
46 | \expandafter\endinput |
---|
47 | \fi |
---|
48 | \typeout{Style option: `fancybox' v\fileversion \space <\filedate> (tvz)} |
---|
49 | |
---|
50 | \newbox\@fancybox |
---|
51 | \@ifundefined{@tempdimc}{\newdimen\@tempdimc}{} |
---|
52 | |
---|
53 | %% \shadowbox |
---|
54 | |
---|
55 | \newdimen\shadowsize |
---|
56 | \shadowsize 4pt |
---|
57 | |
---|
58 | \def\shadowbox{\VerbBox\@shadowbox} |
---|
59 | \def\@shadowbox#1{% |
---|
60 | \setbox\@fancybox\hbox{\fbox{#1}}% |
---|
61 | \leavevmode\vbox{% |
---|
62 | \offinterlineskip |
---|
63 | \dimen@=\shadowsize |
---|
64 | \advance\dimen@ .5\fboxrule |
---|
65 | \hbox{\copy\@fancybox\kern-.5\fboxrule\lower\shadowsize\hbox{% |
---|
66 | \vrule \@height\ht\@fancybox \@depth\dp\@fancybox \@width\dimen@}}% |
---|
67 | \vskip-\dimen@ |
---|
68 | \moveright\shadowsize\vbox{% |
---|
69 | \hrule \@width\wd\@fancybox \@height\dimen@}}} |
---|
70 | |
---|
71 | % \fancyoval |
---|
72 | |
---|
73 | \def\cornersize{\@ifstar{\@cornersize}{\@@cornersize}} |
---|
74 | \def\@cornersize#1{% |
---|
75 | \@tempdima=#1\relax |
---|
76 | \edef\the@cornersize{\number\@tempdima sp}} |
---|
77 | \def\@@cornersize#1{% |
---|
78 | \edef\the@cornersize{#1\noexpand\@tempdimb}} |
---|
79 | \cornersize{.5} |
---|
80 | |
---|
81 | % This is just a simple change to \oval, making use of the \cornersize |
---|
82 | % parameter instead of making the corner arcs are large as possible. |
---|
83 | |
---|
84 | \def\fancyoval(#1,#2){\@ifnextchar[{\fancy@oval(#1,#2)}{\fancy@oval(#1,#2)[]}} |
---|
85 | |
---|
86 | \def\fancy@oval(#1,#2)[#3]{% |
---|
87 | \begingroup |
---|
88 | \fancy@@oval{#1\unitlength}{#2\unitlength}{#3}% |
---|
89 | \@put{-.5\wd\@tempboxa}{-.5\ht\@tempboxa}{\ht\@tempboxa=\z@\box\@tempboxa}% |
---|
90 | \endgroup} |
---|
91 | |
---|
92 | \def\fancy@@oval#1#2#3{% |
---|
93 | \boxmaxdepth \maxdimen |
---|
94 | \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue |
---|
95 | \@tfor\@tempa :=#3\do{\csname @ov\@tempa false\endcsname}% |
---|
96 | \@ovxx#1\relax |
---|
97 | \advance\@ovxx-\@wholewidth |
---|
98 | \@ovyy#2\relax |
---|
99 | \advance\@ovyy-\@wholewidth |
---|
100 | \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi |
---|
101 | \advance\@tempdimb-2\p@ |
---|
102 | \ifdim\@tempdimb>\the@cornersize\relax |
---|
103 | \@tempdimb=\the@cornersize |
---|
104 | \fi |
---|
105 | \@getcirc\@tempdimb |
---|
106 | \@ovro\ht\@tempboxa \@ovri\dp\@tempboxa |
---|
107 | \@ovdx\@ovxx \advance\@ovdx-\@tempdima \divide\@ovdx \tw@ |
---|
108 | \@ovdy\@ovyy \advance\@ovdy-\@tempdima \divide\@ovdy \tw@ |
---|
109 | \@circlefnt |
---|
110 | \setbox\@tempboxa\hbox{% |
---|
111 | \if@ovr \@ovvert32\kern -\@tempdima \fi |
---|
112 | \if@ovl \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx \fi |
---|
113 | \if@ovt \@ovhorz \kern -\@ovxx \fi |
---|
114 | \if@ovb \raise \@ovyy \@ovhorz \fi}% |
---|
115 | \advance\@ovdx\@ovro |
---|
116 | \advance\@ovdy\@ovro |
---|
117 | \advance\@ovxx\@wholewidth |
---|
118 | \wd\@tempboxa=\@ovxx |
---|
119 | \dp\@tempboxa=\z@} |
---|
120 | |
---|
121 | % \ovalbox |
---|
122 | |
---|
123 | \def\ovalbox{\VerbBox{\@ovalbox\thinlines}} |
---|
124 | \def\Ovalbox{\VerbBox{\@ovalbox\thicklines}} |
---|
125 | \def\@ovalbox#1#2{% |
---|
126 | \begingroup |
---|
127 | #1\relax |
---|
128 | \setbox\@fancybox\hbox{{#2}}% |
---|
129 | \@tempdimc\fboxsep \advance\@tempdimc\@wholewidth |
---|
130 | \@tempdima\ht\@fancybox \advance\@tempdima\dp\@fancybox |
---|
131 | \advance\@tempdima2\@tempdimc |
---|
132 | \@tempdimb\wd\@fancybox \advance\@tempdimb2\@tempdimc |
---|
133 | \fancy@@oval\@tempdimb\@tempdima{}% |
---|
134 | \@tempdima\dp\@fancybox \advance\@tempdima\@tempdimc |
---|
135 | \wd\@tempboxa=\z@ |
---|
136 | \leavevmode\hbox{% |
---|
137 | \lower\@tempdima\box\@tempboxa |
---|
138 | \kern\@tempdimc\box\@fancybox\kern\@tempdimc}% |
---|
139 | \endgroup} |
---|
140 | |
---|
141 | % \doublebox |
---|
142 | |
---|
143 | \def\doublebox{\VerbBox\@doublebox} |
---|
144 | \def\@doublebox#1{% |
---|
145 | \begingroup |
---|
146 | \setbox\@fancybox\hbox{{#1}}% |
---|
147 | \fboxrule=.75\fboxrule |
---|
148 | \setbox\@fancybox\hbox{\fbox{\box\@fancybox}}% |
---|
149 | \fboxrule=2\fboxrule |
---|
150 | \fboxsep=\fboxrule |
---|
151 | \advance\fboxsep .5pt |
---|
152 | \fbox{\box\@fancybox}% |
---|
153 | \endgroup} |
---|
154 | |
---|
155 | % Frames for seminar.sty: |
---|
156 | |
---|
157 | \@ifundefined{newslideframe}{}{% |
---|
158 | \newslideframe{shadow}{\shadowbox{#1}} |
---|
159 | \newslideframe{double}{\doublebox{#1}} |
---|
160 | \newslideframe{oval}{\ovalbox{#1}} |
---|
161 | \newslideframe{Oval}{\Ovalbox{#1}}} |
---|
162 | |
---|
163 | % Sbox environment |
---|
164 | |
---|
165 | \newbox\@Sbox |
---|
166 | |
---|
167 | \def\Sbox{\global\setbox\@Sbox\hbox\bgroup\ignorespaces} |
---|
168 | |
---|
169 | \def\endSbox{% |
---|
170 | \@testtrue\ifhmode\ifinner\@testfalse\fi\fi |
---|
171 | \if@test\@latexerr{Misplaced \string\endSbox! Should be in LR mode}\@ehd\fi |
---|
172 | \egroup} |
---|
173 | |
---|
174 | \def\TheSbox{% |
---|
175 | \ifvoid\@Sbox |
---|
176 | \@latexerr{\string\TheSbox\space is empty!}\@ehd |
---|
177 | \else |
---|
178 | \box\@Sbox |
---|
179 | \fi} |
---|
180 | |
---|
181 | \def\beginsbox#1{\setbox#1\hbox\bgroup\ignorespaces} |
---|
182 | |
---|
183 | \def\endsbox{\endSbox} |
---|
184 | |
---|
185 | % \VerbBox |
---|
186 | |
---|
187 | \newtoks\do@VerbBox |
---|
188 | |
---|
189 | \def\VerbBox#1{% |
---|
190 | \do@VerbBox{#1}% |
---|
191 | \afterassignment\begin@VerbBox |
---|
192 | \setbox\@fancybox=\hbox} |
---|
193 | \def\begin@VerbBox{\aftergroup\end@VerbBox} |
---|
194 | \def\end@VerbBox{\the\do@VerbBox{\box\@fancybox}}% |
---|
195 | |
---|
196 | % \Btrivlist |
---|
197 | |
---|
198 | \def\@Blistrestore{% |
---|
199 | \let\par\relax |
---|
200 | \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii |
---|
201 | \lineskip\normallineskip \baselineskip\normalbaselineskip} |
---|
202 | |
---|
203 | \def\Btrivlist#1{\@ifnextchar[{\@Btrivlist{#1}}{\@Btrivlist{#1}[]}} |
---|
204 | \def\@Btrivlist#1[#2]{% |
---|
205 | \@Blistrestore |
---|
206 | \let\\=\@Btrivlistcr |
---|
207 | \fb@beginvbox{#2}% |
---|
208 | \halign\bgroup |
---|
209 | \if#1l\else\@empty\hfil\fi |
---|
210 | \ignorespaces##\unskip |
---|
211 | \if#1r\@empty\else\hfil\fi\cr} |
---|
212 | \def\endBtrivlist{\crcr\egroup\egroup\if@pboxsw$\fi} |
---|
213 | |
---|
214 | \def\fb@beginvbox#1{% |
---|
215 | \leavevmode |
---|
216 | \@pboxswfalse |
---|
217 | \if#1b\@empty\vbox\else\if#1t\@empty\vtop\else |
---|
218 | \ifmmode\vcenter\else\@pboxswtrue$\vcenter\fi |
---|
219 | \fi\fi\bgroup} |
---|
220 | |
---|
221 | \def\@Btrivlistcr{\@ifstar |
---|
222 | {\@ifnextchar[{@@Btrivlistcr}{\cr}}{\@ifnextchar[{\@@Btrivlistcr}{\cr}}} |
---|
223 | \def\@@Btrivlistcr[#1]{\cr\noalign{\vskip #1}} |
---|
224 | |
---|
225 | \def\Bcenter{\Btrivlist{c}} |
---|
226 | \def\endBcenter{\endBtrivlist} |
---|
227 | |
---|
228 | \def\Bflushleft{\Btrivlist{l}} |
---|
229 | \def\endBflushleft{\endBtrivlist} |
---|
230 | |
---|
231 | \def\Bflushright{\Btrivlist{r}} |
---|
232 | \def\endBflushright{\endBtrivlist} |
---|
233 | |
---|
234 | % \Blist |
---|
235 | |
---|
236 | \def\Blist#1#2{\@ifnextchar[{\@Blist{#1}{#2}}{\@Blist{#1}{#2}[]}} |
---|
237 | |
---|
238 | \def\@Blist#1#2[#3]{% |
---|
239 | \ifnum\@listdepth>5 |
---|
240 | \@toodeep |
---|
241 | \else |
---|
242 | \global\advance\@listdepth\@ne |
---|
243 | \fi |
---|
244 | \itemindent\z@ |
---|
245 | \csname @list\romannumeral\the\@listdepth\endcsname |
---|
246 | \def\@itemlabel{#1}% |
---|
247 | \let\makelabel\@mklab |
---|
248 | \@nmbrlistfalse |
---|
249 | \@Blistrestore |
---|
250 | \let\\=\@Blistcr |
---|
251 | \let\item\Bitem |
---|
252 | \@Bitemswfalse |
---|
253 | #2\relax |
---|
254 | \fb@beginvbox{#3}% |
---|
255 | \halign\bgroup |
---|
256 | \ignorespaces##&\hskip\labelsep\ignorespaces##\unskip\hfil\cr} |
---|
257 | |
---|
258 | \def\endBlist{\endBtrivlist\global\advance\@listdepth\m@ne} |
---|
259 | |
---|
260 | \newif\if@Bitemsw |
---|
261 | |
---|
262 | \def\Bitem{\@ifnextchar({\@Bitemcr\Bitem@skip}{\@Bitemcr\@Bitem}} |
---|
263 | |
---|
264 | \def\@Bitemcr{% |
---|
265 | \if@Bitemsw |
---|
266 | \def\next{\cr\noalign{\vskip\itemsep}}% |
---|
267 | \else |
---|
268 | \def\next{\global\@Bitemswtrue}% |
---|
269 | \fi |
---|
270 | \next} |
---|
271 | |
---|
272 | \def\Bitem@skip(#1){\noalign{\vskip #1}\@Bitem} |
---|
273 | |
---|
274 | \def\@Bitem{\@ifnextchar[{\Bitem@label}{\Bitem@nolabel}} |
---|
275 | |
---|
276 | \def\Bitem@label[#1]{\makelabel{#1}&} |
---|
277 | |
---|
278 | \def\Bitem@nolabel{% |
---|
279 | \if@nmbrlist |
---|
280 | \expandafter\advance\csname c@\@listctr\endcsname1 \fi |
---|
281 | \makelabel{\@itemlabel}% |
---|
282 | &% |
---|
283 | \if@nmbrlist\refstepcounter{\@listctr}\fi} |
---|
284 | |
---|
285 | \def\@Blistcr{\@ifstar |
---|
286 | {\@ifnextchar[{@@Blistcr}{\cr&}}{\@ifnextchar[{\@@Blistcr}{\cr&}}} |
---|
287 | |
---|
288 | \def\@@Blistcr[#1]{\cr\noalign{\vskip #1}&} |
---|
289 | |
---|
290 | % \Bitemize |
---|
291 | |
---|
292 | \def\Bitemize{% |
---|
293 | \ifnum\@itemdepth>3 |
---|
294 | \@toodeep |
---|
295 | \else |
---|
296 | \advance\@itemdepth\@ne |
---|
297 | \fi |
---|
298 | \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% |
---|
299 | \Blist{\csname\@itemitem\endcsname}{\def\makelabel####1{\hfil####1}}} |
---|
300 | \def\endBitemize{\endBlist} |
---|
301 | |
---|
302 | % \Bdescription |
---|
303 | |
---|
304 | \def\Bdescription{\Blist{}{\def\makelabel####1{\bf####1\hfil}}} |
---|
305 | \def\endBdescription{\endBlist} |
---|
306 | |
---|
307 | % \Benumerate |
---|
308 | |
---|
309 | \def\Benumerate{% |
---|
310 | \ifnum\@enumdepth>3 |
---|
311 | \@toodeep |
---|
312 | \else |
---|
313 | \advance\@enumdepth\@ne |
---|
314 | \fi |
---|
315 | \edef\@enumctr{enum\romannumeral\the\@enumdepth}% |
---|
316 | \Blist{\csname label\@enumctr\endcsname}% |
---|
317 | {\usecounter{\@enumctr}\def\makelabel####1{\hfil####1}}} |
---|
318 | \def\endBenumerate{\endBlist} |
---|
319 | |
---|
320 | % Beqnarray |
---|
321 | |
---|
322 | \def\Beqnarray{% |
---|
323 | \stepcounter{equation}% |
---|
324 | \let\@currentlabel\theequation |
---|
325 | \def\@eqnnum{{\csname reset@font\endcsname\rm (\theequation)}}% |
---|
326 | \global\@eqnswtrue\m@th |
---|
327 | \global\@eqcnt\z@ |
---|
328 | \tabskip\@centering |
---|
329 | \let\\\@eqncr |
---|
330 | \vbox\bgroup |
---|
331 | \halign\bgroup |
---|
332 | \@eqnsel |
---|
333 | \hskip\@centering |
---|
334 | $\displaystyle\tabskip\z@{##}$% |
---|
335 | &\global\@eqcnt\@ne |
---|
336 | \hskip 2\arraycolsep |
---|
337 | \hfil${##}$\hfil |
---|
338 | &\global\@eqcnt\tw@ |
---|
339 | \hskip 2\arraycolsep |
---|
340 | $\displaystyle\tabskip\z@{##}$% |
---|
341 | \hfil |
---|
342 | \tabskip\@centering |
---|
343 | &\if@eqnsw\hskip 1em\fi |
---|
344 | \hfil{##}\tabskip\z@ |
---|
345 | \cr} |
---|
346 | |
---|
347 | \def\endBeqnarray{% |
---|
348 | \@@eqncr |
---|
349 | \egroup |
---|
350 | \global\advance\c@equation\m@ne |
---|
351 | \egroup |
---|
352 | \global\@ignoretrue} |
---|
353 | |
---|
354 | \@namedef{Beqnarray*}{\def\@eqncr{\nonumber\@seqncr}\Beqnarray} |
---|
355 | \@namedef{endBeqnarray*}{\nonumber\endBeqnarray} |
---|
356 | |
---|
357 | % \fb@outputage |
---|
358 | |
---|
359 | % Here we insert various hooks for rotating or framing the page. |
---|
360 | % Otherwise, it is the usual \@outputpage |
---|
361 | |
---|
362 | \def\fb@outputpage{% |
---|
363 | \begingroup |
---|
364 | \catcode`\ =10 |
---|
365 | \let\-\@dischyph |
---|
366 | \let\'\@acci |
---|
367 | \let\`\@accii |
---|
368 | \let\=\@acciii |
---|
369 | \if@specialpage |
---|
370 | \global\@specialpagefalse\@nameuse{ps@\@specialstyle}% |
---|
371 | \fi |
---|
372 | \if@twoside |
---|
373 | \ifodd\count\z@ |
---|
374 | \let\@thehead\@oddhead |
---|
375 | \let\@thefoot\@oddfoot |
---|
376 | \let\@themargin\oddsidemargin |
---|
377 | \else |
---|
378 | \let\@thehead\@evenhead |
---|
379 | \let\@thefoot\@evenfoot |
---|
380 | \let\@themargin\evensidemargin |
---|
381 | \fi |
---|
382 | \fi |
---|
383 | \csname reset@font\endcsname |
---|
384 | \normalsize |
---|
385 | \baselineskip\z@ |
---|
386 | \lineskip\z@ |
---|
387 | \let\par\@@par |
---|
388 | \ifx\this@fancypage\@empty\else |
---|
389 | \this@fancypage |
---|
390 | \gdef\this@fancypage{}% |
---|
391 | \fi |
---|
392 | \ifx\the@fancypage\@empty\else |
---|
393 | \setbox\@outputbox\hbox{\the@fancypage{\box\@outputbox}}% |
---|
394 | \fi |
---|
395 | \ifx\fb@@rotatepage\@empty\else |
---|
396 | \setbox\@outputbox\hbox{\fb@@rotatepage{\box\@outputbox}}% |
---|
397 | \fi |
---|
398 | \setbox\@outputbox\vbox{% |
---|
399 | \@tempdima=\wd\@outputbox |
---|
400 | \setbox\@tempboxa=\hbox to\@tempdima{% |
---|
401 | \let\label\@gobble |
---|
402 | \let\index\@gobble |
---|
403 | \let\glossary\@gobble |
---|
404 | \@thehead}% |
---|
405 | \ht\@tempboxa\headheight |
---|
406 | \dp\@tempboxa\z@ |
---|
407 | \box\@tempboxa |
---|
408 | \vskip\headsep |
---|
409 | \box\@outputbox |
---|
410 | \baselineskip\footskip |
---|
411 | \hbox to\@tempdima{% |
---|
412 | \let\label\@gobble |
---|
413 | \let\index\@gobble |
---|
414 | \let\glossary\@gobble |
---|
415 | \@thefoot}} |
---|
416 | \ifx\the@@fancypage\@empty\else |
---|
417 | \setbox\@outputbox\hbox{\the@@fancypage{\box\@outputbox}}% |
---|
418 | \fi |
---|
419 | \setbox\@outputbox\vbox{% |
---|
420 | \ifnum\fancyput@flag>-1 \do@fancyput\fi |
---|
421 | \vskip\topmargin |
---|
422 | \moveright\@themargin\box\@outputbox}% |
---|
423 | \ifx\fb@rotatepage\@empty\else |
---|
424 | \setbox\@outputbox\hbox{\lower\ht\@outputbox\box\@outputbox}% |
---|
425 | \dp\@outputbox\z@ |
---|
426 | \wd\@outputbox\z@ |
---|
427 | \setbox\@outputbox\hbox{\fb@rotatepage{\box\@outputbox}}% |
---|
428 | \expandafter\fb@setoffsets\fb@theoffsets |
---|
429 | \fi |
---|
430 | % DG/SR modification begin - September 19, 2000 |
---|
431 | % (suggested by Marcin Wolinski <wolinski@melkor.mimuw.edu.pl> and |
---|
432 | % Heiko Oberdiek <oberdiek@ruf.uni-freiburg.de>) |
---|
433 | \let\protect\noexpand |
---|
434 | % DG/SR modification end |
---|
435 | \shipout\box\@outputbox |
---|
436 | \global\@colht\textheight |
---|
437 | \endgroup |
---|
438 | \stepcounter{page}% |
---|
439 | \let\firstmark\botmark} |
---|
440 | |
---|
441 | % \fancypage |
---|
442 | |
---|
443 | \def\the@fancypage{} |
---|
444 | \def\the@@fancypage{} |
---|
445 | \def\this@fancypage{} |
---|
446 | |
---|
447 | \def\fancypage#1#2{% |
---|
448 | % DG/SR modification begin - May 16, 1997 |
---|
449 | \@begindvi % Need today by LaTeX 2e |
---|
450 | % DG/SR modification end |
---|
451 | \def\the@fancypage{#1}% |
---|
452 | \def\the@@fancypage{#2}% |
---|
453 | \def\@outputpage{\fb@outputpage}} |
---|
454 | |
---|
455 | \def\thisfancypage#1#2{% |
---|
456 | % DG/SR modification begin - May 16, 1997 |
---|
457 | \@begindvi % Need today by LaTeX 2e |
---|
458 | % DG/SR modification end |
---|
459 | \gdef\@outputpage{\fb@outputpage}% |
---|
460 | \gdef\this@fancypage{\def\the@fancypage{#1}\def\the@@fancypage{#2}}} |
---|
461 | |
---|
462 | % \fancyput |
---|
463 | |
---|
464 | % Token registers used to make it easier to put definitions in argument. |
---|
465 | % Boxes not processed until output so that contents can depend, e.g., on |
---|
466 | % current page or marks or whatever. This makes everything slightly more |
---|
467 | % complicated than one would expect. |
---|
468 | |
---|
469 | \newtoks\the@fancyput |
---|
470 | \newtoks\this@fancyput |
---|
471 | \def\fancyput@flag{-1}% |
---|
472 | |
---|
473 | % \fancyput@flag=-1 if no fancyput, 0 if regular fancyput, 1 if thisfancyput. |
---|
474 | |
---|
475 | \def\fancyput{% |
---|
476 | % DG/SR modification begin - May 16, 1997 |
---|
477 | \@begindvi % Need today by LaTeX 2e |
---|
478 | % DG/SR modification end |
---|
479 | \def\@outputpage{\fb@outputpage} |
---|
480 | \@ifstar{\@testtrue\@fancyput}{\@testfalse\@fancyput}} |
---|
481 | \def\@fancyput{\@ifnextchar({\@@fancyput}{\@@fancyput(\z@,\z@)}} |
---|
482 | \def\@@fancyput(#1,#2)#3{% |
---|
483 | \if@test |
---|
484 | \expandafter\the@fancyput\expandafter{\the\the@fancyput\do{#1}{#2}{#3}}% |
---|
485 | \else |
---|
486 | \the@fancyput{\do{#1}{#2}{#3}}% |
---|
487 | \fi |
---|
488 | \gdef\fancyput@flag{\z@}} |
---|
489 | |
---|
490 | \def\thisfancyput{% |
---|
491 | % DG/SR modification begin - May 16, 1997 |
---|
492 | \@begindvi % Need today by LaTeX 2e |
---|
493 | % DG/SR modification end |
---|
494 | \gdef\@outputpage{\fb@outputpage} |
---|
495 | \@ifstar{\@testtrue\@thisfancyput}{\@testfalse\@thisfancyput}} |
---|
496 | \def\@thisfancyput{\@ifnextchar({\@@thisfancyput}{\@@thisfancyput(\z@,\z@)}} |
---|
497 | \def\@@thisfancyput(#1,#2)#3{% |
---|
498 | \if@test |
---|
499 | \ifnum\fancyput@flag=\z@ |
---|
500 | \expandafter\global\expandafter\this@fancyput\expandafter{% |
---|
501 | \the\this@fancyput\do{#1}{#2}{#3}}% |
---|
502 | \else |
---|
503 | \expandafter\global\expandafter\this@fancyput\expandafter{% |
---|
504 | \the\the@fancyput\do{#1}{#2}{#3}}% |
---|
505 | \fi |
---|
506 | \else |
---|
507 | \global\this@fancyput{\do{#1}{#2}{#3}}% |
---|
508 | \fi |
---|
509 | \gdef\fancyput@flag{1}} |
---|
510 | |
---|
511 | \def\do@fancyput{% |
---|
512 | \def\do##1##2##3{\raise##2\hbox to\z@{\kern##1\relax##3\hss}}% |
---|
513 | \setbox\@tempboxa=\hbox to\z@{% |
---|
514 | \kern-\hoffset |
---|
515 | \raise\voffset\hbox{% |
---|
516 | \ifnum\fancyput@flag=\z@\the\the@fancyput\else\the\this@fancyput\fi}% |
---|
517 | \hss}% |
---|
518 | \ht\@tempboxa=\z@ \dp\@tempboxa=\z@ |
---|
519 | \box\@tempboxa |
---|
520 | \gdef\fancyput@flag{\z@}% |
---|
521 | \global\this@fancyput{}} |
---|
522 | |
---|
523 | % \Landscape |
---|
524 | |
---|
525 | \def\UsePageParameters{% |
---|
526 | \clearpage |
---|
527 | \global\@colht\textheight |
---|
528 | \onecolumn} |
---|
529 | |
---|
530 | \def\fb@rotatepage{} |
---|
531 | |
---|
532 | |
---|
533 | \def\Landscape{\@ifstar{\@testtrue\@Landscape}{\@testfalse\@Landscape}} |
---|
534 | \def\@Landscape#1#2#3{% |
---|
535 | % DG/SR modification begin - May 16, 1997 |
---|
536 | \@begindvi % Need today by LaTeX 2e |
---|
537 | % DG/SR modification end |
---|
538 | \clearpage |
---|
539 | \def\fb@rotatepage{#3}% |
---|
540 | \def\@outputpage{\fb@outputpage}% |
---|
541 | \@tempdima#1\relax |
---|
542 | \@tempdimb#2\relax |
---|
543 | \if@test |
---|
544 | \edef\fb@theoffsets{{\voffset}{\hoffset}{\number\@tempdima sp}}% |
---|
545 | \else |
---|
546 | \edef\fb@theoffsets{{\hoffset}{\voffset}{\number\@tempdimb sp}}% |
---|
547 | \fi |
---|
548 | \advance\@tempdimb-\@tempdima |
---|
549 | \advance\textwidth\@tempdimb |
---|
550 | \advance\textheight-\@tempdimb |
---|
551 | \UsePageParameters} |
---|
552 | \def\endLandscape{\clearpage\aftergroup\UsePageParameters} |
---|
553 | |
---|
554 | \def\fb@setoffsets#1#2#3{% |
---|
555 | \@tempdima#1% |
---|
556 | \advance#1#2% |
---|
557 | #2#3 |
---|
558 | \advance#2-2in |
---|
559 | \advance#2-\@tempdima} |
---|
560 | |
---|
561 | \@namedef{Landscape*}{\@testtrue\@Landscape} |
---|
562 | \@namedef{endLandscape*}{\endLandscape} |
---|
563 | |
---|
564 | % \LandScape |
---|
565 | |
---|
566 | \def\fb@@rotatepage{} |
---|
567 | |
---|
568 | \def\LandScape#1{% |
---|
569 | % DG/SR modification begin - May 16, 1997 |
---|
570 | \@begindvi % Need today by LaTeX 2e |
---|
571 | % DG/SR modification end |
---|
572 | \clearpage |
---|
573 | \def\fb@@rotatepage{#1}% |
---|
574 | \def\@outputpage{\fb@outputpage}% |
---|
575 | \@tempdima\textheight |
---|
576 | \textheight\textwidth |
---|
577 | \textwidth\@tempdima |
---|
578 | \UsePageParameters} |
---|
579 | \def\endLandScape{\clearpage\aftergroup\UsePageParameters} |
---|
580 | |
---|
581 | % \GenericCaption |
---|
582 | |
---|
583 | \def\GenericCaption#1{% |
---|
584 | \par |
---|
585 | \begingroup |
---|
586 | \@parboxrestore |
---|
587 | \normalsize |
---|
588 | \vskip 10\p@ |
---|
589 | \setbox\@tempboxa\hbox{#1}% |
---|
590 | \ifdim\wd\@tempboxa>\hsize |
---|
591 | #1\par |
---|
592 | \else |
---|
593 | \hbox to\hsize{\hfil\box\@tempboxa\hfil}% |
---|
594 | \fi |
---|
595 | \endgroup |
---|
596 | \par} |
---|
597 | |
---|
598 | % \landfloat |
---|
599 | |
---|
600 | \def\landfloat#1#2{% |
---|
601 | \gdef\curr@landfloat{#1}% |
---|
602 | \gdef\float@rotation{#2}% |
---|
603 | \begin{#1}[p]% |
---|
604 | \setbox\@tempboxa\vbox\bgroup |
---|
605 | \hsize\@colht |
---|
606 | \@parboxrestore} |
---|
607 | \def\endlandfloat{% |
---|
608 | \par\vskip\z@ |
---|
609 | \egroup |
---|
610 | \setbox\@tempboxa\hbox{\float@rotation{\box\@tempboxa}}% |
---|
611 | \centerline{\box\@tempboxa}% |
---|
612 | \expandafter\end\expandafter{\curr@landfloat}} |
---|
613 | |
---|
614 | % \boxput |
---|
615 | |
---|
616 | \def\boxput{\@ifstar{\@testtrue\@boxput}{\@testfalse\@boxput}} |
---|
617 | \def\@boxput{\@ifnextchar({\@@boxput}{\@@boxput(0,0)}} |
---|
618 | \long\def\@@boxput(#1,#2)#3#4{% |
---|
619 | \setbox\@fancybox\hbox{{#4}}% |
---|
620 | \setbox\@tempboxa\vbox to\z@{\vss\hbox to\z@{\hss{#3}\hss}\vss}% |
---|
621 | \@tempdima=#1\wd\@fancybox |
---|
622 | \advance\@tempdima\wd\@fancybox |
---|
623 | \divide\@tempdima 2 |
---|
624 | \ifcat a#2\relax |
---|
625 | \@tempdimb=\z@ |
---|
626 | \else |
---|
627 | \@tempdimb=.5\ht\@fancybox |
---|
628 | \advance\@tempdimb.5\dp\@fancybox |
---|
629 | \@tempdimc=\@tempdimb |
---|
630 | \advance\@tempdimc-\dp\@fancybox |
---|
631 | \@tempdimb=#2\@tempdimb |
---|
632 | \advance\@tempdimb\@tempdimc |
---|
633 | \fi |
---|
634 | \setbox\@tempboxa\hbox to \z@{% |
---|
635 | \if@test\kern-\wd\@fancybox\fi |
---|
636 | \kern\@tempdima\raise\@tempdimb\box\@tempboxa\hss}% |
---|
637 | \ht\@tempboxa=\z@ \dp\@tempboxa=\z@ |
---|
638 | \leavevmode |
---|
639 | \if@test |
---|
640 | \hbox{\box\@fancybox\box\@tempboxa}% |
---|
641 | \else |
---|
642 | \hbox{\box\@tempboxa\box\@fancybox}% |
---|
643 | \fi} |
---|
644 | |
---|
645 | % \Vfootnotes |
---|
646 | |
---|
647 | \def\VerbatimFootnotes{\let\@footnotetext\V@footnotetext} |
---|
648 | |
---|
649 | \long\def\V@footnotetext{% |
---|
650 | \afterassignment\V@@footnotetext |
---|
651 | \let\@tempa} |
---|
652 | \def\V@@footnotetext{% |
---|
653 | \insert\footins\bgroup |
---|
654 | \csname reset@font\endcsname |
---|
655 | \footnotesize |
---|
656 | \interlinepenalty\interfootnotelinepenalty |
---|
657 | \splittopskip\footnotesep |
---|
658 | \splitmaxdepth\dp\strutbox |
---|
659 | \floatingpenalty \@MM |
---|
660 | \hsize\columnwidth |
---|
661 | \@parboxrestore |
---|
662 | \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}% |
---|
663 | \@makefntext{}% |
---|
664 | \rule{\z@}{\footnotesep}% |
---|
665 | \bgroup |
---|
666 | \aftergroup\V@@@footnotetext |
---|
667 | \ignorespaces} |
---|
668 | \def\V@@@footnotetext{\strut\egroup} |
---|
669 | |
---|
670 | % Verbatim |
---|
671 | |
---|
672 | % The main idea is to separate the reading and formatting of the |
---|
673 | % verbatim listing. It's pretty simple. |
---|
674 | |
---|
675 | \def\Verbatim@Codes{% |
---|
676 | \let\do\@makeother |
---|
677 | \dospecials |
---|
678 | \Verbatim@ObeyThings |
---|
679 | \ThisVerbCodes\relax\gdef\ThisVerbCodes{}} |
---|
680 | |
---|
681 | \def\EveryVerbatimCodes{} |
---|
682 | |
---|
683 | % \Verbatim is redefined temporarilly in \Get@Verbatim to scan the |
---|
684 | % verbatim text. \Verbatim is used so that error messages are more |
---|
685 | % enlightening. \next checks whether \Verbatim found its argument, |
---|
686 | % and attempts to recover if not. |
---|
687 | % |
---|
688 | % Heuristically, if current environment is `foo' and argument of |
---|
689 | % \Get@Verbatim is \The@Verbatim, then definition of \Verbatim is |
---|
690 | % |
---|
691 | % \def\Verbatim#1^^M#2^^M\the\EndVerbatimTokens\end{foo}{% |
---|
692 | % \xdef\The@Verbatim{\noexpand\Every@VerbatimLine#2}% |
---|
693 | % \endgroup\end{foo}} |
---|
694 | % |
---|
695 | % \The@Verbatim is then equal to the verbatim text, with spaces |
---|
696 | % replaced by \Verbatim@Space, tabs replaced by \Verbatim@Tab, |
---|
697 | % and ` replaced by \@lquote. In addition, each line begins with |
---|
698 | % \Every@VerbatimLine, and each line but the last ends with |
---|
699 | % \Verbatim@Par. It is then possible to redefine these when formatting |
---|
700 | % the verbatim text. To insert each line as an argument to \foo, use |
---|
701 | % \def\Every@VerbatimLine#1\Verbatim@Par{\foo{#1}} |
---|
702 | % \The@Verbatim\Verbatim@Par |
---|
703 | % |
---|
704 | \newtoks\EndVerbatimTokens |
---|
705 | \begingroup |
---|
706 | \catcode`\|=0 |
---|
707 | \catcode`\[=1 |
---|
708 | \catcode`\]=2 |
---|
709 | \catcode`\{=12 |
---|
710 | \catcode`\}=12 |
---|
711 | \catcode`\^^M=13% |
---|
712 | \catcode`\\=12% |
---|
713 | |gdef|Get@Verbatim#1[% |
---|
714 | |begingroup% |
---|
715 | |Verbatim@Codes|EveryVerbatimCodes% |
---|
716 | |let|protect|noexpand% |
---|
717 | |VerbatimEnvironment% |
---|
718 | |edef|next[|noexpand|def|noexpand|Verbatim####1|noexpand^^M####2% |
---|
719 | |noexpand^^M|the|EndVerbatimTokens\end{|@VerbEnvir}]% |
---|
720 | |edef|endVerbatim[|noexpand|endgroup|noexpand|end[|@VerbEnvir]]% |
---|
721 | |global|let|@VerbEnvir|relax% |
---|
722 | |next[|@nil|xdef#1[|noexpand|Every@VerbatimLine##2]|endVerbatim]% |
---|
723 | |def|next[|@ifnextchar|@nil[|@gobble]% If \@nil is there, then |
---|
724 | [|gdef#1[]|endVerbatim|end[document]]]% \Verbatim found its argument. |
---|
725 | |expandafter|next|Verbatim]% Otherwise, try to recover. |
---|
726 | |gdef|AltGet@Verbatim#1[% |
---|
727 | |begingroup% |
---|
728 | |Verbatim@Codes|EveryVerbatimCodes% |
---|
729 | |def^^M##1^^M##2[% |
---|
730 | |ifx|@nil##2|@empty|else% |
---|
731 | |noexpand|Verbatim@Par|noexpand|Every@VerbatimLine##1% |
---|
732 | |expandafter^^M|expandafter##2% |
---|
733 | |fi]% |
---|
734 | |let|protect|noexpand% |
---|
735 | |VerbatimEnvironment% |
---|
736 | |edef|next[|noexpand|def|noexpand|Verbatim####1|noexpand^^M####2% |
---|
737 | \end{|@VerbEnvir}]% |
---|
738 | |edef|endVerbatim[|noexpand|endgroup|noexpand|end[|@VerbEnvir]]% |
---|
739 | |global|let|@VerbEnvir|relax% |
---|
740 | |next[|@nil|xdef#1[|noexpand|Every@VerbatimLine##2^^M|@nil]|endVerbatim]% |
---|
741 | |def|next[|@ifnextchar|@nil[|@gobble]% |
---|
742 | [|gdef#1[]|endVerbatim|end[document]]]% |
---|
743 | |expandafter|next|Verbatim]% |
---|
744 | |endgroup |
---|
745 | \def\AltGetVerbatim{\let\Get@Verbatim\AltGet@Verbatim} |
---|
746 | |
---|
747 | % It is enough to not use \begin or \end when defining new verbatim |
---|
748 | % environments, as the default is for \Get@Verbatim to look for the |
---|
749 | % end of the current environment, but using \VerbatimEnvironment |
---|
750 | % is easier to explain to users. |
---|
751 | |
---|
752 | \def\VerbatimEnvironment{% |
---|
753 | \ifx\@VerbEnvir\relax\xdef\@VerbEnvir{\@currenvir}\fi} |
---|
754 | |
---|
755 | \let\@VerbEnvir\relax |
---|
756 | |
---|
757 | \def\The@VerbatimErr{% |
---|
758 | \gdef\The@Verbatim{\@latexerr{Misplaced \string\end{Verbatim}}\@ehd}} |
---|
759 | \The@VerbatimErr |
---|
760 | |
---|
761 | \begingroup |
---|
762 | \catcode`\^^M=\active% |
---|
763 | \catcode`\ =\active% |
---|
764 | \catcode`\^^I=\active% |
---|
765 | \gdef\Verbatim@ObeyThings{% |
---|
766 | \catcode`\^^M=\active% |
---|
767 | \catcode`\ =\active% |
---|
768 | \catcode`\^^I=\active% |
---|
769 | \catcode``=\active% |
---|
770 | \def^^M{\noexpand\Verbatim@Par\noexpand\Every@VerbatimLine}% |
---|
771 | \def^^I{\noexpand\Verbatim@Tab}% |
---|
772 | \def {\noexpand\Verbatim@Space}% |
---|
773 | \Verbatim@NoLigs}% |
---|
774 | \gdef\Verbatim@DontObeyLines{\outer\def^^M{}}% |
---|
775 | \endgroup |
---|
776 | |
---|
777 | \def\SaveVerbatim{\@bsphack\Get@Verbatim} |
---|
778 | |
---|
779 | \def\endSaveVerbatim{\@esphack} |
---|
780 | |
---|
781 | {\catcode``13 \gdef\Verbatim@NoLigs{\def`{\noexpand\@lquote}}} |
---|
782 | |
---|
783 | \def\Verbatim@Prep{% |
---|
784 | \frenchspacing |
---|
785 | \ThisVerb\relax\gdef\ThisVerb{}% |
---|
786 | \VerbatimFont |
---|
787 | \EveryVerbatim |
---|
788 | \let\Every@VerbatimLine\EveryVerbatimLine |
---|
789 | \def\Verbatim@Space{\leavevmode\penalty\@M\VerbatimSpace}% |
---|
790 | \def\Verbatim@Tab{\leavevmode\penalty\@M\VerbatimTab}}% |
---|
791 | |
---|
792 | \def\Verb@Prep{% |
---|
793 | \frenchspacing |
---|
794 | \ThisVerb\relax\gdef\ThisVerb{}% |
---|
795 | \VerbFont |
---|
796 | \EveryVerb |
---|
797 | \let\Every@VerbatimLine\EveryVerbatimLine |
---|
798 | \def\Verbatim@Space{\leavevmode\penalty\@M\VerbSpace}% |
---|
799 | \def\Verbatim@Tab{\leavevmode\penalty\@M\VerbTab}}% |
---|
800 | |
---|
801 | \def\Verbatim@Par{\leavevmode\null\@@par\penalty\interlinepenalty} |
---|
802 | |
---|
803 | % Parameter initialization: |
---|
804 | |
---|
805 | \def\VerbatimSpace{\ } |
---|
806 | |
---|
807 | {\catcode`\ =12\gdef\ttspace{{\tt }}} |
---|
808 | |
---|
809 | \def\VerbSpace{\ } |
---|
810 | |
---|
811 | \def\VerbatimTab{\ \ \ \ \ \ \ \ } |
---|
812 | |
---|
813 | \def\VerbTab{\ } |
---|
814 | |
---|
815 | \def\EveryVerbatim{} |
---|
816 | |
---|
817 | \def\EveryVerb{} |
---|
818 | |
---|
819 | \def\ThisVerb{} |
---|
820 | |
---|
821 | \def\EveryVerbatimLine{}% |
---|
822 | |
---|
823 | \def\EveryVerbOutLine{} |
---|
824 | |
---|
825 | \def\VerbatimFont{\tt} |
---|
826 | |
---|
827 | \def\VerbFont{\tt} |
---|
828 | |
---|
829 | \def\VerbatimFuzz{2pt}% |
---|
830 | |
---|
831 | \def\EveryVerbatimCodes{} |
---|
832 | |
---|
833 | \def\EveryVerbCodes{} |
---|
834 | |
---|
835 | \def\EveryVerbOutCodes{} |
---|
836 | |
---|
837 | \def\ThisVerbCodes{} |
---|
838 | |
---|
839 | \def\Verbatim@List#1{% |
---|
840 | \if@minipage\else\vskip\parskip\fi |
---|
841 | \leftskip\@totalleftmargin |
---|
842 | \@rightskip\@flushglue \rightskip\@rightskip |
---|
843 | \parindent\z@ |
---|
844 | \parskip\z@ |
---|
845 | \parfillskip\@flushglue |
---|
846 | \hfuzz\VerbatimFuzz\relax |
---|
847 | \@@par |
---|
848 | \global\@inlabelfalse %Prevents vspace from being inserted when |
---|
849 | \Verbatim@Prep %first line exceeds \hsize. |
---|
850 | #1% |
---|
851 | \Verbatim@Par}% |
---|
852 | |
---|
853 | \def\UseVerbatim#1{% |
---|
854 | \begingroup\trivlist\item[]\Verbatim@List{#1}\endtrivlist\endgroup} |
---|
855 | |
---|
856 | \def\Verbatim{\Get@Verbatim\The@Verbatim} |
---|
857 | \def\endVerbatim{\UseVerbatim\The@Verbatim\The@VerbatimErr} |
---|
858 | |
---|
859 | \def\LUseVerbatim#1{% |
---|
860 | \begingroup\list{}{}\item[]\Verbatim@List{#1}\endlist\endgroup} |
---|
861 | |
---|
862 | \def\LVerbatim{\Get@Verbatim\The@Verbatim} |
---|
863 | \def\endLVerbatim{\LUseVerbatim\The@Verbatim\The@VerbatimErr} |
---|
864 | |
---|
865 | \def\BUseVerbatim{% |
---|
866 | \@ifnextchar[{\@BUseVerbatim}{\@BUseVerbatim[]}} |
---|
867 | \def\@BUseVerbatim[#1]#2{% |
---|
868 | \begingroup |
---|
869 | \Verbatim@Prep |
---|
870 | \let\Verbatim@Par\@Btrivlistcr |
---|
871 | \@Btrivlist{l}[#1]% |
---|
872 | #2% |
---|
873 | \endBtrivlist |
---|
874 | \endgroup}% |
---|
875 | |
---|
876 | \def\BVerbatim{% |
---|
877 | \catcode`\^^M=13\relax |
---|
878 | \@ifnextchar[{\@BVerbatim}{\@BVerbatim[]}} |
---|
879 | \def\@BVerbatim[#1]{\def\@tempa{[#1]}\Get@Verbatim\The@Verbatim} |
---|
880 | \def\endBVerbatim{ |
---|
881 | \expandafter\@BUseVerbatim\@tempa\The@Verbatim\The@VerbatimErr} |
---|
882 | |
---|
883 | \newwrite\Verbatim@Outfile |
---|
884 | \def\VerbatimOut#1{% |
---|
885 | \@bsphack |
---|
886 | \begingroup |
---|
887 | \immediate\openout\Verbatim@Outfile #1\relax |
---|
888 | \def\EveryVerbatimCodes{\EveryVerbOutCodes}% |
---|
889 | \Get@Verbatim\The@Verbatim} |
---|
890 | \def\endVerbatimOut{% |
---|
891 | \Verbatim@ObeyThings |
---|
892 | \def\Verbatim@Par{^^J}% |
---|
893 | \def\Verbatim@Space{\space}% |
---|
894 | \def\Verbatim@Tab{\space}% |
---|
895 | \def\@lquote{\string`}% |
---|
896 | \ThisVerb\relax\gdef\ThisVerb{}% |
---|
897 | \let\Every@VerbatimLine\EveryVerbOutLine |
---|
898 | \immediate\write\Verbatim@Outfile{\The@Verbatim}% |
---|
899 | \immediate\closeout\Verbatim@Outfile |
---|
900 | \endgroup |
---|
901 | \The@VerbatimErr |
---|
902 | \@esphack} |
---|
903 | |
---|
904 | % This one is a little tricky because: |
---|
905 | % * we want to ignore the ^^M at the end of the last line, |
---|
906 | % * we want to handle files that end with newline and files that don't |
---|
907 | % * we want comment characters to work properly, |
---|
908 | % * we want to expand each line before inserting \Every@VerbatimLine and |
---|
909 | % \Verbatim@Par, |
---|
910 | % |
---|
911 | % \The@GVerbatim is used as scratch with global redefinition. |
---|
912 | \newread\Verbatim@Infile |
---|
913 | \def\Verbatim@Input#1#2{% |
---|
914 | \begingroup |
---|
915 | \Verbatim@Codes\EveryVerbatimCodes |
---|
916 | \immediate\openin\Verbatim@Infile #1\relax |
---|
917 | \ifeof\Verbatim@Infile |
---|
918 | \@latexerr{No verbatim file #1}\@ehd |
---|
919 | \else |
---|
920 | \def\The@GVerbatim{}\Verbatim@NextLine |
---|
921 | \ifeof\Verbatim@Infile |
---|
922 | \@latexerr{Verbatim file #1 is empty}\@ehd |
---|
923 | \else |
---|
924 | \let\The@Verbatim\The@GVerbatim |
---|
925 | \def\The@GVerbatim{}\Verbatim@NextLine |
---|
926 | #2{\Verbatim@@Input}% |
---|
927 | \fi |
---|
928 | \fi |
---|
929 | \immediate\closein\Verbatim@Infile |
---|
930 | \endgroup} |
---|
931 | \def\Verbatim@@Input{% |
---|
932 | \let\protect\noexpand |
---|
933 | \edef\The@Verbatim{% |
---|
934 | \noexpand\Every@VerbatimLine |
---|
935 | \The@Verbatim |
---|
936 | \ifeof\Verbatim@Infile\else\noexpand\Verbatim@Par\fi}% |
---|
937 | \let\protect\relax |
---|
938 | \The@Verbatim |
---|
939 | \ifeof\Verbatim@Infile\else |
---|
940 | \let\The@Verbatim\The@GVerbatim |
---|
941 | \def\The@GVerbatim{}\Verbatim@NextLine |
---|
942 | \expandafter\Verbatim@@Input |
---|
943 | \fi}% |
---|
944 | \begingroup\catcode`\^^M=\active% |
---|
945 | \gdef\Verbatim@NextLine{% |
---|
946 | \ifeof\Verbatim@Infile\else% |
---|
947 | \immediate\read\Verbatim@Infile to\@tempa% |
---|
948 | \expandafter\Verbatim@@NextLine\@tempa^^M\relax^^M\@nil% |
---|
949 | \fi}% |
---|
950 | % #2 is empty if line ends in ^^M, #2=\relax otherwise. |
---|
951 | \gdef\Verbatim@@NextLine#1^^M#2^^M#3\@nil{% |
---|
952 | \expandafter\gdef\expandafter\The@GVerbatim\expandafter{\The@GVerbatim#1}% |
---|
953 | \ifx#2\@empty\@empty\else\expandafter\Verbatim@NextLine\fi}% |
---|
954 | \endgroup% |
---|
955 | |
---|
956 | \def\UseVerb#1{\begingroup\Verb@Prep#1\endgroup} |
---|
957 | |
---|
958 | \def\SaveVerb{\@ifnextchar[{\Save@Verb}{\Save@Verb[]}} |
---|
959 | |
---|
960 | \long\def\Save@Verb[#1]#2{% |
---|
961 | \begingroup |
---|
962 | \Verbatim@Codes\Verbatim@DontObeyLines\EveryVerbCodes |
---|
963 | \Save@@Verb{#1}{#2}} |
---|
964 | |
---|
965 | \long\def\Save@@Verb#1#2#3{% |
---|
966 | \let\protect\noexpand |
---|
967 | \def\next{\@ifnextchar\@nil{\@gobble}{\endgroup}}% |
---|
968 | \long\def\Verb##1#3{\@nil\xdef#2{##1}\endgroup#1}% |
---|
969 | \expandafter\next\Verb} |
---|
970 | |
---|
971 | \def\Verb{\Save@Verb[\UseVerb{\The@Verbatim}]{\The@Verbatim}} |
---|
972 | |
---|
973 | \def\VerbatimInput#1{\begingroup\Verbatim@Input{#1}\UseVerbatim\endgroup} |
---|
974 | |
---|
975 | \def\LVerbatimInput#1{\begingroup\Verbatim@Input{#1}\LUseVerbatim\endgroup} |
---|
976 | |
---|
977 | \def\BVerbatimInput{\@ifnextchar[{\@BVerbatimInput}{\@BVerbatimInput[]}} |
---|
978 | \def\@BVerbatimInput[#1]#2{% |
---|
979 | \begingroup\Verbatim@Input{#2}{\@BUseVerbatim[#1]}\endgroup} |
---|
980 | |
---|
981 | \endinput |
---|
982 | %% END fancybox.sty |
---|