Various changes in Section CLOS
[clqr.git] / clqr.macros.tex
blob5d3a3ae040a3080152260116405fa7010fefe174
1 % Copyright (C) 2008, 2009, 2010, 2011 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]{%
68 \text{{\fontfamily{cmr}\fontseries{b}\fontshape{n}\selectfont#1}}}
71 % Literal Text
72 \newcommand{\LIT}[1]{\text{{\fontfamily{cmtt}\selectfont#1}}}
74 % Variable Text
75 \newcommand{\VAR}[1]{\text{{\fontfamily{cmr}\fontshape{it}\selectfont#1\/}}}
77 % Not Evaluated
78 \newcommand{\NEV}[1]{\text{{$\widehat{#1}$}}}
80 % Subjected to Destruction
81 \newcommand{\DES}[1]{\text{{$\widetilde{#1}$}}}
83 % Default Value
84 \newcommand{\DF}[1]{%
85 \text{\textsubscript{%
86 \setlength{\fboxsep}{.5pt}\setlength{\fboxrule}{.2bp}\fbox{#1}}}}
88 % Optional Part, [], two sizes
89 \newcommand{\OP}[1]{{\text{$\big[$}{#1}\text{$\big]$}}}
90 \newcommand{\Op}[1]{{\text{$[$}{#1}\text{$]$}}}
92 % Or, |
93 \newcommand{\XOR}{\hspace{1pt}\text{\rule[-.9ex]{.25pt}{3ex}}\hspace{1pt}}
94 %\newcommand{\XOR}{\text{$\mid$}\hspace{0pt}}
96 % Optional Parts, *
97 \newcommand{\OPn}[1]{{{#1}\text{${}^{*}$}}}
99 % Required Parts, +
100 \newcommand{\RP}[1]{{{#1}\text{${}^{+}$}}}
102 % Implicit PROGN, P*
103 \newcommand{\PROGN}[1]{%
104 {{#1}\text{${}^{%
105 {\raisebox{.5ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{-.6ex}P}}*}}$}}}
107 % Group of Objects {}, three sizes
108 \newcommand{\GOO}[1]{{\text{$\Big\{$}{#1}\text{$\Big\}$}}}
109 \newcommand{\GOo}[1]{{\text{$\big\{$}{#1}\text{$\big\}$}}}
110 \newcommand{\Goo}[1]{{\text{$\{$}{#1}\text{$\}$}}}
111 % Optional Group of Objects, {}*, three sizes
112 \newcommand{\GOOs}[1]{{$\Big\{${#1}$\Big\}^{\!\!*}$}} % this one can
113 % have line breaks
114 \newcommand{\GOos}[1]{\text{{$\big\{${#1}$\big\}^{\!\!*}$}}}
115 \newcommand{\Goos}[1]{\text{{$\{${#1}$\}^{\!*}$}}}
116 % Required Group of Objects, {}+, three sizes
117 \newcommand{\GOOp}[1]{{\text{$\Big\{$}{#1}\text{$\Big\}^{\!\!+}$}}}
118 \newcommand{\GOop}[1]{{\text{$\big\{$}{#1}\text{$\big\}^{\!\!+}$}}}
119 \newcommand{\Goop}[1]{{\text{$\{$}{#1}\text{$\}^{\!+}$}}}
121 % Vertically Arranged Group of Alternatives, {
122 % usage: \xorGOO{line1\\ line2...}{closing delimiter}
123 \newcommand{\xorGOO}[2]{\text{\(%
124 \left\{\!%
125 \begin{array}{l}%
127 \end{array}\!%
128 \right#2%
129 \)}}
131 % Vertically Arranged Group of Optional Objects, {|
132 % usage: \orGOO{line1\\line2}{closing delimiter}
133 \newcommand{\orGOO}[2]{\text{\(%
134 \left\{\!\left|%
135 \begin{array}{l}%
137 \end{array}\!%
138 \right.\right#2%
139 \)}}
141 % Vertically Arranged Group of Objects, No Opening {
142 % usage: \arrGOO{line1\\line2}{closing delimiter}
143 \newcommand{\arrGOO}[2]{\text{\(\!%
144 \left.%
145 \begin{array}{l}%
147 \end{array}\!%
148 \right#2%
149 \)}}
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
154 % All sorts of tags attached to lisp keywords
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158 \newcommand{\MARKNAME}[2]{%
159 \text{\textsubscript{\sffamily\slshape\mdseries\lowercase{#2}}%
160 {\sffamily\bfseries\selectfont\lowercase{#1}}}}
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 % Generic Keyword, Lowercase
164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
165 \newcommand{\kwd}[1]{\text{{\sffamily\bfseries\selectfont%
166 \lowercase{#1}}}}
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 % Generic Keyword, Uppercase
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 \newcommand{\KWD}[1]{\text{{\sffamily\bfseries\selectfont%
172 \uppercase{#1}}}}
174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
175 % Macro
176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
177 \newcommand{\MC}[1]{%
178 \MARKNAME{#1}{m}}
180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
181 % Special Operator
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 \newcommand{\SO}[1]{%
184 \MARKNAME{#1}{s}}
186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
187 % Function
188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
189 \newcommand{\FU}[1]{%
190 \MARKNAME{#1}{f\/}}
192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 % Generic Function
194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
195 \newcommand{\GFU}[1]{%
196 \MARKNAME{#1}{g}}
198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
199 % Variable
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
201 \newcommand{\V}[1]{%
202 \MARKNAME{#1}{v}}
204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
205 % Constant
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 \newcommand{\CNS}[1]{%
208 \MARKNAME{#1}{c}}
210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
211 % Loop Keyword
212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
213 \newcommand{\LKWD}[1]{\text{{\sffamily\bfseries\selectfont\lowercase{#1}}}}
215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
216 % Return Values, First, nth, Second, Third
217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
218 \renewcommand{\ULthickness}{.2pt}
219 \newcommand{\retval}[1]{\uline{#1}}
220 \newcommand{\retvaln}[2]{{%
221 {\raisebox{-1.7ex}[0pt][1.4ex]{\tiny\sffamily\upshape\mdseries\makebox[0pt][l]{\hspace{-.1em}#1}}\uline{#2}}}}
222 \newcommand{\retvalii}[1]{\retvaln{2}{#1}}
223 \newcommand{\retvaliii}[1]{\retvaln{3}{#1}}
225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
226 % T and NIL
227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
228 \newcommand{\T}{\text{\ttfamily T}}
229 \newcommand{\NIL}{\text{\ttfamily NIL}}
231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 % ~ (slightly lowered)
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
234 \newcommand{\TLD}{{\protect\raisebox{-.8ex}{\textasciitilde}}}
236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
237 % * (lowered version)
238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
239 \newcommand{\A}{\textasteriskcentered}
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
242 % Starred commands send their argument into index:
243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
244 \WithSuffix\newcommand\kwd*[1]{\kwd{#1}\uppercase{\index{#1}}}
245 \WithSuffix\newcommand\KWD*[1]{\KWD{#1}\uppercase{\index{#1}}}
246 \WithSuffix\newcommand\MC*[1]{\MC{#1}\uppercase{\index{#1}}}
247 \WithSuffix\newcommand\SO*[1]{\SO{#1}\uppercase{\index{#1}}}
248 \WithSuffix\newcommand\FU*[1]{\FU{#1}\uppercase{\index{#1}}}
249 \WithSuffix\newcommand\GFU*[1]{\GFU{#1}\uppercase{\index{#1}}}
250 \WithSuffix\newcommand\V*[1]{\V{#1}\uppercase{\index{#1}}}
251 \WithSuffix\newcommand\CNS*[1]{\CNS{#1}\uppercase{\index{#1}}}
252 \WithSuffix\newcommand\LKWD*[1]{\LKWD{#1}\uppercase{\index{#1}}}
254 \hyphenation{white-space pa-ra-me-ters}
256 %%% Local Variables:
257 %%% mode: latex
258 %%% TeX-master: "clqr"
259 %%% End: