summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rcs/src/rcs-doc.sty
blob: 38d4908eec4f218880969f4fdf46f794b44d7df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
% $Id: rcs-doc.sty,v 1.4 1995/08/02 12:09:06 schrod Exp $
%----------------------------------------------------------------------

%
% tags for the documentation of rcs style option
%


\ProvidesPackage{rcs-doc}


%
% Configuration of RCS fields
%

% keywords in style are prefixed by `Style', in documentation by `Doc'.
\let\RcsHandleStyleDate=\RcsHandleDate	% transform StyleDate value
\let\RcsHandleDocDate=\RcsHandleDate	% transform DocDate field

% the revision of rcs.sty is needed by the documentation
\expandafter\RCS \rcs@loaded		% creates \RCSStyleRevision

% name of the author
%
% CAVEAT: Don't define another author name without changing the text
% in the user manual where \rcsAuthor is explained!
\rcsAuthor{schrod}{Joachim Schrod}


%
% new tags
%

\def\rcsField#1{\textsf{#1}}		% name of a RCS field (ie, RCS keyword)
\def\Log{\rcsField{Log}}		% The `Log' keyword, needed often
\def\Date{\rcsField{Date}}		% The `Date' keyword, needed often


%
% \macroCall[p]{\\split \[Revision\(: \)1.1\( \]:\) \{\} \\end_value}
%
% \[...\] is param of caller, \(...\) is arg (delimiter) for \split
%	empty arg delimiter must be input as `\(\|\)'
%	may not be nested, as shown above
% in \macroCall arg: `_' and ` ' are other characters
%		     \\, \{, and \} produce characters `\', `{' and `}'
%		     \| is invisible text
% The optional arg is the character to mark the delimiter. By using
% [p] one can mark args with `\(...\)'!

\newtoks\@macroCall

\def\macroCall{%
    \@ifnextchar[%			% ] (Emacs)
	\macro@call
	{\macro@call[d]}%
    }
\def\macro@call[#1]{%
    \def\delimChar{#1}%
    \begingroup
	\catcode`\ =\CatOther
	\catcode`\_=\CatOther
	\afterassignment\showExample
	\global\@macroCall
    }

\newcount\delimCount
\def\showExample{%
    \endgroup
    \leavevmode
    \vtop{%
	\reset@font \ttfamily
	\let\[\relax	\let\]\relax
	\let\(\relax	\let\)\relax
	\chardef\\=`\\	\chardef\{=`\{	\chardef\}=`\}
	\def\|{\hskip 1sp}%		% must be >0pt, but invisible
	\baselineskip\z@skip
	\lineskip 2pt
	\delimCount\z@
	\hbox{\expandafter\showParam \the\@macroCall \endValue}%
	\hbox{\the\@macroCall}%		% the example itself
	\hbox{\expandafter\showDelimiter \the\@macroCall \(\)\endValue}%
	\hrule height \z@
	}%
    }


\def\showParam #1\[#2\]#3\endValue{%
    \hphantom{#1}%
    \setbox\z@ \hbox{#2}%
    \vbox{\hsize \wd\z@
	\centerline{\tt \#1}%
	\vskip 3pt
	\hrule
	\@@line{\hss \vrule height 3pt \hskip\hsize \vrule \hss}%
	}%
    \setbox\z@ \hbox{#3}%
    \vbox{\hsize \wd\z@
	\centerline{$s$}%
	\vskip 3pt
	\@@line{\cleaders \hbox{$\mkern 1mu.\mkern 1mu$}\hfill}\nointerlineskip
	\@@line{\hskip\hsize \vrule height 3pt \hss}%
	}%
    }

\def\showDelimiter #1\(#2\)#3\endValue{%
    \hphantom{#1}%
    \advance\delimCount \@ne
    \setbox\z@ \hbox{#2}%
    \ifdim \wd\z@=\z@
    \else
	\vtop{\hsize\wd\z@
	    \@@line{\hss \vrule depth 3pt \hskip\hsize \vrule \hss}%
	    \hrule
	    \vskip 3pt
	    \centerline{$\delimChar_{\the\delimCount}$}%
	    }%
	\showDelimiter #3\endValue
    \fi
    }



\endinput



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Local Variables:
mode: plain-TeX
TeX-master: t
TeX-brace-indent-level: 4
indent-tabs-mode: t
TeX-auto-untabify: nil
End: