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}}
61 \def\(#1){\mathord{\left<#1\right>}}
64 \def\shl{\mathbin{<\!<}}
65 \def\shr{\mathbin{>\!>}}
66 \def\bop#1{\mathbin{\hbox{\sc #1}}}
70 \def\bnot{\mathop{\hbox{\sc not}}}
72 % A reversed version of \ddots with extra space at the top to get good alignment of exponents.
73 \def\rddots{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
74 \raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\raise11\p@\hbox{}\mkern1mu}}
79 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
87 %\font\twelverm=pplr8z at 12pt
88 %\font\twelveit=pplri8z at 12pt
89 %\font\twelvebf=pplb8z at 12pt
93 \font\twelvesc=cmcsc12
95 \def\mathf@nt#1#2#3#4{%
96 \toks0=\expandafter{\csname#1#2\endcsname}%
97 \expandafter\ifx\the\toks0\relax%
98 %\immediate\write-1{bb \the\toks0=#4#2#3}%
99 \global\expandafter\font\the\toks0=#4#2#3%
101 \edef\m@@f{\the\toks0}}
104 \def\fntmathtok{twelve}
106 \def\fntmathstok{eight}
107 \def\fntmathsssize{6}
108 \def\fntmathsstok{six}
110 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
111 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
112 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
113 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
114 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
115 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
116 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
117 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
118 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
119 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
120 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
121 \mathf@nt{\fntmathstok}{ti}{\fntmathssize}{cm}\scriptfont\itfam=\m@@f
122 \mathf@nt{\fntmathsstok}{ti}{\fntmathssize}{cm}\scriptscriptfont\itfam=\m@@f
123 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
124 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
125 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
126 \mathf@nt{\fntmathtok}{msam}{\fntmathsize}{}\textfont\msafam=\m@@f
127 \mathf@nt{\fntmathstok}{msam}{\fntmathssize}{}\scriptfont\msafam=\m@@f
128 \mathf@nt{\fntmathsstok}{msam}{\fntmathsssize}{}\scriptscriptfont\msafam=\m@@f
129 \mathf@nt{\fntmathtok}{msbm}{\fntmathsize}{}\textfont\msbfam=\m@@f
130 \mathf@nt{\fntmathstok}{msbm}{\fntmathssize}{}\scriptfont\msbfam=\m@@f
131 \mathf@nt{\fntmathsstok}{msbm}{\fntmathsssize}{}\scriptscriptfont\msbfam=\m@@f
133 % Blackboard bold font
138 \textfont\bbfam=\bbtwelve
139 \scriptfont\bbfam=\bbeight
140 \scriptscriptfont\bbfam=\bbsix
141 \def\bb{\bbtwelve\fam\bbfam}
144 \def\rm{\fam\z@\twelverm}
145 \def\it{\fam\itfam\twelveit}
146 \def\bo{\fam\bffam\twelveb}
147 \def\bf{\fam\bffam\twelvebf}
148 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
150 \def\sl{\fam\slfam\twelvesl}
152 % Switch to 12pt baselines
156 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
159 \font\chapfont=csssdc17 scaled \magstep1
161 \font\secitfont=csbxti14
164 \footline={\hss\twelverm\folio\hss}
166 %%% Enumerated lists %%%
168 \newif\ifitem\itemtrue
172 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
174 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
175 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
177 \def\inititemize{\interlistskip\begingroup
178 \parskip=1pt plus 0.3pt minus 0.1pt
181 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
184 \def\singleitem{\par\leavevmode\copy\itembox}
186 \def\endlist{\interlistskip\endgroup}
188 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
189 \def\idot{\raise0.2ex\hbox{$\cdot$}}
190 \def\istar{\raise0.2ex\hbox{$\ast$}}
192 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
193 \let\itemnumbering=#1}
195 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
196 \llap{\itemnumbering\hskip 0.4em}}
198 \def\nnorm{\the\itemcount}
199 \def\ndotted{\nnorm.}
201 \def\nroman{\romannumeral\itemcount}
202 \def\nromanp{\nroman)}
203 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
204 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
205 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
206 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
207 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
209 % New \frenchspacing, which doesn't leave unwanted spaces in text.
210 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
211 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
213 %%% Local verbatim mode %%%
215 \def\make@ther#1{\catcode`#1=12\relax}
216 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
217 \let\do=\make@ther\dospecials\obeyspaces}
221 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
224 \global\chardef\sp@ce=32
225 \gdef\showspaces{\let =\sp@ce}
228 \catcode124=\active % Make | active
229 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
232 %%% Verbatim mode for text in { } %%%
234 \newskip\verbglue\newskip\verblineglue
235 \verbglue=3pt plus 1pt minus 0.3pt
236 \verblineglue=0pt plus 1.5pt
245 \def\v@rbend{\par\endgroup\vskip\verbglue}
246 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
247 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
248 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
249 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
250 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
252 \def\startb@x{\setbox0=\hbox\bgroup}
253 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
254 \everypar{\startb@x}}
256 {\catcode`\^^I=\active
257 \gdef\setupt@bs{\catcode`\^^I=\active
258 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
259 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
260 \multiply\t@b by \tabwidth%
261 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
265 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
266 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
267 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
270 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
274 % \algo{jmeno algoritmu}
275 % \algin popis vstupu
279 % \algout popis vystupu
286 \parskip=1pt plus 1pt minus 0.3pt
291 \def\endalgo{\interlistskip\endgroup}
299 \algopar\advance\itemcount by 1
300 \hbox to 2em{\hss \the\itemcount. }%
301 \futurelet\next\algoitemh}
302 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
303 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
304 \def\algin{\par{\sl Input:\/} }
305 \def\algout{\par{\sl Output:\/} }
307 %%% Constructs used in algorithms %%%
310 \def\cmt#1{~~{\sl (#1)}}
312 %%% Chapters, sections and proclamations %%%
322 \def\chapter#1{\vfill\supereject
323 \advance\chapcount by 1
327 \edef\currentid{\the\chapcount}
328 \leftline{\chapfont\currentid. #1}
332 \def\section#1{\bigskip
333 \advance\seccount by 1
335 \edef\currentid{\the\chapcount.\the\seccount}
336 \leftline{\secfont\currentid. #1}
340 \def\para{\advance\thmcount by 1
341 \edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
342 \noindent {\bo \currentid.\enspace}}
344 \def\proclaim#1{\para {\bo #1.\enspace}}
346 \def\thm{\proclaim{Theorem}}
347 \def\lemma{\proclaim{Lemma}}
348 \def\defn{\proclaim{Definition}}
349 \def\problem{\proclaim{Problem}}
350 \def\obs{\proclaim{Observation}}
351 \def\rem{\proclaim{Remark}}
352 \def\alg{\proclaim{Algorithm}}
353 \def\impl{\proclaim{Implementation}}
354 \def\cor{\proclaim{Corollary}}
355 \def\nota{\proclaim{Notation}}
356 \def\example{\proclaim{Example}}
358 \def\label#1{{\sl (#1)\/}\enspace}
359 \def\labelx#1{\label{#1}\hfil\break\kern 0pt} % Eat spaces
361 \def\thmn{\thm\labelx}
362 \def\lemman{\lemma\labelx}
363 \def\defnn{\defn\labelx}
364 \def\corn{\cor\labelx}
365 \def\algn{\alg\label}
366 \def\notan{\nota\labelx}
367 \def\examplen{\example\labelx}
368 \def\problemn{\problem\labelx}
369 \def\remn{\rem\labelx}
371 \def\paran#1{\para {\sl #1:}}
373 \def\proof{\noindent {\sl Proof.}\enspace}
374 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
379 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
381 \immediate\openin\ids=\jobname.ids
386 \immediate\closein\ids
387 \immediate\openout\ids=\jobname.ids
389 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
391 \immediate\write16{*** Warning: Reference #1 undefined ***}%
393 \csname id#1\endcsname
397 \def\id#1{\writeid{#1}{\currentid}}
401 %\bibliographystyle{abbrv}
402 \bibliographystyle{alpha}
404 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
405 \bibliography{biblio}
410 \def\figure#1#2#3{\midinsert
412 \centerline{\epsfxsize=#2\epsfbox{pic/#1}}
420 \vbox{\hsize=0.7\hsize
422 \leftskip=0pt plus 0.3\hsize
428 %%% Stand-alone chapters %%%
431 \section{Bibliography}
433 \vfill\supereject\end