Debian Codegraph @

texmf-dist/tex/latex/fancyvrb/fancyvrb.sty

raw
1 %%
2 %% This is file `fancyvrb.sty',
3 %%
4 %% COPYRIGHT 1992-1999, by Timothy Van Zandt <[email protected]>
5 %% 2000-2026 ... , by Herbert Voss <[email protected]>
6 %%
7 %% This package may be distributed under the terms of the LaTeX Project Public
8 %% License, as described in lppl.txt in the base LaTeX distribution.
9 %% Either version 1.3 or, at your option, any later version.
10 %%
11 %% DESCRIPTION:
12 %% fancyvrb.sty is a LaTeX style option, containing flexible
13 %% verbatim environments and commands and extensive documentation.
14 %%
15 \NeedsTeXFormat{LaTeX2e}
16 \def\fileversion{4.6a}
17 \def\filedate{2026/04/16}
18 \ProvidesPackage{fancyvrb}[\filedate\space \fileversion\space verbatim text (tvz,hv)]
19 %\message{Style option: `fancyvrb' v\fileversion \space <\filedate> (tvz)}
20 \csname fancyvrb@loaded\endcsname
21 \let\fancyvrb@loaded\endinput
22 %\ProcessOptions
23 %\@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}} % Standard LaTeX `color' package
24 \def\FV@Error#1#2{%
25 \edef\@tempc{#2}\expandafter\errhelp\expandafter{\@tempc}%
26 \errmessage{FancyVerb Error:^^J\space\space #1^^J}}
27
28 \def\FV@eha{Your command was ignored. Type <return> to continue.}
29 %% DG/SR modification begin - Jan. 21, 1998
30 %% Suggested by Bernard Gaulle to solve a compatibility problem with `french'
31 %% (it introduce the restriction to put \VerbatimFootnotes AFTER the preambule)
32 %%\def\VerbatimFootnotes{\let\@footnotetext\V@footnotetext}
33 \let\V@footnote\footnote
34 \def\VerbatimFootnotes{%
35 \let\@footnotetext\V@footnotetext%
36 \let\footnote\V@footnote}
37 %% DG/SR modification end
38 \long\def\V@footnotetext{%
39 \afterassignment\V@@footnotetext
40 \let\@tempa}
41 \def\V@@footnotetext{%
42 \insert\footins\bgroup
43 \csname reset@font\endcsname
44 \footnotesize
45 \interlinepenalty\interfootnotelinepenalty
46 \splittopskip\footnotesep
47 \splitmaxdepth\dp\strutbox
48 \floatingpenalty \@MM
49 \hsize\columnwidth
50 \@parboxrestore
51 \def\@currentcounter{footnote}%
52 \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
53 \@makefntext{}%
54 \rule{\z@}{\footnotesep}%
55 \bgroup
56 \aftergroup\V@@@footnotetext
57 \ignorespaces}
58 \def\V@@@footnotetext{\strut\egroup}
59 \RequirePackage{keyval}
60 \def\define@booleankey#1#2#3#4{%
61 \@namedef{KV@#1@#2@default}{#3}%
62 \@namedef{KV@#1@#2@false}{#4}%
63 \@namedef{KV@#1@#2}##1{\KV@booleankey{##1}{#1}{#2}}}
64 \def\KV@booleankey#1#2#3{%
65 \edef\@tempa{#1}\expandafter\KV@@booleankey\@tempa\relax\@nil{#2}{#3}}
66 \def\KV@@booleankey#1#2\@nil#3#4{%
67 \@nameuse{KV@#3@#4@\if t#1default\else\if T#1default\else false\fi\fi}}
68 \def\FV@None{none}
69 \def\FV@Auto{auto}
70 \def\fvset#1{\setkeys{FV}{#1}}
71 \def\FV@Command#1#2{%
72 \@ifstar
73 {\def\FV@KeyValues{#1,showspaces}\FV@@Command{#2}}%
74 {\def\FV@KeyValues{#1}\FV@@Command{#2}}}
75 \def\FV@@Command#1{%
76 \@ifnextchar[%
77 {\FV@GetKeyValues{\@nameuse{FVC@#1}}}%
78 {\@nameuse{FVC@#1}}}
79 \def\FV@GetKeyValues#1[#2]{%
80 \expandafter\def\expandafter\FV@KeyValues\expandafter{\FV@KeyValues,#2}#1}
81 \def\@CustomVerbatimCommand#1#2#3#4{%
82 \begingroup\fvset{#4}\endgroup % If there are errors, it easier to locate.
83 %% DG/SR modification begin - Jan. 13, 1998
84 %% \def\@tempa##1##2\@nil{\def\@tempa{##2}}%
85 %% \expandafter\@tempa\string#3\@empty\@nil
86 %% \@ifundefined{FVC@\@tempa}%
87 \@ifundefined{FVC@#3}%
88 %% DG/SR modification end
89 {\FV@Error{Command `\string#3' is not a FancyVerb command.}\@eha}%
90 {#1{#2}{\FV@Command{#4}{#3}}}}
91 \def\CustomVerbatimCommand{\@CustomVerbatimCommand\newcommand}
92 \def\RecustomVerbatimCommand{\@CustomVerbatimCommand\renewcommand}
93 \def\FV@Environment#1#2{%
94 \def\FV@KeyValues{#1}%
95 \catcode`\^^M=\active
96 \@ifnextchar[%
97 {\catcode`\^^M=5 \FV@GetKeyValues{\@nameuse{FVB@#2}}}%
98 {\catcode`\^^M=5 \@nameuse{FVB@#2}}}
99 \def\CustomVerbatimEnvironment{\@CustomVerbatimEnvironment\newenvironment}
100 \def\RecustomVerbatimEnvironment{\@CustomVerbatimEnvironment\renewenvironment}
101 \def\@CustomVerbatimEnvironment#1#2#3#4{%
102 \begingroup\fvset{#4}\endgroup % If there are errors, it easier to locate.
103 \@ifundefined{FVB@#3}%
104 {\FV@Error{`#3' is not a FancyVerb environment.}\@eha}%
105 {#1{#2}{\FV@Environment{#4}{#3}}{\@nameuse{FVE@#3}}%
106 #1{#2*}{\FV@Environment{#4,showspaces}{#3}}{\@nameuse{FVE@#3}}}}
107 \def\DefineVerbatimEnvironment#1#2#3{%
108 \@namedef{#1}{\FV@Environment{#3}{#2}}%
109 \@namedef{end#1}{\@nameuse{FVE@#2}}%
110 \@namedef{#1*}{\FV@Environment{#3,showspaces}{#2}}%
111 \@namedef{end#1*}{\@nameuse{FVE@#2}}}
112 \def\FV@UseKeyValues{%
113 \ifx\FV@KeyValues\@empty\else%
114 \def\KV@prefix{KV@FV@}%
115 \expandafter\KV@do\FV@KeyValues,\relax,%
116 \def\FV@KeyValues{}%
117 \fi}
118 \def\FV@CatCodes{%
119 \let\do\@makeother\dospecials % The usual stuff.
120 \FV@ActiveWhiteSpace % See below.
121 \FV@FontScanPrep % See below.
122 \FV@CatCodesHook % A style hook.
123 \FancyVerbCodes} % A user-defined hook.
124 \def\FV@ActiveWhiteSpace{%
125 \catcode`\^^M=\active % End of line
126 \catcode`\ =\active % Space
127 \catcode`\^^I=\active} % Tab
128 \def\FV@CatCodesHook{}
129 \def\FV@AddToHook#1#2{%
130 \expandafter\def\expandafter#1\expandafter{#1#2\relax}}
131 \define@key{FV}{codes}[]{\def\FancyVerbCodes{#1\relax}}
132 \define@key{FV}{codes*}{%
133 \expandafter\def\expandafter\FancyVerbCodes\expandafter{\FancyVerbCodes#1\relax}}
134 \fvset{codes}
135 %
136 \define@key{FV}{vspace}[\topsep]{\def\FancyVerbVspace{#1}}
137 \fvset{vspace}
138 %
139 \define@key{FV}{commandchars}[\\\{\}]%
140 {\def\@tempa{#1}%
141 \ifx\@tempa\FV@None
142 \let\FV@CommandChars\relax
143 \else
144 \FV@DefineCommandChars#1\relax\relax\relax
145 \fi}
146 \def\FV@DefineCommandChars#1#2#3{%
147 \def\FV@CommandChars{%
148 \catcode`#1=0\relax\catcode`#2=1\relax\catcode`#3=2\relax}}
149 \FV@AddToHook\FV@CatCodesHook\FV@CommandChars
150 \define@key{FV}{commentchar}[\%]{%
151 \def\@tempa{#1}%
152 \ifx\@tempa\FV@None
153 \let\FV@CommentChar\relax
154 \else
155 \def\FV@CommentChar{\catcode`#1=14}%
156 \fi}
157 \FV@AddToHook\FV@CatCodesHook\FV@CommentChar
158 \fvset{commandchars=none,commentchar=none}
159 \define@key{FV}{firstline}{%
160 \afterassignment\FV@ParseStart\@tempcnta=0#1\relax\@nil{#1}}
161 %
162 \def\FV@ParseStart#1\relax\@nil#2{%
163 \ifx\@nil#1\@nil
164 \edef\FancyVerbStartNum{\the\@tempcnta}%
165 \let\FancyVerbStartString\relax
166 \else
167 \edef\FancyVerbStartString{#2}%
168 \fi}
169 \def\KV@FV@firstline@default{%
170 \let\FancyVerbStartNum\z@
171 \let\FancyVerbStartString\relax}
172 %
173 \def\FancyVerbStopNum{1}
174 %
175 \define@key{FV}{lastline}{%
176 \afterassignment\FV@ParseStop\@tempcnta=0#1\relax\@nil{#1}}
177 \def\FV@ParseStop#1\relax\@nil#2{%
178 \ifx\@nil#1\@nil
179 \edef\FancyVerbStopNum{\the\@tempcnta}%
180 \let\FancyVerbStopString\relax
181 \else%
182 \edef\FancyVerbStopString{#2}%
183 \fi}
184 %\def\KV@FV@lastline@default{%
185 % \let\FancyVerbStopNum\z@
186 % \let\FancyVerbStopString\relax}
187 \def\KV@FV@lastline@default{%
188 \let\FancyVerbStopNum\m@ne
189 \let\FancyVerbStopString\relax
190 }
191 \KV@FV@firstline@default
192 \KV@FV@lastline@default
193 \fvset{firstline,lastline}
194 \newcount\FV@CodeLineNo
195 \def\FV@PreProcessLine{%
196 \global\advance\FV@CodeLineNo\@ne
197 \FV@FindStartStop}
198 \def\FV@@PreProcessLine{%
199 \FV@StepLineNo
200 \FV@Gobble
201 \expandafter\FV@ProcessLine\expandafter{\FV@Line}}
202 \def\FV@FindStartStop{\FV@DefineFindStart\FV@FindStartStop}
203 %% \def\FV@DefinePreProcessLine{%
204 %% \setcounter{FancyVerbLine}{0}%
205 %% \FV@DefineFindStart}
206 \def\FV@DefineFindStart{%
207 \ifx\FancyVerbStartString\relax
208 \ifnum\FancyVerbStartNum<\tw@
209 \FV@DefineFindStop
210 \else
211 \let\FV@FindStartStop\FV@FindStartNum
212 \fi
213 \else
214 \let\FV@FindStartStop\FV@FindStartString
215 \fi}
216 \def\FV@FindStartNum{%
217 \ifnum\FancyVerbStartNum>\FV@CodeLineNo\else
218 \FV@DefineFindStop
219 \expandafter\FV@@PreProcessLine
220 \fi}
221 %% SR modification begin - 1996
222 \def\FV@FindStartString{%
223 \expandafter\FV@@FindStartString
224 {\meaning\FV@Line}%
225 {\meaning\FancyVerbStartString}%
226 }
227 \def\FV@@FindStartString#1#2{%
228 \edef\@fooA{#1}\edef\@fooB{#2}%
229 \ifx\@fooA\@fooB\FV@DefineFindStop\fi
230 }
231 %% SR modification end
232 \def\FV@DefineFindStop{%
233 \ifx\FancyVerbStopString\relax
234 \ifnum\FancyVerbStopNum<\z@
235 \let\FV@FindStartStop\FV@@PreProcessLine
236 \else
237 \let\FV@FindStartStop\FV@FindStopNum
238 \fi
239 \else
240 \let\FV@FindStartStop\FV@FindStopString
241 \fi}
242 \def\FV@FindStopNum{%
243 \ifnum\FancyVerbStopNum>\FV@CodeLineNo
244 \else
245 \let\FV@FindStartStop\relax
246 \ifeof\FV@InFile\else
247 \immediate\closein\FV@InFile
248 \fi
249 \fi
250 \ifnum\FancyVerbStopNum<\FV@CodeLineNo
251 \else
252 \FV@@PreProcessLine
253 \fi}
254 %% SR modification begin - 1996
255 \def\FV@FindStopString{%
256 \expandafter\FV@@FindStopString
257 {\meaning\FV@Line}%
258 {\meaning\FancyVerbStopString}%
259 }
260 \def\FV@@FindStopString#1#2{%
261 \edef\@fooA{#1}\edef\@fooB{#2}%
262 \ifx\@fooA\@fooB
263 \let\FV@FindStartStop\relax
264 \ifeof\FV@InFile\else
265 \immediate\closein\FV@InFile
266 \fi
267 \else
268 \expandafter\FV@@PreProcessLine
269 \fi}
270 %% SR modification end
271 \def\FV@@Gobble{%
272 \expandafter\expandafter\expandafter\FV@@@Gobble
273 \expandafter\FV@@@@Gobble\FV@Line
274 \@nil\@nil\@nil\@nil\@nil\@nil\@nil\@nil\@nil\@nil\@@nil}
275 \def\FV@@@Gobble#1\@nil#2\@@nil{\def\FV@Line{#1}}
276 \define@key{FV}{gobble}{%
277 \@tempcnta=#1\relax
278 \ifnum\@tempcnta<\@ne
279 \let\FV@Gobble\relax
280 \else
281 \ifnum\@tempcnta>9
282 \FV@Error{gobble parameter must be less than 10}\FV@eha
283 \else
284 \renewcommand{\FV@@@@Gobble}[\@tempcnta]{}%
285 \let\FV@Gobble\FV@@Gobble
286 \fi
287 \fi}
288 \def\FV@@@@Gobble{}
289 \def\KV@FV@gobble@default{\let\FV@Gobble\relax}
290 \fvset{gobble}
291 \def\FV@Scan{%
292 \FV@CatCodes
293 \VerbatimEnvironment
294 \FV@DefineCheckEnd
295 \FV@BeginScanning}
296 \def\VerbatimEnvironment{%
297 \ifx\FV@EnvironName\relax\xdef\FV@EnvironName{\@currenvir}\fi}
298 \let\FV@EnvironName\relax
299 \begingroup
300 \catcode`\!=0
301 \catcode`\[=1
302 \catcode`\]=2
303 !gdef!FV@CheckEnd@i#1[!FV@@CheckEnd#1\end{}!@nil]
304 !gdef!FV@@CheckEnd@i#1\end#2#3!@nil[!def!@tempa[#2]!def!@tempb[#3]]
305 !gdef!FV@@@CheckEnd@i[\end{}]
306 \catcode`!\=12
307
308 !gdef!FV@CheckEnd@ii#1[!FV@@CheckEnd#1\end{}!@nil]
309 !gdef!FV@@CheckEnd@ii#1\end#2#3!@nil[!def!@tempa[#2]!def!@tempb[#3]]
310 !gdef!FV@@@CheckEnd@ii[\end{}]
311 !catcode`!{=12
312 !catcode`!}=12
313
314 !gdef!FV@CheckEnd@iii#1[!FV@@CheckEnd#1\end{}!@nil]
315 !gdef!FV@@CheckEnd@iii#1\end{#2}#3!@nil[!def!@tempa[#2]!def!@tempb[#3]]
316 !gdef!FV@@@CheckEnd@iii[\end{}]
317 !catcode`!\=0
318
319 !gdef!FV@CheckEnd@iv#1[!FV@@CheckEnd#1\end{}!@nil]
320 !gdef!FV@@CheckEnd@iv#1\end{#2}#3!@nil[!def!@tempa[#2]!def!@tempb[#3]]
321 !gdef!FV@@@CheckEnd@iv[\end{}]
322 \endgroup
323 \def\FV@BadCodes#1{%
324 \FV@Error
325 {\string\catcode\space of \expandafter\@gobble\string#1 is wrong:
326 \the\catcode`#1}%
327 {Only the following catcode values are allowed:
328 ^^J\@spaces \expandafter\@gobble\string\\ \space\space --> 0 or 12.
329 ^^J\@spaces \string{ \string} --> 1 and 2, resp., or both 12.
330 ^^JTo get this error, either you are a hacker or you got bad advice.}%
331 \def\FV@CheckEnd##1{\iftrue}}
332 \def\FV@DefineCheckEnd{%
333 \ifnum\catcode`\\=\z@
334 \ifnum\catcode`\{=\@ne
335 \let\FV@CheckEnd\FV@CheckEnd@i
336 \let\FV@@CheckEnd\FV@@CheckEnd@i
337 \let\FV@@@CheckEnd\FV@@@CheckEnd@i
338 \else
339 \ifnum\catcode`\{=12
340 \let\FV@CheckEnd\FV@CheckEnd@iv
341 \let\FV@@CheckEnd\FV@@CheckEnd@iv
342 \let\FV@@@CheckEnd\FV@@@CheckEnd@iv
343 \else
344 \FV@BadCodes\{%
345 \fi
346 \fi
347 \else
348 \ifnum\catcode`\\=12
349 \ifnum\catcode`\{=\@ne
350 \let\FV@CheckEnd\FV@CheckEnd@ii
351 \let\FV@@CheckEnd\FV@@CheckEnd@ii
352 \let\FV@@@CheckEnd\FV@@@CheckEnd@ii
353 \else
354 \ifnum\catcode`\{=12
355 \let\FV@CheckEnd\FV@CheckEnd@iii
356 \let\FV@@CheckEnd\FV@@CheckEnd@iii
357 \let\FV@@@CheckEnd\FV@@@CheckEnd@iii
358 \else
359 \FV@BadCodes\{%
360 \fi
361 \fi
362 \else
363 \FV@BadCodes\\%
364 \fi
365 \fi}
366 \begingroup
367 \catcode`\^^M=\active
368 \gdef\FV@BeginScanning#1^^M{%
369 \def\@tempa{#1}\ifx\@tempa\@empty\else\FV@BadBeginError\fi%
370 \FV@GetLine}%
371 \endgroup
372 \def\FV@BadBeginError#1{%
373 \expandafter\@temptokena\expandafter{\@tempa}%
374 \FV@Error
375 {Extraneous input `\the\@temptokena' between
376 \string\begin{\FV@EnvironName}[<key=value>] and line end}%
377 {This input will be discarded. Hit <return> to continue.}}
378 %% DG/SR modification begin - May. 18, 1998 (added code to turn off ligatures)
379 %% \def\FV@GetLine{\expandafter\FV@CheckScan\FancyVerbGetLine}
380 \def\FV@GetLine{\@noligs\expandafter\FV@CheckScan\FancyVerbGetLine}
381 %% DG/SR modification end
382 \begingroup
383 \catcode`\^^M=\active%
384 \gdef\FancyVerbGetLine#1^^M{%
385 \@nil%
386 \FV@CheckEnd{#1}%
387 \ifx\@tempa\FV@EnvironName% % True if end is found
388 \ifx\@tempb\FV@@@CheckEnd\else\FV@BadEndError\fi%
389 \let\next\FV@EndScanning%
390 \else%
391 \def\FV@Line{#1}%
392 \def\next{\FV@PreProcessLine\FV@GetLine}%
393 \fi%
394 \next}%
395 \endgroup
396 \def\FV@BadEndError{%
397 \expandafter\@temptokena\expandafter{\@tempb}%
398 \FV@Error
399 {Extraneous input `\the\@temptokena' between
400 \string\end{\FV@EnvironName} and line end}%
401 {This input will be discarded. Type <return> to continue.}}
402 \def\FV@EndScanning{%
403 \edef\next{\noexpand\end{\FV@EnvironName}}%
404 \global\let\FV@EnvironName\relax
405 \next}
406 \@ifundefined{@currenvline}{\let\@currenvline\@empty}{}
407 %\def\FV@CheckScan#1{\@ifnextchar\@nil{\@gobble}{\FV@EOF}}
408 \def\FV@CheckScan#1{\ifx\@nil#1\@empty\else\expandafter\FV@EOF\fi}
409 \def\FV@EOF{%
410 \FV@Error{Couldn't find `\string\end{\FV@EnvironName}' to end
411 a verbatim environment\@currenvline.}%
412 {Probably you mistyped the environment name or included an extraneous
413 ^^Jspace, or are using an improperly defined verbatim environment.
414 ^^JHit return and I will try to terminate this job.}%
415 \FV@EndScanning
416 \end{document}}
417 % \subsection{Input}
418 \newread\FV@InFile
419 \def\FV@Input#1{%
420 \immediate\openin\FV@InFile #1\relax
421 \ifeof\FV@InFile
422 \FV@Error{No verbatim file #1}\FV@eha
423 \immediate\closein\FV@InFile
424 \else
425 \FV@CatCodes
426 \expandafter\FV@@Input
427 \fi}
428 \def\FV@@Input{%
429 \def\FV@Line{}%
430 \FV@ReadLine
431 \ifeof\FV@InFile
432 \ifx\FV@Line\@empty\else
433 \FV@PreProcessLine
434 \fi
435 \immediate\closein\FV@InFile
436 \else
437 \FV@PreProcessLine
438 \expandafter\FV@@Input
439 \fi}
440 \begingroup
441 \catcode`\^^M=\active
442 \gdef\FV@ReadLine{%
443 \ifeof\FV@InFile\else%
444 \immediate\read\FV@InFile to\@tempa%
445 \expandafter\FV@@ReadLine\@tempa^^M\relax^^M\@nil%
446 \fi}
447 \gdef\FV@@ReadLine#1^^M#2^^M#3\@nil{%
448 \expandafter\def\expandafter\FV@Line\expandafter{%
449 \FV@Line#1}%
450 \ifx\relax#2\@empty\expandafter\FV@ReadLine\fi}%
451 \endgroup
452 \def\FV@FormattingPrep{%
453 \global\FV@CodeLineNo\z@
454 \frenchspacing % Cancels special punctuation spacing.
455 \FV@SetupFont % See below.
456 \FV@DefineWhiteSpace % See below.
457 \FancyVerbDefineActive
458 \FancyVerbFormatCom} % A user-defined hook (formatcom parameter).
459 \expandafter\ifx\csname selectfont\endcsname\relax
460 \def\FV@SetupFont{%
461 \FV@BaseLineStretch
462 \ifx\@currsize\small\normalsize\else\small\fi\@currsize
463 \FV@FontSize
464 \FV@FontFamily}
465 %
466 \else
467 %
468 \def\FV@SetupFont{%
469 \FV@BaseLineStretch
470 \FV@FontSize
471 \FV@FontFamily
472 \FV@FontSeries
473 \FV@FontShape
474 \selectfont
475 %% DG/SR modification begin - May. 18, 1998 (added code to turn off ligatures)
476 \@noligs}
477 %% DG/SR modification end
478 \fi
479 \define@key{FV}{fontsize}{%
480 \def\@tempa{#1}%
481 \ifx\@tempa\FV@Auto
482 \let\FV@FontSize\relax
483 \else
484 \def\FV@FontSize{#1}%
485 \fi}
486 \def\KV@FV@fontsize@default{\let\FV@FontSize\relax}
487 \define@key{FV}{baselinestretch}[auto]{%
488 \def\@tempa{#1}%
489 \ifx\@tempa\FV@Auto
490 \let\FV@BaseLineStretch\relax
491 \else
492 \def\FV@BaseLineStretch{\def\baselinestretch{#1}}%
493 \fi}
494 \def\KV@FV@baselinestretch@default{\let\FV@BaseLineStretch\relax}
495 \define@key{FV}{fontfamily}{%
496 \@ifundefined{FV@fontfamily@#1}%
497 {\def\FV@FontScanPrep{}\def\FV@FontFamily{\fontfamily{#1}}}
498 {\csname FV@fontfamily@#1\endcsname}}
499 \define@key{FV}{fontseries}{%
500 \def\@tempa{#1}%
501 \ifx\@tempa\FV@Auto
502 \let\FV@FontSeries\relax
503 \else
504 \def\FV@FontSeries{\fontseries{#1}}%
505 \fi}
506 \define@key{FV}{fontshape}{%
507 \def\@tempa{#1}%
508 \ifx\@tempa\FV@Auto
509 \let\FV@FontShape\relax
510 \else
511 \def\FV@FontShape{\fontshape{#1}}%
512 \fi}
513 \def\FV@MakeActive#1{%
514 \catcode`#1=\active
515 \def\next##1{\expandafter\def\expandafter\FV@MakeUnActive\expandafter{%
516 \FV@MakeUnActive\def##1{\string##1}}}%
517 \begingroup\lccode`~=`#1\relax\expandafter\next\expandafter~\endgroup}
518 \def\FV@MakeUnActive{}
519 \begingroup
520 \catcode`\`=\active
521 \gdef\FV@fontfamily@tt{\def\FV@FontScanPrep{\FV@MakeActive\`}\def\FV@FontFamily{\ttfamily\edef`{{\string`}}}}
522 \gdef\FV@fontfamily@cmtt{\def\FV@FontScanPrep{\FV@MakeActive\`}\def\FV@FontFamily{\edef`{{\string`}}\fontfamily{cmtt}}}
523 \endgroup
524 \@namedef{FV@fontfamily@cmtt-spanish}{\def\FV@FontScanPrep{}\def\FV@FontFamily{\fontfamily{cmtt}}}
525 \@namedef{FV@fontfamily@courier}{\def\FV@FontScanPrep{}\def\FV@FontFamily{\fontfamily{pcr}}}
526 \@namedef{FV@fontfamily@helvetica}{\def\FV@FontScanPrep{}\let\FV@FontFamily\sffamily}
527 % \def\FV@FontFamily{\fontfamily{phv}}}
528 \def\myFont{}
529 \@namedef{FV@fontfamily@myFont}{\def\FV@FontScanPrep{}\def\FV@FontFamily{\myFont}}
530 \fvset{fontfamily=tt,fontsize=auto,fontshape=auto,fontseries=auto,baselinestretch=auto}
531 \begingroup
532 \catcode`\ =\active
533 \catcode`\^^I=\active
534 \gdef\FV@DefineWhiteSpace{\def {\FV@Space}\def^^I{\FV@Tab}}%
535 \endgroup
536 \define@key{FV}{fileext}[.tex]{\def\FancyVerbFileExtension{#1}}
537 \define@key{FV}{defineactive}[]{\def\FancyVerbDefineActive{#1\relax}}
538 \define@key{FV}{defineactive*}{%
539 \expandafter\def\expandafter\FancyVerbDefineActive\expandafter{%
540 \FancyVerbDefineActive#1\relax}}
541 \fvset{defineactive,fileext=.tex}
542 \define@booleankey{FV}{showspaces}%
543 {\def\FV@Space{{\FancyVerbSpace}}}%
544 {\def\FV@Space{\ }}
545 %
546 % new definition for \verbvisiblespace 2020-01-13
547 \@ifundefined{verbvisiblespace}%
548 {%
549 \@ifundefined{textvisiblespace}%
550 {\begingroup\catcode`\ =12 \gdef\FancyVerbSpace{\tt }\endgroup}
551 {\def\FancyVerbSpace{\textvisiblespace}}
552 }%
553 {\def\FancyVerbSpace{\verbvisiblespace}}
554 %\@ifundefined{textvisiblespace}%
555 % {\begingroup\catcode`\ =12 \gdef\FancyVerbSpace{\tt }\endgroup}
556 % {\let\FancyVerbSpace\textvisiblespace}
557 %
558 \fvset{showspaces=false}
559 \def\FV@Tab{\hbox to\FancyVerbTabSize\fontdimen2\font{\hss\FV@TabChar}}
560 \define@key{FV}{tabsize}{%
561 \@tempcnta=#1\relax
562 \ifnum\@tempcnta>100
563 \FV@Error{Tab size too large: `\the\@tempcnta'. (Max size = 100)}\FV@eha
564 \else%
565 \edef\FancyVerbTabSize{\the\@tempcnta}%
566 \fi}
567 \define@booleankey{FV}{showtabs}%
568 {\def\FV@TabChar{\FancyVerbTab}}%
569 {\let\FV@TabChar\relax}
570 \fvset{tabsize=8,showtabs=false}
571 \def\FancyVerbTab{%
572 \valign{%
573 \vfil##\vfil\cr
574 \hbox{$\scriptscriptstyle-$}\cr
575 \hbox to 0pt{\hss$\scriptscriptstyle\rangle\mskip -.8mu$}\cr
576 \hbox{$\scriptstyle\mskip -3mu\mid\mskip -1.4mu$}\cr}}
577 \newbox\FV@TabBox
578 \def\FV@@ObeyTabsInit{%
579 \@tempdimb=\FancyVerbTabSize\fontdimen\tw@\font
580 \edef\FV@ObeyTabSize{\number\@tempdimb}%
581 \advance\@tempdimb\fontdimen\tw@\font
582 \advance\@tempdimb-\FancyVerbTabSize sp % Allow for rounding errors.
583 \edef\FV@@ObeyTabSize{\number\@tempdimb}%
584 \let\FV@ObeyTabs\FV@@ObeyTabs
585 \let\FV@Tab\FV@TrueTab}
586 \def\FV@@ObeyTabs#1{\setbox\FV@TabBox=\hbox{#1}\box\FV@TabBox}
587 \let\FV@ObeyTabs\relax
588 \def\FV@TrueTab{%
589 \egroup
590 \@tempdima=\FV@ObeyTabSize sp\relax
591 \@tempcnta=\wd\FV@TabBox
592 \advance\@tempcnta\FV@@ObeyTabSize\relax
593 \divide\@tempcnta\@tempdima
594 \multiply\@tempdima\@tempcnta
595 \advance\@tempdima-\wd\FV@TabBox
596 \setbox\FV@TabBox=\hbox\bgroup
597 \unhbox\FV@TabBox\kern\@tempdima\hbox to\z@{\hss\FV@TabChar}}
598 \define@booleankey{FV}{obeytabs}%
599 {\let\FV@ObeyTabsInit\FV@@ObeyTabsInit}%
600 {\let\FV@ObeyTabsInit\relax}
601 \fvset{obeytabs=false}
602 \define@key{FV}{formatcom}[]{\def\FancyVerbFormatCom{#1\relax}}
603 \define@key{FV}{formatcom*}{%
604 \expandafter\def\expandafter\FancyVerbFormatCom\expandafter{%
605 \FancyVerbFormatCom#1\relax}}
606 \fvset{formatcom}
607 \def\FancyVerbFormatLine#1{\FV@ObeyTabs{#1}}
608 \define@key{FV}{xleftmargin}{\def\FV@XLeftMargin{#1}}
609 \let\FV@XLeftMargin\z@
610 \define@key{FV}{xrightmargin}{\def\FV@XRightMargin{#1}}
611 \let\FV@XRightMargin\z@
612 \define@booleankey{FV}{resetmargins}%
613 {\let\if@FV@ResetMargins\iftrue}
614 {\let\if@FV@ResetMargins\iffalse}
615 \fvset{resetmargins=false}
616 \define@key{FV}{listparameters}{\def\FV@ListParameterHook{#1}}
617 \def\FV@ListParameterHook{}
618 \define@key{FV}{hfuzz}{%
619 \@tempdima=#1\relax
620 \edef\FancyVerbHFuzz{\number\@tempdima sp}}
621 \fvset{hfuzz=2pt}
622 \define@booleankey{FV}{samepage}%
623 {\def\FV@InterLinePenalty{\interlinepenalty\@M}}%
624 {\let\FV@InterLinePenalty\relax}
625 \fvset{samepage=false}
626 \def\FV@List#1{%
627 \begingroup
628 \FV@UseKeyValues
629 \FV@LeaveVMode
630 \if@inlabel\else\setbox\@labels=\box\voidb@x\fi
631 \FV@ListNesting{#1}%
632 \FV@ListParameterHook
633 \FV@ListVSpace
634 \FV@SetLineWidth
635 \FV@InterLinePenalty
636 \let\FV@ProcessLine\FV@ListProcessLine@i
637 \FV@CatCodes
638 \FV@FormattingPrep
639 \FV@ObeyTabsInit
640 \FV@BeginListFrame}
641 \def\FV@LeaveVMode{%
642 \if@noskipsec
643 \leavevmode
644 \else
645 \if@FV@ResetMargins\if@inlabel\leavevmode\fi\fi
646 \fi
647 \ifvmode\@noparlisttrue\else\@noparlistfalse\unskip\par\fi}
648 \def\FV@ListNesting#1{%
649 \if@FV@ResetMargins
650 \@listdepth=\z@
651 \else
652 \ifnum\@listdepth>5\relax
653 \@toodeep
654 \else
655 \advance\@listdepth\@ne
656 \fi
657 \fi
658 \rightmargin\z@
659 \csname @list\romannumeral\the\@listdepth\endcsname
660 \ifnum#1=\z@
661 \rightmargin\z@
662 \leftmargin\z@
663 \fi}
664 \def\FV@ListVSpace{%
665 % \@topsepadd\topsep
666 \@topsepadd=\FancyVerbVspace
667 \if@noparlist\advance\@topsepadd\partopsep\fi
668 \if@inlabel
669 \vskip\parskip
670 \else
671 \if@nobreak
672 \vskip\parskip
673 \clubpenalty\@M
674 \else
675 \addpenalty\@beginparpenalty
676 \@topsep\@topsepadd
677 \advance\@topsep\parskip
678 \addvspace\@topsep
679 \fi
680 \fi
681 \global\@nobreakfalse
682 \global\@inlabelfalse
683 \global\@minipagefalse
684 \global\@newlistfalse}
685 \def\FV@SetLineWidth{%
686 \if@FV@ResetMargins\else
687 \advance\leftmargin\@totalleftmargin
688 \fi
689 \advance\leftmargin\FV@XLeftMargin\relax
690 \advance\rightmargin\FV@XRightMargin\relax
691 \linewidth\hsize
692 \advance\linewidth-\leftmargin
693 \advance\linewidth-\rightmargin
694 \hfuzz\FancyVerbHFuzz\relax}
695 \def\FV@ListProcessLine#1{%
696 \hbox to \hsize{%
697 \kern\leftmargin
698 \hbox to \linewidth{%
699 \FV@LeftListNumber
700 \FV@LeftListFrame
701 \FancyVerbFormatLine{#1}\hss
702 %% DG/SR modification begin - Jan. 28, 1998 (for numbers=right add-on)
703 %% \FV@RightListFrame}%
704 \FV@RightListFrame
705 \FV@RightListNumber}%
706 %% DG/SR modification end
707 \hss}}
708 \def\FV@ListProcessLine@i#1{%
709 \hbox{%
710 \ifvoid\@labels\else
711 \hbox to \z@{\kern\@totalleftmargin\box\@labels\hss}%
712 \fi
713 \FV@ListProcessLine{#1}}%
714 \let\FV@ProcessLine\FV@ListProcessLine@ii}
715 \def\FV@ListProcessLine@ii#1{%
716 \setbox\@tempboxa=\FV@ListProcessLine{#1}%
717 \let\FV@ProcessLine\FV@ListProcessLine@iii}
718 \def\FV@ListProcessLine@iii#1{%
719 {\advance\interlinepenalty\clubpenalty\penalty\interlinepenalty}%
720 \box\@tempboxa
721 \setbox\@tempboxa=\FV@ListProcessLine{#1}%
722 \let\FV@ProcessLine\FV@ListProcessLine@iv}
723 \def\FV@ListProcessLine@iv#1{%
724 \penalty\interlinepenalty
725 \box\@tempboxa
726 \setbox\@tempboxa=\FV@ListProcessLine{#1}}%
727 \def\FV@EndList{%
728 \FV@ListProcessLastLine
729 \FV@EndListFrame
730 \@endparenv
731 \endgroup
732 \@endpetrue}
733 \def\FV@ListProcessLastLine{%
734 \ifx\FV@ProcessLine\FV@ListProcessLine@iv
735 {\advance\interlinepenalty\widowpenalty\penalty\interlinepenalty}%
736 \box\@tempboxa
737 \else
738 \ifx\FV@ProcessLine\FV@ListProcessLine@iii
739 {\advance\interlinepenalty\widowpenalty
740 \advance\interlinepenalty\clubpenalty
741 \penalty\interlinepenalty}%
742 \box\@tempboxa
743 \else
744 \ifnum\FancyVerbStopNum>\@ne
745 \ifx\FV@ProcessLine\FV@ListProcessLine@i
746 \FV@Error{Empty verbatim environment}{}%
747 \FV@ProcessLine{}%
748 \fi
749 \fi
750 \fi
751 \fi}
752 \def\FV@VerbatimBegin{\FV@List\z@}
753 \def\FV@VerbatimEnd{\FV@EndList}
754 \def\FVB@Verbatim{\FV@VerbatimBegin\FV@Scan}
755 \def\FVE@Verbatim{\FV@VerbatimEnd}
756 \DefineVerbatimEnvironment{Verbatim}{Verbatim}{}
757 \def\FV@UseVerbatim#1{%
758 \FV@VerbatimBegin#1\FV@VerbatimEnd
759 \@doendpe\global\@ignorefalse\ignorespaces}
760 \def\VerbatimInput{\FV@Command{}{VerbatimInput}}
761 \def\FVC@VerbatimInput#1{\FV@UseVerbatim{\FV@Input{#1}}}
762 \def\FV@LVerbatimBegin{\FV@List\@ne}
763 \def\FV@LVerbatimEnd{\FV@EndList}
764 \def\FVB@LVerbatim{\FV@LVerbatimBegin\FV@Scan}
765 \def\FVE@LVerbatim{\FV@LVerbatimEnd}
766 \DefineVerbatimEnvironment{LVerbatim}{LVerbatim}{}
767 \def\FV@LUseVerbatim#1{%
768 \FV@LVerbatimBegin#1\FV@LVerbatimEnd
769 \@doendpe\global\@ignorefalse\ignorespaces}
770 \def\LVerbatimInput{\FV@Command{}{LVerbatimInput}}
771 \def\FVC@LVerbatimInput#1{\FV@LUseVerbatim{\FV@Input{#1}}}
772 \def\FV@Frame@none{%
773 \let\FV@BeginListFrame\relax
774 \let\FV@LeftListFrame\relax
775 \let\FV@RightListFrame\relax
776 \let\FV@EndListFrame\relax}
777 \def\FV@Frame@single{%
778 \let\FV@BeginListFrame\FV@BeginListFrame@Single
779 \let\FV@LeftListFrame\FV@LeftListFrame@Single
780 \let\FV@RightListFrame\FV@RightListFrame@Single
781 \let\FV@EndListFrame\FV@EndListFrame@Single}
782 \def\FV@Frame@lines{%
783 \let\FV@BeginListFrame\FV@BeginListFrame@Lines
784 \let\FV@LeftListFrame\relax
785 \let\FV@RightListFrame\relax
786 \let\FV@EndListFrame\FV@EndListFrame@Lines}
787 \def\FV@Frame@topline{%
788 \let\FV@BeginListFrame\FV@BeginListFrame@Lines
789 \let\FV@LeftListFrame\relax
790 \let\FV@RightListFrame\relax
791 \let\FV@EndListFrame\relax}
792 \def\FV@Frame@bottomline{%
793 \let\FV@BeginListFrame\relax
794 \let\FV@LeftListFrame\relax
795 \let\FV@RightListFrame\relax
796 \let\FV@EndListFrame\FV@EndListFrame@Lines}
797 %% To define a frame with only a left line
798 \def\FV@Frame@leftline{%
799 % To define the \FV@FrameFillLine macro (from \FV@BeginListFrame)
800 \ifx\FancyVerbFillColor\relax
801 \let\FV@FrameFillLine\relax
802 \else
803 \@tempdima\FV@FrameRule\relax
804 \multiply\@tempdima-\tw@
805 \edef\FV@FrameFillLine{%
806 {\noexpand\FancyVerbFillColor{\vrule\@width\number\@tempdima sp}%
807 \kern-\number\@tempdima sp}}%
808 \fi
809 \let\FV@BeginListFrame\relax
810 \let\FV@LeftListFrame\FV@LeftListFrame@Single
811 \let\FV@RightListFrame\relax
812 \let\FV@EndListFrame\relax}
813 \def\FV@BeginListFrame@Single{%
814 \lineskip\z@
815 \baselineskip\z@
816 \ifx\FancyVerbFillColor\relax
817 \let\FV@FrameFillLine\relax
818 \else
819 \@tempdima\FV@FrameRule\relax
820 \multiply\@tempdima-\tw@
821 \edef\FV@FrameFillLine{%
822 {\noexpand\FancyVerbFillColor{\vrule\@width\number\@tempdima sp}%
823 \kern-\number\@tempdima sp}}%
824 \fi
825 %% DG/SR modification begin - May. 19, 1998
826 %% \FV@SingleFrameLine
827 \FV@SingleFrameLine{\z@}%
828 %% DG/SR modification end
829 \penalty\@M
830 \FV@SingleFrameSep
831 \penalty\@M
832 }
833 %% DG/SR modification begin - May. 19, 1998
834 \define@key{FV}{label}{%
835 \def\@tempa{#1}%
836 \ifx\@tempa\FV@None
837 \let\FV@LabelBegin\relax
838 \let\FV@LabelEnd\relax
839 \else
840 \FV@Label@i#1\@nil%
841 \fi}
842 \def\FV@Label@i{\@ifnextchar[{\FV@Label@ii}{\FV@Label@ii[]}}
843 \def\FV@Label@ii[#1]#2\@nil{%
844 \def\@tempa{#1}%
845 \ifx\@tempa\empty
846 \def\FV@LabelBegin{#2}%
847 \else
848 \def\FV@LabelBegin{#1}%
849 \def\FV@LabelPositionBottomLine{\@ne}%
850 \fi
851 \def\FV@LabelEnd{#2}}
852 \fvset{label=none}
853 \define@key{FV}{labelposition}[none]{%
854 \@ifundefined{FV@LabelPosition@#1}%
855 {\FV@Error{Label position `#1' not defined.}\FV@eha}%
856 {\@nameuse{FV@LabelPosition@#1}}}
857 \def\FV@LabelPosition@none{%
858 \let\FV@LabelPositionTopLine\relax%
859 \let\FV@LabelPositionBottomLine\relax}
860 \def\FV@LabelPosition@topline{%
861 \def\FV@LabelPositionTopLine{\@ne}%
862 \let\FV@LabelPositionBottomLine\relax}
863 \def\FV@LabelPosition@bottomline{%
864 \let\FV@LabelPositionTopLine\relax%
865 \def\FV@LabelPositionBottomLine{\@ne}}
866 \def\FV@LabelPosition@all{%
867 \def\FV@LabelPositionTopLine{\@ne}%
868 \def\FV@LabelPositionBottomLine{\@ne}}
869 \fvset{labelposition=topline}
870 \def\FV@SingleFrameLine#1{%
871 \hbox to\z@{%
872 \kern\leftmargin
873 \ifnum#1=\z@% top line?
874 \let\FV@Label\FV@LabelBegin
875 \else
876 \let\FV@Label\FV@LabelEnd
877 \fi
878 \ifx\FV@Label\relax
879 \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}%
880 \else
881 \ifnum#1=\z@% top line
882 \setbox\z@\hbox{\strut\enspace\FV@LabelBegin\enspace\strut}%
883 \else
884 \setbox\z@\hbox{\strut\enspace\FV@LabelEnd\enspace\strut}%
885 \fi
886 \@tempdimb=\dp\z@
887 \advance\@tempdimb -.5\ht\z@
888 \@tempdimc=\linewidth
889 \advance\@tempdimc -\wd\z@
890 \divide\@tempdimc\tw@
891 \ifnum#1=\z@ % Top line
892 \ifx\FV@LabelPositionTopLine\relax
893 \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}%
894 \else
895 \FV@FrameLineWithLabel
896 \fi
897 \else % Bottom line
898 \ifx\FV@LabelPositionBottomLine\relax
899 \FancyVerbRuleColor{\vrule \@width\linewidth \@height\FV@FrameRule}%
900 \else
901 \FV@FrameLineWithLabel
902 \fi
903 \fi
904 \fi
905 \hss}}
906 \def\FV@FrameLineWithLabel{%
907 \ht\z@\@tempdimb\dp\z@\@tempdimb%
908 \FancyVerbRuleColor{%
909 \vrule \@width\@tempdimc \@height\FV@FrameRule
910 \raise\@tempdimb\box\z@
911 \vrule \@width\@tempdimc \@height\FV@FrameRule}}
912 \def\FV@BeginListFrame@Lines{%
913 \begingroup
914 \lineskip\z@skip
915 \FV@SingleFrameLine{\z@}%
916 % \kern-0.5\baselineskip\relax %% 20220604 (hv)
917 \nointerlineskip %% added 20220604 (hv)
918 \baselineskip\z@skip
919 \kern\FV@FrameSep\relax
920 \penalty\@M% prevent a pagebreak _after_ the line 20220602 (hv)
921 \endgroup}%
922 \def\FV@EndListFrame@Lines{%
923 \begingroup
924 \baselineskip\z@skip
925 \kern\FV@FrameSep\relax
926 \nointerlineskip %% added 20220604 (hv)
927 \penalty\@M% prevent a pagebreak _before_ the line 20220602 (hv)
928 \FV@SingleFrameLine{\@ne}%
929 \endgroup}
930 \def\FV@SingleFrameSep{%
931 \hbox to \z@{%
932 \kern\leftmargin
933 \hbox to\linewidth{%
934 \FancyVerbRuleColor{%
935 \ifx\FancyVerbFillColor\relax
936 \vrule\@width 0pt\@height\FV@FrameSep\relax
937 \fi
938 \vrule\@width\FV@FrameRule\relax
939 \ifx\FancyVerbFillColor\relax
940 \hfil
941 \else
942 {\FancyVerbFillColor\leaders\hrule\@height\FV@FrameSep\hfil}%
943 \fi
944 \ifx\FancyVerbFillColor\relax
945 \vrule\@width 0pt\@height\FV@FrameSep\relax
946 \fi
947 \vrule\@width\FV@FrameRule\relax}}%
948 \hss}}
949 \def\FV@LeftListFrame@Single{%
950 \strut
951 {\FancyVerbRuleColor{\vrule \@width\FV@FrameRule}}%
952 \FV@FrameFillLine
953 \ifx\FancyVerbFillColor\relax
954 \kern\FV@FrameSep
955 \else
956 {\noexpand\leavevmode\FancyVerbFillColor{\vrule\@width\FV@FrameSep}}%
957 \fi}
958 \def\FV@RightListFrame@Single{%
959 \ifx\FancyVerbFillColor\relax
960 \kern\FV@FrameSep
961 \else
962 {\noexpand\leavevmode\FancyVerbFillColor{\vrule\@width\FV@FrameSep}}%
963 \fi
964 {\noexpand\leavevmode\FancyVerbRuleColor{\vrule\@width\FV@FrameRule}}}
965 \def\FV@EndListFrame@Single{%
966 \penalty\@M
967 \FV@SingleFrameSep
968 \penalty\@M
969 \FV@SingleFrameLine{\@ne}}
970 \define@key{FV}{framerule}{%
971 \@tempdima=#1\relax
972 \edef\FV@FrameRule{\number\@tempdima sp\relax}}
973 \def\KV@FV@framerule@default{\let\FV@FrameRule\fboxrule}
974 \define@key{FV}{framesep}{%
975 \@tempdima=#1\relax
976 \edef\FV@FrameSep{\number\@tempdima sp\relax}}
977 \def\KV@FV@framesep@default{\let\FV@FrameSep\fboxsep}
978 \fvset{framerule,framesep}
979 \define@key{FV}{rulecolor}{%
980 \def\@tempa{#1}%
981 \ifx\@tempa\FV@None
982 \let\FancyVerbRuleColor\relax
983 \else
984 \let\FancyVerbRuleColor\@tempa
985 \fi}
986 \define@key{FV}{fillcolor}{%
987 \def\@tempa{#1}%
988 \ifx\@tempa\FV@None
989 \let\FancyVerbFillColor\relax
990 \else
991 \let\FancyVerbFillColor\@tempa
992 \fi}
993 \fvset{rulecolor=none,fillcolor=none}
994 \def\FV@Frame@double{%
995 \let\FV@FrameBegin\FV@FrameBegin@double
996 \let\FV@FrameLine\FV@FrameLine@double
997 \let\FV@FrameEnd\FV@FrameEnd@double}
998 \define@key{FV}{frame}[none]{%
999 \@ifundefined{FV@Frame@#1}%
1000 {\FV@Error{Frame style `#1' not defined.}\FV@eha}%
1001 {\@nameuse{FV@Frame@#1}}}
1002 \fvset{frame=none}
1003 \newcounter{FancyVerbLine}
1004 \define@key{FV}{firstnumber}[auto]{%
1005 \def\@tempa{#1}\def\@tempb{auto}%
1006 \def\FV@FirstNumber{#1}% added 2021-08-12
1007 \ifx\@tempa\@tempb
1008 \def\FV@SetLineNo{%
1009 \c@FancyVerbLine\FV@CodeLineNo%
1010 \advance\c@FancyVerbLine\m@ne}%
1011 \else%
1012 \def\@tempb{last}%
1013 \ifx\@tempa\@tempb
1014 \let\FV@SetLineNo\relax%
1015 \else%
1016 \def\FV@SetLineNo{%
1017 \c@FancyVerbLine#1%
1018 \advance\c@FancyVerbLine\m@ne}%
1019 \fi%
1020 \fi}
1021 \define@booleankey{FV}{numberblanklines}%
1022 {\let\if@FV@NumberBlankLines\iftrue}
1023 {\let\if@FV@NumberBlankLines\iffalse}
1024 \fvset{numberblanklines=true}
1025 \def\FV@refstepcounter#1{%
1026 \stepcounter{#1}%
1027 \protected@edef\@currentlabel{\csname p@#1\endcsname\arabic{FancyVerbLine}}%
1028 }
1029 \def\FV@StepLineNo{%
1030 \FV@SetLineNo%
1031 \def\FV@StepLineNo{%
1032 \if@FV@NumberBlankLines%
1033 \FV@refstepcounter{FancyVerbLine}%
1034 \else%
1035 \ifx\FV@Line\empty%
1036 \else%
1037 \FV@refstepcounter{FancyVerbLine}%
1038 \fi%
1039 \fi}%
1040 \FV@StepLineNo}
1041 \def\theFancyVerbLine{\rmfamily\tiny\arabic{FancyVerbLine}}
1042 \define@key{FV}{numbers}[none]{%
1043 \@ifundefined{FV@Numbers@#1}%
1044 {\FV@Error{Numbers style `#1' not defined.}\FV@eha}%
1045 {\@nameuse{FV@Numbers@#1}}}
1046 \def\FV@Numbers@none{%
1047 \let\FV@LeftListNumber\relax
1048 \let\FV@RightListNumber\relax}
1049 \newcount\FV@StepNumber
1050 \define@key{FV}{stepnumber}{\FV@StepNumber#1}
1051 \def\KV@FV@stepnumber@default{\FV@StepNumber\@ne}
1052 \fvset{stepnumber}
1053 \def\FV@Numbers@left{%
1054 \let\FV@RightListNumber\relax
1055 \def\FV@LeftListNumber{%
1056 \@tempcnta=\FV@CodeLineNo
1057 \@tempcntb=\FV@CodeLineNo
1058 \divide\@tempcntb\FV@StepNumber
1059 \multiply\@tempcntb\FV@StepNumber
1060 \ifnum\@tempcnta=\@tempcntb
1061 \if@FV@NumberBlankLines
1062 \hbox to\z@{\hss\theFancyVerbLine\kern\FV@NumberSep}%
1063 \else
1064 \ifx\FV@Line\empty
1065 \else
1066 \hbox to\z@{\hss\theFancyVerbLine\kern\FV@NumberSep}%
1067 \fi
1068 \fi
1069 \fi}}
1070 \def\FV@Numbers@right{%
1071 \let\FV@LeftListNumber\relax
1072 \def\FV@RightListNumber{%
1073 \@tempcnta=\FV@CodeLineNo
1074 \@tempcntb=\FV@CodeLineNo
1075 \divide\@tempcntb\FV@StepNumber
1076 \multiply\@tempcntb\FV@StepNumber
1077 \ifnum\@tempcnta=\@tempcntb
1078 %% DG/SR modification begin - Apr. 28, 1998
1079 %% \hbox to \z@{\kern\FV@NumberSep\theFancyVerbLine\hss}%
1080 \if@FV@NumberBlankLines
1081 \hbox to\z@{\kern\FV@NumberSep\theFancyVerbLine\hss}%
1082 \else
1083 \ifx\FV@Line\empty
1084 \else
1085 \hbox to\z@{\kern\FV@NumberSep\theFancyVerbLine\hss}%
1086 \fi
1087 \fi
1088 %% DG/SR modification end
1089 \fi}}
1090 %% DG modification end
1091 \define@key{FV}{numbersep}{%
1092 \@tempdima=#1\relax
1093 \edef\FV@NumberSep{\number\@tempdima sp\relax}}
1094 \fvset{numbers=none,numbersep=12pt,firstnumber=auto}
1095 \def\FV@BVerbatimBegin{%
1096 \begingroup
1097 \FV@UseKeyValues
1098 \FV@BeginVBox
1099 \let\FV@ProcessLine\FV@BProcessLine
1100 \FV@FormattingPrep
1101 \FV@ObeyTabsInit}%
1102 \def\FV@BVerbatimEnd{\FV@EndVBox\endgroup}
1103 \def\FV@BeginVBox{%
1104 \leavevmode
1105 \hbox\ifx\FV@boxwidth\relax\else to\FV@boxwidth\fi\bgroup
1106 \ifcase\FV@baseline\vbox\or\vtop\or$\vcenter\fi\bgroup}
1107 \def\FV@EndVBox{\egroup\ifmmode$\fi\hfil\egroup}
1108 \define@key{FV}{boxwidth}{%
1109 \def\@tempa{#1}\def\@tempb{auto}%
1110 \ifx\@tempa\@tempb
1111 \let\FV@boxwidth\relax
1112 \else
1113 \@tempdima=#1\relax
1114 \edef\FV@boxwidth{\number\@tempdima sp}%
1115 \fi}
1116 \def\KV@FV@boxwidth@default{\let\FV@boxwidth\relax}
1117 \define@key{FV}{baseline}{%
1118 \if t#1\@empty\let\FV@baseline\@ne\else
1119 \if c#1\@empty\let\FV@baseline\tw@\else\let\FV@baseline\z@\fi
1120 \fi}
1121 \fvset{baseline=b,boxwidth}
1122 \def\FV@BProcessLine#1{\hbox{\FancyVerbFormatLine{#1}}}
1123 \def\FVB@BVerbatim{\FV@BVerbatimBegin\FV@Scan}
1124 \def\FVE@BVerbatim{\FV@BVerbatimEnd}
1125 \DefineVerbatimEnvironment{BVerbatim}{BVerbatim}{}
1126 \def\FV@BUseVerbatim#1{\FV@BVerbatimBegin#1\FV@BVerbatimEnd}
1127 \def\BVerbatimInput{\FV@Command{}{BVerbatimInput}}
1128 \def\FVC@BVerbatimInput#1{\FV@BUseVerbatim{\FV@Input{#1}}}
1129 \def\SaveVerbatim{\FV@Environment{}{SaveVerbatim}}
1130 \def\FVB@SaveVerbatim#1{%
1131 \@bsphack
1132 \begingroup
1133 \FV@UseKeyValues
1134 %% \FV@BeginVBox
1135 %% \let\FV@ProcessLine\FV@BProcessLine
1136 %% \FV@FormattingPrep
1137 %% \FV@ObeyTabsInit%
1138 %%
1139 \def\SaveVerbatim@Name{#1}%
1140 \gdef\FV@TheVerbatim{}%
1141 \def\FV@ProcessLine##1{%
1142 \expandafter\gdef\expandafter\FV@TheVerbatim\expandafter{%
1143 % \FV@TheVerbatim\FV@ProcessLine{##1}}}% 2021-08-12
1144 % \gdef\FV@TheVerbatim{}%
1145 \FV@TheVerbatim\advance\c@FancyVerbLine\@ne\FV@ProcessLine{##1}}}%
1146 \gdef\FV@TheVerbatim{%
1147 \edef\@tempa{\FV@FirstNumber}%
1148 \def\@tempb{auto}%
1149 \ifx\@tempa\@tempb%
1150 \c@FancyVerbLine\FV@CodeLineNo%
1151 \else%
1152 \c@FancyVerbLine\FV@FirstNumber%
1153 \advance\c@FancyVerbLine\m@ne%
1154 \fi%
1155 }%
1156 \FV@Scan}
1157 \def\FVE@SaveVerbatim{%
1158 \expandafter\global\expandafter\let
1159 \csname FV@SV@\SaveVerbatim@Name\endcsname\FV@TheVerbatim
1160 %% \expandafter\gdef
1161 %% \csname FV@SV@\SaveVerbatim@Name\endcsname{\FV@TheVerbatim}
1162 %% \FV@EndVBox
1163 %% \endgroup}
1164 \endgroup\@esphack}
1165 \DefineVerbatimEnvironment{SaveVerbatim}{SaveVerbatim}{}
1166 \def\FV@CheckIfSaved#1#2{%
1167 \@ifundefined{FV@SV@#1}%
1168 {\FV@Error{No verbatim text has been saved under name `#1'}\FV@eha}%
1169 {#2{\csname FV@SV@#1\endcsname}}}
1170 \def\UseVerbatim{\FV@Command{}{UseVerbatim}}
1171 \def\FVC@UseVerbatim#1{\FV@CheckIfSaved{#1}{\FV@UseVerbatim}}
1172 \def\LUseVerbatim{\FV@Command{}{LUseVerbatim}}
1173 \def\FVC@LUseVerbatim#1{\FV@CheckIfSaved{#1}{\FV@LUseVerbatim}}
1174 \def\BUseVerbatim{\FV@Command{}{BUseVerbatim}}
1175 \def\FVC@BUseVerbatim#1{\FV@CheckIfSaved{#1}{\FV@BUseVerbatim}}
1176 \newwrite\FV@OutFile
1177 \def\VerbatimOut{\FV@Environment{}{VerbatimOut}}
1178 \def\FVB@VerbatimOut#1{%
1179 \@bsphack
1180 \begingroup
1181 \FV@UseKeyValues
1182 \FV@DefineWhiteSpace
1183 \def\FV@Space{\space}%
1184 \FV@DefineTabOut
1185 \def\FV@ProcessLine{\immediate\write\FV@OutFile}%
1186 \immediate\openout\FV@OutFile #1\relax
1187 \let\FV@FontScanPrep\relax
1188 %% DG/SR modification begin - May. 18, 1998 (to avoid problems with ligatures)
1189 \let\@noligs\relax
1190 %% DG/SR modification end
1191 \FV@Scan}
1192 \def\FVE@VerbatimOut{\immediate\closeout\FV@OutFile\endgroup\@esphack}
1193 \DefineVerbatimEnvironment{VerbatimOut}{VerbatimOut}{}
1194 \def\FV@DefineTabOut{%
1195 \def\FV@Tab{}%
1196 \@tempcnta=\FancyVerbTabSize\relax
1197 \loop\ifnum\@tempcnta>\z@
1198 \edef\FV@Tab{\FV@Tab\space}%
1199 \advance\@tempcnta\m@ne
1200 \repeat}
1201 \def\SaveVerb{\FV@Command{}{SaveVerb}}
1202 \begingroup
1203 \catcode`\^^M=\active%
1204 \gdef\FVC@SaveVerb#1#2{%
1205 \@namedef{FV@SV@#1}{}%
1206 \begingroup%
1207 \FV@UseKeyValues%
1208 \FV@CatCodes%
1209 \outer\def^^M{\FV@EOL}%
1210 \global\let\@tempg\FancyVerbAfterSave%
1211 \catcode`#2=12%
1212 \def\@tempa{\def\FancyVerbGetVerb####1####2}%
1213 \expandafter\@tempa\string#2{\endgroup\@namedef{FV@SV@#1}{##2}\@tempg}%
1214 \FancyVerbGetVerb\FV@EOL}%
1215 \endgroup
1216 \def\FV@EOL{%
1217 \endgroup
1218 \FV@Error%
1219 {Could not find the end delimiter of a short verb command}%
1220 {You probably just forget the end delimiter of a \string\Verb\space or
1221 \string\SaveVerb^^J%
1222 command, or you broke the literal text across input lines.^^J%
1223 Hit <return> to procede.}}
1224 \define@key{FV}{aftersave}{\def\FancyVerbAfterSave{#1}}
1225 \fvset{aftersave=}
1226 \define@key{FV}{reflabel}{\if$#1$\else\label{#1}\fi}
1227 %\fvset{reflabel=}
1228
1229 \def\FV@UseVerb#1{\mbox{\FV@UseKeyValues\FV@FormattingPrep#1}}
1230 \DeclareRobustCommand\UseVerb{\FV@Command{}{UseVerb}}
1231 \def\FVC@UseVerb#1{%
1232 \@ifundefined{FV@SV@#1}%
1233 {\FV@Error{Short verbatim text never saved to name `#1'}\FV@eha}%
1234 {\FV@UseVerb{\@nameuse{FV@SV@#1}}}}
1235 \def\Verb{\FV@Command{}{Verb}}
1236 \begingroup
1237 \catcode`\^^M=\active%
1238 \gdef\FVC@Verb#1{%
1239 \begingroup%
1240 \FV@UseKeyValues%
1241 \FV@FormattingPrep%
1242 \FV@CatCodes%
1243 \outer\def^^M{}%
1244 \catcode`#1=12%
1245 \def\@tempa{\def\FancyVerbGetVerb####1####2}%
1246 \expandafter\@tempa\string#1{\mbox{##2}\endgroup}%
1247 \FancyVerbGetVerb\FV@EOL}%
1248 \endgroup
1249 \def\DefineShortVerb{\FV@Command{}{DefineShortVerb}}
1250 \def\FVC@DefineShortVerb#1{%
1251 \@ifundefined{FV@CC@\string#1}%
1252 {\FVC@@DefineShortVerb#1}%
1253 {\FV@Error{`\expandafter\@gobble\string#1' is already a short
1254 verb character.}\FV@eha}}
1255 \def\FVC@@DefineShortVerb#1{%
1256 \begingroup
1257 \lccode`\~=`#1%
1258 \lowercase{\gdef\@tempg{\edef~}\global\let\@temph~}%
1259 \endgroup
1260 \expandafter\let\csname FV@AC@\string#1\endcsname\@temph
1261 \expandafter\edef\csname FV@CC@\string#1\endcsname{\the\catcode`#1}%
1262 \expandafter\let\csname FV@KV@\string#1\endcsname\FV@KeyValues
1263 \@tempg{%
1264 \let\noexpand\FV@KeyValues\expandafter\noexpand
1265 \csname FV@KV@\string#1\endcsname
1266 \noexpand\FVC@Verb\expandafter\@gobble\string#1}%
1267 \expandafter\def\expandafter\dospecials\expandafter{\dospecials\do#1}%
1268 \expandafter\def\expandafter\@sanitize\expandafter{\@sanitize\@makeother#1}%
1269 \catcode`#1=\active}%
1270 \def\UndefineShortVerb#1{%
1271 \@ifundefined{FV@CC@\string#1}%
1272 {\FV@Error{`\expandafter\@gobble\string#1' is not a short
1273 verb character}\FV@eha}%
1274 {\FV@UndefineShortVerb#1}}
1275 \def\FV@UndefineShortVerb#1{%
1276 \catcode`#1=\csname FV@CC@\string#1\endcsname
1277 %% DG/SR modification begin - Jun. 12, 1998
1278 \expandafter\let\csname FV@CC@\string#1\endcsname\relax
1279 %% DG/SR modification end
1280 \begingroup
1281 \lccode`\~=`#1%
1282 \lowercase{\gdef\@tempg{\let~}}%
1283 \endgroup
1284 \expandafter\@tempg\csname FV@AC@\string#1\endcsname
1285 \def\@tempa##1\do#1##2\@nil##3\@nil##4\@@nil{##3\def\dospecials{##1##2}\fi}%
1286 \expandafter\@tempa\dospecials\@nil\iftrue\@nil\do#1\@nil\iffalse\@nil\@@nil
1287 \def\@tempa##1\@makeother#1##2\@nil##3\@nil##4\@@nil{%
1288 ##3\def\@sanitize{##1##2}\fi}%
1289 \expandafter\@tempa\@sanitize\@nil\iftrue\@nil\do#1\@nil\iffalse\@nil\@@nil}
1290 \def\SaveMVerb{\FV@Command{}{SaveMVerb}}
1291 \begingroup
1292 \catcode`\^^M=\active%
1293 \gdef\FVC@SaveMVerb#1#2{%
1294 \@ifundefined{FV@SVM@#1}{}%
1295 {\FV@Error{Moving verbatim name `#1' already used}%
1296 {I will overwrite the old definition. Hit <return> to continue.}}%
1297 \global\@namedef{FV@SVM@#1}{}%
1298 \begingroup%
1299 \let\FV@SavedKeyValues\FV@KeyValues%
1300 \FV@UseKeyValues%
1301 \FV@CatCodes%
1302 \outer\def^^M{}%
1303 \global\let\@tempg\FancyVerbAfterSave%
1304 \catcode`#2=12%
1305 \def\@tempa{\def\FancyVerbGetVerb####1####2}%
1306 \expandafter\@tempa\string#2{%
1307 \if@filesw
1308 \FV@DefineWhiteSpace%
1309 \let\FV@Space\space%
1310 \let\FV@Tab\space%
1311 \FV@MakeUnActive%
1312 \let\protect\string
1313 \immediate\write\@auxout{%
1314 \noexpand\SaveGVerb[\FV@SavedKeyValues]{#1}\string#2##2\string#2}%
1315 \fi
1316 \endgroup%
1317 \@namedef{FV@SV@#1}{##2}%
1318 \@tempg}%
1319 \FancyVerbGetVerb\FV@EOL}%
1320 \endgroup
1321 \def\SaveGVerb{\FV@Command{}{SaveGVerb}}
1322 \begingroup
1323 \catcode`\^^M=\active%
1324 \gdef\FVC@SaveGVerb#1#2{%
1325 \global\@namedef{FV@SVG@#1}{}%
1326 \begingroup%
1327 \FV@UseKeyValues%
1328 \FV@CatCodes%
1329 \outer\def^^M{}%
1330 \catcode`#2=12%
1331 \def\@tempa{\def\FancyVerbGetVerb####1####2}%
1332 \expandafter\@tempa\string#2{\endgroup\global\@namedef{FV@SVG@#1}{##2}}%
1333 \FancyVerbGetVerb\FV@EOL}%
1334 \endgroup
1335 \def\UseMVerb{\protect\pUseMVerb}
1336 \def\pUseMVerb{\FV@Command{}{pUseMVerb}}
1337 \def\FVC@pUseMVerb#1{%
1338 \expandafter\ifx \csname FV@SVM@#1\endcsname\relax
1339 \expandafter\ifx \csname FV@SVG@#1\endcsname\relax
1340 \@warning{Moving verbatim text not defined for name `#1'}\FV@eha
1341 {\bf ??}%
1342 \else
1343 \FV@UseVerb{\@nameuse{FV@SVG@#1}}%
1344 \fi
1345 \else
1346 \FV@UseVerb{\@nameuse{FV@SVM@#1}}%
1347 \fi}
1348 \expandafter\ifx\csname documentclass\endcsname\relax
1349 \def\lrbox#1{%
1350 \edef\@tempa{%
1351 \endgroup
1352 \setbox#1\hbox{%
1353 \begingroup\aftergroup}%
1354 \def\noexpand\@currenvir{\@currenvir}}%
1355 %\def\noexpand\@currenvline{\on@line}}%
1356 \@tempa
1357 \@endpefalse
1358 \bgroup
1359 \ignorespaces}
1360 \def\endlrbox{\unskip\egroup}
1361 \fi
1362 %
1363 %%
1364 \InputIfFileExists{fancyvrb.cfg}{}{}
1365 %%
1366 \endinput
1367 %%
1368 %% End of file `fancyvrb.sty'.