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}
48 \def\per{\mathop{\rm per}}
53 \def\(#1){\mathord{\left<#1\right>}}
56 \def\shl{\mathbin{<\!<}}
57 \def\shr{\mathbin{>\!>}}
58 \def\bop#1{\mathbin{\hbox{\sc #1}}}
62 \def\bnot{\mathop{\hbox{\sc not}}}
64 % A reversed version of \ddots with extra space at the top to get good alignment of exponents.
65 \def\rddots{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
66 \raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\raise11\p@\hbox{}\mkern1mu}}
71 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
79 %\font\twelverm=pplr8z at 12pt
80 %\font\twelveit=pplri8z at 12pt
81 %\font\twelvebf=pplb8z at 12pt
85 \font\twelvesc=cmcsc12
87 \def\mathf@nt#1#2#3#4{%
88 \toks0=\expandafter{\csname#1#2\endcsname}%
89 \expandafter\ifx\the\toks0\relax%
90 %\immediate\write-1{bb \the\toks0=#4#2#3}%
91 \global\expandafter\font\the\toks0=#4#2#3%
93 \edef\m@@f{\the\toks0}}
96 \def\fntmathtok{twelve}
98 \def\fntmathstok{eight}
100 \def\fntmathsstok{six}
102 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
103 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
104 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
105 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
106 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
107 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
108 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
109 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
110 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
111 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
112 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
113 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
114 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
115 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
116 \mathf@nt{\fntmathtok}{msam}{\fntmathsize}{}\textfont\msafam=\m@@f
117 \mathf@nt{\fntmathstok}{msam}{\fntmathssize}{}\scriptfont\msafam=\m@@f
118 \mathf@nt{\fntmathsstok}{msam}{\fntmathsssize}{}\scriptscriptfont\msafam=\m@@f
119 \mathf@nt{\fntmathtok}{msbm}{\fntmathsize}{}\textfont\msbfam=\m@@f
120 \mathf@nt{\fntmathstok}{msbm}{\fntmathssize}{}\scriptfont\msbfam=\m@@f
121 \mathf@nt{\fntmathsstok}{msbm}{\fntmathsssize}{}\scriptscriptfont\msbfam=\m@@f
123 % Blackboard bold font
128 \textfont\bbfam=\bbtwelve
129 \scriptfont\bbfam=\bbeight
130 \scriptscriptfont\bbfam=\bbsix
131 \def\bb{\bbtwelve\fam\bbfam}
134 \def\rm{\fam\z@\twelverm}
135 \def\it{\fam\itfam\twelveit}
136 \def\bo{\fam\bffam\twelveb}
137 \def\bf{\fam\bffam\twelvebf}
138 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
140 \def\sl{\fam\slfam\twelvesl}
142 % Switch to 12pt baselines
146 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
149 \font\chapfont=csssdc17 scaled \magstep1
151 \font\secitfont=csbxti14
154 \footline={\hss\twelverm\folio\hss}
156 %%% Enumerated lists %%%
158 \newif\ifitem\itemtrue
162 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
164 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
165 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
167 \def\inititemize{\interlistskip\begingroup
168 \parskip=1pt plus 0.3pt minus 0.1pt
171 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
174 \def\singleitem{\par\leavevmode\copy\itembox}
176 \def\endlist{\interlistskip\endgroup}
178 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
179 \def\idot{\raise0.2ex\hbox{$\cdot$}}
180 \def\istar{\raise0.2ex\hbox{$\ast$}}
182 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
183 \let\itemnumbering=#1}
185 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
186 \llap{\itemnumbering\hskip 0.4em}}
188 \def\nnorm{\the\itemcount}
189 \def\ndotted{\nnorm.}
191 \def\nroman{\romannumeral\itemcount}
192 \def\nromanp{\nroman)}
193 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
194 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
195 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
196 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
197 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
199 % New \frenchspacing, which doesn't leave unwanted spaces in text.
200 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
201 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
203 %%% Local verbatim mode %%%
205 \def\make@ther#1{\catcode`#1=12\relax}
206 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
207 \let\do=\make@ther\dospecials\obeyspaces}
211 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
214 \global\chardef\sp@ce=32
215 \gdef\showspaces{\let =\sp@ce}
218 \catcode124=\active % Make | active
219 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
222 %%% Verbatim mode for text in { } %%%
224 \newskip\verbglue\newskip\verblineglue
225 \verbglue=3pt plus 1pt minus 0.3pt
226 \verblineglue=0pt plus 1.5pt
235 \def\v@rbend{\par\endgroup\vskip\verbglue}
236 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
237 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
238 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
239 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
240 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
242 \def\startb@x{\setbox0=\hbox\bgroup}
243 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
244 \everypar{\startb@x}}
246 {\catcode`\^^I=\active
247 \gdef\setupt@bs{\catcode`\^^I=\active
248 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
249 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
250 \multiply\t@b by \tabwidth%
251 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
255 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
256 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
257 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
260 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
264 % \algo{jmeno algoritmu}
265 % \algin popis vstupu
269 % \algout popis vystupu
276 \parskip=1pt plus 1pt minus 0.3pt
281 \def\endalgo{\interlistskip\endgroup}
289 \algopar\advance\itemcount by 1
290 \hbox to 2em{\hss \the\itemcount. }%
291 \futurelet\next\algoitemh}
292 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
293 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
294 \def\algin{\par{\sl Input:\/} }
295 \def\algout{\par{\sl Output:\/} }
297 %%% Constructs used in algorithms %%%
300 \def\cmt#1{~~{\sl (#1)}}
302 %%% Chapters, sections and proclamations %%%
312 \def\chapter#1{\vfill\supereject
313 \advance\chapcount by 1
317 \edef\currentid{\the\chapcount}
318 \leftline{\chapfont\currentid. #1}
322 \def\section#1{\bigskip
323 \advance\seccount by 1
325 \edef\currentid{\the\chapcount.\the\seccount}
326 \leftline{\secfont\currentid. #1}
330 \def\para{\advance\thmcount by 1
331 \edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
332 \noindent {\bo \currentid.\enspace}}
334 \def\proclaim#1{\para {\bo #1.\enspace}}
336 \def\thm{\proclaim{Theorem}}
337 \def\lemma{\proclaim{Lemma}}
338 \def\defn{\proclaim{Definition}}
339 \def\problem{\proclaim{Problem}}
340 \def\obs{\proclaim{Observation}}
341 \def\rem{\proclaim{Remark}}
342 \def\alg{\proclaim{Algorithm}}
343 \def\impl{\proclaim{Implementation}}
344 \def\cor{\proclaim{Corollary}}
345 \def\nota{\proclaim{Notation}}
346 \def\example{\proclaim{Example}}
348 \def\label#1{{\sl (#1)\/}\enspace}
349 \def\labelx#1{\label{#1}\hfil\break\kern 0pt} % Eat spaces
351 \def\thmn{\thm\labelx}
352 \def\lemman{\lemma\labelx}
353 \def\defnn{\defn\labelx}
354 \def\algn{\alg\label}
355 \def\notan{\nota\labelx}
356 \def\examplen{\example\labelx}
358 \def\proof{\noindent {\sl Proof.}\enspace}
359 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
364 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
366 \immediate\openin\ids=\jobname.ids
371 \immediate\closein\ids
372 \immediate\openout\ids=\jobname.ids
374 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
376 \immediate\write16{*** Warning: Reference #1 undefined ***}%
378 \csname id#1\endcsname
382 \def\id#1{\writeid{#1}{\currentid}}
386 %\bibliographystyle{abbrv}
387 \bibliographystyle{alpha}
389 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
390 \bibliography{biblio}
395 \def\figure#1#2#3{\midinsert
397 \centerline{\epsfxsize=#2\epsfbox{pic/#1}}
403 %%% Stand-alone chapters %%%
406 \section{Bibliography}
408 \vfill\supereject\end