summaryrefslogtreecommitdiff
path: root/macros/generic/vrb
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/vrb
Initial commit
Diffstat (limited to 'macros/generic/vrb')
-rw-r--r--macros/generic/vrb/readme20
-rw-r--r--macros/generic/vrb/vrb.tex144
2 files changed, 164 insertions, 0 deletions
diff --git a/macros/generic/vrb/readme b/macros/generic/vrb/readme
new file mode 100644
index 0000000000..4e46165e27
--- /dev/null
+++ b/macros/generic/vrb/readme
@@ -0,0 +1,20 @@
+%Contents: Verbatim macros via plain TeX, to be used with AnyTeX.
+%Version: 1.1 of March 1994.
+%Purpose: Handling verbatims with user guidance (options) to be
+% provided via \everyverbatim and/or \thisverbatim. (New approach.)
+% To be used with TeX, LaTeX, ...
+% Examples of guidance: verbatim input from file
+% escapecharacter and metacode
+% block comment
+% (selective) numbering of verbatim lines
+% inline verbatim (with minimal | tags).
+% Placement within context is parameterized via
+% \preverbatim and \postverbatim with as default \medskip.
+%Author: C.G. van der Laan, Hunzeweg 57, 9893PB, Garnwerd. The Netherlands.
+% 05941-1525., cgl@risc1.rug.nl.
+%Documentation: MAPS 94.1, as a spin-off in the TUGboat BLUes article,
+% which discusses the TUGboat styles and descendants.
+%Keywords: verbatim, escape character, block comment, file verbatim inclusion.
+%Examples of use (after \input vrb.tex) %the macros, as appended below
+%
+%\input vrb.tex %File included for convenience
diff --git a/macros/generic/vrb/vrb.tex b/macros/generic/vrb/vrb.tex
new file mode 100644
index 0000000000..7b18bfcc2d
--- /dev/null
+++ b/macros/generic/vrb/vrb.tex
@@ -0,0 +1,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