]> mj.ucw.cz Git - ucwmac.git/commitdiff
Added \verb -- a verbatim environment with one-character delimiters
authorMartin Mares <mj@ucw.cz>
Sat, 9 Oct 2010 11:24:10 +0000 (13:24 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 9 Oct 2010 11:24:10 +0000 (13:24 +0200)
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.

test.tex
ucw-verb.tex

index ad70a84a51962d6906617f73d4596a5f334190c7..6fa29390a8c7bacf5d5cfac2dad436cc2f93d994 100644 (file)
--- 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
index b218307f3535f0e0bdaf59eec943d76a02831de4..981aebefbb834fa4062d6e10a142aae038c30c3a 100644 (file)
@@ -1,4 +1,4 @@
-% The UCW Macro Collection: Verbatim environment
+% The UCW Macro Collection: Verbatim environments
 % Written by Martin Mares <mj@ucw.cz> in 2010 and placed into public domain
 % -------------------------------------------------------------------------
 
 \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