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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
% macro.tex
%
% LaTeX macros for CMUCL User's Manual
%
% by Raymond Toy
% use Palatino
\renewcommand{\rmdefault}{ppl}
\ifpdf
\usepackage{palatino}
\fi
%% Define the indices. We need one for Types, Variables, Functions,
%% and a general concept index.
\makeindex
\newindex{types}{tdx}{tnd}{Type Index}
\newindex{vars}{vdx}{vnd}{Variable Index}
\newindex{funs}{fdx}{fnd}{Function Index}
\newindex{concept}{cdx}{cnd}{Concept Index}
\newcommand{\tindexed}[1]{\index[types]{#1}\code{#1}}
\newcommand{\findexed}[1]{\index[funs]{#1}\code{#1}}
\newcommand{\vindexed}[1]{\index[vars]{#1}\code{*#1*}}
\newcommand{\cindex}[1]{\index[concept]{#1}}
\newcommand{\cpsubindex}[2]{\index[concept]{#1!#2}}
%% This code taken from the LaTeX companion. It's meant as a
%% replacement for the description environment. We want one that
%% prints description items in a fixed size box and puts the
%% description itself on the same line or the next depending on the
%% size of the item.
\newcommand{\entrylabel}[1]{\mbox{#1}\hfil}
\newenvironment{entry}{%
\begin{list}{}%
{\renewcommand{\makelabel}{\entrylabel}%
\setlength{\labelwidth}{45pt}%
\setlength{\leftmargin}{\labelwidth+\labelsep}}}%
{\end{list}}
\newlength{\Mylen}
\newcommand{\Lentrylabel}[1]{%
\settowidth{\Mylen}{#1}%
\ifthenelse{\lengthtest{\Mylen > \labelwidth}}%
{\parbox[b]{\labelwidth}% term > labelwidth
{\makebox[0pt][l]{#1}\\}}%
{#1}%
\hfil\relax}
\newenvironment{Lentry}{%
\renewcommand{\entrylabel}{\Lentrylabel}
\begin{entry}}%
{\end{entry}}
\newcommand{\fcntype}[1]{\textit{#1}}
\newcommand{\argtype}[1]{\textit{#1}}
\newcommand{\fcnname}[1]{\textsf{#1}}
\newlength{\formnamelen} % length of a name of a form
\newlength{\pboxargslen} % length of parbox for arguments
\newlength{\typelen} % length of the type label for the form
\newcommand{\args}[1]{#1}
\newcommand{\keys}[1]{\code{\&key} \= #1}
\newcommand{\morekeys}[1]{\\ \> #1}
\newcommand{\yetmorekeys}[1]{\\ \> #1}
\newcommand{\defunvspace}{\ifhmode\unskip \par\fi\addvspace{18pt plus 12pt minus 6pt}}
%% \layout[pkg]{name}{param list}{type}
%%
%% This lays out a entry like so:
%%
%% pkg:name arg1 arg2 [Function]
%%
%% where [Function] is flush right.
%%
\newcommand{\layout}[4][\mbox{}]{%
\par\noindent
\fcnname{#1#2\hspace{1em}}%
\settowidth{\formnamelen}{\fcnname{#1#2\hspace{1em}}}%
\settowidth{\typelen}{[\argtype{#4}]}%
\setlength{\pboxargslen}{\linewidth}%
\addtolength{\pboxargslen}{-1\formnamelen}%
\addtolength{\pboxargslen}{-1\typelen}%
\begin{minipage}[t]{\pboxargslen}
\begin{tabbing}
#3
\end{tabbing}
\end{minipage}
\hfill[\fcntype{#4}]%
\par\addvspace{2pt plus 2pt minus 2pt}}
\newcommand{\vrindexbold}[1]{\index[vars]{#1|textbf}}
\newcommand{\fnindexbold}[1]{\index[funs]{#1|textbf}}
%% Define a new type
%%
%% \begin{deftp}{typeclass}{typename}{args}
%% some description
%% \end{deftp}
\newenvironment{deftp}[3]{%
\par\bigskip\index[types]{#2|textbf}%
\layout{#2}{\var{#3}}{#1}
}{}
%% Define a function with name NAME and given parameters PARAM. The
%% function is in the package PKG. If the optional arg SUFFIX is
%% given, this is used as a suffix for the label. (Useful when you
%% have functions of the same name, such as methods, but want
%% different labels for each version.)
%%
%% The defunx is for additional functions that are related to this one
%% in some way, and we want to group them all together.
%%
%% \begin{defun}[suffix]{pkg}{name}{params}
%% \defunx[pkg]{name}{params}
%% description of function
%% \end{defun}
\newenvironment{defun}[4][]{%
\par\defunvspace\fnindexbold{#3}\label{FN:#3#1}%
\layout[#2]{#3}{#4}{Function}
}{}
\newcommand{\defunx}[3][\mbox{}]{%
\par\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Function}}
%% Define a generic function. Like defun, but for defgeneric.
%%
%% \begin{defgeneric}[suffix]{pkg}{name}{params}
%% \defgenericx[pkg]{name}{params}
%% description of function
%% \end{defgeneric}
\newenvironment{defgeneric}[4][]{%
\par\defunvspace\fnindexbold{#3}\label{FN:#3-generic#1}%
\layout[#2]{#3}{#4}{Generic Function}
}{}
\newcommand{\defgenericx}[3][\mbox{}]{%
\par\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Generic Function}}
%% Define a method. Like defgeneric, but for methods.
%%
%% \begin{defmethod}[suffix]{pkg}{name}{params}
%% \defmethod[pkg]{name}{params}
%% description of function
%% \end{defmethod}
\newenvironment{defmethod}[4][]{%
\par\defunvspace\fnindexbold{#3}\label{FN:#3-method#1}%
\layout[#2]{#3}{#4}{Method}
}{}
\newcommand{\defmethodx}[3][\mbox{}]{%
\par\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Method}}
%% Define a macro
%%
%% \begin{defmac}[suffix]{pkg}{name}{params}
%% \defmacx[pkg]{name}{params}
%% description of macro
%% \end{defmac}
\newenvironment{defmac}[4][]{%
\par\defunvspace\fnindexbold{#3}\label{FN:#3#1}%
\layout[#2]{#3}{#4}{Macro}}{}
\newcommand{\defmacx}[3][\mbox{}]{%
\par\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Macro}}
%% Define a variable
%%
%% \begin{defvar}{pkg}{name}
%% \defvarx[pkg]{name}
%% description of defvar
%% \end{defvar}
\newenvironment{defvar}[2]{%
\par\defunvspace\vrindexbold{#2}\label{VR:#2}
\layout[#1]{*#2*}{}{Variable}}{}
\newcommand{\defvarx}[2][\mbox{}]{%
\par\vrindexbold{#2}\label{VR:#2}
\layout[#1]{*#2*}{}{Variable}}
%% Define a constant
%%
%% \begin{defconst}{pkg}{name}
%% \ddefconstx[pkg]{name}
%% description of defconst
%% \end{defconst}
\newcommand{\defconstx}[2][\mbox{}]{%
\layout[#1]{#2}{}{Constant}}
\newenvironment{defconst}[2]{%
\defunvspace\defconstx[#1]{#2}}{}
\newcommand{\credits}[1]{%
\begin{center}
\textbf{#1}
\end{center}}
\newenvironment{example}{\begin{quote}\begin{alltt}}{\end{alltt}\end{quote}}
\newenvironment{lisp}{\begin{example}}{\end{example}}
\newcommand{\hide}[1]{}
\newcommand{\trnumber}[1]{#1}
\newcommand{\citationinfo}[1]{#1}
\newcommand{\var}[1]{{\textsf{\textsl{#1}}\xspace}}
\newcommand{\code}[1]{\textnormal{{\sffamily #1}}}
\newcommand{\file}[1]{`\texttt{#1}'}
\newcommand{\kwd}[1]{\code{:#1}}
\newcommand{\F}[1]{\code{#1}}
\newcommand{\w}[1]{\hbox{#1}}
\newcommand{\ctrl}[1]{$\uparrow$\textsf{#1}}
\newcommand{\result}{$\Rightarrow$}
\newcommand{\myequiv}{$\equiv$}
\newcommand{\back}[1]{\(\backslash\)#1}
\newcommand{\pxlref}[1]{see section~\ref{#1}, page~\pageref{#1}}
\newcommand{\xlref}[1]{See section~\ref{#1}, page~\pageref{#1}}
\newcommand{\funref}[1]{\findexed{#1} (page~\pageref{FN:#1})}
\newcommand{\specref}[1]{\findexed{#1} (page~\pageref{FN:#1})}
\newcommand{\macref}[1]{\findexed{#1} (page~\pageref{FN:#1})}
\newcommand{\varref}[1]{\vindexed{#1} (page~\pageref{VR:#1})}
\newcommand{\conref}[1]{\conindexed{#1} (page~\pageref{VR:#1})}
\newcommand{\false}{\code{nil}}
\newcommand{\true}{\code{t}}
\newcommand{\nil}{\false{}}
%% Printed lisp character #\foo
\newcommand{\lispchar}[1]{\code{\#\back{#1}}}
\newcommand{\ampoptional}{\code{\&optional}}
\newcommand{\amprest}{\code{\&rest}}
\newcommand{\ampbody}{\code{\&body}}
\newcommand{\mopt}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}\,$}}
\newcommand{\mstar}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}^*\,$}}
\newcommand{\mplus}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}^+\,$}}
\newcommand{\mgroup}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}\,$}}
\newcommand{\mor}{$|$}
%% Some common abbreviations
\newcommand{\dash}{---}
\newcommand{\alien}{Alien}
\newcommand{\aliens}{Aliens}
\newcommand{\hemlock}{Hemlock}
\newcommand{\python}{Python}
\newcommand{\cmucl}{\textsc{cmucl}}
\newcommand{\clisp}{Common Lisp}
\newcommand{\llisp}{Common Lisp}
\newcommand{\cltl}{\textit{Common Lisp: The Language}}
\newcommand{\cltltwo}{\textit{Common Lisp: The Language II}}
%% Set up margins
\setlength{\oddsidemargin}{-10pt}
\setlength{\evensidemargin}{-10pt}
\setlength{\topmargin}{-40pt}
\setlength{\headheight}{12pt}
\setlength{\headsep}{25pt}
\setlength{\footskip}{30pt}
\setlength{\textheight}{9.25in}
\setlength{\textwidth}{6.75in}
\setlength{\columnsep}{0.375in}
\setlength{\columnseprule}{0pt}
\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}
\def\textfraction{.1}
\def\bottomfraction{.9} % was .3
\def\topfraction{.9}
%% Allow TeX some stretching space to avoid overfull and underfull
%% boxes.
\setlength{\emergencystretch}{5pt}
%% requires the sectsty package
\allsectionsfont{\bfseries\sffamily}
\chapterfont{\fontfamily{pag}\selectfont}
%% section numbers in the left margin
\makeatletter
\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname
the#1\endcsname\quad}}
\makeatother
|