summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/newvbtm/varvbtm.sty
blob: 30b42e4437e52fd5ba855febf8ae8826d3ab9d3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
%%
%% This is file `varvbtm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% newvbtm.dtx  (with options: `varvbtm')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from varvbtm.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file newvbtm.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Style file `varvbtm'.
%% Copyright (C) 1999-2002  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.
%%
%% \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         \~}
%%
%%
\newif\ifnvb@LaTeXe
\def\next{LaTeX2e}
\ifx\fmtname\next \nvb@LaTeXetrue
\def\next{
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{varvbtm}}
\else \nvb@LaTeXefalse
\def\next[#1]{}\fi
\next
[2002/04/08 v1.1 ]
%% tex newvbtm.ins

\ifnvb@LaTeXe
\RequirePackage{newvbtm}
\else
\input{newvbtm.sty}
\fi

%% Tab Emulation

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

\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}

\def\vvb@tabbol{\@tempswatrue \setbox\vvb@tabbox\hbox\bgroup}
\def\vvb@tabeol{\if@tempswa
        \leavevmode \egroup \box\vvb@tabbox \@@par \penalty\interlinepenalty
        \fi \@tempswatrue}

\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}

\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

%% 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

%% 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}

\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}

\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

\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

%% 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}

\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}}}
\endinput
%%
%% End of file `varvbtm.sty'.