1 % TeX macros for typesetting my PhD thesis
2 % (c) 2008 Martin Mares <mj@ucw.cz>
9 %%% Basic parameters %%%
11 % A4 with 1in margins, leaving 20pt for page numbering at the bottom
14 \advance\vsize by -20pt
16 \parskip=3pt plus 1pt minus 1pt
18 \smallskipamount=4pt plus 1.2pt minus 1.2pt
19 \medskipamount=7pt plus 2.5pt minus 2pt
20 \bigskipamount=15pt plus 5pt minus 4pt
22 \abovedisplayskip=15pt plus 4pt minus 10pt
23 \abovedisplayshortskip=0pt plus 3pt
24 \belowdisplayskip=15pt plus 4pt minus 10pt
25 \belowdisplayshortskip=8.5pt plus 3.5pt minus 4.5pt
30 \def\df#1{{\it #1\/}} % when we define something
32 \def\<#1>{\leavevmode\hbox{\it #1\/}}
34 \def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\spadesuit$\par}}
35 \def\FIXME#1{\>{\bo TODO:} #1}
36 \def\symdiff{\mathbin{\Delta}}
37 \def\hphantas#1#2{\setbox0=\hbox{#2}\hbox to \wd0{#1\hss}}
38 \def\o#1{\accent23 #1}
39 \def\mst{\mathop{\rm mst}}
40 \def\deg{\mathop{\rm deg}}
41 \def\timesalpha{\mskip2mu\alpha}
46 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
54 %\font\twelverm=pplr8z at 12pt
55 %\font\twelveit=pplri8z at 12pt
56 %\font\twelvebf=pplb8z at 12pt
60 \font\twelvesc=cmcsc12
62 \def\mathf@nt#1#2#3#4{%
63 \toks0=\expandafter{\csname#1#2\endcsname}%
64 \expandafter\ifx\the\toks0\relax%
65 %\immediate\write-1{bb \the\toks0=#4#2#3}%
66 \global\expandafter\font\the\toks0=#4#2#3%
68 \edef\m@@f{\the\toks0}}
71 \def\fntmathtok{twelve}
73 \def\fntmathstok{eight}
75 \def\fntmathsstok{six}
77 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
78 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
79 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
80 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
81 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
82 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
83 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
84 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
85 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
86 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
87 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
88 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
89 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
90 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
92 % Blackboard bold font
97 \textfont\bbfam=\bbtwelve
98 \scriptfont\bbfam=\bbeight
99 \scriptscriptfont\bbfam=\bbsix
100 \def\bb{\bbtwelve\fam\bbfam}
103 \def\rm{\fam\z@\twelverm}
104 \def\it{\fam\itfam\twelveit}
105 \def\bo{\fam\bffam\twelveb}
106 \def\bf{\fam\bffam\twelvebf}
107 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
109 \def\sl{\fam\slfam\twelvesl}
111 % Switch to 12pt baselines
115 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
118 \font\chapfont=csssdc17 scaled \magstep1
122 \footline={\hss\twelverm\folio\hss}
124 %%% Enumerated lists %%%
126 \newif\ifitem\itemtrue
130 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
132 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
133 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
135 \def\inititemize{\interlistskip\begingroup
136 \parskip=1pt plus 0.3pt minus 0.1pt
139 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
142 \def\singleitem{\par\leavevmode\copy\itembox}
144 \def\endlist{\interlistskip\endgroup}
146 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
147 \def\idot{\raise0.2ex\hbox{$\cdot$}}
148 \def\istar{\raise0.2ex\hbox{$\ast$}}
150 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
151 \let\itemnumbering=#1}
153 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
154 \llap{\itemnumbering\hskip 0.4em}}
156 \def\nnorm{\the\itemcount}
157 \def\ndotted{\nnorm.}
159 \def\nroman{\romannumeral\itemcount}
160 \def\nromanp{\nroman)}
161 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
162 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
163 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
164 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
165 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
167 % New \frenchspacing, which doesn't leave unwanted spaces in text.
168 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
169 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
171 %%% Local verbatim mode %%%
173 \def\make@ther#1{\catcode`#1=12\relax}
174 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
175 \let\do=\make@ther\dospecials\obeyspaces}
179 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
182 \global\chardef\sp@ce=32
183 \gdef\showspaces{\let =\sp@ce}
186 \catcode124=\active % Make | active
187 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
190 %%% Verbatim mode for text in { } %%%
192 \newskip\verbglue\newskip\verblineglue
193 \verbglue=3pt plus 1pt minus 0.3pt
194 \verblineglue=0pt plus 1.5pt
203 \def\v@rbend{\par\endgroup\vskip\verbglue}
204 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
205 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
206 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
207 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
208 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
210 \def\startb@x{\setbox0=\hbox\bgroup}
211 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
212 \everypar{\startb@x}}
214 {\catcode`\^^I=\active
215 \gdef\setupt@bs{\catcode`\^^I=\active
216 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
217 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
218 \multiply\t@b by \tabwidth%
219 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
223 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
224 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
225 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
228 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
232 % \algo{jmeno algoritmu}
233 % \algin popis vstupu
237 % \algout popis vystupu
244 \parskip=1pt plus 1pt minus 0.3pt
249 \def\endalgo{\interlistskip\endgroup}
257 \algopar\advance\itemcount by 1
258 \hbox to 2em{\hss \the\itemcount. }%
259 \futurelet\next\algoitemh}
260 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
261 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
262 \def\algin{\par{\sl Input:\/} }
263 \def\algout{\par{\sl Output:\/} }
265 %%% Constructs used in algorithms %%%
268 \def\cmt#1{~~{\sl (#1)}}
270 %%% Chapters, sections and proclamations %%%
280 \def\chapter#1{\vfill\supereject
281 \advance\chapcount by 1
284 \edef\currentid{\the\chapcount}
285 \leftline{\chapfont\currentid. #1}
289 \def\section#1{\bigskip
290 \advance\seccount by 1
292 \edef\currentid{\the\chapcount.\the\seccount}
293 \leftline{\secfont\currentid. #1}
297 \def\para{\advance\thmcount by 1
298 \edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
299 \noindent {\bo \currentid.\enspace}}
301 \def\proclaim#1{\para {\bo #1.\enspace}}
303 \def\thm{\proclaim{Theorem}}
304 \def\lemma{\proclaim{Lemma}}
305 \def\defn{\proclaim{Definition}}
306 \def\problem{\proclaim{Problem}}
307 \def\obs{\proclaim{Observation}}
308 \def\rem{\proclaim{Remark}}
309 \def\alg{\proclaim{Algorithm}}
310 \def\impl{\proclaim{Implementation}}
311 \def\cor{\proclaim{Corollary}}
312 \def\nota{\proclaim{Notation}}
313 \def\example{\proclaim{Example}}
315 \def\label#1{{\sl (#1)\/}\enspace}
317 \def\thmn{\thm\label}
318 \def\lemman{\lemma\label}
319 \def\defnn{\defn\label}
320 \def\algn{\alg\label}
322 \def\proof{\noindent {\sl Proof.}\enspace}
327 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
329 \immediate\openin\ids=\jobname.ids
334 \immediate\closein\ids
335 \immediate\openout\ids=\jobname.ids
337 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
339 \immediate\write16{*** Warning: Reference #1 undefined ***}%
341 \csname id#1\endcsname
345 \def\id#1{\writeid{#1}{\currentid}}
349 %\bibliographystyle{abbrv}
350 \bibliographystyle{alpha}
352 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
353 \bibliography{biblio}
358 \def\figure#1#2#3{\midinsert
360 \centerline{\epsfxsize=#2\epsfbox{pic/#1}}
366 %%% Stand-alone chapters %%%
369 \section{Bibliography}
371 \vfill\supereject\end