Debian Codegraph @

texmf-dist/source/latex/newvbtm/newvbtm.dtx

raw
1 % \iffalse
2 %<newvbtm>%% Style file `newvbtm'.
3 %<varvbtm>%% Style file `varvbtm'.
4 %% Copyright (C) 1999-2002 Hiroshi Nakashima <[email protected]>
5 %% (Toyohashi Univ. of Tech.)
6 %%
7 %% This program can be redistributed and/or modified under the terms
8 %% of the LaTeX Project Public License distributed from CTAN
9 %% archives in directory macros/latex/base/lppl.txt; either
10 %% version 1 of the License, or any later version.
11 %%
12 % \fi
13 %
14 % \CheckSum{578}
15 %% \CharacterTable
16 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
17 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
18 %% Digits \0\1\2\3\4\5\6\7\8\9
19 %% Exclamation \! Double quote \" Hash (number) \#
20 %% Dollar \$ Percent \% Ampersand \&
21 %% Acute accent \' Left paren \( Right paren \)
22 %% Asterisk \* Plus \+ Comma \,
23 %% Minus \- Point \. Solidus \/
24 %% Colon \: Semicolon \; Less than \<
25 %% Equals \= Greater than \> Question mark \?
26 %% Commercial at \@ Left bracket \[ Backslash \\
27 %% Right bracket \] Circumflex \^ Underscore \_
28 %% Grave accent \` Left brace \{ Vertical bar \|
29 %% Right brace \} Tilde \~}
30 %%
31 % \iffalse
32 %%
33 %<*dtx>
34 \ProvidesFile{newvbtm.dtx}
35 %</dtx>
36 %<newvbtm|varvbtm>\newif\ifnvb@LaTeXe
37 %<newvbtm|varvbtm>\def\next{LaTeX2e}
38 %<newvbtm|varvbtm>\ifx\fmtname\next \nvb@LaTeXetrue
39 %<newvbtm|varvbtm>\def\next{
40 %<newvbtm|varvbtm>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
41 %<newvbtm>\ProvidesPackage{newvbtm}}
42 %<varvbtm>\ProvidesPackage{varvbtm}}
43 %<newvbtm|varvbtm>\else \nvb@LaTeXefalse
44 %<newvbtm|varvbtm>\def\next[#1]{}\fi
45 %<newvbtm|varvbtm>\next
46 %<driver>\ProvidesFile{newvbtm-man.tex}
47 % \fi
48 % \ProvidesFile{newvbtm.dtx}
49 [2002/04/08 v1.1 ]
50 % \iffalse
51 %<*driver>
52 \documentclass{ltxdoc}
53 \usepackage{varvbtm}
54 \DisableCrossrefs
55 \PageIndex
56 \CodelineNumbered
57 \RecordChanges
58 %</driver>
59 %<driver>\OnlyDescription
60 %<driver>\def\ONLYDESCRIPTION{}
61 %<*driver>
62 \advance\textwidth4em
63 \begin{document}
64 \DocInput{newvbtm.dtx}
65 \end{document}
66 %</driver>
67 % \fi
68 % \changes{v0.1}{1991/12/18}
69 % {The macros for tabbing verbatim etc. has already been born.}
70 % \changes{v0.2}{1992/03/26}
71 % {The style defverbatim is born.}
72 % \changes{v0.3}{1992/10/27}
73 % {The style newverbatim has already been born.}
74 % \changes{v1.0}{1999/07/14}
75 % {The Style and macros are merged into newvbtm.dtx and rewritten.}
76 % \changes{v1.1}{2002/04/08}
77 % {The following are to fix the bug revealed in LaTeX-2.09.}
78 %
79 % \errorcontextlines10000
80 % \GetFileInfo{newvbtm.dtx}
81 % \setcounter{IndexColumns}{2}
82 %
83 % \def\bottomfraction{.9}
84 % \def\cs#1{\hbox{\tt\char\escapechar#1}}
85 % \def\Item{\vskip-\itemsep\vskip-\parsep\vskip0pt\item}
86 %
87 % \makeatletter
88 % \def\nosv{\catcode`\|12}
89 %
90 % \def\eqnarray{\stepcounter{equation}\let\@currentlabel=\theequation
91 % \global\@eqnswtrue
92 % \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr
93 % $$\halign to \displaywidth\bgroup\hskip\@centering
94 % $\displaystyle\tabskip\z@{##}$\@eqnsel&\global\@eqcnt\@ne
95 % \hfil$\;{##}\;$\hfil
96 % &\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil
97 % \tabskip\@centering&\llap{##}\tabskip\z@\cr}
98 %
99 % \def\Meta#1{\penalty\@highpenalty
100 % \hbox{{\tt\char`\{}{\it\meta{#1}}{\tt\char`\}}}}
101 % \def\opt#1{{\tt[}{\it\meta{#1}}{\tt]}}
102 % \def\optn#1{{\tt[#1]}}
103 % \def\arg#1{{\tt\char`\{#1\char`\}}}
104 %
105 % \let\latex@addmarginpar\@addmarginpar
106 % \let\latex@latex@warning@no@line\@latex@warning@no@line
107 % \def\@addmarginpar{\let\@latex@warning@no@line\@gobble
108 % \latex@addmarginpar
109 % \let\@latex@warning@no@line\latex@latex@warning@no@line}
110 % \let\@font@warning\@gobble
111 %
112 % \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
113 % \edef\saved@macroname{\string#2}
114 % \def\makelabel##1{\llap{##1\hskip\@totalleftmargin}}
115 % \if@inlabel
116 % \let\@tempa\@empty \count@\macro@cnt
117 % \loop \ifnum\count@>\z@
118 % \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
119 % \edef\makelabel##1{\llap{\vtop to\baselineskip
120 % {\@tempa\hbox{##1}\vss}
121 % \hskip\@totalleftmargin}}
122 % \advance \macro@cnt \@ne
123 % \else \macro@cnt\@ne \fi
124 % \edef\@tempa{\noexpand\item[
125 % #1
126 % \noexpand\PrintMacroName
127 % \else
128 % \noexpand\PrintEnvName
129 % \fi
130 % {\string#2}]}
131 % \@tempa
132 % \global\advance\c@CodelineNo\@ne
133 % #1
134 % \SpecialMainIndex{#2}\nobreak
135 % \DoNotIndex{#2}
136 % \else
137 % \SpecialMainEnvIndex{#2}\nobreak
138 % \fi
139 % \global\advance\c@CodelineNo\m@ne
140 % \ignorespaces}
141 %
142 % \def\dummymacro{\topsep\MacroTopsep \trivlist \item[]}
143 % \let\enddummymacro\endtrivlist
144 %
145 % \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
146 % \Describe@Opt}
147 % \def\Describe@Opt#1{\endgroup \Describe@pt{#1}}
148 % \def\Describe@pt#1#2{
149 % \marginpar{\raggedleft\PrintDescribeMacro{#1}}
150 % \SpecialOptUsageIndex{#1}{#2}}
151 % \def\SpecialOptUsageIndex#1#2{
152 % \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar usage}
153 % \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar usage}
154 % \@esphack\ignorespaces}
155 % \def\SpecialOptMainIndex#1#2{
156 % \index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar main}
157 % \index{#2s:\levelchar{\protect\ttfamily#1}\encapchar main}
158 % \@esphack\ignorespaces}
159 % \def\SpecialOptIndex#1#2{
160 % \index{#1\actualchar{\protect\ttfamily#1} (#2)}
161 % \index{#2s:\levelchar{\protect\ttfamily#1}}
162 % \@esphack\ignorespaces}
163 % \def\SpecialOptIndexS#1#2{
164 % \index{#1\actualchar{\protect\ttfamily#1} (#2)}
165 % \index{#2es:\levelchar{\protect\ttfamily#1}}
166 % \@esphack\ignorespaces}
167 %
168 % \begingroup
169 % \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active}
170 % \catcode`\@\active \gdef@{\char`\@\penalty\exhyphenpenalty}
171 % \catcode`\#\active \gdef#{\penalty\exhyphenpenalty}
172 % \endgroup
173 % \let\latex@sverb\@sverb
174 % \def\@sverb{\@sverbcat\latex@sverb}
175 %
176 % \def\theglossary{\onecolumn \glossary@prologue
177 % \GlossaryParms \let\item\@idxitem \ignorespaces}
178 % \def\endtheglossary{\relax}
179 %
180 %
181 %
182 % \def\bracepair{`{\tt\char`\{\char`\}'}}
183 %
184 % \ifx\ONLYDESCRIPTION\undefined\else
185 % \let\SpecialUsageIndex\SpecialMainIndex
186 % \let\SpecialOptUsageIndex\SpecialOptMainIndex
187 % \fi
188 % \newverbatim{iverbatim}{\begin{itemize}\item[]\ttfamily}{}{}{\end{itemize}}
189 %
190 %
191 %
192 % \title{\textsf{newvbtm} and \textsf{varvbtm}\\
193 % Packages for Variants of \texttt{verbatim} Environment\thanks{
194 % This file has version number \fileversion, last revised \filedate.}}
195 % \author{Hiroshi Nakashima\\(Toyohashi Univ. of Tech.)}
196 % \date{\filedate}
197 % \maketitle
198 %
199 % \begin{abstract}
200 % This file provides two style files; \textsf{newvbtm} to define
201 % |verbatim|-like environments; \textsf{varvbtm} to provide set of macros
202 % for variants of |verbatim|, e.g.\ in which \texttt{\char`\^I} acts as a tab.
203 % \end{abstract}
204 %
205 % \tableofcontents
206 % \newpage
207 %
208 %
209 %
210 % \section{Introduction}
211 % \label{sec:intro}
212 %
213 % \SpecialOptIndex{verbatim}{environment}
214 % \LaTeX{} users often have trouble when they wish to have their own
215 % customized |verbatim|-like environment. Probably you once wished to have
216 % an indented-footnotesize-|verbatim| instead of always typing;
217 %
218 %\begin{iverbatim}
219 %\begin{itemize}\item[]\footnotesize
220 %\begin{verbatim}
221 %...
222 %\end{verbatim}
223 %\end{itemize}
224 %\end{iverbatim}
225 %
226 % and tried the following just to know it does not work.
227 %
228 %\begin{iverbatim}
229 %\newenvironment{myverbatim}{\begin{itemize}\item[]\footnotesize
230 % \begin{verbatim}}%
231 % {\end{verbatim}\end{itemize}}
232 %\end{iverbatim}
233 %
234 % Another trouble you probablly have had is that what you see in |verbatim|
235 % text with |<TAB>| is not what you get because |<TAB>| does not acts as an
236 % tab but a space.
237 %
238 % Of course it is possible to define your own |verbatim|-like environments
239 % if you have enough knowledge of the implementation of |verbatim| including
240 % dirty tricks with |\catcode|. However, even a \TeX{}pert should be bored
241 % with typing a dirty code like;
242 %
243 %\begin{iverbatim}
244 %\begingroup \catcode`\|=0 \catcode`\[=1 \catcode`\]=2
245 %\catcode`\{=12 \catcode`\}=12 \catcode`\\=12
246 %|long|def|@myxverbatim##1\end{myverbatim}[##1|end[myverbatim]]
247 %|endgroup
248 %\end{iverbatim}
249 %
250 % \DescribeOpt{newvbtm}{style file}
251 % \DescribeOpt{varvbtm}{style file}
252 % The style files distributed with this document will solve these problems.
253 % You will have two style files, \textsf{newvbtm.sty} and
254 % \textsf{varvbtm.sty}, by processing \textsf{newvbtm.dtx} with
255 % \textsf{docstrip}, or simply doing the following.
256 %
257 %\begin{iverbatim}
258 %% tex newvbtm.ins
259 %\end{iverbatim}
260 %
261 % The former style provides you |\(re)newverbatim| command to (re)define
262 % your own |verbatim|-like environment easily. The latter gives you a set
263 % of various macros for tab-emulation, page break control, etc.
264 %
265 %
266 %
267 % \section{Usage}
268 % \label{sec:usage}
269 % \subsection{Loading Style Files}
270 % \label{sec:usage-load}
271 %
272 % Both style files are usable to both \LaTeXe{} and \LaTeX-2.09
273 % users with their standard package loading declaration. If you use
274 % \LaTeXe{} and wish to load, for example, \textsf{newvbtm}, simply do the
275 % following.
276 %
277 % \SpecialUsageIndex{\usepackage}
278 %\begin{iverbatim}
279 %\usepackage{newvbtm}
280 %\end{iverbatim}
281 %
282 % If you still love \LaTeX-2.09, the following is what you have to do.
283 %
284 % \begin{quote}
285 % \SpecialUsageIndex{\documentstyle}
286 % |\documentstyle[..,newvbtm,...]|\Meta{main-style}
287 % \end{quote}
288 %
289 % Note that loading \textsf{varvbtm} automatically loads \textsf{newvbtm}
290 % too. Thus you may not load both though doing so is safe.
291 %
292 %
293 %
294 % \subsection{\textsf{newvbtm}: Define \texttt{verbatim}-like Environments}
295 % \label{sec:usage-new}
296 %
297 % \SpecialOptIndex{newvbtm}{style file}
298 % \DescribeMacro{\newverbatim}
299 % The command;
300 %
301 % \begin{quote}
302 % |\newverbatim|\Meta{env}\opt{n-args}
303 % \Meta{beg-def-outer}\Meta{beg-def-inner}|%|\\
304 % \phantom{\texttt{+newverbatim}\Meta{env}\opt{n-args}}
305 % \Meta{end-def-inner}\Meta{end-def-outer}
306 % \end{quote}
307 %
308 % defines an environment named \meta{env} with \meta{n-args} arguments
309 % (optionally), and acting conceptually as follows:
310 %
311 % \begin{quote}
312 % \meta{beg-def-outer}|\begin{verbatim}|\meta{beg-def-inner}\\
313 % \meta{body-of-environment}\\
314 % \meta{end-def-inner}|\end{verbatim}|\meta{end-def-outer}
315 % \end{quote}
316 %
317 % Thus to have indented-footnotesize-|verbatim| named, say |indfnsverbatim|,
318 % you may simply do the following.
319 %
320 %\begin{iverbatim}
321 %\newverbatim{indfnsverbatim}{\begin{itemize}\item[]\footnotesize}{}{}%
322 % {\end{itemize}}
323 %\end{iverbatim}
324 %
325 % Since |\newverbatim| defines not only \meta{env} but also its starred
326 % counterpart \meta{env}\texttt{*} that acts like |verbatim*|, the
327 % definition above also defines |indfnsverbatim*| environment.
328 %
329 % If you use \LaTeXe{}, you may make \meta{env} have an optional argument
330 % whose default value is \meta{default} by;
331 %
332 % \begin{itemize}\item[]
333 % |\newverbatim|\Meta{env}\opt{n-args}\opt{default}
334 % \Meta{beg-def-outer}\Meta{beg-def-inner}|%|\\
335 % \phantom{\texttt{+newverbatim}\Meta{env}\opt{n-args}\opt{default}}
336 % \Meta{end-def-inner}\Meta{end-def-outer}
337 % \end{itemize}
338 %
339 % For example, our |indfnsverbatim| environment can have an optional
340 % argument to specify a font size other than |\footnotesize| by the
341 % following definition.
342 %
343 %\begin{iverbatim}
344 %\newverbatim{indfnsverbatim}[1][\footnotesize]%
345 % {\begin{itemize}\item[]#1}{}{}{\end{itemize}}
346 %\end{iverbatim}
347 %
348 % The argument \meta{beg-def-inner} is for \TeX{}perts who wish to do
349 % something overriding what \LaTeX's |\verbatim| does. Even if you don't
350 % have much confidence in your \TeX{}pertise, however, you can do some
351 % useful thing with this argument. For example, the following is obtained
352 % by itself.
353 %
354 % \begin{itemize}\item[]
355 %\newverbatim{slverbatim}{\ttfamily}{\slshape}{}{}
356 %\begin{slverbatim}
357 %\newverbatim{slverbatim}{}{\slshape}{}{}
358 %\end{slverbatim}
359 % \end{itemize}
360 %
361 % Also you will find a few commands for this argument in
362 % \S\ref{sec:usage-var}.
363 %
364 % The needs of \meta{end-def-inner} is much more limited. One example is to
365 % check if |\end{verbatim}| is at the beginning of a line. This examination
366 % is done by;
367 %
368 % \begin{quote}
369 % |\newverbatim{myverbatim}{...}{...}%|\\
370 % | {\ifvmode |\meta{at-bol}| \else |\meta{not-at-bol}| \fi}{...}|
371 % \end{quote}
372 %
373 % \DescribeMacro{\renewverbatim}
374 % You may redefine your own |verbatim|-like environment, or even |verbatim|
375 % itself, by |\renewverbatim| whose arguments are same as those of
376 % |\newenvironment|.
377 %
378 %
379 %
380 % \subsection{\textsf{varvbtm}: To Make Variants of \texttt{verbatim}}
381 % \label{sec:usage-var}
382 %
383 % \subsubsection{Tab Emulation}
384 % \label{sec:usage-var-tab}
385 %
386 % \DescribeMacro{\newtabverbatim}
387 % \DescribeMacro{\renewtabverbatim}
388 % The commands |\(re)newtabverbatim| is to (re)define a |verbatim|-like
389 % environment in which |<TAB>| acts as a tab. The syntax of the command is
390 % same as that of |\(re)newverbatim|, and its operation is equivalent to;
391 %
392 % \begin{itemize}\item[]
393 % |\(re)newverbatim|\Meta{env}\opt{n-args}\opt{default}\\
394 % \mbox{}\qquad\qquad\Meta{beg-def-outer}|%|\\
395 % \mbox{}\qquad\qquad|{|\meta{beg-def-inner}\meta{beg-def-for-tab}|}%|\\
396 % \mbox{}\qquad\qquad|{|\meta{end-def-for-tab}\meta{end-def-inner}|}%|\\
397 % \mbox{}\qquad\qquad\Meta{end-def-outer}
398 % \end{itemize}
399 %
400 % For example;
401 %
402 %\begin{iverbatim}
403 %\newtabverbatim{tabverbatim}{}{}{}{}
404 %\end{iverbatim}
405 %
406 % defines |tabverbatim| environment just to make |<TAB>| act as a tab.
407 % Another example to have tab emulation version of |indfnsverbatim| with
408 % optional argument, say |indfnstabverbatim| is;
409 %
410 %\begin{iverbatim}
411 %\newtabverbatim{indfnstabverbatim}[1][\footnotesize]%
412 % {\begin{itemize}\item[]#1}{}{}{\end{itemize}}
413 %\end{iverbatim}
414 %
415 % Note that in the starred version, e.g. |tabverbatim*|, a |<TAB>| is
416 % translated into a sequence of \verb*! !.
417 %
418 % \DescribeOpt{VVBtabwidth}{counter}
419 % The distance between tab stops is the width of eight characters of the
420 % font used in the environment, i.e. typewriter font usually. If you want
421 % to change this default value, set the counter |VVBtabwidth| to the number
422 % of characters of the distance.
423 %
424 % \DescribeMacro{\VVBbegintab}
425 % \DescribeMacro{\VVBendtab}
426 % The magical stuff for \meta{beg-def-for-tab} and \meta{end-def-for-tab}
427 % is also accessible through commands |\VVBbegintab| and |\VVBendtab| for
428 % \TeX{}perts who wish to do something with |\(re)newverbatim| rather than
429 % |\(re)newtabverbatim|.
430 %
431 %
432 %
433 % \subsubsection{Form Feed Character}
434 % \label{sec:usage-var-ff}
435 %
436 % \DescribeMacro{\VVBprintFF}
437 % \DescribeMacro{\VVBprintFFas}
438 % You might have found that |<FF>| (or |^L|) in |verbatim| caused a
439 % mysterious error;
440 %
441 %\begin{iverbatim}
442 %! Forbidden control sequence found while scanning use of \@xverbatim.
443 %\end{iverbatim}
444 %
445 % This is because |<FF>| is not {\em verbatimized}. Giving the command
446 % |\VVBprintFF| to $\langle$\textit{beg-def-}\allowbreak
447 % \textit{outer}$\rangle$ (or \meta{beg-def-inner}) of |\newverbatim| does
448 % it for you and makes |<FF>| printed as |^L| in default. You may change
449 % this default print image by;
450 %
451 % \begin{quote}
452 % |\VVBprintFFas|\Meta{str}
453 % \end{quote}
454 % where \meta{str} is a sequence of any printable characters other than |{|
455 % and |}|. Note that this command is very {\em fragile} as |\verb| and
456 % |\index|, and thus should not be used in an argument of other commands
457 % including |\(re)newverbatim|.
458 %
459 % \DescribeMacro{\VVBbreakatFF}
460 % \DescribeMacro{\VVBbreakatFFonly}
461 % The other way to make |<FF>| acceptable is to give it a useful and natural
462 % job, i.e.\ page breaking. This is done by giving |\VVBbreakatFF| to
463 % \meta{beg-def-inner} (not {\em outer}). Its more powerful relative,
464 % |\VVBbreakatFFonly|, is also available to allow page breaking at |<FF>|
465 % only. Unfortunately, these two commands are incompatible with
466 % |\(re)newtabverbatim| and thus you have to use |\(re)newverbatim| with
467 % |\VVBbegintab| {\em followed by} them.
468 %
469 %
470 %
471 % \subsubsection{Non-Verbatim Stuff in \texttt{verbatim}-like Environment}
472 % \label{sec:usage-var-nonverb}
473 %
474 % \DescribeMacro{\VVBnonverb}
475 % You might have once wished to insert a few non-verbatim stuff, for example
476 % math stuff. The command, to be given to \meta{beg-def-outer};
477 %
478 %\begin{quote}
479 %\newverbatim{verbatimwithnv}{\VVBnonverb{\!}\ttfamily}{}{}{}
480 %\begin{verbatimwithnv}
481 %\VVBnonverb{\!$\langle\mbox{\textit{char}}\rangle$!}
482 %\end{verbatimwithnv}
483 %\end{quote}
484 %
485 % makes it possible. For example, the author just did the following to
486 % produce the result shown above.
487 %
488 %\begin{iverbatim}
489 %\newverbatim{verbatimwithnv}{\VVBnonverb{\!}}{}{}{}
490 %\begin{verbatimwithnv}
491 %\VVBnonverb{\!$\langle\mbox{\textit{char}}\rangle$!}
492 %\end{verbatimwithnv}
493 %\end{iverbatim}
494 %
495 % As shown in the example above, the non-verbatim staff is surrounded by
496 % a pair of \meta{char}, the letter `|!|' in this case. Note that
497 % \meta{char} has to be preceded by `|\|' when it is given as the argument of
498 % |\VVBnonbverb|, and \meta{char} should not be `|\|'. Also note that the
499 % default font for the non-verbatim part % is not that for verbatim part,
500 % but the font used outside the environment
501 %
502 % \footnote{Strictly speaking, the font used when \cs{VVBnonverb} is
503 % invoked. Thus if \cs{VVBnonverb} is preceded by a font changing command,
504 % the fond chosen by the command will be used.}.
505 %
506 % \DescribeMacro{\VVBnonverbmath}
507 % As mentioned above, math stuffs will be most desirable to be
508 % non-verbatim. Thus the macro;
509 %
510 %\begin{quote}
511 %\newverbatim{verbatimwithnv}{\VVBnonverbmath\ttfamily}{}{}{}
512 %\begin{verbatimwithnv}
513 %\VVBnonverbmath[\$\langle\mbox{\textit{char}}\rangle$]
514 %\end{verbatimwithnv}
515 %\end{quote}
516 % gives you a shorthand to typeset the stuff surrounded by a pair of
517 % \meta{char} in math mode. Since the default of \meta{char} is |$| as
518 % expected, the example above may be;
519 %
520 %\begin{iverbatim}
521 %\newverbatim{verbatimwithnv}{\VVBnonverbmath}{}{}{}
522 %\begin{verbatimwithnv}
523 %\VVBnonverb{\$\langle\mbox{\textit{char}}\rangle$}
524 %\end{verbatimwithnv}
525 %\end{iverbatim}
526 %
527 %
528 %
529 % \subsubsection{Verbatim Input}
530 % \label{sec:usage-var-input}
531 %
532 % The last thing \textsf{varvbtm} gives you is;
533 %
534 % \begin{itemize}\item[]
535 % |\(re)newverbatiminput|\Meta{command}\opt{n-args}\opt{default}|%|\\
536 % \phantom{\texttt{+(re)newverbatiminput}}
537 % \Meta{beg-def-outer}\Meta{beg-def-inner}|%|\\
538 % \phantom{\texttt{+(re)newverbatiminput}}
539 % \Meta{end-def-inner}\Meta{end-def-outer}
540 % \end{itemize}
541 %
542 % to define a \meta{command} to |\input| a file. Since this define a
543 % \meta{command} instead of an environment, \meta{command} should have `|\|'
544 % as its prefix. The \meta{command} has at least one mandatory argument,
545 % \meta{file} to be input, which can be referred as first argument if
546 % \opt{default} is not supplied, or as second otherwise. Note that,
547 % however, if the \meta{command} does not have any other arguments, you can
548 % omit \opt{n-arg}.
549 %
550 % For example;
551 %
552 %\begin{iverbatim}
553 %\newverbatiminput{\vinput}{}{}{}{}
554 %\end{iverbatim}
555 %
556 % defines |\vinput|\Meta{file} (and |\vinput*|) that |\input| a \meta{file}
557 % as if the \meta{file} has |\begin|\slash|\end{verbatim}| at its first and
558 % last lines. A little bit more complicated example;
559 %
560 %\begin{iverbatim}
561 %\newverbatiminput{\indfnsvinput}[2][\footnotesize]%
562 % {\begin{itemize}\item[]#1}{}{}{\end{itemize}}
563 %\end{iverbatim}
564 %
565 % defines a indented-footnotesize-by-default version of |\vinput|.
566 %
567 %
568 %
569 % \IndexPrologue{\newpage\section*{Index}
570 % Underlined number refers to the page where the specification of
571 % corresponding entry is described.}
572 % \StopEventually{
573 % \section*{Acknowledgments}
574 %
575 % The author thanks to Noboru Matsuda and Carlos Puchol whose posts to
576 % news groups triggered writing very first version of macros in
577 % \textsf{newvbtm} and \textsf{varvbtm}.
578 %
579 % For the implementation of these style files, the author refers the base
580 % implementations of the macros for \texttt{verbatim} environment.
581 % These macros are written by Leslie Lamport as a part of
582 % \LaTeX-2.09 and \LaTeXe{} (1997/12/01) to which Johannes Braams and other
583 % authors also contributed.
584 %
585 % \PrintIndex}
586 %
587 %
588 %
589 % \newpage
590 % \section{Implementation}
591 % \label{sec:imp}
592 % \subsection{Tricks for Compatibility}
593 % \label{sec:imp-compat}
594 %
595 % \begin{macro}{\ifnvb@LaTeXe}
596 % At the very beginning of each style file, we check whether it is loaded by
597 % \LaTeXe{} or \LaTeX-2.09, declare the flag |\ifnvb@LaTeXe| and set it to
598 % true or false, and then declare |\NeedsTeXFormat| and |\ProvidesPackage|
599 % if \LaTeXe{}. This part is embedded at the beginning of
600 % \textsf{newvbtm.dtx} in a tricky manner to let \textsf{docstrip} produce
601 % the following code, for example for \textsf{newvbtm}.
602 % \SpecialIndex{\NeedsTeXFormat}
603 % \SpecialIndex{\ProvidesPackage}
604 % \end{macro}
605 %
606 %\begin{itemize}\item[]
607 %\begin{verbatim}
608 %\newif\ifnvb@LaTeXe
609 %\def\next{LaTeX2e}
610 %\ifx\fmtname\next \nvb@LaTeXetrue
611 %\def\next{
612 %\NeedsTeXFormat{LaTeX2e}[1994/12/01]
613 %\ProvidesPackage{newvbtm}}
614 %\else \nvb@LaTeXefalse
615 %\def\next[#1]{}\fi
616 %\next
617 %[2002/04/08 v1.1 ]
618 %\end{verbatim}
619 %\end{itemize}
620 %
621 % \SpecialIndex{\RequirePackage}
622 % In \textsf{varvbtm}, loading \textsf{newvbtm} also takes care of the
623 % compatibility. That is, \textsf{newvbtm} is loaded by |\RequirePackage| if
624 % \LaTeXe, while simply by |\input| otherwise. Since \textsf{newvbtm} does
625 % not modifies any existential macros nor declares anything by |\new| except
626 % for |\newif|\footnote{
627 %
628 % Multiple \cs{newif} for a flag is safe, and thus we do it for
629 % \cs{nvb@LaTeXe} both in \textsf{newvbtm} and \textsf{varvbtm}.},
630 %
631 % it is safe even if |\newvbtm| is loaded multiple times in \LaTeX-2.09.
632 %
633 % \iffalse
634 %<*varvbtm>
635 % \fi
636 % \begin{macrocode}
637
638 \ifnvb@LaTeXe
639 \RequirePackage{newvbtm}
640 \else
641 \input{newvbtm.sty}
642 \fi
643 % \end{macrocode}
644 % \iffalse
645 %</varvbtm>
646 % \fi
647 %
648 %
649 %
650 % \subsection{\textsf{newvbtm}}
651 % \label{sec:imp-new}
652 %
653 % \iffalse
654 %<*newvbtm>
655 % \fi
656 % \begin{macro}{\newverbatim}
657 % \begin{macro}{\renewverbatim}
658 % \begin{macro}{\nvb@newenv}
659 % \begin{macro}{\nvb@Xnewverbatim}
660 % The macros |\newverbatim| and |\renewverbatim| call a macro
661 % |\nvb@newverbatim| after |\nvb@newenv| and |\nvb@Xnewverbatim| are made
662 % |\let|-equal to appropriate macros. That is, |\nvb@newenv| is either
663 % |\newenvironment| or |\renewenvironment|, and |\nvb@Xnewverbatim| is, in
664 % both cases, |\nvb@xnewverbatim| that is the body of our environment
665 % definition as explained later. Note that |\nvb@Xnewverbatim| will be set
666 % differently in the macros defined in \textsf{varvbtm}.
667 % \end{macro}\end{macro}\end{macro}\end{macro}
668 %
669 % \begin{macro}{\nvb@newverbatim}
670 % \begin{macro}{\nvb@inewverbatim}
671 % The common macro |\nvb@newverbatim| checks the existence of \opt{n-args}
672 % and then calls |\nvb@inewverbatim| to check that of \opt{default}. Note
673 % that since \LaTeX-2.09's |\(re)newenvironment| does not have
674 % \opt{default}, these macros have definitions slightly different from those
675 % for \LaTeXe{} to pass an empty argument to |\nvb@Xnewverbatim| always.
676 % \end{macro}\end{macro}
677 %
678 % \begin{macrocode}
679
680 \def\newverbatim{\let\nvb@newenv\newenvironment
681 \let\nvb@Xnewverbatim\nvb@xnewverbatim \nvb@newverbatim}
682 \def\renewverbatim{\let\nvb@newenv\renewenvironment
683 \let\nvb@Xnewverbatim\nvb@xnewverbatim \nvb@newverbatim}
684
685 \ifnvb@LaTeXe
686 \def\nvb@newverbatim#1{\@ifnextchar[%]
687 {\nvb@inewverbatim{#1}}{\nvb@inewverbatim{#1}[0]}}
688 \def\nvb@inewverbatim#1[#2]{\@ifnextchar[%]
689 {\nvb@Xnewverbatim{#1}[#2]}{\nvb@Xnewverbatim{#1}[#2][]}}
690 \else
691 \def\nvb@newverbatim#1{\@ifnextchar[%]
692 {\nvb@inewverbatim{#1}}{\nvb@Xnewverbatim{#1}[0][]}}
693 \def\nvb@inewverbatim#1[#2]{\nvb@Xnewverbatim{#1}[#2][]}
694 \fi
695
696 % \end{macrocode}
697 %
698 % \begin{macro}{\nvb@xnewverbatim}
699 % \changes{v1.1}{2002/04/05}
700 % {\cs{@tempa} is replaced by \cs{nvb@tempa} to avoid conflict in 2.09.}
701 % \begin{macro}{\nvb@currenvir}
702 % \begin{macro}{\nvb@defxverbatim}
703 % \begin{macro}{\nvb@xverbatim}
704 % \begin{macro}{\nvb@beginhook}
705 % \begin{macro}{\nvb@endinhook}
706 % \begin{macro}{\nvb@endouthook}
707 % The macro |\nvb@xnewverbatim| performs the essential part of the function
708 % to define a verbatim-like environment. First it checks if \meta{default}
709 % is empty so that this optional argument is not passed to
710 % |\(re)newenvironment|, especially of \LaTeX-2.09. Then it calls
711 % |\(re)newenvironment| to define \meta{env} which performs the following in
712 % \meta{beg-def} part.
713 %
714 % \begin{enumerate}
715 % \def\labelenumi{b\arabic{enumi}.}
716 % \item
717 % |\def|-ine |\nvb@currenvir| to let it have \meta{env} as its body, so that
718 % the name of environment can be referred by the macros in \textsf{varvbtm}.
719 %
720 % \item
721 % Execute \meta{beg-def-outer}.
722 %
723 % \item
724 % Open a group to localize assignments in \LaTeX's |\@verbatim|, especially
725 % those of flags referred in |\list|-related macros.
726 %
727 % \item
728 % Perform what \LaTeX's |\verbatim| does, i.e.\ |\@verbatim| etc., except for
729 % |\@xverbatim|. In starred-version, only |\@verbatim| is called in this
730 % step.
731 %
732 % \item
733 % Call |\nvb@defxverbatim| to define |\nvb@xverbatim| that performs what
734 % \LaTeX's \hbox{|\@xverbatim|} does but its argument terminator is
735 % ``|\end|\Meta{env}''. The definition of |\nvb@defxverbatim| is done in a
736 % group in which `|\|', `|{|' and `|}|' have ``other'' |\catcode| with the
737 % well-known technique using `\verb!|!', `|[|' and `|]|'.
738 %
739 % \item
740 % Call |\nvb@beginhook|, which is usually |\relax| but will not be if
741 % |\VVBnonverb| is executed in \meta{beg-def-outer} as described in
742 % \S\ref{sec:imp-var-nonverb}.
743 %
744 % \item
745 % Execute \meta{beg-def-inner}.
746 %
747 % \item
748 % Call |\nvb@xverbatim| to typeset the body of environment verbatim.
749 % \end{enumerate}
750 %
751 % The \meta{end-def} part for \meta{env} performs the following.
752 %
753 % \begin{enumerate}
754 % \def\labelenumi{e\arabic{enumi}.}
755 % \item
756 % Execute \meta{end-def-inner}.
757 %
758 % \item
759 % Call |\nvb@endinhook|, which is |\relax| now but could do something if
760 % necessary.
761 %
762 % \item
763 % Call |\endverbatim| to close the |\trivlist| opened by |\@verbatim|.
764 %
765 % \item
766 % Close the group opened by \meta{beg-def}.
767 %
768 % \item
769 % Execute \meta{end-def-outer}.
770 %
771 % \item
772 % Call |\nvb@endouthook|, which is also |\relax| now but might not be.
773 %
774 % \item
775 % Turn |\if@endpe| true to tell |\end| that \meta{env} is list-like.
776 % \end{enumerate}
777 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
778 %
779 % \begin{macrocode}
780 \long\def\nvb@xnewverbatim#1[#2][#3]#4#5#6#7{\def\nvb@tempa{#3}%
781 \ifx\nvb@tempa\@empty \def\nvb@tempa{[#2]}%
782 \else \def\nvb@tempa{[#2][#3]}\fi
783 \def\@tempb{\nvb@newenv{#1}}%
784 \expandafter\@tempb\nvb@tempa
785 {\def\nvb@currenvir{#1}%
786 #4\begingroup \@verbatim \frenchspacing \@vobeyspaces
787 \nvb@defxverbatim{#1}\nvb@beginhook #5\nvb@xverbatim}%
788 {#6\nvb@endinhook \endverbatim \endgroup
789 #7\nvb@endouthook \@endpetrue}%
790 \def\@tempb{\nvb@newenv{#1*}}%
791 \expandafter\@tempb\nvb@tempa
792 {\def\nvb@currenvir{#1*}%
793 #4\begingroup \@verbatim
794 \nvb@defxverbatim{#1*}\nvb@beginhook #5\nvb@xverbatim}%
795 {\@nameuse{end#1}}}
796 \let\nvb@beginhook\relax
797 \let\nvb@endinhook\relax
798 \let\nvb@endouthook\relax
799
800 \begingroup \catcode`\|\z@ \catcode`\[\@ne \catcode`\]\tw@
801 \@makeother\{ \@makeother\} \@makeother\\
802 |gdef|nvb@defxverbatim#1[|long|def|nvb@xverbatim##1\end{#1}[##1|end[#1]]]
803 |endgroup
804 % \end{macrocode}
805 %
806 % \iffalse
807 %</newvbtm>
808 % \fi
809 %
810 %
811 %
812 % \subsection{\textsf{varvbtm}}
813 % \label{sec:imp-var}
814 %
815 % \iffalse
816 %<*varvbtm>
817 % \fi
818 %
819 % \subsubsection{Tab Emulation}
820 % \label{sec:imp-var-tab}
821 %
822 % For tab emulation, we declare the following registers.
823 %
824 % \begin{itemize}
825 % \item
826 % \begin{macro}{\c@VVBtabwidth}
827 % The count register |\c@VVBtabwidth| that has the number of characters
828 % between tab stops. The default value 8 is set.
829 % \end{macro}
830 %
831 % \item
832 % \begin{macro}{\vvb@tabwidth}
833 % The dimen register |\vvb@tabwidth| that has the distance between tab
834 % stops.
835 % \end{macro}
836 %
837 % \item
838 % \begin{macro}{\vvb@everypar}
839 % The toks register |\vvb@everypar| to save the contents of |\everypar|,
840 % though it is usually ineffective.
841 % \end{macro}
842 %
843 % \item
844 % \begin{macro}{\vvb@tabbox}
845 % The box register |\vvb@tabbox| that contains stuffs between the beginning
846 % of line or a tab stop and the end of line or another tab stop.
847 % \end{macro}
848 % \end{itemize}
849 %
850 % \begin{macrocode}
851
852 %% Tab Emulation
853
854 \newcounter{VVBtabwidth}\c@VVBtabwidth8
855 \newdimen\vvb@tabwidth
856 \newtoks\vvb@everypar
857 \newbox\vvb@tabbox
858
859 % \end{macrocode}
860 %
861 % \begin{macro}{\VVBbegintab}
862 % \begin{macro}{\vvb@tabfil}
863 % \begin{macro}{\vvb@tabdef}
864 % The macro |\VVBbegintab|, which should be called from \meta{beg-def-inner}
865 % part, performs a few preprocessing for tabbing some of which override the
866 % definition in |\@verbatim|.
867 %
868 % A line in a tabbing verbatim environment is
869 % enclosed in a box |\vvb@tabbox| so that we can know the horizontal
870 % position of a tab. Thus, we let |\everypar| call |\vvb@tabbol| to
871 % open the box, and |\par| be |\vvb@tabeol| to close. Note that
872 % |\obeylines| after the |\let| for |\par| is necessary to make `|^M|'
873 % |\let|-equal to our own |\par|.
874 %
875 % Then we set |\vvb@tabwidth| to
876 % $|\c@VVBtabwidth|\times\hbox{\meta{width-of-\texttt{A}}}$. We also
877 % |\def|-ine |\vvb@tabfil| to produce a sequence of `\verb*! !' in the case
878 % of starred environment, i.e.\ the |\catcode| of space is not |\active|.
879 %
880 % Finally, we make |^I| active and |\let|-equal to |\vvb@tab| by
881 % |\vvb@tabdef|.
882 % \end{macro}\end{macro}\end{macro}
883 %
884 % \begin{macro}{\VVBendtab}
885 % The macro |\VVBendtab|, which should be called from \meta{end-def-inner}
886 % part, closes the box |\vvb@tabbox| if necessary, i.e.\ |\end|\Meta{env} is
887 % not at the beginning of a line and thus not in vertical mode.
888 % \end{macro}
889 %
890 % \begin{macrocode}
891 \def\VVBbegintab{\vvb@everypar\everypar
892 \everypar{\vvb@tabbol \the\vvb@everypar}%
893 \let\par\vvb@tabeol \obeylines
894 \settowidth\vvb@tabwidth{A}\multiply\vvb@tabwidth\c@VVBtabwidth
895 \ifnum\catcode`\ =\active \let\vvb@tabfil\relax
896 \else \def\vvb@tabfil{\leaders\hbox{\char`\ }}\fi
897 \catcode`\^^I\active \vvb@tabdef}
898 {\catcode`\^^I\active \gdef\vvb@tabdef{\let^^I\vvb@tab}}
899 \def\VVBendtab{\ifvmode\else \par \fi}
900
901 % \end{macrocode}
902 %
903 % \begin{macro}{\vvb@tabbol}
904 % \begin{macro}{\vvb@tabeol}
905 % The macro |\vvb@tabbol| opens the box |\vvb@tabbox|, while |\vvb@tabeol|
906 % closes it after |\leavevmode| to ensure the box is opened and puts the
907 % contents of the box as the last (and maybe only one) element of a
908 % paragraph terminated by |\@@par|. The flag |\if@tempswa|, which |\@verbatim|
909 % initiated to false, is examined in order to prevent |^M| just
910 % following |\begin|\Meta{env} from making an empty line. Since the flag is
911 % turned true by both |\vvb@tabbol| and |\vvb@tabeol|, a |^M| is in effect
912 % in other cases.
913 % \end{macro}\end{macro}
914 %
915 % \begin{macrocode}
916 \def\vvb@tabbol{\@tempswatrue \setbox\vvb@tabbox\hbox\bgroup}
917 \def\vvb@tabeol{\if@tempswa
918 \leavevmode \egroup \box\vvb@tabbox \@@par \penalty\interlinepenalty
919 \fi \@tempswatrue}
920
921 % \end{macrocode}
922 %
923 % \begin{macro}{\vvb@tab}
924 % The macro |\vvb@tab|, to which |^I| is made |\let|-equal, is the heart of
925 % tabbing. It first closes |\vvb@tabbox| after |\leavevmode| to ensure its
926 % opening. Then it moves to the next tab stop by putting a box of $(\lfloor
927 % w/t\rfloor+1)\times t$ wide, where $w$ is the width of |\vvb@tabbox| and
928 % $t$ is |\vvb@tabwidth|. In the box, the contents of |\vvb@tabbox| is
929 % flushed left by |\vvb@tabfil#\hfil|, which makes invisible space in
930 % non-starred environment because |\vvb@tabfil| is relax, while produces a
931 % sequence of `\verb*! !' by |\leaders| in starred environment. After the
932 % box is put, it opens |\vvb@tabbox| again by |\vvb@tabbol|.
933 % \end{macro}
934 %
935 % \begin{macrocode}
936 \def\vvb@tab{\leavevmode \egroup
937 \@tempdima\wd\vvb@tabbox \divide\@tempdima\vvb@tabwidth
938 \multiply\@tempdima\vvb@tabwidth \advance\@tempdima\vvb@tabwidth
939 \hbox to\@tempdima{\unhbox\vvb@tabbox \vvb@tabfil\hfil}\vvb@tabbol}
940
941 % \end{macrocode}
942 %
943 % \begin{macro}{\newtabverbatim}
944 % \begin{macro}{\renewtabverbatim}
945 % \begin{macro}{\vvb@xnewtabverbatim}
946 % Finally, we define |\newtabverbatim| and |\renewtabverbatim| for tabbing
947 % verbatim environment definition. They call the common macro
948 % |\nvb@newverbatim| described in \S\ref{sec:imp-new} to check the existence
949 % of optional arguments as |\(re)newverbatim| does, but |\nvb@Xnewverbatim|
950 % is made |\let|-equal to |\vvb@xnewtabverbatim| that simply calls
951 % |\nvb@xnewverbatim| attaching |\VVBbegintab| and |\VVBendtab| to
952 % \meta{beg-def-inner} and \meta{end-def-inner} respectively.
953 % \end{macro}\end{macro}\end{macro}
954 %
955 % \begin{macrocode}
956 \def\newtabverbatim{\let\nvb@newenv\newenvironment
957 \let\nvb@Xnewverbatim\vvb@xnewtabverbatim \nvb@newverbatim}
958 \def\renewtabverbatim{\let\nvb@newenv\renewenvironment
959 \let\nvb@Xnewverbatim\vvb@xnewtabverbatim \nvb@newverbatim}
960 \def\vvb@xnewtabverbatim#1[#2][#3]#4#5#6{%
961 \nvb@xnewverbatim{#1}[#2][#3]{#4}{#5\VVBbegintab}{\VVBendtab#6}}
962
963 %%^L
964 % \end{macrocode}
965 %
966 %
967 %
968 % \subsubsection{Form Feed Character}
969 % \label{sec:imp-var-ff}
970 %
971 % \begin{macro}{\VVBprintFF}
972 % \begin{macro}{\vvb@printFF}
973 % \begin{macro}{\VVBprintFFas}
974 % \begin{macro}{\vvb@printFFas}
975 % The macro |\VVBprintFF| simply makes |^L| |\let|-equal to |\vvb@printFF|
976 % whose body is print image of |^L| and is defined by |\VVBprintFFas|.
977 % Since the body of |\VVBprintFF| has |^L| that usually cannot appear in
978 % the body of a macro because of its |\active|-ness and {\em outerness}, its
979 % |\def|-inition is enclosed in a group in which |^L| is made |\relax|
980 % together with that of |\VVBbreakatFF|.
981 %
982 % The macro |\VVBprintFFas|, cooperating with |\VVB@printFFas|, defines its
983 % argument \meta{str} verbatim as the body of |\vvb@printFF| by a well-known
984 % trick with grouping and \hbox{|\@sanitize|} used in, for example, |\index|.
985 % The default print image ``|^L|'' is also defined by |\VVBprintFFas|.
986 % \end{macro}\end{macro}\end{macro}\end{macro}
987 %
988 % \begin{macro}{\VVBbreakatFF}
989 % \begin{macro}{\vvb@FFpar}
990 % \begin{macro}{\vvb@breakFF}
991 % \begin{macro}{\vvb@parafterFF}
992 % The macro |\VVBbreakatFF| makes |^L| |\let|-equal to |\vvb@breakFF| and
993 % saves the definition of |\par| in |\vvb@FFpar| because it will be modified
994 % by |\vvb@breakFF|\@. The macro |\vvb@breakFF| breaks the current page and
995 % then makes |\par|, and |^M| by |\obeylines|, |\let|-equal to
996 % |\vvb@parafterFF|\@. Since |\vvb@parafterFF| will do |\par| saved in
997 % |\vvb@FFpar| only when horizontal mode, |^M| just following |^L| will not
998 % produce an empty line at the beginning of the new page. After the first
999 % |^M| in the page, |\par| and |^M| regain their original definitions.
1000 % \end{macro}\end{macro}\end{macro}\end{macro}
1001 %
1002 % \begin{macro}{\VVBbreakatFFonly}
1003 % \begin{macro}{\vvb@FF@par}
1004 % \begin{macro}{\vvb@FFpenalty}
1005 % \begin{macro}{\vvb@parnobreak}
1006 % The macro |\VVBbreakatFFonly| does what |\VVBbreakatFF| by calling it but
1007 % before that it makes |\par| |\let|-equal to |\vvb@parnobreak| saving its
1008 % definition in |\vvb@FF@par|. The macro |\vvb@parnobreak| temporarily
1009 % makes |\penalty| |\let|-equal to |\@tempcnta| in order that
1010 % |\penalty|\meta{num} in original |\par| saved in |\vvb@FF@par| do
1011 % nothing. Then it restores |\penalty| from |\vvb@FFpenalty| and inserts
1012 % |\nobreak| to inhibit page break at |^M|. The temporary modification of
1013 % |\penalty| is done |\global|-ly because of the compatibility with the
1014 % tabbing verbatim.
1015 % \end{macro}\end{macro}\end{macro}\end{macro}
1016 %
1017 % \begin{macrocode}
1018
1019 %% Form Feed Character
1020
1021 \begingroup \let^^L\relax
1022 \gdef\VVBprintFF{\let^^L\vvb@printFF}
1023 \gdef\VVBbreakatFF{\let^^L\vvb@breakFF \let\vvb@FFpar\par}
1024 \endgroup
1025
1026 \def\VVBprintFFas{\begingroup \@sanitize \vvb@printFFas}
1027 \def\vvb@printFFas#1{\endgroup \def\vvb@printFF{#1}}
1028 \VVBprintFFas{^L}
1029
1030 \def\vvb@breakFF{\par \vfil \break \let\par\vvb@parafterFF \obeylines}
1031 \def\vvb@parafterFF{\ifhmode \vvb@FFpar \fi \let\par\vvb@FFpar \obeylines}
1032
1033 \gdef\VVBbreakatFFonly{\let\vvb@FF@par\par
1034 \let\par\vvb@parnobreak \obeylines \VVBbreakatFF}
1035 \let\vvb@FFpenalty\penalty
1036 \def\vvb@parnobreak{\global\let\penalty\@tempcnta \vvb@FF@par
1037 \global\let\penalty\vvb@FFpenalty \nobreak}
1038
1039 %%^L
1040 % \end{macrocode}
1041 %
1042 %
1043 %
1044 % \subsubsection{Non-Verbatim}
1045 % \label{sec:imp-var-nonverb}
1046 %
1047 % \begin{macro}{\VVBnonverb}
1048 % \begin{macro}{\vvb@nvfont}
1049 % \begin{macro}{\vvb@currsize}
1050 % \begin{macro}{\vvb@beginhook}
1051 % The macro |\VVBnonverb| saves the current font in |\vvb@nvfont|. If
1052 % \LaTeXe, its body will be a sequence of |\fontencoding|\meta{curr-encoding}
1053 % and its relatives followed by |\selectfont|. Otherwise, its body will be
1054 % the current font size command saved in |\vvb@currsize| followed by the
1055 % current font produced by |\the\font|. Then |\VVBnonverb| defines
1056 % |\nvb@beginhook| so as to call |\vvb@nonverb| with the argument
1057 % |\|\meta{char} just before \meta{beg-def-inner} is executed.
1058 % \end{macro}\end{macro}\end{macro}\end{macro}
1059 %
1060 % \begin{macro}{\VVBnonverbmath}
1061 % \begin{macro}{\vvb@nonverbmath}
1062 % \begin{macro}{\vvb@@bnonverb}
1063 % \begin{macro}{\vvb@@enonverb}
1064 % The macro |\VVBnonverbmath| examines the existence of its optional
1065 % argument |\|\meta{char} and calls |\VVBnonverb| via |\vvb@nonverbmath|
1066 % with it or with |\$| if omitted. Prior to the call, it makes both
1067 % |\vvb@@bnonverb| and |\vvb@@enonverb| |\let|-equal to `|$|' so that the
1068 % non-verbatim part is surrounded by them.
1069 % \end{macro}\end{macro}\end{macro}\end{macro}
1070 %
1071 % \begin{macrocode}
1072
1073 %% Non-Verbatim
1074
1075 \def\VVBnonverb#1{\ifnvb@LaTeXe
1076 \edef\vvb@nvfont{\noexpand\fontencoding{\f@encoding}%
1077 \noexpand\fontfamily{\f@family}%
1078 \noexpand\fontseries{\f@series}%
1079 \noexpand\fontshape{\f@shape}%
1080 \noexpand\fontsize{\f@size}{\noexpand\f@baselineskip}%
1081 \noexpand\selectfont}%
1082 \else
1083 \let\vvb@currsize\@currsize
1084 \edef\vvb@nvfont{\noexpand\vvb@currsize \the\font}\fi
1085 \def\nvb@beginhook{\vvb@nonverb#1}}
1086 \def\VVBnonverbmath{\@ifnextchar[%]
1087 {\vvb@nonverbmath}{\vvb@nonverbmath[\$]}}
1088 \def\vvb@nonverbmath[#1]{\let\vvb@@bnonverb$\let\vvb@@enonverb$\VVBnonverb#1}
1089
1090 % \end{macrocode}
1091 %
1092 % \begin{macro}{\vvb@nonverb}
1093 % \begin{macro}{\vvb@bnonverb}
1094 % \begin{macro}{\vvb@enonverb}
1095 % \begin{macro}{\vvb@@bnonverb}
1096 % \begin{macro}{\vvb@@enonverb}
1097 % \begin{macro}{\do}
1098 % \begin{macro}{\vvb@regaincat}
1099 % The macro |\vvb@nonverb| defines the |\active| \meta{char} to open a
1100 % |\hbox| after |\leavevmode| and then to call |\vvb@bnonverb| to do the
1101 % following. First it selects the font saved in |\vvb@nvfont| and then
1102 % restores |\catcode| of special characters by |\vvb@regaincat|. Since the
1103 % body of |\vvb@regaincat| is the expansion result of |\dospecials| with the
1104 % defintion of |\do| as;
1105 %
1106 %\begin{iverbatim}
1107 %\def\do#1{\catcode`\noexpand#1\number\catcode`#1\relax}
1108 %\end{iverbatim}
1109 %
1110 % it should be the sequence of ``\verb*!\catcode`\ 10!'' and so on. The
1111 % macro |\vvb@bnoverb| also set |\catcode| of characters in
1112 % |\verbatim@nolig@list| if exists or `|`|' otherwise to 12 (other). Then
1113 % the |\catcode| of \meta{char} is made |\active| because it might not be by
1114 % the preceding |\catcode| modification. Finaly it calls |\vvb@enonverb| to
1115 % get non-verbatim stuff.
1116 %
1117 % The macro |\vvb@enonverb|, which is also defined in |\vvb@nonverb|, gets
1118 % everything before \meta{char}, puts it in the |\hbox| surrounding it by
1119 % |\vvb@@bnonverb| and |\vvb@@enonverb|, which are both `|$|' in the case of
1120 % |\VVBnonverbmath| but |\relax| otherwise, and then closes the |\hbox|.
1121 %
1122 % Since the definitions of the \meta{char} and |\vvb@enonverb| should have
1123 % |\active| \meta{char}, we use the trick with |\lowercase| in which the
1124 % |\lccode| of `|~|' is the code of \meta{char}.
1125 %
1126 % After the definitions, the character `|\|' is made |\active| and
1127 % |\let|-equal to |\vvb@esc| by |\vvb@escdef| so that we can find
1128 % ``|end|\Meta{env}'', stored in |\vvb@endenvir| by |\vvb@enddef|, following
1129 % `|\|'. Note that we cannot use the conventional scheme to get everything
1130 % in the body of \meta{env} by |\nvb@xverbatim| because the |\catcode| of
1131 % special characters are modified in non-verbatim part. Thus we make `|\|'
1132 % active and |\vvb@xverbatim| |\relax|.
1133 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
1134 %
1135 % \begin{macrocode}
1136 \def\vvb@nonverb#1{\catcode`#1\active \begingroup \lccode`\~`#1\relax
1137 \lowercase{\endgroup
1138 \def~{\leavevmode \hbox\bgroup \vvb@bnonverb#1}%
1139 \def\vvb@enonverb##1~{\vvb@@bnonverb
1140 ##1\vvb@@enonverb \egroup}}%
1141 \catcode`\\\active \vvb@escdef \vvb@enddef \let\nvb@xverbatim\relax}
1142 \def\vvb@bnonverb#1{\vvb@nvfont \vvb@regaincat
1143 \ifx\verbatim@nolig@list\undefined \@makeother\`\relax
1144 \else \let\do\@makeother \verbatim@nolig@list \fi
1145 \catcode`#1\active \vvb@enonverb}
1146 \let\vvb@@bnonverb\relax
1147 \let\vvb@@enonverb\relax
1148 \def\do#1{\catcode`\noexpand#1\number\catcode`#1\relax}
1149 \edef\vvb@regaincat{\dospecials}
1150
1151 % \end{macrocode}
1152 %
1153 % \begin{macro}{\vvb@escdef}
1154 % \begin{macro}{\vvb@enddef}
1155 % \begin{macro}{\vvb@endenvir}
1156 % The macro |\vvb@escdef| simply let |\active| character `|\|' act as the
1157 % macro |\vvb@esc|, while |\vvb@enddef| defines the macro |\vvb@endenvir| as
1158 % ``|end|\Meta{env}'' referring the environment name saved in
1159 % |\vvb@currenvir|. Since these two macros has `|\|', `|{|' and `|}|' of
1160 % ``other'' category, the well-known technique replacing them is used.
1161 % \end{macro}\end{macro}\end{macro}
1162 %
1163 % \begin{macrocode}
1164 \begingroup \catcode`\|\z@ \catcode`\[\@ne \catcode`\]\tw@
1165 \@makeother\{ \@makeother\} \catcode`\\|active
1166 |gdef|vvb@escdef[|let\|vvb@esc]
1167 |gdef|vvb@enddef[|edef|vvb@endenvir[end{|nvb@currenvir}]]
1168 |endgroup
1169
1170 % \end{macrocode}
1171 %
1172 % \begin{macro}{\vvb@esc}
1173 % \begin{macro}{\vvb@checkend}
1174 % The macro |\vvb@esc| for `|\|' in |\active| examines if it is followed by
1175 % |end|\Meta{env} stored in |\vvb@endenvir|. The examination is done in
1176 % character-by-character manner by |\vvb@checkend| because we might have a
1177 % partially matching sequence followed by non-verbatim stuff which cannot be
1178 % picked before the |\catcode| modification. The comparison for the
1179 % examination is done by |\ifx| because we might have an |\active| character.
1180 %
1181 % If we find the terminator, we call |\end|\Meta{env} to close the
1182 % environment. Otherwise, the |\char|-acter `|\|' followed by the partial
1183 % matched (possibly empty) sequence followed by the unmatched character are
1184 % inserted back.
1185 % \end{macro}\end{macro}
1186 %
1187 % \begin{macrocode}
1188 \def\vvb@esc{\let\@tempa\vvb@endenvir \let\@tempb\@empty \vvb@checkend}
1189 \def\vvb@checkend#1{\edef\@tempc{\expandafter\@car\@tempa\@nil}%
1190 \def\@tempd{#1}\ifx\@tempc\@tempd
1191 \edef\@tempa{\expandafter\@cdr\@tempa\@nil}%
1192 \ifx\@tempa\@empty
1193 \edef\next{\noexpand\end{\nvb@currenvir}}%
1194 \else
1195 \edef\@tempb{\@tempb#1}\let\next\vvb@checkend \fi
1196 \else \def\next{\char`\\\@tempb#1}\fi
1197 \next}
1198
1199 %%^L
1200 % \end{macrocode}
1201 %
1202 %
1203 %
1204 % \subsubsection{Verbatim Input}
1205 % \label{sec:imp-var-input}
1206 %
1207 % \begin{macro}{\newverbatiminput}
1208 % \begin{macro}{\renewverbatiminput}
1209 % \begin{macro}{\vvb@Xnewverbatim}
1210 % The macros |\newverbatiminput| and |\renewverbatiminput| call the common
1211 % macro |\nvb@newverbatim| described in \S\ref{sec:imp-new} to check the
1212 % existence of optional arguments, making |\nvb@Xnewverbatim| |\let|-equal
1213 % to their own version, |\nvb@xnewvinput|.
1214 % \end{macro}\end{macro}\end{macro}
1215 %
1216 % \begin{macrocode}
1217
1218 %% Verbatim Input
1219
1220 \def\newverbatiminput{\let\nvb@newenv\newenvironment
1221 \let\nvb@Xnewverbatim\vvb@xnewvinput \nvb@newverbatim}
1222 \def\renewverbatiminput{\let\nvb@newenv\renewenvironment
1223 \let\nvb@Xnewverbatim\vvb@xnewvinput \nvb@newverbatim}
1224
1225 % \end{macrocode}
1226 %
1227 % \begin{macro}{\nvb@xnewvinput}
1228 % \begin{macro}{\nvb@xnewvinputnodef}
1229 % \begin{macro}{\nvb@xnewvinputdefault}
1230 % The macro |\nvb@xnewvinput| defines environments of weird names,
1231 % \meta{command} name followed by a space and a `|*|' for starred-version.
1232 % The \meta{command} itself is defined to call |\begin|\Meta{env} or
1233 % |\begin{|\meta{env}|*}|, where \meta{env} is what we now define, according
1234 % to the existence of `|*|' following the \meta{command}.
1235 %
1236 % Prior to defining \meta{env}, we check if the optional \meta{n-args} is
1237 % zero, and makes it one if so for the argument \meta{file}. We also check
1238 % the existence of the \meta{default} argument, because if omitted
1239 % \meta{file} is the first argument as |\vvb@xnewvinputnodef| defines, while
1240 % the second otherwise as |\vvb@xnewvinputdefault| does. The core of the
1241 % definition is in the \meta{beg-def-inner} part given to
1242 % |\nvb@xnewverbatim|. In this part, we redefine |\nvb@xverbatim| as
1243 % |\end|\Meta{env} and then |\input| the \meta{file} so that the environment
1244 % is immediately closed after the \meta{file} is read verbatim.
1245 % \end{macro}\end{macro}\end{macro}
1246 %
1247 % \begin{macrocode}
1248 \def\vvb@xnewvinput#1[#2][#3]{%
1249 \edef\@tempa{\expandafter\@cdr\string#1\@nil\space}
1250 \edef#1{\noexpand\@ifstar{\noexpand\begin{\@tempa*}}%
1251 {\noexpand\begin{\@tempa}}}%
1252 \ifnum#2=\z@
1253 \edef\@tempa{\noexpand\nvb@xnewverbatim{\@tempa}[1]}
1254 \else
1255 \edef\@tempa{\noexpand\nvb@xnewverbatim{\@tempa}[#2]}\fi
1256 \def\@tempb{#3}\ifx\@tempb\@empty \let\@tempb\vvb@xnewvinputnodef
1257 \else \let\@tempb\vvb@xnewvinputdefault \fi
1258 \@tempb[#3]}
1259 \def\vvb@xnewvinputnodef[#1]#2#3{%
1260 \@tempa[#1]{#2}{#3%
1261 \edef\nvb@xverbatim{\noexpand\end{\nvb@currenvir}}\input{##1}}}
1262 \def\vvb@xnewvinputdefault[#1]#2#3{%
1263 \@tempa[#1]{#2}{#3%
1264 \edef\nvb@xverbatim{\noexpand\end{\nvb@currenvir}}\input{##2}}}
1265 % \end{macrocode}
1266 %
1267 % \iffalse
1268 %</varvbtm>
1269 % \fi
1270 %
1271 %
1272 %
1273 % \IndexPrologue{\newpage\section*{Index}
1274 % Italicized number refers to the page where the specification and usage of
1275 % corresponding entry is described, while underlined is for the
1276 % implementation of the entry.}
1277 % \Finale
1278 % \GlossaryPrologue{\newpage\section*{Revision History}}
1279 % \PrintChanges
1280 \endinput