1 % TeX macros for typesetting my PhD thesis
2 % (c) 2008 Martin Mares <mj@ucw.cz>
10 %%% Basic parameters %%%
12 % A4 with 1in margins, leaving 20pt for page numbering at the bottom
15 \advance\vsize by -20pt
17 \parskip=3pt plus 1pt minus 1pt
19 \smallskipamount=4pt plus 1.2pt minus 1.2pt
20 \medskipamount=7pt plus 2.5pt minus 2pt
21 \bigskipamount=15pt plus 5pt minus 4pt
23 \abovedisplayskip=15pt plus 4pt minus 10pt
24 \abovedisplayshortskip=0pt plus 3pt
25 \belowdisplayskip=15pt plus 4pt minus 10pt
26 \belowdisplayshortskip=8.5pt plus 3.5pt minus 4.5pt
31 \def\df#1{{\it #1\/}} % when we define something
33 \def\<#1>{\leavevmode\hbox{\it #1\/}}
35 \def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\spadesuit$\par}}
36 \def\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\spadesuit$}}\par}}
37 \def\FIXME#1{\>{\bo TODO:} #1}
38 \def\symdiff{\mathbin{\Delta}}
39 \def\rack#1#2{\setbox0=\hbox{#1}\hbox to \wd0{#2}}
40 \def\o#1{\accent23 #1}
41 \def\mst{\mathop{\rm mst}}
42 \def\deg{\mathop{\rm deg}}
43 \def\timesalpha{\mskip2mu\alpha}
44 \def\timesbeta{\mskip2mu\beta}
45 \def\tower{\mathop\uparrow}
47 \def\minorof{\preccurlyeq}
52 \def\(#1){\mathord{\left<#1\right>}}
55 \def\shl{\mathbin{<\!<}}
56 \def\shr{\mathbin{>\!>}}
57 \def\bop#1{\mathbin{\hbox{\sc #1}}}
61 \def\bnot{\mathop{\hbox{\sc not}}}
63 % A reversed version of \ddots with extra space at the top to get good alignment of exponents.
64 \def\rddots{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
65 \raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\raise11\p@\hbox{}\mkern1mu}}
70 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
78 %\font\twelverm=pplr8z at 12pt
79 %\font\twelveit=pplri8z at 12pt
80 %\font\twelvebf=pplb8z at 12pt
84 \font\twelvesc=cmcsc12
86 \def\mathf@nt#1#2#3#4{%
87 \toks0=\expandafter{\csname#1#2\endcsname}%
88 \expandafter\ifx\the\toks0\relax%
89 %\immediate\write-1{bb \the\toks0=#4#2#3}%
90 \global\expandafter\font\the\toks0=#4#2#3%
92 \edef\m@@f{\the\toks0}}
95 \def\fntmathtok{twelve}
97 \def\fntmathstok{eight}
99 \def\fntmathsstok{six}
101 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
102 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
103 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
104 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
105 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
106 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
107 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
108 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
109 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
110 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
111 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
112 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
113 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
114 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
115 \mathf@nt{\fntmathtok}{msam}{\fntmathsize}{}\textfont\msafam=\m@@f
116 \mathf@nt{\fntmathstok}{msam}{\fntmathssize}{}\scriptfont\msafam=\m@@f
117 \mathf@nt{\fntmathsstok}{msam}{\fntmathsssize}{}\scriptscriptfont\msafam=\m@@f
118 \mathf@nt{\fntmathtok}{msbm}{\fntmathsize}{}\textfont\msbfam=\m@@f
119 \mathf@nt{\fntmathstok}{msbm}{\fntmathssize}{}\scriptfont\msbfam=\m@@f
120 \mathf@nt{\fntmathsstok}{msbm}{\fntmathsssize}{}\scriptscriptfont\msbfam=\m@@f
122 % Blackboard bold font
127 \textfont\bbfam=\bbtwelve
128 \scriptfont\bbfam=\bbeight
129 \scriptscriptfont\bbfam=\bbsix
130 \def\bb{\bbtwelve\fam\bbfam}
133 \def\rm{\fam\z@\twelverm}
134 \def\it{\fam\itfam\twelveit}
135 \def\bo{\fam\bffam\twelveb}
136 \def\bf{\fam\bffam\twelvebf}
137 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
139 \def\sl{\fam\slfam\twelvesl}
141 % Switch to 12pt baselines
145 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
148 \font\chapfont=csssdc17 scaled \magstep1
150 \font\secitfont=csbxti14
153 \footline={\hss\twelverm\folio\hss}
155 %%% Enumerated lists %%%
157 \newif\ifitem\itemtrue
161 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
163 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
164 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
166 \def\inititemize{\interlistskip\begingroup
167 \parskip=1pt plus 0.3pt minus 0.1pt
170 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
173 \def\singleitem{\par\leavevmode\copy\itembox}
175 \def\endlist{\interlistskip\endgroup}
177 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
178 \def\idot{\raise0.2ex\hbox{$\cdot$}}
179 \def\istar{\raise0.2ex\hbox{$\ast$}}
181 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
182 \let\itemnumbering=#1}
184 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
185 \llap{\itemnumbering\hskip 0.4em}}
187 \def\nnorm{\the\itemcount}
188 \def\ndotted{\nnorm.}
190 \def\nroman{\romannumeral\itemcount}
191 \def\nromanp{\nroman)}
192 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
193 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
194 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
195 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
196 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
198 % New \frenchspacing, which doesn't leave unwanted spaces in text.
199 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
200 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
202 %%% Local verbatim mode %%%
204 \def\make@ther#1{\catcode`#1=12\relax}
205 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
206 \let\do=\make@ther\dospecials\obeyspaces}
210 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
213 \global\chardef\sp@ce=32
214 \gdef\showspaces{\let =\sp@ce}
217 \catcode124=\active % Make | active
218 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
221 %%% Verbatim mode for text in { } %%%
223 \newskip\verbglue\newskip\verblineglue
224 \verbglue=3pt plus 1pt minus 0.3pt
225 \verblineglue=0pt plus 1.5pt
234 \def\v@rbend{\par\endgroup\vskip\verbglue}
235 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
236 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
237 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
238 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
239 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
241 \def\startb@x{\setbox0=\hbox\bgroup}
242 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
243 \everypar{\startb@x}}
245 {\catcode`\^^I=\active
246 \gdef\setupt@bs{\catcode`\^^I=\active
247 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
248 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
249 \multiply\t@b by \tabwidth%
250 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
254 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
255 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
256 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
259 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
263 % \algo{jmeno algoritmu}
264 % \algin popis vstupu
268 % \algout popis vystupu
275 \parskip=1pt plus 1pt minus 0.3pt
280 \def\endalgo{\interlistskip\endgroup}
288 \algopar\advance\itemcount by 1
289 \hbox to 2em{\hss \the\itemcount. }%
290 \futurelet\next\algoitemh}
291 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
292 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
293 \def\algin{\par{\sl Input:\/} }
294 \def\algout{\par{\sl Output:\/} }
296 %%% Constructs used in algorithms %%%
299 \def\cmt#1{~~{\sl (#1)}}
301 %%% Chapters, sections and proclamations %%%
311 \def\chapter#1{\vfill\supereject
312 \advance\chapcount by 1
316 \edef\currentid{\the\chapcount}
317 \leftline{\chapfont\currentid. #1}
321 \def\section#1{\bigskip
322 \advance\seccount by 1
324 \edef\currentid{\the\chapcount.\the\seccount}
325 \leftline{\secfont\currentid. #1}
329 \def\para{\advance\thmcount by 1
330 \edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
331 \noindent {\bo \currentid.\enspace}}
333 \def\proclaim#1{\para {\bo #1.\enspace}}
335 \def\thm{\proclaim{Theorem}}
336 \def\lemma{\proclaim{Lemma}}
337 \def\defn{\proclaim{Definition}}
338 \def\problem{\proclaim{Problem}}
339 \def\obs{\proclaim{Observation}}
340 \def\rem{\proclaim{Remark}}
341 \def\alg{\proclaim{Algorithm}}
342 \def\impl{\proclaim{Implementation}}
343 \def\cor{\proclaim{Corollary}}
344 \def\nota{\proclaim{Notation}}
345 \def\example{\proclaim{Example}}
347 \def\label#1{{\sl (#1)\/}\enspace}
349 \def\thmn{\thm\label}
350 \def\lemman{\lemma\label}
351 \def\defnn{\defn\label}
352 \def\algn{\alg\label}
353 \def\notan{\nota\label}
355 \def\proof{\noindent {\sl Proof.}\enspace}
356 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
361 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
363 \immediate\openin\ids=\jobname.ids
368 \immediate\closein\ids
369 \immediate\openout\ids=\jobname.ids
371 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
373 \immediate\write16{*** Warning: Reference #1 undefined ***}%
375 \csname id#1\endcsname
379 \def\id#1{\writeid{#1}{\currentid}}
383 %\bibliographystyle{abbrv}
384 \bibliographystyle{alpha}
386 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
387 \bibliography{biblio}
392 \def\figure#1#2#3{\midinsert
394 \centerline{\epsfxsize=#2\epsfbox{pic/#1}}
400 %%% Stand-alone chapters %%%
403 \section{Bibliography}
405 \vfill\supereject\end