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 % Parameters for final typesetting (bigger inner margins etc.)
23 \advance\hsize by -10mm
32 \smallskipamount=4pt plus 1.2pt minus 1.2pt
33 \medskipamount=7pt plus 2.5pt minus 2pt
34 \bigskipamount=15pt plus 5pt minus 4pt
36 \abovedisplayskip=15pt plus 4pt minus 10pt
37 \abovedisplayshortskip=0pt plus 3pt
38 \belowdisplayskip=15pt plus 4pt minus 10pt
39 \belowdisplayshortskip=8.5pt plus 3.5pt minus 4.5pt
44 \def\df#1{{\it #1\/}} % when we define something
47 \mathchoice{\hbox{\it #1\/}}{\hbox{\it #1\/}}{\hbox{\eightti #1\/}}{\hbox{\sixti #1\/}}%
48 \else\leavevmode\hbox{\it #1\/}\fi}
50 \def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\spadesuit$\par}}
51 \def\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\spadesuit$}}\par}}
52 \def\qedmath{\eqno{\spadesuit}}
53 \def\FIXME#1{\>{\bo TODO:} #1}
54 \def\symdiff{\mathbin{\Delta}}
55 \def\rack#1#2{\setbox0=\hbox{#1}\hbox to \wd0{#2}}
56 \def\o#1{\accent23 #1}
57 \def\mst{\mathop{\rm mst}}
58 \def\msf{\mathop{\rm msf}}
59 \def\deg{\mathop{\rm deg}}
60 \def\timesalpha{\mskip2mu\alpha}
61 \def\timesbeta{\mskip2mu\beta}
62 \def\tower{\mathbin\uparrow}
64 \def\minorof{\preccurlyeq}
65 \def\per{\mathop{\rm per}}
66 \def\poly{\mathop{\rm poly}}
68 \def\crpt{\mathbin{\Uparrow}}
77 \def\(#1){\mathord{\left<#1\right>}}
80 \def\shl{\mathbin{<\!<}}
81 \def\shr{\mathbin{>\!>}}
82 \def\bop#1{\mathbin{\hbox{\sc #1}}}
86 \def\bnot{\mathop{\hbox{\sc not}}}
88 % A reversed version of \ddots with extra space at the top to get good alignment of exponents.
89 \def\rddots{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
90 \raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\raise11\p@\hbox{}\mkern1mu}}
95 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
100 \font\twelveit=cmti12
101 \font\twelvebf=cmbx12
103 %\font\twelverm=pplr8z at 12pt
104 %\font\twelveit=pplri8z at 12pt
105 %\font\twelvebf=pplb8z at 12pt
107 \font\twelvesl=cmsl12
109 \font\twelvesc=cmcsc12
111 \def\mathf@nt#1#2#3#4{%
112 \toks0=\expandafter{\csname#1#2\endcsname}%
113 \expandafter\ifx\the\toks0\relax%
114 %\immediate\write-1{bb \the\toks0=#4#2#3}%
115 \global\expandafter\font\the\toks0=#4#2#3%
117 \edef\m@@f{\the\toks0}}
120 \def\fntmathtok{twelve}
122 \def\fntmathstok{eight}
123 \def\fntmathsssize{6}
124 \def\fntmathsstok{six}
126 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
127 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
128 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
129 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
130 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
131 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
132 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
133 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
134 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
135 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
136 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
137 \mathf@nt{\fntmathstok}{ti}{\fntmathssize}{cm}\scriptfont\itfam=\m@@f
138 \mathf@nt{\fntmathsstok}{ti}{\fntmathssize}{cm}\scriptscriptfont\itfam=\m@@f
139 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
140 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
141 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
142 \mathf@nt{\fntmathtok}{msam}{\fntmathsize}{}\textfont\msafam=\m@@f
143 \mathf@nt{\fntmathstok}{msam}{\fntmathssize}{}\scriptfont\msafam=\m@@f
144 \mathf@nt{\fntmathsstok}{msam}{\fntmathsssize}{}\scriptscriptfont\msafam=\m@@f
145 \mathf@nt{\fntmathtok}{msbm}{\fntmathsize}{}\textfont\msbfam=\m@@f
146 \mathf@nt{\fntmathstok}{msbm}{\fntmathssize}{}\scriptfont\msbfam=\m@@f
147 \mathf@nt{\fntmathsstok}{msbm}{\fntmathsssize}{}\scriptscriptfont\msbfam=\m@@f
149 % Blackboard bold font
154 \textfont\bbfam=\bbtwelve
155 \scriptfont\bbfam=\bbeight
156 \scriptscriptfont\bbfam=\bbsix
157 \def\bb{\bbtwelve\fam\bbfam}
160 \def\rm{\fam\z@\twelverm}
161 \def\it{\fam\itfam\twelveit}
162 \def\bo{\fam\bffam\twelveb}
163 \def\bf{\fam\bffam\twelvebf}
164 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
166 \def\sl{\fam\slfam\twelvesl}
168 % Switch to 12pt baselines
172 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
175 \font\chapfont=csssdc17 scaled \magstep1
177 \font\secitfont=csbxti14
180 \footline={\hss\twelverm\folio\hss}
182 % We have to redefine \big and friends as we are using 12pt symbols
183 \def\big#1{{\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}}
184 \def\Big#1{{\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}}
185 \def\bigg#1{{\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}}
186 \def\Bigg#1{{\hbox{$\left#1\vbox to20.5\p@{}\right.\n@space$}}}
188 %%% Enumerated lists %%%
190 \newif\ifitem\itemtrue
194 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
196 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
197 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
199 \def\inititemize{\interlistskip\begingroup
200 \parskip=1pt plus 0.3pt minus 0.1pt
203 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
206 \def\singleitem{\par\leavevmode\copy\itembox}
208 \def\endlist{\interlistskip\endgroup}
210 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
211 \def\icirc{\raise0.2ex\hbox{$\circ$}} % Signs frequently used for \itemize
212 \def\idot{\raise0.2ex\hbox{$\cdot$}}
213 \def\istar{\raise0.2ex\hbox{$\ast$}}
215 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
216 \let\itemnumbering=#1}
218 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
219 \llap{\itemnumbering\hskip 0.4em}}
221 \def\nnorm{\the\itemcount}
222 \def\ndotted{\nnorm.}
224 \def\nroman{\romannumeral\itemcount}
225 \def\nromanp{\nroman)}
226 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
227 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
228 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
229 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
230 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
232 % New \frenchspacing, which doesn't leave unwanted spaces in text.
233 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
234 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
236 %%% Local verbatim mode %%%
238 \def\make@ther#1{\catcode`#1=12\relax}
239 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
240 \let\do=\make@ther\dospecials\obeyspaces}
244 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
247 \global\chardef\sp@ce=32
248 \gdef\showspaces{\let =\sp@ce}
251 \catcode124=\active % Make | active
252 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
255 %%% Verbatim mode for text in { } %%%
257 \newskip\verbglue\newskip\verblineglue
258 \verbglue=3pt plus 1pt minus 0.3pt
259 \verblineglue=0pt plus 1.5pt
268 \def\v@rbend{\par\endgroup\vskip\verbglue}
269 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
270 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
271 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
272 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
273 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
275 \def\startb@x{\setbox0=\hbox\bgroup}
276 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
277 \everypar{\startb@x}}
279 {\catcode`\^^I=\active
280 \gdef\setupt@bs{\catcode`\^^I=\active
281 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
282 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
283 \multiply\t@b by \tabwidth%
284 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
288 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
289 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
290 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
293 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
297 % \algo{jmeno algoritmu}
298 % \algin popis vstupu
302 % \algout popis vystupu
309 \parskip=1pt plus 1pt minus 0.3pt
314 \def\endalgo{\interlistskip\endgroup}
322 \algopar\advance\itemcount by 1
323 \hbox to 2em{\hss \the\itemcount. }%
324 \futurelet\next\algoitemh}
325 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
326 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
327 \def\algin{\par{\sl Input:\/} }
328 \def\algout{\par{\sl Output:\/} }
330 %%% Constructs used in algorithms %%%
333 \def\cmt#1{~~{\sl (#1)}}
335 %%% Chapters, sections and proclamations %%%
347 \def\appendices{\chapcount=99}
353 \hglue 1in \vfill\supereject
358 \def\rawchapter#1{\vfill\supereject
360 \leftline{\chapfont #1}
366 \writetoc{unchap}{#1}
369 \def\chapter#1{\advance\chapcount by 1
376 \advance\tmpcount by -100
377 \edef\currentchap{\ifcase\tmpcount A\or B\or C\or D\or E\or ZZZ\fi}
379 \edef\currentchap{\the\chapcount}
381 \edef\currentid{\currentchap}
382 \rawchapter{\currentid. #1}
386 \def\vensure#1{\dimen0=#1
387 \vskip 0pt plus \dimen0
389 \vskip 0pt plus -\dimen0
392 \def\section#1{\bigskip
394 \advance\seccount by 1
396 \edef\currentid{\currentchap.\the\seccount}
397 \leftline{\secfont\currentid. #1}
404 \def\para{\advance\thmcount by 1
405 \edef\currentid{\currentchap.\the\seccount.\the\thmcount}
406 \noindent {\bo \currentid.\enspace}}
408 \def\proclaim#1{\para {\bo #1.\enspace}}
410 \def\thm{\proclaim{Theorem}}
411 \def\lemma{\proclaim{Lemma}}
412 \def\defn{\proclaim{Definition}}
413 \def\problem{\proclaim{Problem}}
414 \def\obs{\proclaim{Observation}}
415 \def\rem{\proclaim{Remark}}
416 \def\alg{\proclaim{Algorithm}}
417 \def\impl{\proclaim{Implementation}}
418 \def\cor{\proclaim{Corollary}}
419 \def\nota{\proclaim{Notation}}
420 \def\example{\proclaim{Example}}
422 \def\label#1{{\sl (#1)\/}\enspace}
423 \def\labelx#1{\label{#1}\hfil\break\eatspaces}
424 \def\eatspaces{\kern0pt}
426 \def\thmn{\thm\labelx}
427 \def\lemman{\lemma\labelx}
428 \def\defnn{\defn\labelx}
429 \def\corn{\cor\labelx}
430 \def\algn{\alg\label}
431 \def\notan{\nota\labelx}
432 \def\examplen{\example\labelx}
433 \def\problemn{\problem\labelx}
434 \def\remn{\rem\labelx}
436 \def\paran#1{\para {\sl #1.\/}\enspace\eatspaces}
438 \def\proof{\noindent {\sl Proof.}\enspace}
439 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
441 %%% Table of contents %%%
444 \immediate\openout\toc=\jobname.toc
451 \edef\tocaux{\write\toc{\noexpand\expandafter\noexpand\string\noexpand\csname toc#1\noexpand\endcsname{\currentid}{#2}{\the\toks0}}}
458 \immediate\openin\tok=\jobname.tok
463 \immediate\closein\tok
466 \def\tocchap#1#2#3{\smallskip\line{\bo #1.~~#2 \dotfill ~#3}}
467 \def\tocsec#1#2#3{\line{#1.~~#2 \dotfill ~#3}}
468 \def\tocunchap#1#2#3{\smallskip\line{\bo #2 \dotfill ~#3}}
473 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
475 \immediate\openin\ids=\jobname.ids
480 \immediate\closein\ids
481 \immediate\openout\ids=\jobname.ids
483 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
485 \immediate\write16{*** Warning: Reference #1 undefined ***}%
487 \csname id#1\endcsname
491 \def\id#1{\writeid{#1}{\currentid}}
495 %\bibliographystyle{abbrv}
496 \bibliographystyle{mjalpha}
498 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
499 \bibliography{biblio}
504 \def\float#1#2{\midinsert
512 \def\figure#1#2#3{\float{\epsfxsize=#2\epsfbox{pic/#1}}{#3}}
516 \vbox{\hsize=0.7\hsize
518 \leftskip=0pt plus 0.3\hsize
524 %%% Stand-alone chapters %%%
527 \section{Bibliography}
529 \vfill\supereject\end
534 \hyphenation{Ra-ma-chan-dran}
536 %%% Output routine %%%
540 \def\sagaoutput{\ifodd\pageno \hoffset=\hwobble \else \hoffset=0pt \fi
543 \def\makefootline{\baselineskip30pt\lineskiplimit 0pt\line{\the\footline}}
545 \footline={\ifodd\pageno
546 {\hfil\twelvemi\the\pageno}%
548 {\twelvemi\the\pageno\hfil}%