Update to 2.0.0 tree from current Fremantle build
[opencv] / doc / verbdef.sty
1 % verbdef.sty v0.2 -- Robin Fairbairns 2000/10/06
2 \ProvidesPackage{verbdef}[2000/10/06 v0.2 define verbatim csnames]
3
4 % This package provides a single command \verbdef
5 %
6 % Usage:  \verbdef\test|verbatim text|
7 %         \verbdef*\testar{with visible spaces}
8 %
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)
12 %
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)
16 %
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
22 % your document.
23
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.
31 %
32 % This program consists of the file verbdef.sty
33
34 \newif\ifverbdef@nostar
35 \def\verbdef{\verbdef@nostarfalse
36   \@ifstar\@sverbdef\@verbdef}
37 \def\@verbdef{\verbdef@nostartrue\@sverbdef}
38
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}%
44   \begingroup
45     \verb@eol@error
46     \let\do\@makeother  \dospecials
47     \toks@{\verbatim@font\@noligs}%
48     \ifverbdef@nostar
49       \@vobeyspaces
50       \toks@\expandafter{\the\toks@\frenchspacing}%
51     \fi
52     \@verb@def}
53
54 %
55 \def\@verb@def#1{%
56   \ifnum`#1=`\{\relax
57     \catcode`\}\active
58     \lccode`\~`\}%
59   \else
60     \catcode`#1\active
61     \lccode`\~`#1%
62   \fi
63   \lowercase{%
64     \def\@tempa##1~{%
65       \expandafter\xdef\csname\verbdef@tempa\space\endcsname{%
66         {\the\toks@##1}}}}%
67   \afterassignment\endgroup
68   \@tempa}