define-method-combination fixed (and inflated).
[clqr.git] / clqr.macros.tex
blob440f066bc30d3b528c03fc1aae86301da250d6f8
1 % Copyright (C) 2008, 2009, 2010 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
9 \newlength{\LISTlinewidth}
10 \newenvironment{LIST}[1]%
12 \LISTlinewidth=\linewidth%
13 \begin{flushleft}%
14 \begin{list}{}%
15 {\setlength{\itemindent}{-#1}\setlength{\leftmargin}{#1}}%
16 %\parskip0pt\itemsep0pt%
18 {\end{list}%
19 \end{flushleft}%
22 %\renewcommand{\topfraction}{1}
23 \renewcommand{\bottomfraction}{1}
24 %\renewcommand*{\figureformat}{}
25 %\renewcommand*{\captionformat}{}
26 \renewcommand{\thefootnote}{\fnsymbol{footnote}}
28 \setlength{\parfillskip}{5cm plus1cm minus3cm}
29 \setlength{\arraycolsep}{0pt}
32 \def\startexplanation{$\triangleright$\hskip1.4ex}
33 \newlength{\ITwidth}
34 \newlength{\ITrest}
35 \newlength{\ITtab}\ITtab=3em
37 \def\IT#1 #2 {%
38 \settowidth{\ITwidth}{#1\unskip\hskip1em\hskip\ITtab}%
39 \ITrest=\LISTlinewidth\advance\ITrest by -\ITwidth%
40 \loop\ifdim\ITrest > \ITtab%
41 \advance\ITrest by -\ITtab%
42 \repeat%
44 \settowidth{\ITwidth}{%
45 #1\unskip\hskip1em\hskip\ITrest%
46 \startexplanation#2%
48 \item{}%
49 \ifdim\ITwidth < \LISTlinewidth% Entry fits into a single line
50 #1\unskip\hskip1em\hskip\ITrest%
51 \startexplanation#2%
52 \else%
53 #1%
54 \unskip\penalty-10000%
55 \parbox[t]{\linewidth}{\startexplanation#2}%
56 \fi%
60 \newpagestyle{lispref}[\sffamily\mdseries\slshape]{
61 \headrule\footrule
62 \sethead*{}{}{\maintitle\/}
63 \setfoot*{}{}{\thepage\/}}
64 \pagestyle{lispref}
66 % Emphasize
67 \newcommand{\EM}[1]{\text{{\fontfamily{cmr}\fontseries{b}\fontshape{n}\selectfont#1}}}
70 % Literal Text
71 \newcommand{\LIT}[1]{\text{{\fontfamily{cmtt}\selectfont#1}}}
73 % Variable Text
74 \newcommand{\VAR}[1]{\text{{\fontfamily{cmr}\fontshape{it}\selectfont#1\/}}}
76 % Not Evaluated
77 \newcommand{\NEV}[1]{\text{{$\widehat{#1}$}}}
79 % Subjected to Destruction
80 \newcommand{\DES}[1]{\text{{$\widetilde{#1}$}}}
82 % Default Value
83 \newcommand{\DF}[1]{\text{\textsubscript{\setlength{\fboxsep}{.5pt}\setlength{\fboxrule}{.2bp}\fbox{#1}}}}
85 % Optional Part, [], two sizes
86 \newcommand{\OP}[1]{{\text{$\big[$}{#1}\text{$\big]$}}}
87 \newcommand{\Op}[1]{{\text{$[$}{#1}\text{$]$}}}
89 % Or, |
90 \newcommand{\XOR}{\hspace{1pt}\text{\rule[-.9ex]{.25pt}{3ex}}\hspace{1pt}}
91 %\newcommand{\XOR}{\text{$\mid$}\hspace{0pt}}
93 % Optional Parts, *
94 \newcommand{\OPn}[1]{{{#1}\text{${}^{*}$}}}
96 % Required Parts, +
97 \newcommand{\RP}[1]{{{#1}\text{${}^{+}$}}}
99 % Implicit PROGN, P*
100 \newcommand{\PROGN}[1]{{{#1}\text{${}^{{\raisebox{.5ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{-.6ex}P}}*}}$}}}
102 % Group of Objects {}, three sizes
103 \newcommand{\GOO}[1]{{\text{$\Big\{$}{#1}\text{$\Big\}$}}}
104 \newcommand{\GOo}[1]{{\text{$\big\{$}{#1}\text{$\big\}$}}}
105 \newcommand{\Goo}[1]{{\text{$\{$}{#1}\text{$\}$}}}
106 % Optional Group of Objects, {}*, three sizes
107 \newcommand{\GOOs}[1]{{$\Big\{${#1}$\Big\}^{\!\!*}$}} % this one can
108 % have line breaks
109 \newcommand{\GOos}[1]{\text{{$\big\{${#1}$\big\}^{\!\!*}$}}}
110 \newcommand{\Goos}[1]{\text{{$\{${#1}$\}^{\!*}$}}}
111 % Required Group of Objects, {}+, three sizes
112 \newcommand{\GOOp}[1]{{\text{$\Big\{$}{#1}\text{$\Big\}^{\!\!+}$}}}
113 \newcommand{\GOop}[1]{{\text{$\big\{$}{#1}\text{$\big\}^{\!\!+}$}}}
114 \newcommand{\Goop}[1]{{\text{$\{$}{#1}\text{$\}^{\!+}$}}}
116 % Vertically Arranged Group of Alternatives, {
117 % usage: \xorGOO{line1\\ line2...}{closing delimiter}
118 \newcommand{\xorGOO}[2]{\text{\(%
119 \left\{\!%
120 \begin{array}{l}%
122 \end{array}\!%
123 \right#2%
124 \)}}
126 % Vertically Arranged Group of Optional Objects, {|
127 % usage: \orGOO{line1\\line2}{closing delimiter}
128 \newcommand{\orGOO}[2]{\text{\(%
129 \left\{\!\left|%
130 \begin{array}{l}%
132 \end{array}\!%
133 \right.\right#2%
134 \)}}
136 % Vertically Arranged Group of Objects, No Opening {
137 % usage: \arrGOO{line1\\line2}{closing delimiter}
138 \newcommand{\arrGOO}[2]{\text{\(\!%
139 \left.%
140 \begin{array}{l}%
142 \end{array}\!%
143 \right#2%
144 \)}}
147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149 % All sorts of tags attached to lisp keywords
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 \newlength{\TAGwidth}
154 \newlength{\KEYWORDwidth}
156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
157 % Generic Keyword, Lowercase
158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
159 \newcommand{\kwd}[1]{\text{{\sffamily\bfseries\selectfont%
160 \lowercase{#1}}}}
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 % Generic Keyword, Uppercase
164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
165 \newcommand{\KWD}[1]{\text{{\sffamily\bfseries\selectfont%
166 \uppercase{#1}}}}
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 % Macro
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 \newcommand{\MC}[1]{%
172 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}Mx}% x just for space
173 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
174 \ifdim\TAGwidth > \KEYWORDwidth%
175 \text{{\sffamily\bfseries\selectfont%
176 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}M}}\lowercase{#1}}}}%
177 \else%
178 \text{{\sffamily\bfseries\selectfont%
179 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}M}}\lowercase{#1}}}}%
180 \fi}
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 % Special Operator
184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
185 \newcommand{\SO}[1]{%
186 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}SOx}% x just for space
187 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
188 \ifdim\TAGwidth > \KEYWORDwidth%
189 \text{{\sffamily\bfseries\selectfont%
190 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}sO}}\lowercase{#1}}}}%
191 \else%
192 \text{{\sffamily\bfseries\selectfont%
193 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}sO}}\lowercase{#1}}}}%
194 \fi}
196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
197 % Function
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
199 \newcommand{\FU}[1]{%
200 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}Fux}% x just for space
201 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
202 \ifdim\TAGwidth > \KEYWORDwidth%
203 \text{{\sffamily\bfseries\selectfont%
204 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}Fu}}\lowercase{#1}}}}%
205 \else%
206 \text{{\sffamily\bfseries\selectfont%
207 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}Fu}}\lowercase{#1}}}}%
208 \fi}
210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
211 % Generic Function
212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
213 \newcommand{\GFU}[1]{%
214 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}gFx}% x just for space
215 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
216 \ifdim\TAGwidth > \KEYWORDwidth%
217 \text{{\sffamily\bfseries\selectfont%
218 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}gF}}\lowercase{#1}}}}%
219 \else%
220 \text{{\sffamily\bfseries\selectfont%
221 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}gF}}\lowercase{#1}}}}%
222 \fi}
224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
225 % Variable
226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
227 \newcommand{\V}[1]{%
228 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.8em}varx}% x just for space
229 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
230 \ifdim\TAGwidth > \KEYWORDwidth%
231 \text{{\sffamily\bfseries\selectfont%
232 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}var}}\lowercase{#1}}}}%
233 \else%
234 \text{{\sffamily\bfseries\selectfont%
235 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.8em}var}}\lowercase{#1}}}}%
236 \fi}
238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
239 % Constant
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 \newcommand{\CNS}[1]{%
242 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}cox}% x just for space
243 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
244 \ifdim\TAGwidth > \KEYWORDwidth%
245 \text{{\sffamily\bfseries\selectfont%
246 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}co}}\lowercase{#1}}}}%
247 \else%
248 \text{{\sffamily\bfseries\selectfont%
249 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}co}}\lowercase{#1}}}}%
250 \fi}
252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
253 % Loop Keyword
254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
255 \newcommand{\LKWD}[1]{\text{{\sffamily\bfseries\selectfont%
256 {\raisebox{1.4ex}[1ex][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}}}\lowercase{#1}}}}}
258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
259 % Return Values, First, Second, nth, Third
260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
261 \renewcommand{\ULthickness}{.2pt}
262 \newcommand{\retval}[1]{\uline{#1}}
263 %\newcommand{\retvalii}[1]{\uuline{#1}}
264 \newcommand{\retvaln}[2]{{%
265 {\raisebox{-1.7ex}[0pt][1.4ex]{\tiny\sffamily\upshape\mdseries\makebox[0pt][l]{\hspace{-.1em}#1}}\uline{#2}}}}
266 \newcommand{\retvalii}[1]{\retvaln{2}{#1}}
267 \newcommand{\retvaliii}[1]{\retvaln{3}{#1}}
269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
270 % T and NIL
271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
272 \newcommand{\T}{\text{\ttfamily T}}
273 \newcommand{\NIL}{\text{\ttfamily NIL}}
275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
276 % ~ (slightly lowered)
277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
278 \newcommand{\TLD}{{\protect\raisebox{-.8ex}{\textasciitilde}}}
280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
281 % * (lowered version)
282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
283 \newcommand{\A}{\textasteriskcentered}
285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
286 % Starred commands send their argument into index:
287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
288 \WithSuffix\newcommand\kwd*[1]{\kwd{#1}\uppercase{\index{#1}}}
289 \WithSuffix\newcommand\KWD*[1]{\KWD{#1}\uppercase{\index{#1}}}
290 \WithSuffix\newcommand\MC*[1]{\MC{#1}\uppercase{\index{#1}}}
291 \WithSuffix\newcommand\SO*[1]{\SO{#1}\uppercase{\index{#1}}}
292 \WithSuffix\newcommand\FU*[1]{\FU{#1}\uppercase{\index{#1}}}
293 \WithSuffix\newcommand\GFU*[1]{\GFU{#1}\uppercase{\index{#1}}}
294 \WithSuffix\newcommand\V*[1]{\V{#1}\uppercase{\index{#1}}}
295 \WithSuffix\newcommand\CNS*[1]{\CNS{#1}\uppercase{\index{#1}}}
296 \WithSuffix\newcommand\LKWD*[1]{\LKWD{#1}\uppercase{\index{#1}}}
298 \hyphenation{white-space pa-ra-me-ters}