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
34 \mathchoice{\hbox{\it #1\/}}{\hbox{\it #1\/}}{\hbox{\eightti #1\/}}{\hbox{\sixti #1\/}}%
35 \else\leavevmode\hbox{\it #1\/}\fi}
37 \def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\spadesuit$\par}}
38 \def\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\spadesuit$}}\par}}
39 \def\qedmath{\eqno{\spadesuit}}
40 \def\FIXME#1{\>{\bo TODO:} #1}
41 \def\symdiff{\mathbin{\Delta}}
42 \def\rack#1#2{\setbox0=\hbox{#1}\hbox to \wd0{#2}}
43 \def\o#1{\accent23 #1}
44 \def\mst{\mathop{\rm mst}}
45 \def\msf{\mathop{\rm msf}}
46 \def\deg{\mathop{\rm deg}}
47 \def\timesalpha{\mskip2mu\alpha}
48 \def\timesbeta{\mskip2mu\beta}
49 \def\tower{\mathop\uparrow}
51 \def\minorof{\preccurlyeq}
52 \def\per{\mathop{\rm per}}
53 \def\poly{\mathop{\rm poly}}
55 \def\crpt{\mathop{\Uparrow}}
62 \def\(#1){\mathord{\left<#1\right>}}
65 \def\shl{\mathbin{<\!<}}
66 \def\shr{\mathbin{>\!>}}
67 \def\bop#1{\mathbin{\hbox{\sc #1}}}
71 \def\bnot{\mathop{\hbox{\sc not}}}
73 % A reversed version of \ddots with extra space at the top to get good alignment of exponents.
74 \def\rddots{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
75 \raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\raise11\p@\hbox{}\mkern1mu}}
80 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
88 %\font\twelverm=pplr8z at 12pt
89 %\font\twelveit=pplri8z at 12pt
90 %\font\twelvebf=pplb8z at 12pt
94 \font\twelvesc=cmcsc12
96 \def\mathf@nt#1#2#3#4{%
97 \toks0=\expandafter{\csname#1#2\endcsname}%
98 \expandafter\ifx\the\toks0\relax%
99 %\immediate\write-1{bb \the\toks0=#4#2#3}%
100 \global\expandafter\font\the\toks0=#4#2#3%
102 \edef\m@@f{\the\toks0}}
105 \def\fntmathtok{twelve}
107 \def\fntmathstok{eight}
108 \def\fntmathsssize{6}
109 \def\fntmathsstok{six}
111 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
112 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
113 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
114 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
115 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
116 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
117 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
118 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
119 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
120 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
121 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
122 \mathf@nt{\fntmathstok}{ti}{\fntmathssize}{cm}\scriptfont\itfam=\m@@f
123 \mathf@nt{\fntmathsstok}{ti}{\fntmathssize}{cm}\scriptscriptfont\itfam=\m@@f
124 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
125 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
126 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
127 \mathf@nt{\fntmathtok}{msam}{\fntmathsize}{}\textfont\msafam=\m@@f
128 \mathf@nt{\fntmathstok}{msam}{\fntmathssize}{}\scriptfont\msafam=\m@@f
129 \mathf@nt{\fntmathsstok}{msam}{\fntmathsssize}{}\scriptscriptfont\msafam=\m@@f
130 \mathf@nt{\fntmathtok}{msbm}{\fntmathsize}{}\textfont\msbfam=\m@@f
131 \mathf@nt{\fntmathstok}{msbm}{\fntmathssize}{}\scriptfont\msbfam=\m@@f
132 \mathf@nt{\fntmathsstok}{msbm}{\fntmathsssize}{}\scriptscriptfont\msbfam=\m@@f
134 % Blackboard bold font
139 \textfont\bbfam=\bbtwelve
140 \scriptfont\bbfam=\bbeight
141 \scriptscriptfont\bbfam=\bbsix
142 \def\bb{\bbtwelve\fam\bbfam}
145 \def\rm{\fam\z@\twelverm}
146 \def\it{\fam\itfam\twelveit}
147 \def\bo{\fam\bffam\twelveb}
148 \def\bf{\fam\bffam\twelvebf}
149 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
151 \def\sl{\fam\slfam\twelvesl}
153 % Switch to 12pt baselines
157 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
160 \font\chapfont=csssdc17 scaled \magstep1
162 \font\secitfont=csbxti14
165 \footline={\hss\twelverm\folio\hss}
167 % We have to redefine \big and friends as we are using 12pt symbols
168 \def\big#1{{\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}}
169 \def\Big#1{{\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}}
170 \def\bigg#1{{\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}}
171 \def\Bigg#1{{\hbox{$\left#1\vbox to20.5\p@{}\right.\n@space$}}}
173 %%% Enumerated lists %%%
175 \newif\ifitem\itemtrue
179 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
181 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
182 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
184 \def\inititemize{\interlistskip\begingroup
185 \parskip=1pt plus 0.3pt minus 0.1pt
188 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
191 \def\singleitem{\par\leavevmode\copy\itembox}
193 \def\endlist{\interlistskip\endgroup}
195 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
196 \def\idot{\raise0.2ex\hbox{$\cdot$}}
197 \def\istar{\raise0.2ex\hbox{$\ast$}}
199 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
200 \let\itemnumbering=#1}
202 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
203 \llap{\itemnumbering\hskip 0.4em}}
205 \def\nnorm{\the\itemcount}
206 \def\ndotted{\nnorm.}
208 \def\nroman{\romannumeral\itemcount}
209 \def\nromanp{\nroman)}
210 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
211 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
212 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
213 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
214 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
216 % New \frenchspacing, which doesn't leave unwanted spaces in text.
217 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
218 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
220 %%% Local verbatim mode %%%
222 \def\make@ther#1{\catcode`#1=12\relax}
223 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
224 \let\do=\make@ther\dospecials\obeyspaces}
228 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
231 \global\chardef\sp@ce=32
232 \gdef\showspaces{\let =\sp@ce}
235 \catcode124=\active % Make | active
236 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
239 %%% Verbatim mode for text in { } %%%
241 \newskip\verbglue\newskip\verblineglue
242 \verbglue=3pt plus 1pt minus 0.3pt
243 \verblineglue=0pt plus 1.5pt
252 \def\v@rbend{\par\endgroup\vskip\verbglue}
253 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
254 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
255 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
256 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
257 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
259 \def\startb@x{\setbox0=\hbox\bgroup}
260 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
261 \everypar{\startb@x}}
263 {\catcode`\^^I=\active
264 \gdef\setupt@bs{\catcode`\^^I=\active
265 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
266 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
267 \multiply\t@b by \tabwidth%
268 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
272 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
273 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
274 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
277 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
281 % \algo{jmeno algoritmu}
282 % \algin popis vstupu
286 % \algout popis vystupu
293 \parskip=1pt plus 1pt minus 0.3pt
298 \def\endalgo{\interlistskip\endgroup}
306 \algopar\advance\itemcount by 1
307 \hbox to 2em{\hss \the\itemcount. }%
308 \futurelet\next\algoitemh}
309 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
310 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
311 \def\algin{\par{\sl Input:\/} }
312 \def\algout{\par{\sl Output:\/} }
314 %%% Constructs used in algorithms %%%
317 \def\cmt#1{~~{\sl (#1)}}
319 %%% Chapters, sections and proclamations %%%
329 \def\chapter#1{\vfill\supereject
330 \advance\chapcount by 1
334 \edef\currentid{\the\chapcount}
335 \leftline{\chapfont\currentid. #1}
339 \def\section#1{\bigskip
340 \advance\seccount by 1
342 \edef\currentid{\the\chapcount.\the\seccount}
343 \leftline{\secfont\currentid. #1}
347 \def\para{\advance\thmcount by 1
348 \edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
349 \noindent {\bo \currentid.\enspace}}
351 \def\proclaim#1{\para {\bo #1.\enspace}}
353 \def\thm{\proclaim{Theorem}}
354 \def\lemma{\proclaim{Lemma}}
355 \def\defn{\proclaim{Definition}}
356 \def\problem{\proclaim{Problem}}
357 \def\obs{\proclaim{Observation}}
358 \def\rem{\proclaim{Remark}}
359 \def\alg{\proclaim{Algorithm}}
360 \def\impl{\proclaim{Implementation}}
361 \def\cor{\proclaim{Corollary}}
362 \def\nota{\proclaim{Notation}}
363 \def\example{\proclaim{Example}}
365 \def\label#1{{\sl (#1)\/}\enspace}
366 \def\labelx#1{\label{#1}\hfil\break\kern 0pt} % Eat spaces
368 \def\thmn{\thm\labelx}
369 \def\lemman{\lemma\labelx}
370 \def\defnn{\defn\labelx}
371 \def\corn{\cor\labelx}
372 \def\algn{\alg\label}
373 \def\notan{\nota\labelx}
374 \def\examplen{\example\labelx}
375 \def\problemn{\problem\labelx}
376 \def\remn{\rem\labelx}
378 \def\paran#1{\para {\sl #1:}}
380 \def\proof{\noindent {\sl Proof.}\enspace}
381 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
386 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
388 \immediate\openin\ids=\jobname.ids
393 \immediate\closein\ids
394 \immediate\openout\ids=\jobname.ids
396 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
398 \immediate\write16{*** Warning: Reference #1 undefined ***}%
400 \csname id#1\endcsname
404 \def\id#1{\writeid{#1}{\currentid}}
408 %\bibliographystyle{abbrv}
409 \bibliographystyle{alpha}
411 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
412 \bibliography{biblio}
417 \def\figure#1#2#3{\midinsert
419 \centerline{\epsfxsize=#2\epsfbox{pic/#1}}
427 \vbox{\hsize=0.7\hsize
429 \leftskip=0pt plus 0.3\hsize
435 %%% Stand-alone chapters %%%
438 \section{Bibliography}
440 \vfill\supereject\end