1 % verbdef.sty v0.2 -- Robin Fairbairns 2000/10/06
2 \ProvidesPackage{verbdef}[2000/10/06 v0.2 define verbatim csnames]
4 % This package provides a single command \verbdef
6 % Usage: \verbdef\test|verbatim text|
7 % \verbdef*\testar{with visible spaces}
9 % \test (or \testar) above will be defined as robust commands that
10 % expand to typeset their `verbatim text' argument in the usual
11 % verbatim font (using the visible space symbol in the * case)
13 % The verbatim text argument may be delimited in the same was as the
14 % argument of a \verb command (see definition of \test above) or using
15 % braces (see definition of \testar command above)
17 % Note: if the command you're defining with \verbdef is to be used in
18 % a \section-type command, or a \caption, it's going to appear in the
19 % table of contents, or list of whatevers; in this case you must
20 % define the command *before* the \tableofcontents command (or
21 % whatever). I recommend defining the commands in the preamble of
24 % This program may be distributed and/or modified under the
25 % conditions of the LaTeX Project Public License, either version 1.1
26 % of this license or (at your option) any later version.
27 % The latest version of this license is in
28 % http://www.latex-project.org/lppl.txt
29 % and version 1.1 or later is part of all distributions of LaTeX
30 % version 1999/06/01 or later.
32 % This program consists of the file verbdef.sty
34 \newif\ifverbdef@nostar
35 \def\verbdef{\verbdef@nostarfalse
36 \@ifstar\@sverbdef\@verbdef}
37 \def\@verbdef{\verbdef@nostartrue\@sverbdef}
39 % set up robustness of the command to be defined, set conditions for
40 % reading verbatim text
41 \def\@sverbdef#1{\edef\verbdef@tempa{\expandafter\@gobble\string#1}%
42 \edef#1{\noexpand\protect
43 \expandafter\noexpand\csname\verbdef@tempa\space\endcsname}%
46 \let\do\@makeother \dospecials
47 \toks@{\verbatim@font\@noligs}%
50 \toks@\expandafter{\the\toks@\frenchspacing}%
65 \expandafter\xdef\csname\verbdef@tempa\space\endcsname{%
67 \afterassignment\endgroup