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\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\spadesuit$}}\par}}
36 \def\FIXME#1{\>{\bo TODO:} #1}
37 \def\symdiff{\mathbin{\Delta}}
38 \def\hphantas#1#2{\setbox0=\hbox{#2}\hbox to \wd0{#1\hss}}
39 \def\o#1{\accent23 #1}
40 \def\mst{\mathop{\rm mst}}
41 \def\deg{\mathop{\rm deg}}
42 \def\timesalpha{\mskip2mu\alpha}
43 \def\tower{\mathop\uparrow}
48 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
56 %\font\twelverm=pplr8z at 12pt
57 %\font\twelveit=pplri8z at 12pt
58 %\font\twelvebf=pplb8z at 12pt
62 \font\twelvesc=cmcsc12
64 \def\mathf@nt#1#2#3#4{%
65 \toks0=\expandafter{\csname#1#2\endcsname}%
66 \expandafter\ifx\the\toks0\relax%
67 %\immediate\write-1{bb \the\toks0=#4#2#3}%
68 \global\expandafter\font\the\toks0=#4#2#3%
70 \edef\m@@f{\the\toks0}}
73 \def\fntmathtok{twelve}
75 \def\fntmathstok{eight}
77 \def\fntmathsstok{six}
79 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
80 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
81 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
82 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
83 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
84 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
85 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
86 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
87 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
88 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
89 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
90 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
91 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
92 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
94 % Blackboard bold font
99 \textfont\bbfam=\bbtwelve
100 \scriptfont\bbfam=\bbeight
101 \scriptscriptfont\bbfam=\bbsix
102 \def\bb{\bbtwelve\fam\bbfam}
105 \def\rm{\fam\z@\twelverm}
106 \def\it{\fam\itfam\twelveit}
107 \def\bo{\fam\bffam\twelveb}
108 \def\bf{\fam\bffam\twelvebf}
109 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
111 \def\sl{\fam\slfam\twelvesl}
113 % Switch to 12pt baselines
117 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
120 \font\chapfont=csssdc17 scaled \magstep1
124 \footline={\hss\twelverm\folio\hss}
126 %%% Enumerated lists %%%
128 \newif\ifitem\itemtrue
132 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
134 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
135 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
137 \def\inititemize{\interlistskip\begingroup
138 \parskip=1pt plus 0.3pt minus 0.1pt
141 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
144 \def\singleitem{\par\leavevmode\copy\itembox}
146 \def\endlist{\interlistskip\endgroup}
148 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
149 \def\idot{\raise0.2ex\hbox{$\cdot$}}
150 \def\istar{\raise0.2ex\hbox{$\ast$}}
152 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
153 \let\itemnumbering=#1}
155 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
156 \llap{\itemnumbering\hskip 0.4em}}
158 \def\nnorm{\the\itemcount}
159 \def\ndotted{\nnorm.}
161 \def\nroman{\romannumeral\itemcount}
162 \def\nromanp{\nroman)}
163 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
164 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
165 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
166 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
167 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
169 % New \frenchspacing, which doesn't leave unwanted spaces in text.
170 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
171 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
173 %%% Local verbatim mode %%%
175 \def\make@ther#1{\catcode`#1=12\relax}
176 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
177 \let\do=\make@ther\dospecials\obeyspaces}
181 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
184 \global\chardef\sp@ce=32
185 \gdef\showspaces{\let =\sp@ce}
188 \catcode124=\active % Make | active
189 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
192 %%% Verbatim mode for text in { } %%%
194 \newskip\verbglue\newskip\verblineglue
195 \verbglue=3pt plus 1pt minus 0.3pt
196 \verblineglue=0pt plus 1.5pt
205 \def\v@rbend{\par\endgroup\vskip\verbglue}
206 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
207 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
208 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
209 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
210 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
212 \def\startb@x{\setbox0=\hbox\bgroup}
213 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
214 \everypar{\startb@x}}
216 {\catcode`\^^I=\active
217 \gdef\setupt@bs{\catcode`\^^I=\active
218 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
219 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
220 \multiply\t@b by \tabwidth%
221 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
225 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
226 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
227 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
230 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
234 % \algo{jmeno algoritmu}
235 % \algin popis vstupu
239 % \algout popis vystupu
246 \parskip=1pt plus 1pt minus 0.3pt
251 \def\endalgo{\interlistskip\endgroup}
259 \algopar\advance\itemcount by 1
260 \hbox to 2em{\hss \the\itemcount. }%
261 \futurelet\next\algoitemh}
262 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
263 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
264 \def\algin{\par{\sl Input:\/} }
265 \def\algout{\par{\sl Output:\/} }
267 %%% Constructs used in algorithms %%%
270 \def\cmt#1{~~{\sl (#1)}}
272 %%% Chapters, sections and proclamations %%%
282 \def\chapter#1{\vfill\supereject
283 \advance\chapcount by 1
286 \edef\currentid{\the\chapcount}
287 \leftline{\chapfont\currentid. #1}
291 \def\section#1{\bigskip
292 \advance\seccount by 1
294 \edef\currentid{\the\chapcount.\the\seccount}
295 \leftline{\secfont\currentid. #1}
299 \def\para{\advance\thmcount by 1
300 \edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
301 \noindent {\bo \currentid.\enspace}}
303 \def\proclaim#1{\para {\bo #1.\enspace}}
305 \def\thm{\proclaim{Theorem}}
306 \def\lemma{\proclaim{Lemma}}
307 \def\defn{\proclaim{Definition}}
308 \def\problem{\proclaim{Problem}}
309 \def\obs{\proclaim{Observation}}
310 \def\rem{\proclaim{Remark}}
311 \def\alg{\proclaim{Algorithm}}
312 \def\impl{\proclaim{Implementation}}
313 \def\cor{\proclaim{Corollary}}
314 \def\nota{\proclaim{Notation}}
315 \def\example{\proclaim{Example}}
317 \def\label#1{{\sl (#1)\/}\enspace}
319 \def\thmn{\thm\label}
320 \def\lemman{\lemma\label}
321 \def\defnn{\defn\label}
322 \def\algn{\alg\label}
324 \def\proof{\noindent {\sl Proof.}\enspace}
329 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
331 \immediate\openin\ids=\jobname.ids
336 \immediate\closein\ids
337 \immediate\openout\ids=\jobname.ids
339 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
341 \immediate\write16{*** Warning: Reference #1 undefined ***}%
343 \csname id#1\endcsname
347 \def\id#1{\writeid{#1}{\currentid}}
351 %\bibliographystyle{abbrv}
352 \bibliographystyle{alpha}
354 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
355 \bibliography{biblio}
360 \def\figure#1#2#3{\midinsert
362 \centerline{\epsfxsize=#2\epsfbox{pic/#1}}
368 %%% Stand-alone chapters %%%
371 \section{Bibliography}
373 \vfill\supereject\end