Change license
[clqr.git] / clqr.macros.tex
blobbe8f7dd3dcec8f27fe724499e7368ecaec701403
1 % Copyright (C) 2008, 2009, 2010, 2011, 2014 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; with no Invariant Sections, no Front-Cover Texts and
6 % no Back-Cover Texts. For details see file COPYING.
8 \newlength{\LISTlinewidth}
9 \newenvironment{LIST}[1]%
11 \LISTlinewidth=\linewidth%
12 \begin{flushleft}%
13 \begin{list}{}%
14 {\setlength{\itemindent}{-#1}\setlength{\leftmargin}{#1}}%
15 %\parskip0pt\itemsep0pt%
17 {\end{list}%
18 \end{flushleft}%
21 %\renewcommand{\topfraction}{1}
22 \renewcommand{\bottomfraction}{1}
23 %\renewcommand*{\figureformat}{}
24 %\renewcommand*{\captionformat}{}
25 \renewcommand{\thefootnote}{\fnsymbol{footnote}}
27 \setlength{\parfillskip}{5cm plus1cm minus3cm}
28 \setlength{\arraycolsep}{0pt}
31 \def\startexplanation{$\triangleright$\hskip1.4ex}
32 \newlength{\ITwidth}
33 \newlength{\ITrest}
34 \newlength{\ITtab}\ITtab=3em
36 \def\IT#1 #2 {%
37 \settowidth{\ITwidth}{#1\unskip\hskip1em\hskip\ITtab}%
38 \ITrest=\LISTlinewidth\advance\ITrest by -\ITwidth%
39 \loop\ifdim\ITrest > \ITtab%
40 \advance\ITrest by -\ITtab%
41 \repeat%
43 \settowidth{\ITwidth}{%
44 #1\unskip\hskip1em\hskip\ITrest%
45 \startexplanation#2%
47 \item{}%
48 \ifdim\ITwidth < \LISTlinewidth% Entry fits into a single line
49 #1\unskip\hskip1em\hskip\ITrest%
50 \startexplanation#2%
51 \else%
52 #1%
53 \unskip\penalty-10000%
54 \parbox[t]{\linewidth}{\startexplanation#2}%
55 \fi%
59 \newpagestyle{lispref}[\sffamily\mdseries\slshape]{
60 \headrule\footrule
61 \sethead*{}{}{\maintitle\/}
62 \setfoot*{}{}{\thepage\/}}
63 \pagestyle{lispref}
65 % Emphasize
66 \newcommand{\EM}[1]{%
67 \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]{%
84 \text{\textsubscript{%
85 \setlength{\fboxsep}{.5pt}\setlength{\fboxrule}{.2bp}\fbox{#1}}}}
87 % Optional Part, [], two sizes
88 \newcommand{\OP}[1]{{\text{$\big[$}{#1}\text{$\big]$}}}
89 \newcommand{\Op}[1]{{\text{$[$}{#1}\text{$]$}}}
91 % Or, |
92 \newcommand{\XOR}{\hspace{1pt}\text{\rule[-.9ex]{.25pt}{3ex}}\hspace{1pt}}
93 %\newcommand{\XOR}{\text{$\mid$}\hspace{0pt}}
95 % Optional Parts, *
96 \newcommand{\OPn}[1]{{{#1}\text{${}^{*}$}}}
98 % Required Parts, +
99 \newcommand{\RP}[1]{{{#1}\text{${}^{+}$}}}
101 % Implicit PROGN, P*
102 \newcommand{\PROGN}[1]{%
103 {{#1}\text{${}^{%
104 {\raisebox{.5ex}[0pt][0pt]{\tiny\sffamily\mdseries\makebox[0pt][l]{\hspace{-.6ex}P}}*}}$}}}
106 % Group of Objects {}, three sizes
107 \newcommand{\GOO}[1]{{\text{$\Big\{$}{#1}\text{$\Big\}$}}}
108 \newcommand{\GOo}[1]{{\text{$\big\{$}{#1}\text{$\big\}$}}}
109 \newcommand{\Goo}[1]{{\text{$\{$}{#1}\text{$\}$}}}
110 % Optional Group of Objects, {}*, three sizes
111 \newcommand{\GOOs}[1]{{$\Big\{${#1}$\Big\}^{\!\!*}$}} % this one can
112 % have line breaks
113 \newcommand{\GOos}[1]{\text{{$\big\{${#1}$\big\}^{\!\!*}$}}}
114 \newcommand{\Goos}[1]{\text{{$\{${#1}$\}^{\!*}$}}}
115 % Required Group of Objects, {}+, three sizes
116 \newcommand{\GOOp}[1]{{\text{$\Big\{$}{#1}\text{$\Big\}^{\!\!+}$}}}
117 \newcommand{\GOop}[1]{{\text{$\big\{$}{#1}\text{$\big\}^{\!\!+}$}}}
118 \newcommand{\Goop}[1]{{\text{$\{$}{#1}\text{$\}^{\!+}$}}}
120 % Vertically Arranged Group of Alternatives, {
121 % usage: \xorGOO{line1\\ line2...}{closing delimiter}
122 \newcommand{\xorGOO}[2]{\text{\(%
123 \left\{\!%
124 \begin{array}{l}%
126 \end{array}\!%
127 \right#2%
128 \)}}
130 % Vertically Arranged Group of Optional Objects, {|
131 % usage: \orGOO{line1\\line2}{closing delimiter}
132 \newcommand{\orGOO}[2]{\text{\(%
133 \left\{\!\left|%
134 \begin{array}{l}%
136 \end{array}\!%
137 \right.\right#2%
138 \)}}
140 % Vertically Arranged Group of Objects, No Opening {
141 % usage: \arrGOO{line1\\line2}{closing delimiter}
142 \newcommand{\arrGOO}[2]{\text{\(\!%
143 \left.%
144 \begin{array}{l}%
146 \end{array}\!%
147 \right#2%
148 \)}}
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 % All sorts of tags attached to lisp keywords
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157 \newcommand{\MARKNAME}[2]{%
158 \text{\textsubscript{\sffamily\slshape\mdseries\lowercase{#2}}%
159 {\sffamily\bfseries\selectfont\lowercase{#1}}}}
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
162 % Generic Keyword, Lowercase
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
164 \newcommand{\kwd}[1]{\text{{\sffamily\bfseries\selectfont%
165 \lowercase{#1}}}}
167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
168 % Generic Keyword, Uppercase
169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
170 \newcommand{\KWD}[1]{\text{{\sffamily\bfseries\selectfont%
171 \uppercase{#1}}}}
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
174 % Macro
175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
176 \newcommand{\MC}[1]{%
177 \MARKNAME{#1}{m}}
179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 % Special Operator
181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
182 \newcommand{\SO}[1]{%
183 \MARKNAME{#1}{s}}
185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
186 % Function
187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
188 \newcommand{\FU}[1]{%
189 \MARKNAME{#1}{f\/}}
191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
192 % Generic Function
193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
194 \newcommand{\GFU}[1]{%
195 \MARKNAME{#1}{g}}
197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
198 % Variable
199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
200 \newcommand{\V}[1]{%
201 \MARKNAME{#1}{v}}
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
204 % Constant
205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
206 \newcommand{\CNS}[1]{%
207 \MARKNAME{#1}{c}}
209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
210 % Loop Keyword
211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
212 \newcommand{\LKWD}[1]{\text{{\sffamily\bfseries\selectfont\lowercase{#1}}}}
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 % Return Values, First, nth, Second, Third
216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
217 \renewcommand{\ULthickness}{.2pt}
218 \newcommand{\retval}[1]{\uline{#1}}
219 \newcommand{\retvaln}[2]{{%
220 {\raisebox{-1.7ex}[0pt][1.4ex]{\tiny\sffamily\upshape\mdseries\makebox[0pt][l]{\hspace{-.1em}#1}}\uline{#2}}}}
221 \newcommand{\retvalii}[1]{\retvaln{2}{#1}}
222 \newcommand{\retvaliii}[1]{\retvaln{3}{#1}}
224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
225 % T and NIL
226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
227 \newcommand{\T}{\text{\ttfamily T}}
228 \newcommand{\NIL}{\text{\ttfamily NIL}}
230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
231 % ~ (slightly lowered)
232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
233 \newcommand{\TLD}{{\protect\raisebox{-.8ex}{\textasciitilde}}}
235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
236 % * (lowered version)
237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
238 \newcommand{\A}{\textasteriskcentered}
240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
241 % Starred commands send their argument into index:
242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
243 \WithSuffix\newcommand\kwd*[1]{\kwd{#1}\uppercase{\index{#1}}}
244 \WithSuffix\newcommand\KWD*[1]{\KWD{#1}\uppercase{\index{#1}}}
245 \WithSuffix\newcommand\MC*[1]{\MC{#1}\uppercase{\index{#1}}}
246 \WithSuffix\newcommand\SO*[1]{\SO{#1}\uppercase{\index{#1}}}
247 \WithSuffix\newcommand\FU*[1]{\FU{#1}\uppercase{\index{#1}}}
248 \WithSuffix\newcommand\GFU*[1]{\GFU{#1}\uppercase{\index{#1}}}
249 \WithSuffix\newcommand\V*[1]{\V{#1}\uppercase{\index{#1}}}
250 \WithSuffix\newcommand\CNS*[1]{\CNS{#1}\uppercase{\index{#1}}}
251 \WithSuffix\newcommand\LKWD*[1]{\LKWD{#1}\uppercase{\index{#1}}}
253 \hyphenation{white-space pa-ra-me-ters}
255 %%% Local Variables:
256 %%% mode: latex
257 %%% TeX-master: "clqr"
258 %%% End: