% \iffalse
%<newvbtm>%% Style file `newvbtm'.
%<varvbtm>%% Style file `varvbtm'.
%% Copyright (C) 1999  Hiroshi Nakashima <nakasima@tutics.tut.ac.jp>
%%		       (Toyohashi Univ. of Tech.)
%% 
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or any later version.
%% 
% \fi
%
% \CheckSum{578}
%% \CharacterTable
%%  {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
%%   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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
% \iffalse
%%
%<*dtx>
\ProvidesFile{newvbtm.dtx}
%</dtx>
%<newvbtm|varvbtm>\newif\ifnvb@LaTeXe
%<newvbtm|varvbtm>\def\next{LaTeX2e}
%<newvbtm|varvbtm>\ifx\fmtname\next \nvb@LaTeXetrue
%<newvbtm|varvbtm>\def\next{
%<newvbtm|varvbtm>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%<newvbtm>\ProvidesPackage{newvbtm}}
%<varvbtm>\ProvidesPackage{varvbtm}}
%<newvbtm|varvbtm>\else \nvb@LaTeXefalse
%<newvbtm|varvbtm>\def\next[#1]{}\fi
%<newvbtm|varvbtm>\next
%<driver>\ProvidesFile{newvbtm-man.tex}
% \fi
% \ProvidesFile{newvbtm.dtx}
[1999/08/11 v1.0 ]
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\usepackage{varvbtm}
\DisableCrossrefs
\PageIndex
\CodelineNumbered
\RecordChanges
%</driver>
%<driver>\OnlyDescription
%<driver>\def\ONLYDESCRIPTION{}
%<*driver>
\advance\textwidth4em
\begin{document}
\DocInput{newvbtm.dtx}
\end{document}
%</driver>
% \fi
% \changes{v0.1}{1991/12/18}
%	{The macros for tabbing verbatim etc. has already been born.}
% \changes{v0.2}{1992/03/26}
%	{The style defverbatim is born.}
% \changes{v0.3}{1992/10/27}
%	{The style newverbatim has already been born.}
% \changes{v1.0}{1999/07/14}
%	{The Style and macros are merged into newvbtm.dtx and rewritten.}
%
% \errorcontextlines10000
% \GetFileInfo{newvbtm.dtx}
% \setcounter{IndexColumns}{2}
% 
% \def\bottomfraction{.9}
% \def\cs#1{\hbox{\tt\char\escapechar#1}}
% \def\Item{\vskip-\itemsep\vskip-\parsep\vskip0pt\item}
%
% \makeatletter
% \def\nosv{\catcode`\|12}
% 
% \def\eqnarray{\stepcounter{equation}\let\@currentlabel=\theequation
% \global\@eqnswtrue
% \global\@eqcnt\z@\tabskip\@centering\let\\=\@eqncr
% $$\halign to \displaywidth\bgroup\hskip\@centering
%   $\displaystyle\tabskip\z@{##}$\@eqnsel&\global\@eqcnt\@ne
%   \hfil$\;{##}\;$\hfil
%   &\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil
%    \tabskip\@centering&\llap{##}\tabskip\z@\cr}
%
% \def\Meta#1{\penalty\@highpenalty
%	\hbox{{\tt\char`\{}{\it\meta{#1}}{\tt\char`\}}}}
% \def\opt#1{{\tt[}{\it\meta{#1}}{\tt]}}
% \def\optn#1{{\tt[#1]}}
% \def\arg#1{{\tt\char`\{#1\char`\}}}
%
% \let\latex@addmarginpar\@addmarginpar
% \let\latex@latex@warning@no@line\@latex@warning@no@line
% \def\@addmarginpar{\let\@latex@warning@no@line\@gobble
%	\latex@addmarginpar
%	\let\@latex@warning@no@line\latex@latex@warning@no@line}
% \let\@font@warning\@gobble
%
% \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
%    \edef\saved@macroname{\string#2}
%   \def\makelabel##1{\llap{##1\hskip\@totalleftmargin}}
%   \if@inlabel
%     \let\@tempa\@empty \count@\macro@cnt
%     \loop \ifnum\count@>\z@
%       \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
%     \edef\makelabel##1{\llap{\vtop to\baselineskip
%                                {\@tempa\hbox{##1}\vss}
%			       \hskip\@totalleftmargin}}
%     \advance \macro@cnt \@ne
%   \else  \macro@cnt\@ne  \fi
%   \edef\@tempa{\noexpand\item[
%      #1
%        \noexpand\PrintMacroName
%      \else
%        \noexpand\PrintEnvName
%      \fi
%      {\string#2}]}
%   \@tempa
%   \global\advance\c@CodelineNo\@ne
%    #1
%       \SpecialMainIndex{#2}\nobreak
%       \DoNotIndex{#2}
%    \else
%       \SpecialMainEnvIndex{#2}\nobreak
%    \fi
%   \global\advance\c@CodelineNo\m@ne
%   \ignorespaces}
% 
% \def\dummymacro{\topsep\MacroTopsep \trivlist \item[]}
% \let\enddummymacro\endtrivlist
% 
% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
%   \Describe@Opt}
% \def\Describe@Opt#1{\endgroup \Describe@pt{#1}}
% \def\Describe@pt#1#2{
%               \marginpar{\raggedleft\PrintDescribeMacro{#1}}
% 		\SpecialOptUsageIndex{#1}{#2}}
% \def\SpecialOptUsageIndex#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar usage}
%	\index{#2s:\levelchar{\protect\ttfamily#1}\encapchar usage}
%	\@esphack\ignorespaces}
% \def\SpecialOptMainIndex#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)\encapchar main}
%	\index{#2s:\levelchar{\protect\ttfamily#1}\encapchar main}
%	\@esphack\ignorespaces}
% \def\SpecialOptIndex#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)}
%	\index{#2s:\levelchar{\protect\ttfamily#1}}
%	\@esphack\ignorespaces}
% \def\SpecialOptIndexS#1#2{
% 	\index{#1\actualchar{\protect\ttfamily#1} (#2)}
%	\index{#2es:\levelchar{\protect\ttfamily#1}}
%	\@esphack\ignorespaces}
%
% \begingroup
% \gdef\@sverbcat{\catcode`\@\active\catcode`\#\active}
% \catcode`\@\active \gdef@{\char`\@\penalty\exhyphenpenalty}
% \catcode`\#\active \gdef#{\penalty\exhyphenpenalty}
% \endgroup
% \let\latex@sverb\@sverb
% \def\@sverb{\@sverbcat\latex@sverb}
%
% \def\theglossary{\onecolumn \glossary@prologue
%	\GlossaryParms \let\item\@idxitem \ignorespaces}
% \def\endtheglossary{\relax}
% 
% 
%
% \def\bracepair{`{\tt\char`\{\char`\}'}}
%
% \ifx\ONLYDESCRIPTION\undefined\else
% \let\SpecialUsageIndex\SpecialMainIndex
% \let\SpecialOptUsageIndex\SpecialOptMainIndex
% \fi
% \newverbatim{iverbatim}{\begin{itemize}\item[]\ttfamily}{}{}{\end{itemize}}
% 
% 
%
% \title{\textsf{newvbtm} and \textsf{varvbtm}\\
%	Packages for Variants of \texttt{verbatim} Environment\thanks{
%	This file has version number \fileversion, last revised \filedate.}}
% \author{Hiroshi Nakashima\\(Toyohashi Univ. of Tech.)}
% \date{\filedate}
% \maketitle
% 
% \begin{abstract}
% This file provides two style files; \textsf{newvbtm} to define
% |verbatim|-like environments; \textsf{varvbtm} to provide set of macros
% for variants of |verbatim|, e.g.\ in which \texttt{\char`\^I} acts as a tab.
% \end{abstract}
%
% \tableofcontents
% \newpage
%
% 
%
% \section{Introduction}
% \label{sec:intro}
%
% \SpecialOptIndex{verbatim}{environment}
% \LaTeX{} users often have trouble when they wish to have their own
% customized |verbatim|-like environment.  Probably you once wished to have
% an indented-footnotesize-|verbatim| instead of always typing;
%
%\begin{iverbatim}
%\begin{itemize}\item[]\footnotesize
%\begin{verbatim}
%...
%\end{verbatim}
%\end{itemize}
%\end{iverbatim}
%
% and tried the following just to know it does not work.
%
%\begin{iverbatim}
%\newenvironment{myverbatim}{\begin{itemize}\item[]\footnotesize
%                            \begin{verbatim}}%
%                           {\end{verbatim}\end{itemize}}
%\end{iverbatim}
%
% Another trouble you probablly have had is that what you see in |verbatim|
% text with |<TAB>| is not what you get because |<TAB>| does not acts as an
% tab but a space.
%
% Of course it is possible to define your own |verbatim|-like environments
% if you have enough knowledge of the implementation of |verbatim| including 
% dirty tricks with |\catcode|.  However, even a \TeX{}pert should be bored
% with typing a dirty code like;
%
%\begin{iverbatim}
%\begingroup \catcode`\|=0 \catcode`\[=1 \catcode`\]=2
%\catcode`\{=12 \catcode`\}=12 \catcode`\\=12
%|long|def|@myxverbatim##1\end{myverbatim}[##1|end[myverbatim]]
%|endgroup
%\end{iverbatim}
%
% \DescribeOpt{newvbtm}{style file}
% \DescribeOpt{varvbtm}{style file}
% The style files distributed with this document will solve these problems.
% You will have two style files, \textsf{newvbtm.sty} and
% \textsf{varvbtm.sty}, by processing \textsf{newvbtm.dtx} with
% \textsf{docstrip}, or simply doing the following.
%
%\begin{iverbatim}
%% tex newvbtm.ins
%\end{iverbatim}
%
% The former style provides you |\(re)newverbatim| command to (re)define
% your own |verbatim|-like environment easily.  The latter gives you a set
% of various macros for tab-emulation, page break control, etc.
%
% 
%
% \section{Usage}
% \label{sec:usage}
% \subsection{Loading Style Files}
% \label{sec:usage-load}
%
% Both style files are usable to both \LaTeXe{} and \LaTeX-2.09
% users with their standard package loading declaration.  If you use
% \LaTeXe{} and wish to load, for example, \textsf{newvbtm}, simply do the
% following.
%
% \SpecialUsageIndex{\usepackage}
%\begin{iverbatim}
%\usepackage{newvbtm}
%\end{iverbatim}
%
% If you still love \LaTeX-2.09, the following is what you have to do.
%
% \begin{quote}
% \SpecialUsageIndex{\documentstyle}
% |\documentstyle[..,newvbtm,...]|\Meta{main-style}
% \end{quote}
%
% Note that loading \textsf{varvbtm} automatically loads \textsf{newvbtm}
% too.  Thus you may not load both though doing so is safe.
%
% 
%
% \subsection{\textsf{newvbtm}: Define \texttt{verbatim}-like Environments}
% \label{sec:usage-new}
%
% \SpecialOptIndex{newvbtm}{style file}
% \DescribeMacro{\newverbatim}
% The command;
%
% \begin{quote}
% |\newverbatim|\Meta{env}\opt{n-args}
%	\Meta{beg-def-outer}\Meta{beg-def-inner}|%|\\
% \phantom{\texttt{+newverbatim}\Meta{env}\opt{n-args}}
%	\Meta{end-def-inner}\Meta{end-def-outer}
% \end{quote}
%
% defines an environment named \meta{env} with \meta{n-args} arguments
% (optionally), and acting conceptually as follows:
%
% \begin{quote}
% \meta{beg-def-outer}|\begin{verbatim}|\meta{beg-def-inner}\\
% \meta{body-of-environment}\\
% \meta{end-def-inner}|\end{verbatim}|\meta{end-def-outer}
% \end{quote}
%
% Thus to have indented-footnotesize-|verbatim| named, say |indfnsverbatim|, 
% you may simply do the following.
%
%\begin{iverbatim}
%\newverbatim{indfnsverbatim}{\begin{itemize}\item[]\footnotesize}{}{}%
%                            {\end{itemize}}
%\end{iverbatim}
%
% Since |\newverbatim| defines not only \meta{env} but also its starred 
% counterpart \meta{env}\texttt{*} that acts like |verbatim*|, the
% definition above also defines |indfnsverbatim*| environment.
%
% If you use \LaTeXe{}, you may make \meta{env} have an optional argument
% whose default value is \meta{default} by;
%
% \begin{itemize}\item[]
% |\newverbatim|\Meta{env}\opt{n-args}\opt{default}
%	\Meta{beg-def-outer}\Meta{beg-def-inner}|%|\\
% \phantom{\texttt{+newverbatim}\Meta{env}\opt{n-args}\opt{default}}
%	\Meta{end-def-inner}\Meta{end-def-outer}
% \end{itemize}
%
% For example, our |indfnsverbatim| environment can have an optional
% argument to specify a font size other than |\footnotesize| by the
% following definition.
%
%\begin{iverbatim}
%\newverbatim{indfnsverbatim}[1][\footnotesize]%
%        {\begin{itemize}\item[]#1}{}{}{\end{itemize}}
%\end{iverbatim}
%
% The argument \meta{beg-def-inner} is for \TeX{}perts who wish to do
% something overriding what \LaTeX's |\verbatim| does.  Even if you don't
% have much confidence in your \TeX{}pertise, however, you can do some
% useful thing with this argument.  For example, the following is obtained
% by itself.
%
% \begin{itemize}\item[]
%\newverbatim{slverbatim}{\ttfamily}{\slshape}{}{}
%\begin{slverbatim}
%\newverbatim{slverbatim}{}{\slshape}{}{}
%\end{slverbatim}
% \end{itemize}
%
% Also you will find a few commands for this argument in
% \S\ref{sec:usage-var}.
% 
% The needs of \meta{end-def-inner} is much more limited.  One example is to
% check if |\end{verbatim}| is at the beginning of a line.  This examination
% is done by;
%
% \begin{quote}
% |\newverbatim{myverbatim}{...}{...}%|\\
% |        {\ifvmode |\meta{at-bol}| \else |\meta{not-at-bol}| \fi}{...}|
% \end{quote}
%
% \DescribeMacro{\renewverbatim}
% You may redefine your own |verbatim|-like environment, or even |verbatim|
% itself, by |\renewverbatim| whose arguments are same as those of
% |\newenvironment|.
%
% 
%
% \subsection{\textsf{varvbtm}: To Make Variants of \texttt{verbatim}}
% \label{sec:usage-var}
%
% \subsubsection{Tab Emulation}
% \label{sec:usage-var-tab}
%
% \DescribeMacro{\newtabverbatim}
% \DescribeMacro{\renewtabverbatim}
% The commands |\(re)newtabverbatim| is to (re)define a |verbatim|-like
% environment in which |<TAB>| acts as a tab.  The syntax of the command is
% same as that of |\(re)newverbatim|, and its operation is equivalent to;
%
% \begin{itemize}\item[]
% |\(re)newverbatim|\Meta{env}\opt{n-args}\opt{default}\\
% \mbox{}\qquad\qquad\Meta{beg-def-outer}|%|\\
% \mbox{}\qquad\qquad|{|\meta{beg-def-inner}\meta{beg-def-for-tab}|}%|\\
% \mbox{}\qquad\qquad|{|\meta{end-def-for-tab}\meta{end-def-inner}|}%|\\
% \mbox{}\qquad\qquad\Meta{end-def-outer}
% \end{itemize}
%
% For example;
%
%\begin{iverbatim}
%\newtabverbatim{tabverbatim}{}{}{}{}
%\end{iverbatim}
%
% defines |tabverbatim| environment just to make |<TAB>| act as a tab.
% Another example to have tab emulation version of |indfnsverbatim| with
% optional argument, say |indfnstabverbatim| is;
%
%\begin{iverbatim}
%\newtabverbatim{indfnstabverbatim}[1][\footnotesize]%
%        {\begin{itemize}\item[]#1}{}{}{\end{itemize}}
%\end{iverbatim}
%
% Note that in the starred version, e.g. |tabverbatim*|, a |<TAB>| is
% translated into a sequence of \verb*! !.
%
% \DescribeOpt{VVBtabwidth}{counter}
% The distance between tab stops is the width of eight characters of the
% font used in the environment, i.e. typewriter font usually.  If you want
% to change this default value, set the counter |VVBtabwidth| to the number
% of characters of the distance.
% 
% \DescribeMacro{\VVBbegintab}
% \DescribeMacro{\VVBendtab}
% The magical stuff for \meta{beg-def-for-tab} and \meta{end-def-for-tab}
% is also accessible through commands |\VVBbegintab| and |\VVBendtab| for
% \TeX{}perts who wish to do something with |\(re)newverbatim| rather than
% |\(re)newtabverbatim|.
%
% 
%
% \subsubsection{Form Feed Character}
% \label{sec:usage-var-ff}
%
% \DescribeMacro{\VVBprintFF}
% \DescribeMacro{\VVBprintFFas}
% You might have found that |<FF>| (or |^L|) in |verbatim| caused a
% mysterious error;
%
%\begin{iverbatim}
%! Forbidden control sequence found while scanning use of \@xverbatim.
%\end{iverbatim}
%
% This is because |<FF>| is not {\em verbatimized}.  Giving the command
% |\VVBprintFF| to $\langle$\textit{beg-def-}\allowbreak
% \textit{outer}$\rangle$ (or \meta{beg-def-inner}) of |\newverbatim| does
% it for you and makes |<FF>| printed as |^L| in default.  You may change
% this default print image by;
%
% \begin{quote}
% |\VVBprintFFas|\Meta{str}
% \end{quote}
% where \meta{str} is a sequence of any printable characters other than |{|
% and |}|.  Note that this command is very {\em fragile} as |\verb| and
% |\index|, and thus should not be used in an argument of other commands
% including |\(re)newverbatim|.
%
% \DescribeMacro{\VVBbreakatFF}
% \DescribeMacro{\VVBbreakatFFonly}
% The other way to make |<FF>| acceptable is to give it a useful and natural
% job, i.e.\ page breaking.  This is done by giving |\VVBbreakatFF| to
% \meta{beg-def-inner} (not {\em outer}).  Its more powerful relative,
% |\VVBbreakatFFonly|, is also available to allow page breaking at |<FF>|
% only.  Unfortunately, these two commands are incompatible with
% |\(re)newtabverbatim| and thus you have to use |\(re)newverbatim| with
% |\VVBbegintab| {\em followed by} them.
%
% 
%
% \subsubsection{Non-Verbatim Stuff in \texttt{verbatim}-like Environment}
% \label{sec:usage-var-nonverb}
%
% \DescribeMacro{\VVBnonverb}
% You might have once wished to insert a few non-verbatim stuff, for example 
% math stuff.  The command, to be given to \meta{beg-def-outer};
%
%\begin{quote}
%\newverbatim{verbatimwithnv}{\VVBnonverb{\!}\ttfamily}{}{}{}
%\begin{verbatimwithnv}
%\VVBnonverb{\!$\langle\mbox{\textit{char}}\rangle$!}
%\end{verbatimwithnv}
%\end{quote}
%
% makes it possible.  For example, the author just did the following to
% produce the result shown above.
%
%\begin{iverbatim}
%\newverbatim{verbatimwithnv}{\VVBnonverb{\!}}{}{}{}
%\begin{verbatimwithnv}
%\VVBnonverb{\!$\langle\mbox{\textit{char}}\rangle$!}
%\end{verbatimwithnv}
%\end{iverbatim}
%
% As shown in the example above, the non-verbatim staff is surrounded by
% a pair of \meta{char}, the letter `|!|' in this case.  Note that
% \meta{char} has to be preceded by `|\|' when it is given as the argument of
% |\VVBnonbverb|, and \meta{char} should not be `|\|'.  Also note that the
% default font for the non-verbatim part % is not that for verbatim part,
% but the font used outside the environment
%
% \footnote{Strictly speaking, the font used when \cs{VVBnonverb} is
% invoked.  Thus if \cs{VVBnonverb} is preceded by a font changing command,
% the fond chosen by the command will be used.}.
% 
% \DescribeMacro{\VVBnonverbmath}
% As mentioned above, math stuffs will be most desirable to be
% non-verbatim.  Thus the macro;
%
%\begin{quote}
%\newverbatim{verbatimwithnv}{\VVBnonverbmath\ttfamily}{}{}{}
%\begin{verbatimwithnv}
%\VVBnonverbmath[\$\langle\mbox{\textit{char}}\rangle$]
%\end{verbatimwithnv}
%\end{quote}
% gives you a shorthand to typeset the stuff surrounded by a pair of
% \meta{char} in math mode.  Since the default of \meta{char} is |$| as
% expected, the example above may be;
%
%\begin{iverbatim}
%\newverbatim{verbatimwithnv}{\VVBnonverbmath}{}{}{}
%\begin{verbatimwithnv}
%\VVBnonverb{\$\langle\mbox{\textit{char}}\rangle$}
%\end{verbatimwithnv}
%\end{iverbatim}
%
% 
%
% \subsubsection{Verbatim Input}
% \label{sec:usage-var-input}
%
% The last thing \textsf{varvbtm} gives you is;
%
% \begin{itemize}\item[]
% |\(re)newverbatiminput|\Meta{command}\opt{n-args}\opt{default}|%|\\
% \phantom{\texttt{+(re)newverbatiminput}}
%	\Meta{beg-def-outer}\Meta{beg-def-inner}|%|\\
% \phantom{\texttt{+(re)newverbatiminput}}
%	\Meta{end-def-inner}\Meta{end-def-outer}
% \end{itemize}
%
% to define a \meta{command} to |\input| a file.  Since this define a
% \meta{command} instead of an environment, \meta{command} should have `|\|'
% as its prefix.  The \meta{command} has at least one mandatory argument,
% \meta{file} to be input, which can be referred as first argument if
% \opt{default} is not supplied, or as second otherwise.  Note that,
% however, if the \meta{command} does not have any other arguments, you can
% omit \opt{n-arg}.
%
% For example;
%
%\begin{iverbatim}
%\newverbatiminput{\vinput}{}{}{}{}
%\end{iverbatim}
%
% defines |\vinput|\Meta{file} (and |\vinput*|) that |\input| a \meta{file}
% as if the \meta{file} has |\begin|\slash|\end{verbatim}| at its first and
% last lines.  A little bit more complicated example;
%
%\begin{iverbatim}
%\newverbatiminput{\indfnsvinput}[2][\footnotesize]%
%        {\begin{itemize}\item[]#1}{}{}{\end{itemize}}
%\end{iverbatim}
%
% defines a indented-footnotesize-by-default version of |\vinput|.
%
% 
%
% \IndexPrologue{\newpage\section*{Index}
% Underlined number refers to the page where the specification of
% corresponding entry is described.}
% \StopEventually{
% \section*{Acknowledgments}
%
% The author thanks to Noboru Matsuda and Carlos Puchol whose posts to
% news groups triggered writing very first version of macros in
% \textsf{newvbtm} and \textsf{varvbtm}.
%
% For the implementation of these style files, the author refers the base
% implementations of the macros for \texttt{verbatim} environment.
% These macros are written by Leslie Lamport as a part of
% \LaTeX-2.09 and \LaTeXe{} (1997/12/01) to which Johannes Braams and other
% authors also contributed.
%
% \PrintIndex}
%
% 
%
% \newpage
% \section{Implementation}
% \label{sec:imp}
% \subsection{Tricks for Compatibility}
% \label{sec:imp-compat}
%
% \begin{macro}{\ifnvb@LaTeXe}
% At the very beginning of each style file, we check whether it is loaded by
% \LaTeXe{} or \LaTeX-2.09, declare the flag |\ifnvb@LaTeXe| and set it to
% true or false, and then declare |\NeedsTeXFormat| and |\ProvidesPackage|
% if \LaTeXe{}.  This part is embedded at the beginning of
% \textsf{newvbtm.dtx} in a tricky manner to let \textsf{docstrip} produce
% the following code, for example for \textsf{newvbtm}.
% \SpecialIndex{\NeedsTeXFormat}
% \SpecialIndex{\ProvidesPackage}
% \end{macro}
%
%\begin{itemize}\item[]
%\begin{verbatim}
%\newif\ifnvb@LaTeXe
%\def\next{LaTeX2e}
%\ifx\fmtname\next \nvb@LaTeXetrue
%\def\next{
%\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%\ProvidesPackage{newvbtm}}
%\else \nvb@LaTeXefalse
%\def\next[#1]{}\fi
%\next
%[1999/08/11 v1.0 ]
%\end{verbatim}
%\end{itemize}
%
% \SpecialIndex{\RequirePackage}
% In \textsf{varvbtm}, loading \textsf{newvbtm} also takes care of the
% compatibility.  That is, \textsf{newvbtm} is loaded by |\RequirePackage| if 
% \LaTeXe, while simply by |\input| otherwise.  Since \textsf{newvbtm} does
% not modifies any existential macros nor declares anything by |\new| except 
% for |\newif|\footnote{
%
% Multiple \cs{newif} for a flag is safe, and thus we do it for
% \cs{nvb@LaTeXe} both in \textsf{newvbtm} and \textsf{varvbtm}.},
%
% it is safe even if |\newvbtm| is loaded multiple times in \LaTeX-2.09.
%
% \iffalse
%<*varvbtm>
% \fi
%    \begin{macrocode}

\ifnvb@LaTeXe
\RequirePackage{newvbtm}
\else
\input{newvbtm.sty}
\fi
%    \end{macrocode}
% \iffalse
%</varvbtm>
% \fi
%
% 
%
% \subsection{\textsf{newvbtm}}
% \label{sec:imp-new}
%
% \iffalse
%<*newvbtm>
% \fi
% \begin{macro}{\newverbatim}
% \begin{macro}{\renewverbatim}
% \begin{macro}{\nvb@newenv}
% \begin{macro}{\nvb@Xnewverbatim}
% The macros |\newverbatim| and |\renewverbatim| call a macro
% |\nvb@newverbatim| after |\nvb@newenv| and |\nvb@Xnewverbatim| are made
% |\let|-equal to appropriate macros.  That is, |\nvb@newenv| is either
% |\newenvironment| or |\renewenvironment|, and |\nvb@Xnewverbatim| is, in
% both cases, |\nvb@xnewverbatim| that is the body of our environment
% definition as explained later.  Note that |\nvb@Xnewverbatim| will be set
% differently in the macros defined in \textsf{varvbtm}.
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\nvb@newverbatim}
% \begin{macro}{\nvb@inewverbatim}
% The common macro |\nvb@newverbatim| checks the existence of \opt{n-args}
% and then calls |\nvb@inewverbatim| to check that of \opt{default}.  Note
% that since \LaTeX-2.09's |\(re)newenvironment| does not have
% \opt{default}, these macros have definitions slightly different from those
% for \LaTeXe{} to pass an empty argument to |\nvb@Xnewverbatim| always.
% \end{macro}\end{macro}
%
%    \begin{macrocode}

\def\newverbatim{\let\nvb@newenv\newenvironment
        \let\nvb@Xnewverbatim\nvb@xnewverbatim \nvb@newverbatim}
\def\renewverbatim{\let\nvb@newenv\renewenvironment
        \let\nvb@Xnewverbatim\nvb@xnewverbatim \nvb@newverbatim}

\ifnvb@LaTeXe
\def\nvb@newverbatim#1{\@ifnextchar[%]
        {\nvb@inewverbatim{#1}}{\nvb@inewverbatim{#1}[0]}}
\def\nvb@inewverbatim#1[#2]{\@ifnextchar[%]
        {\nvb@Xnewverbatim{#1}[#2]}{\nvb@Xnewverbatim{#1}[#2][]}}
\else
\def\nvb@newverbatim#1{\@ifnextchar[%]
        {\nvb@inewverbatim{#1}}{\nvb@Xnewverbatim{#1}[0][]}}
\def\nvb@inewverbatim#1[#2]{\nvb@Xnewverbatim{#1}[#2][]}
\fi

%    \end{macrocode}
%
% \begin{macro}{\nvb@xnewverbatim}
% \begin{macro}{\nvb@currenvir}
% \begin{macro}{\nvb@defxverbatim}
% \begin{macro}{\nvb@xverbatim}
% \begin{macro}{\nvb@beginhook}
% \begin{macro}{\nvb@endinhook}
% \begin{macro}{\nvb@endouthook}
% The macro |\nvb@xnewverbatim| performs the essential part of the function
% to define a verbatim-like environment.  First it checks if \meta{default}
% is empty so that this optional argument is not passed to
% |\(re)newenvironment|, especially of \LaTeX-2.09.  Then it calls
% |\(re)newenvironment| to define \meta{env} which performs the following in
% \meta{beg-def} part.
%
% \begin{enumerate}
% \def\labelenumi{b\arabic{enumi}.}
% \item
% |\def|-ine |\nvb@currenvir| to let it have \meta{env} as its body, so that
% the name of environment can be referred by the macros in \textsf{varvbtm}.
%
% \item
% Execute \meta{beg-def-outer}.
%
% \item
% Open a group to localize assignments in \LaTeX's |\@verbatim|, especially
% those of flags referred in |\list|-related macros.
%
% \item
% Perform what \LaTeX's |\verbatim| does, i.e.\ |\@verbatim| etc., except for
% |\@xverbatim|.  In starred-version, only |\@verbatim| is called in this
% step.
%
% \item
% Call |\nvb@defxverbatim| to define |\nvb@xverbatim| that performs what
% \LaTeX's \hbox{|\@xverbatim|} does but its argument terminator is
% ``|\end|\Meta{env}''.  The definition of |\nvb@defxverbatim| is done in a
% group in which `|\|', `|{|' and `|}|' have ``other'' |\catcode| with the
% well-known technique using `\verb!|!', `|[|' and `|]|'.
%
% \item
% Call |\nvb@beginhook|, which is usually |\relax| but will not be if
% |\VVBnonverb| is executed in \meta{beg-def-outer} as described in
% \S\ref{sec:imp-var-nonverb}.
%
% \item
% Execute \meta{beg-def-inner}.
%
% \item
% Call |\nvb@xverbatim| to typeset the body of environment verbatim.
% \end{enumerate}
%
% The \meta{end-def} part for \meta{env} performs the following.
%
% \begin{enumerate}
% \def\labelenumi{e\arabic{enumi}.}
% \item
% Execute \meta{end-def-inner}.
%
% \item
% Call |\nvb@endinhook|, which is |\relax| now but could do something if
% necessary.
%
% \item
% Call |\endverbatim| to close the |\trivlist| opened by |\@verbatim|.
%
% \item
% Close the group opened by \meta{beg-def}.
%
% \item
% Execute \meta{end-def-outer}.
%
% \item
% Call |\nvb@endouthook|, which is also |\relax| now but might not be.
%
% \item
% Turn |\if@endpe| true to tell |\end| that \meta{env} is list-like.
% \end{enumerate}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
\long\def\nvb@xnewverbatim#1[#2][#3]#4#5#6#7{\def\@tempa{#3}%
        \ifx\@tempa\@empty \def\@tempa{[#2]}%
        \else              \def\@tempa{[#2][#3]}\fi
        \def\@tempb{\nvb@newenv{#1}}%
        \expandafter\@tempb\@tempa
                {\def\nvb@currenvir{#1}%
                        #4\begingroup \@verbatim \frenchspacing \@vobeyspaces
                        \nvb@defxverbatim{#1}\nvb@beginhook #5\nvb@xverbatim}%
                {#6\nvb@endinhook \endverbatim \endgroup
                        #7\nvb@endouthook \@endpetrue}%
        \def\@tempb{\nvb@newenv{#1*}}%
        \expandafter\@tempb\@tempa
                {\def\nvb@currenvir{#1*}%
                        #4\begingroup \@verbatim
                        \nvb@defxverbatim{#1*}\nvb@beginhook #5\nvb@xverbatim}%
                {\@nameuse{end#1}}}
\let\nvb@beginhook\relax
\let\nvb@endinhook\relax
\let\nvb@endouthook\relax

\begingroup \catcode`\|\z@ \catcode`\[\@ne \catcode`\]\tw@
\@makeother\{ \@makeother\} \@makeother\\
|gdef|nvb@defxverbatim#1[|long|def|nvb@xverbatim##1\end{#1}[##1|end[#1]]]
|endgroup
%    \end{macrocode}
%
% \iffalse
%</newvbtm>
% \fi
%
% 
%
% \subsection{\textsf{varvbtm}}
% \label{sec:imp-var}
%
% \iffalse
%<*varvbtm>
% \fi
% 
% \subsubsection{Tab Emulation}
% \label{sec:imp-var-tab}
%
% For tab emulation, we declare the following registers.
%
% \begin{itemize}
% \item
% \begin{macro}{\c@VVBtabwidth}
% The count register |\c@VVBtabwidth| that has the number of characters
% between tab stops.  The default value 8 is set.
% \end{macro}
%
% \item
% \begin{macro}{\vvb@tabwidth}
% The dimen register |\vvb@tabwidth| that has the distance between tab
% stops.
% \end{macro}
%
% \item
% \begin{macro}{\vvb@everypar}
% The toks register |\vvb@everypar| to save the contents of |\everypar|,
% though it is usually ineffective.
% \end{macro}
%
% \item
% \begin{macro}{\vvb@tabbox}
% The box register |\vvb@tabbox| that contains stuffs between the beginning
% of line or a tab stop and the end of line or another tab stop.
% \end{macro}
% \end{itemize}
%
%    \begin{macrocode}

%% Tab Emulation

\newcounter{VVBtabwidth}\c@VVBtabwidth8
\newdimen\vvb@tabwidth
\newtoks\vvb@everypar
\newbox\vvb@tabbox

%    \end{macrocode}
%
% \begin{macro}{\VVBbegintab}
% \begin{macro}{\vvb@tabfil}
% \begin{macro}{\vvb@tabdef}
% The macro |\VVBbegintab|, which should be called from \meta{beg-def-inner} 
% part, performs a few preprocessing for tabbing some of which override the
% definition in |\@verbatim|.
%
% A line in a tabbing verbatim environment is
% enclosed in a box |\vvb@tabbox| so that we can know the horizontal
% position of a tab.  Thus, we let |\everypar| call |\vvb@tabbol| to
% open the box, and |\par| be |\vvb@tabeol| to close.  Note that
% |\obeylines| after the |\let| for |\par| is necessary to make `|^M|'
% |\let|-equal to our own |\par|.
%
% Then we set |\vvb@tabwidth| to
% $|\c@VVBtabwidth|\times\hbox{\meta{width-of-\texttt{A}}}$.  We also
% |\def|-ine |\vvb@tabfil| to produce a sequence of `\verb*! !' in the case
% of starred environment, i.e.\ the |\catcode| of space is not |\active|.
%
% Finally, we make |^I| active and |\let|-equal to |\vvb@tab| by
% |\vvb@tabdef|.
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\VVBendtab}
% The macro |\VVBendtab|, which should be called from \meta{end-def-inner}
% part, closes the box |\vvb@tabbox| if necessary, i.e.\ |\end|\Meta{env} is 
% not at the beginning of a line and thus not in vertical mode.
% \end{macro}
%
%    \begin{macrocode}
\def\VVBbegintab{\vvb@everypar\everypar
        \everypar{\vvb@tabbol \the\vvb@everypar}%
        \let\par\vvb@tabeol \obeylines
        \settowidth\vvb@tabwidth{A}\multiply\vvb@tabwidth\c@VVBtabwidth
        \ifnum\catcode`\ =\active \let\vvb@tabfil\relax
        \else                     \def\vvb@tabfil{\leaders\hbox{\char`\ }}\fi
        \catcode`\^^I\active \vvb@tabdef}
{\catcode`\^^I\active \gdef\vvb@tabdef{\let^^I\vvb@tab}}
\def\VVBendtab{\ifvmode\else \par \fi}

%    \end{macrocode}
%
% \begin{macro}{\vvb@tabbol}
% \begin{macro}{\vvb@tabeol}
% The macro |\vvb@tabbol| opens the box |\vvb@tabbox|, while |\vvb@tabeol|
% closes it after |\leavevmode| to ensure the box is opened and puts the
% contents of the box as the last (and maybe only one) element of a
% paragraph terminated by |\@@par|.  The flag |\if@tempswa|, which |\@verbatim|
% initiated to false, is examined in order to prevent |^M| just
% following |\begin|\Meta{env} from making an empty line.  Since the flag is 
% turned true by both |\vvb@tabbol| and |\vvb@tabeol|, a |^M| is in effect
% in other cases.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
\def\vvb@tabbol{\@tempswatrue \setbox\vvb@tabbox\hbox\bgroup}
\def\vvb@tabeol{\if@tempswa
        \leavevmode \egroup \box\vvb@tabbox \@@par \penalty\interlinepenalty
        \fi \@tempswatrue}

%    \end{macrocode}
%
% \begin{macro}{\vvb@tab}
% The macro |\vvb@tab|, to which |^I| is made |\let|-equal, is the heart of
% tabbing.  It first closes |\vvb@tabbox| after |\leavevmode| to ensure its
% opening.  Then it moves to the next tab stop by putting a box of $(\lfloor
% w/t\rfloor+1)\times t$ wide, where $w$ is the width of |\vvb@tabbox| and
% $t$ is |\vvb@tabwidth|.  In the box, the contents of |\vvb@tabbox| is
% flushed left by |\vvb@tabfil#\hfil|, which makes invisible space in
% non-starred environment because |\vvb@tabfil| is relax, while produces a
% sequence of `\verb*! !' by |\leaders| in starred environment.  After the
% box is put, it opens |\vvb@tabbox| again by |\vvb@tabbol|.
% \end{macro}
%
%    \begin{macrocode}
\def\vvb@tab{\leavevmode \egroup
        \@tempdima\wd\vvb@tabbox \divide\@tempdima\vvb@tabwidth
        \multiply\@tempdima\vvb@tabwidth \advance\@tempdima\vvb@tabwidth
        \hbox to\@tempdima{\unhbox\vvb@tabbox \vvb@tabfil\hfil}\vvb@tabbol}

%    \end{macrocode}
%
% \begin{macro}{\newtabverbatim}
% \begin{macro}{\renewtabverbatim}
% \begin{macro}{\vvb@xnewtabverbatim}
% Finally, we define |\newtabverbatim| and |\renewtabverbatim| for tabbing
% verbatim environment definition.  They call the common macro
% |\nvb@newverbatim| described in \S\ref{sec:imp-new} to check the existence
% of optional arguments as |\(re)newverbatim| does, but |\nvb@Xnewverbatim|
% is made |\let|-equal to |\vvb@xnewtabverbatim| that simply calls
% |\nvb@xnewverbatim| attaching |\VVBbegintab| and |\VVBendtab| to
% \meta{beg-def-inner} and \meta{end-def-inner} respectively.
% \end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
\def\newtabverbatim{\let\nvb@newenv\newenvironment
        \let\nvb@Xnewverbatim\vvb@xnewtabverbatim \nvb@newverbatim}
\def\renewtabverbatim{\let\nvb@newenv\renewenvironment
        \let\nvb@Xnewverbatim\vvb@xnewtabverbatim \nvb@newverbatim}
\def\vvb@xnewtabverbatim#1[#2][#3]#4#5#6{%
        \nvb@xnewverbatim{#1}[#2][#3]{#4}{#5\VVBbegintab}{\VVBendtab#6}}

%%^L
%    \end{macrocode}
%
% 
%
% \subsubsection{Form Feed Character}
% \label{sec:imp-var-ff}
%
% \begin{macro}{\VVBprintFF}
% \begin{macro}{\vvb@printFF}
% \begin{macro}{\VVBprintFFas}
% \begin{macro}{\vvb@printFFas}
% The macro |\VVBprintFF| simply makes |^L| |\let|-equal to |\vvb@printFF|
% whose body is print image of |^L| and is defined by |\VVBprintFFas|.
% Since the body of |\VVBprintFF| has |^L| that usually cannot appear in 
% the body of a macro because of its |\active|-ness and {\em outerness}, its
% |\def|-inition is enclosed in a group in which |^L| is made |\relax|
% together with that of |\VVBbreakatFF|.
%
% The macro |\VVBprintFFas|, cooperating with |\VVB@printFFas|, defines its
% argument \meta{str} verbatim as the body of |\vvb@printFF| by a well-known
% trick with grouping and \hbox{|\@sanitize|} used in, for example, |\index|.
% The default print image ``|^L|'' is also defined by |\VVBprintFFas|.
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\VVBbreakatFF}
% \begin{macro}{\vvb@FFpar}
% \begin{macro}{\vvb@breakFF}
% \begin{macro}{\vvb@parafterFF}
% The macro |\VVBbreakatFF| makes |^L| |\let|-equal to |\vvb@breakFF| and
% saves the definition of |\par| in |\vvb@FFpar| because it will be modified 
% by |\vvb@breakFF|\@.  The macro |\vvb@breakFF| breaks the current page and
% then makes |\par|, and |^M| by |\obeylines|, |\let|-equal to
% |\vvb@parafterFF|\@.  Since |\vvb@parafterFF| will do |\par| saved in
% |\vvb@FFpar| only when horizontal mode, |^M| just following |^L| will not
% produce an empty line at the beginning of the new page.  After the first
% |^M| in the page, |\par| and |^M| regain their original definitions.
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\VVBbreakatFFonly}
% \begin{macro}{\vvb@FF@par}
% \begin{macro}{\vvb@FFpenalty}
% \begin{macro}{\vvb@parnobreak}
% The macro |\VVBbreakatFFonly| does what |\VVBbreakatFF| by calling it but
% before that it makes |\par| |\let|-equal to |\vvb@parnobreak| saving its
% definition in |\vvb@FF@par|.  The macro |\vvb@parnobreak| temporarily
% makes |\penalty| |\let|-equal to |\@tempcnta| in order that
% |\penalty|\meta{num} in original |\par| saved in |\vvb@FF@par| do
% nothing.  Then it restores |\penalty| from |\vvb@FFpenalty| and inserts
% |\nobreak| to inhibit page break at |^M|.  The temporary modification of
% |\penalty| is done |\global|-ly because of the compatibility with the
% tabbing verbatim.
% \end{macro}\end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}

%% Form Feed Character

\begingroup \let^^L\relax
\gdef\VVBprintFF{\let^^L\vvb@printFF}
\gdef\VVBbreakatFF{\let^^L\vvb@breakFF \let\vvb@FFpar\par}
\endgroup

\def\VVBprintFFas{\begingroup \@sanitize \vvb@printFFas}
\def\vvb@printFFas#1{\endgroup \def\vvb@printFF{#1}}
\VVBprintFFas{^L}

\def\vvb@breakFF{\par \vfil \break \let\par\vvb@parafterFF \obeylines}
\def\vvb@parafterFF{\ifhmode \vvb@FFpar \fi \let\par\vvb@FFpar \obeylines}

\gdef\VVBbreakatFFonly{\let\vvb@FF@par\par
        \let\par\vvb@parnobreak \obeylines \VVBbreakatFF}
\let\vvb@FFpenalty\penalty
\def\vvb@parnobreak{\global\let\penalty\@tempcnta \vvb@FF@par
        \global\let\penalty\vvb@FFpenalty \nobreak}

%%^L
%    \end{macrocode}
%
% 
% 
% \subsubsection{Non-Verbatim}
% \label{sec:imp-var-nonverb}
%
% \begin{macro}{\VVBnonverb}
% \begin{macro}{\vvb@nvfont}
% \begin{macro}{\vvb@currsize}
% \begin{macro}{\vvb@beginhook}
% The macro |\VVBnonverb| saves the current font in |\vvb@nvfont|.  If
% \LaTeXe, its body will be a sequence of |\fontencoding|\meta{curr-encoding}
% and its relatives followed by |\selectfont|.  Otherwise, its body will be
% the current font size command saved in |\vvb@currsize| followed by the
% current font produced by |\the\font|.  Then |\VVBnonverb| defines
% |\nvb@beginhook| so as to call |\vvb@nonverb| with the argument
% |\|\meta{char} just before \meta{beg-def-inner} is executed.
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\VVBnonverbmath}
% \begin{macro}{\vvb@nonverbmath}
% \begin{macro}{\vvb@@bnonverb}
% \begin{macro}{\vvb@@enonverb}
% The macro |\VVBnonverbmath| examines the existence of its optional
% argument |\|\meta{char} and calls |\VVBnonverb| via |\vvb@nonverbmath|
% with it or with |\$| if omitted.  Prior to the call, it makes both
% |\vvb@@bnonverb| and |\vvb@@enonverb| |\let|-equal to `|$|' so that the
% non-verbatim part is surrounded by them.
% \end{macro}\end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}

%% Non-Verbatim

\def\VVBnonverb#1{\ifnvb@LaTeXe
        \edef\vvb@nvfont{\noexpand\fontencoding{\f@encoding}%
                \noexpand\fontfamily{\f@family}%
                \noexpand\fontseries{\f@series}%
                \noexpand\fontshape{\f@shape}%
                \noexpand\fontsize{\f@size}{\noexpand\f@baselineskip}%
                \noexpand\selectfont}%
        \else
        \let\vvb@currsize\@currsize
        \edef\vvb@nvfont{\noexpand\vvb@currsize \the\font}\fi
        \def\nvb@beginhook{\vvb@nonverb#1}}
\def\VVBnonverbmath{\@ifnextchar[%]
        {\vvb@nonverbmath}{\vvb@nonverbmath[\$]}}
\def\vvb@nonverbmath[#1]{\let\vvb@@bnonverb$\let\vvb@@enonverb$\VVBnonverb#1}

%    \end{macrocode}
% 
% \begin{macro}{\vvb@nonverb}
% \begin{macro}{\vvb@bnonverb}
% \begin{macro}{\vvb@enonverb}
% \begin{macro}{\vvb@@bnonverb}
% \begin{macro}{\vvb@@enonverb}
% \begin{macro}{\do}
% \begin{macro}{\vvb@regaincat}
% The macro |\vvb@nonverb| defines the |\active| \meta{char} to open a
% |\hbox| after |\leavevmode| and then to call |\vvb@bnonverb| to do the
% following.  First it selects the font saved in |\vvb@nvfont| and then
% restores |\catcode| of special characters by |\vvb@regaincat|.  Since the
% body of |\vvb@regaincat| is the expansion result of |\dospecials| with the
% defintion of |\do| as;
%
%\begin{iverbatim}
%\def\do#1{\catcode`\noexpand#1\number\catcode`#1\relax}
%\end{iverbatim}
%
% it should be the sequence of ``\verb*!\catcode`\ 10!'' and so on.  The
% macro |\vvb@bnoverb| also set |\catcode| of characters in
% |\verbatim@nolig@list| if exists or `|`|' otherwise to 12 (other).  Then
% the |\catcode| of \meta{char} is made |\active| because it might not be by
% the preceding |\catcode| modification.  Finaly it calls |\vvb@enonverb| to
% get non-verbatim stuff.
%
% The macro |\vvb@enonverb|, which is also defined in |\vvb@nonverb|, gets
% everything before \meta{char}, puts it in the |\hbox| surrounding it by
% |\vvb@@bnonverb| and |\vvb@@enonverb|, which are both `|$|' in the case of
% |\VVBnonverbmath| but |\relax| otherwise, and then closes the |\hbox|.
%
% Since the definitions of the \meta{char} and |\vvb@enonverb| should have
% |\active| \meta{char}, we use the trick with |\lowercase| in which the
% |\lccode| of `|~|' is the code of \meta{char}.
%
% After the definitions, the character `|\|' is made |\active| and
% |\let|-equal to |\vvb@esc| by |\vvb@escdef| so that we can find
% ``|end|\Meta{env}'', stored in |\vvb@endenvir| by |\vvb@enddef|, following 
% `|\|'.  Note that we cannot use the conventional scheme to get everything
% in the body of \meta{env} by |\nvb@xverbatim| because the |\catcode| of
% special characters are modified in non-verbatim part.  Thus we make `|\|'
% active and |\vvb@xverbatim| |\relax|.
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
\def\vvb@nonverb#1{\catcode`#1\active \begingroup \lccode`\~`#1\relax
        \lowercase{\endgroup
                \def~{\leavevmode \hbox\bgroup \vvb@bnonverb#1}%
                \def\vvb@enonverb##1~{\vvb@@bnonverb
                        ##1\vvb@@enonverb \egroup}}%
        \catcode`\\\active \vvb@escdef \vvb@enddef \let\nvb@xverbatim\relax}
\def\vvb@bnonverb#1{\vvb@nvfont \vvb@regaincat
        \ifx\verbatim@nolig@list\undefined \@makeother\`\relax
        \else \let\do\@makeother \verbatim@nolig@list \fi
        \catcode`#1\active \vvb@enonverb}
\let\vvb@@bnonverb\relax
\let\vvb@@enonverb\relax
\def\do#1{\catcode`\noexpand#1\number\catcode`#1\relax}
\edef\vvb@regaincat{\dospecials}

%    \end{macrocode}
%
% \begin{macro}{\vvb@escdef}
% \begin{macro}{\vvb@enddef}
% \begin{macro}{\vvb@endenvir}
% The macro |\vvb@escdef| simply let |\active| character `|\|' act as the
% macro |\vvb@esc|, while |\vvb@enddef| defines the macro |\vvb@endenvir| as 
% ``|end|\Meta{env}'' referring the environment name saved in
% |\vvb@currenvir|.  Since these two macros has `|\|', `|{|' and `|}|' of
% ``other'' category, the well-known technique replacing them is used.
% \end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
\begingroup \catcode`\|\z@ \catcode`\[\@ne \catcode`\]\tw@
\@makeother\{ \@makeother\} \catcode`\\|active
|gdef|vvb@escdef[|let\|vvb@esc]
|gdef|vvb@enddef[|edef|vvb@endenvir[end{|nvb@currenvir}]]
|endgroup

%    \end{macrocode}
%
% \begin{macro}{\vvb@esc}
% \begin{macro}{\vvb@checkend}
% The macro |\vvb@esc| for `|\|' in |\active| examines if it is followed by
% |end|\Meta{env} stored in |\vvb@endenvir|.  The examination is done in
% character-by-character manner by |\vvb@checkend| because we might have a
% partially matching sequence followed by non-verbatim stuff which cannot be 
% picked before the |\catcode| modification.  The comparison for the
% examination is done by |\ifx| because we might have an |\active| character.
%
% If we find the terminator, we call |\end|\Meta{env} to close the
% environment.  Otherwise, the |\char|-acter `|\|' followed by the partial
% matched (possibly empty) sequence followed by the unmatched character are 
% inserted back.
% \end{macro}\end{macro}
%
%    \begin{macrocode}
\def\vvb@esc{\let\@tempa\vvb@endenvir \let\@tempb\@empty \vvb@checkend}
\def\vvb@checkend#1{\edef\@tempc{\expandafter\@car\@tempa\@nil}%
        \def\@tempd{#1}\ifx\@tempc\@tempd
                \edef\@tempa{\expandafter\@cdr\@tempa\@nil}%
                \ifx\@tempa\@empty
                        \edef\next{\noexpand\end{\nvb@currenvir}}%
                \else
                        \edef\@tempb{\@tempb#1}\let\next\vvb@checkend \fi
        \else   \def\next{\char`\\\@tempb#1}\fi
        \next}

%%^L
%    \end{macrocode}
%
% 
%
% \subsubsection{Verbatim Input}
% \label{sec:imp-var-input}
%
% \begin{macro}{\newverbatiminput}
% \begin{macro}{\renewverbatiminput}
% \begin{macro}{\vvb@Xnewverbatim}
% The macros |\newverbatiminput| and |\renewverbatiminput| call the common
% macro |\nvb@newverbatim| described in \S\ref{sec:imp-new} to check the
% existence of optional arguments, making |\nvb@Xnewverbatim| |\let|-equal
% to their own version, |\nvb@xnewvinput|.
% \end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}

%% Verbatim Input

\def\newverbatiminput{\let\nvb@newenv\newenvironment
        \let\nvb@Xnewverbatim\vvb@xnewvinput \nvb@newverbatim}
\def\renewverbatiminput{\let\nvb@newenv\renewenvironment
        \let\nvb@Xnewverbatim\vvb@xnewvinput \nvb@newverbatim}

%    \end{macrocode}
%
% \begin{macro}{\nvb@xnewvinput}
% \begin{macro}{\nvb@xnewvinputnodef}
% \begin{macro}{\nvb@xnewvinputdefault}
% The macro |\nvb@xnewvinput| defines environments of weird names,
% \meta{command} name followed by a space and a `|*|' for starred-version.
% The \meta{command} itself is defined to call |\begin|\Meta{env} or
% |\begin{|\meta{env}|*}|, where \meta{env} is what we now define, according
% to the existence of `|*|' following the \meta{command}.
%
% Prior to defining \meta{env}, we check if the optional \meta{n-args} is
% zero, and makes it one if so for the argument \meta{file}.  We also check
% the existence of the \meta{default} argument, because if omitted
% \meta{file} is the first argument as |\vvb@xnewvinputnodef| defines, while
% the second otherwise as |\vvb@xnewvinputdefault| does.  The core of the
% definition is in the \meta{beg-def-inner} part given to
% |\nvb@xnewverbatim|.  In this part, we redefine |\nvb@xverbatim| as
% |\end|\Meta{env} and then |\input| the \meta{file} so that the environment
% is immediately closed after the \meta{file} is read verbatim.
% \end{macro}\end{macro}\end{macro}
%
%    \begin{macrocode}
\def\vvb@xnewvinput#1[#2][#3]{%
        \edef\@tempa{\expandafter\@cdr\string#1\@nil\space}
        \edef#1{\noexpand\@ifstar{\noexpand\begin{\@tempa*}}%
                                 {\noexpand\begin{\@tempa}}}%
        \ifnum#2=\z@
                \edef\@tempa{\noexpand\nvb@xnewverbatim{\@tempa}[1]}
        \else   
                \edef\@tempa{\noexpand\nvb@xnewverbatim{\@tempa}[#2]}\fi
        \def\@tempb{#3}\ifx\@tempb\@empty \let\@tempb\vvb@xnewvinputnodef
                       \else              \let\@tempb\vvb@xnewvinputdefault \fi
        \@tempb[#3]}
\def\vvb@xnewvinputnodef[#1]#2#3{%
        \@tempa[#1]{#2}{#3%
                \edef\nvb@xverbatim{\noexpand\end{\nvb@currenvir}}\input{##1}}}
\def\vvb@xnewvinputdefault[#1]#2#3{%
        \@tempa[#1]{#2}{#3%
                \edef\nvb@xverbatim{\noexpand\end{\nvb@currenvir}}\input{##2}}}
%    \end{macrocode}
% 
% \iffalse
%</varvbtm>
% \fi
%
% 
%
% \IndexPrologue{\newpage\section*{Index}
% Italicized number refers to the page where the specification and usage of
% corresponding entry is described, while underlined is for the
% implementation of the entry.}
% \Finale
% \GlossaryPrologue{\newpage\section*{Revision History}}
% \PrintChanges
\endinput