From: Martin Mares Date: Sat, 9 Oct 2010 11:24:10 +0000 (+0200) Subject: Added \verb -- a verbatim environment with one-character delimiters X-Git-Tag: v1.0~4 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e51d2ddb736ea025de57c0d41f554438b2407b4d;p=ucwmac.git Added \verb -- a verbatim environment with one-character delimiters Written by Mosquitoe, who took inspiration from LaTeX. I have changed it from \iverb to \verb, so that LaTeX documents are easier to adapt to plain with ucwmac. --- diff --git a/test.tex b/test.tex index ad70a84..6fa2939 100644 --- a/test.tex +++ b/test.tex @@ -63,6 +63,8 @@ Lo and behold: |a quick brown fox| {\showspacestrue |jumps over the lazy dog|} \inlineverboff When turned off, vertical lines work as usually: $|a-b| \ge 0$. +Delimited verbatim: \verb@abracadabra@ or \verb|brekeke|. + \hd{Block verbatim} \noindent Pre-verbatim diff --git a/ucw-verb.tex b/ucw-verb.tex index b218307..981aebe 100644 --- a/ucw-verb.tex +++ b/ucw-verb.tex @@ -1,4 +1,4 @@ -% The UCW Macro Collection: Verbatim environment +% The UCW Macro Collection: Verbatim environments % Written by Martin Mares in 2010 and placed into public domain % ------------------------------------------------------------------------- @@ -34,6 +34,16 @@ \gdef\inlineverboff{\catcode124=12} } +% Typesetting of verbatim text with a given delimiter: +% - usage: \verb%verbatim text% +% - the delimiter is the first character after \verb +% - remember that writing (for example) \verbz with meaning \verb +% with the delimiter 'z' is possible only if \catcode`z is not 11 + +\def\verb{\relax\def\sv@rb##1{\uccode`~=`##1% +\uppercase{\catcode`~13\global\let~\endgroup}}% +\begingroup\setverb@tim\sv@rb} + % Typesetting of verbatim blocks: % - the block is enclosed in balanced {}'s % - leading and trailing empty lines are ignored