summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/vrb/vrb.tex
blob: 7b18bfcc2d14a12237b4b2e2de61412a379508c7 (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
%Author: C.G. van der Laan, Hunzeweg 57, 9893PB
%   Garnwerd, The Netherlands
%   05941-1525, cgl@risc1.rug.nl.
%Purpose: Verbatim macros via plain TeX, 
%         to be used with AnyTeX.
%                         *numvrb
%User toks variables
\newtoks\thisverbatim
\newtoks\everyverbatim
%
%User customization
\let\preverbatim\medskip
\let\postverbatim\medbreak
%                         *vrblin100
%User `options': \numvrb
\newcount\vrblin
\def\numvrb{\vrblin0
   \everypar{\advance\vrblin1
    \llap{\sevenrm\the\vrblin\quad}}}
\def\nonum{\everypar={}}
%              : \emc
\def\makeescape#1{\catcode`#1=0 }
\def\makeactive#1{\catcode`#1=13 }
{\makeactive\<
 \gdef\emc{\makeactive\<%
   \def<##1>{$\langle##1\rangle$}}}
%                         *vrblin200
%User macro
\def\verbatim{\preverbatim\begingroup
   \tt\setupverbatim
   \the\everyverbatim\relax
   \the\thisverbatim\relax
   \verbatimgobble}
%
\def\endverbatim{\endgroup\postverbatim
   \thisverbatim={}}
%
\def\setupverbatim{\makeactive\`%
   \let\!=!\makeescape\!%Knuth&Levy  
   \def\par{\leavevmode\endgraf}%TB381
   \obeylines\uncatcodespecials
   \obeyspaces}
%
{\obeyspaces\global\let =\ 
 \obeylines\gdef\verbatimgobble#1^^M{}%
 \makeactive\` \gdef`{\relax\lq}}%TB381 
%
\def\uncatcodespecials{\def\do##1{%
   \catcode`##1=12 }\dospecials}
%                         *vrblin250
%Minimal | tag for inline verbatim
\def\vrt{{\tt\char`\|}}\makeactive\|
\def|{\bgroup\tt\setupverbatim
      \the\everyverbatim\relax
      \the\thisverbatim\relax
      \def|{\egroup\thisverbatim{}}}
%\endinput %14/2/94 cgl@risc1.rug.nl
%                         *nonum
%Contents
%Newtoks
%   \thisverbatim.................2
%   \everyverbatim................3
%Customing
%   \preverbatim..................6
%   \postverbatim.................7
%Options
%   \numvrb.....................103   
%   \nonum......................106
%   \makeescape.................108
%   \makeactive.................109
%   \emc........................111   
%   <#1>........................112   
%User macro
%   \verbatim...................202
%   \endverbatim................208
%   \setupverbatim..............211
%   \verbatimgobble.............218
%   `...........................219
%   \uncatcodespecials..........221
%Inline verbatim
%   \vrt........................252
%   |...........................253
%History of changes vrb.tex
%March  94   Block comments omitted.
%            Verbatim mode with exclamation 
%            mark as escape char.
%Febr 1994   Release Version 1.
%
%Examples. (Extract the above vrt.tex file
%           and store this as vrt.tex.)
%           
%
%1. To handle other fonts via change and emc (enable metacode).
\thisverbatim={\emc}
\verbatim 
Some <meta code> and
blah, blah, ...    !it
Now text in italics!tt
and back again in tt
!endverbatim
%
%2. To handle numbering and verbatim file inclusion
\everyverbatim={\numvrb}
\thisverbatim={\makeescape\*
               \catcode`\|=12                
               \catcode`\!=12
               \input vrb.tex
               }
\verbatim 
Extras after file
*endverbatim
%
%3. To restart (line)numbers
\thisverbatim={\vrblin0 }
\verbatim 
Just some text with
line numbers restarted.


After two blank lines.
!endverbatim
%
%4. In-line with alias tags
{\makeactive\|
\thisverbatim{\emc}
Before |inline <text and \cs>| after.
}
\bye
%History of changes
%March  1994 Selective numbering added as example.
%12 Feb 1994 File verbatim inclusion simplified. Just supply 
%            as part of the replacement text of \thisverbatim
%		          \input ... . 
%            Now more than one file can be specified. 
%            Moreover, the encoding is simpler. 
%            Furthermore, the coding of the second | as alias
%            for \endverbatim is simplified, similar to manmac.
%            Last but not least the deficiencies as mentioned 
%            in TeXbook p.381 have been incorporated. 
%            In-line verbatim only via alias tags.
%12 Jan 1994 \ea\relax omitted and file rearranged as test.
%            \processl improved to handle blank lines.
%            in-line verbatim added, explicitly
%   Jan 1994 Name changes and submission to CTAN