Unfinished work on figures Data Types and Condition Types.
[clqr.git] / clqr.macros.tex
blob0ac3d9cd3ee86267c5f3237b88d871262e52c49e
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}{.1pt}\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 \)}}
146 % Boxed Group of Alternatives
147 % usage: \boxGOO{line1\\ line2...}
148 \newcommand{\boxGOO}[1]{\text{\hspace{1ex}\(%
149 \setlength{\fboxsep}{1pt}\setlength{\fboxrule}{0pt}
150 \boxed{
151 \setlength{\fboxsep}{1pt}\setlength{\fboxrule}{.1pt}
152 \boxed{\;%
153 \begin{array}[t]{l}%
155 \end{array}%
158 \)}}
160 % In a Boxed Group of Alternatives: Replacement for \\ with additional
161 % vspace
162 \newcommand{\boxGOOcr}{\vspace{1ex}\\}
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 % All sorts of tags attached to lisp keywords
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 \newlength{\TAGwidth}
172 \newlength{\KEYWORDwidth}
174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
175 % Generic Keyword, Lowercase
176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
177 \newcommand{\kwd}[1]{\text{{\sffamily\bfseries\selectfont%
178 \lowercase{#1}}}}
180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
181 % Generic Keyword, Uppercase
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 \newcommand{\KWD}[1]{\text{{\sffamily\bfseries\selectfont%
184 \uppercase{#1}}}}
186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
187 % Macro
188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
189 \newcommand{\MC}[1]{%
190 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}Mx}% x just for space
191 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
192 \ifdim\TAGwidth > \KEYWORDwidth%
193 \text{{\sffamily\bfseries\selectfont%
194 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}M}}\lowercase{#1}}}}%
195 \else%
196 \text{{\sffamily\bfseries\selectfont%
197 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}M}}\lowercase{#1}}}}%
198 \fi}
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
201 % Special Operator
202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
203 \newcommand{\SO}[1]{%
204 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}SOx}% x just for space
205 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
206 \ifdim\TAGwidth > \KEYWORDwidth%
207 \text{{\sffamily\bfseries\selectfont%
208 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}sO}}\lowercase{#1}}}}%
209 \else%
210 \text{{\sffamily\bfseries\selectfont%
211 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}sO}}\lowercase{#1}}}}%
212 \fi}
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 % Function
216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
217 \newcommand{\FU}[1]{%
218 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}Fux}% x just for space
219 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
220 \ifdim\TAGwidth > \KEYWORDwidth%
221 \text{{\sffamily\bfseries\selectfont%
222 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}Fu}}\lowercase{#1}}}}%
223 \else%
224 \text{{\sffamily\bfseries\selectfont%
225 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}Fu}}\lowercase{#1}}}}%
226 \fi}
228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
229 % Generic Function
230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
231 \newcommand{\GFU}[1]{%
232 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}gFx}% x just for space
233 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
234 \ifdim\TAGwidth > \KEYWORDwidth%
235 \text{{\sffamily\bfseries\selectfont%
236 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}gF}}\lowercase{#1}}}}%
237 \else%
238 \text{{\sffamily\bfseries\selectfont%
239 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}gF}}\lowercase{#1}}}}%
240 \fi}
242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
243 % Variable
244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
245 \newcommand{\V}[1]{%
246 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.8em}varx}% x just for space
247 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
248 \ifdim\TAGwidth > \KEYWORDwidth%
249 \text{{\sffamily\bfseries\selectfont%
250 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}var}}\lowercase{#1}}}}%
251 \else%
252 \text{{\sffamily\bfseries\selectfont%
253 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.8em}var}}\lowercase{#1}}}}%
254 \fi}
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
257 % Constant
258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
259 \newcommand{\CNS}[1]{%
260 \settowidth{\TAGwidth}{\tiny\sffamily\mdseries\hspace*{.5em}cox}% x just for space
261 \settowidth{\KEYWORDwidth}{\lowercase{#1}}%
262 \ifdim\TAGwidth > \KEYWORDwidth%
263 \text{{\sffamily\bfseries\selectfont%
264 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{0em}co}}\lowercase{#1}}}}%
265 \else%
266 \text{{\sffamily\bfseries\selectfont%
267 {\raisebox{1.4ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}co}}\lowercase{#1}}}}%
268 \fi}
270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
271 % Loop Keyword
272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
273 \newcommand{\LKWD}[1]{\text{{\sffamily\bfseries\selectfont%
274 {\raisebox{1.4ex}[1ex][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{.5em}}}\lowercase{#1}}}}}
276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
277 % Return Values, First, Second, nth, Third
278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
279 \renewcommand{\ULthickness}{.2pt}
280 \newcommand{\retval}[1]{\uline{#1}}
281 %\newcommand{\retvalii}[1]{\uuline{#1}}
282 \newcommand{\retvaln}[2]{{%
283 {\raisebox{-1.7ex}[0pt][1.4ex]{\tiny\sffamily\upshape\mdseries\makebox[0pt][l]{\hspace{-.1em}#1}}\uline{#2}}}}
284 \newcommand{\retvalii}[1]{\retvaln{2}{#1}}
285 \newcommand{\retvaliii}[1]{\retvaln{3}{#1}}
287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
288 % T and NIL
289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
290 \newcommand{\T}{\text{\ttfamily T}}
291 \newcommand{\NIL}{\text{\ttfamily NIL}}
293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
294 % ~ (slightly lowered)
295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
296 \newcommand{\TLD}{{\protect\raisebox{-.8ex}{\textasciitilde}}}
298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
299 % * (lowered version)
300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
301 \newcommand{\A}{\textasteriskcentered}
303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
304 % Starred commands send their argument into index:
305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
306 \WithSuffix\newcommand\kwd*[1]{\kwd{#1}\uppercase{\index{#1}}}
307 \WithSuffix\newcommand\KWD*[1]{\KWD{#1}\uppercase{\index{#1}}}
308 \WithSuffix\newcommand\MC*[1]{\MC{#1}\uppercase{\index{#1}}}
309 \WithSuffix\newcommand\SO*[1]{\SO{#1}\uppercase{\index{#1}}}
310 \WithSuffix\newcommand\FU*[1]{\FU{#1}\uppercase{\index{#1}}}
311 \WithSuffix\newcommand\GFU*[1]{\GFU{#1}\uppercase{\index{#1}}}
312 \WithSuffix\newcommand\V*[1]{\V{#1}\uppercase{\index{#1}}}
313 \WithSuffix\newcommand\CNS*[1]{\CNS{#1}\uppercase{\index{#1}}}
314 \WithSuffix\newcommand\LKWD*[1]{\LKWD{#1}\uppercase{\index{#1}}}
316 \hyphenation{white-space pa-ra-me-ters}