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.)
24 \advance\hsize by -10mm
27 \smallskipamount=4pt plus 1.2pt minus 1.2pt
28 \medskipamount=7pt plus 2.5pt minus 2pt
29 \bigskipamount=15pt plus 5pt minus 4pt
31 \abovedisplayskip=15pt plus 4pt minus 10pt
32 \abovedisplayshortskip=0pt plus 3pt
33 \belowdisplayskip=15pt plus 4pt minus 10pt
34 \belowdisplayshortskip=8.5pt plus 3.5pt minus 4.5pt
39 \def\df#1{{\it #1\/}} % when we define something
42 \mathchoice{\hbox{\it #1\/}}{\hbox{\it #1\/}}{\hbox{\eightti #1\/}}{\hbox{\sixti #1\/}}%
43 \else\leavevmode\hbox{\it #1\/}\fi}
45 \def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\spadesuit$\par}}
46 \def\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\spadesuit$}}\par}}
47 \def\qedmath{\eqno{\spadesuit}}
48 \def\FIXME#1{\>{\bo TODO:} #1}
49 \def\symdiff{\mathbin{\Delta}}
50 \def\rack#1#2{\setbox0=\hbox{#1}\hbox to \wd0{#2}}
51 \def\o#1{\accent23 #1}
52 \def\mst{\mathop{\rm mst}}
53 \def\msf{\mathop{\rm msf}}
54 \def\deg{\mathop{\rm deg}}
55 \def\timesalpha{\mskip2mu\alpha}
56 \def\timesbeta{\mskip2mu\beta}
57 \def\tower{\mathbin\uparrow}
59 \def\minorof{\preccurlyeq}
60 \def\per{\mathop{\rm per}}
61 \def\poly{\mathop{\rm poly}}
63 \def\crpt{\mathbin{\Uparrow}}
72 \def\(#1){\mathord{\left<#1\right>}}
75 \def\shl{\mathbin{<\!<}}
76 \def\shr{\mathbin{>\!>}}
77 \def\bop#1{\mathbin{\hbox{\sc #1}}}
81 \def\bnot{\mathop{\hbox{\sc not}}}
83 % A reversed version of \ddots with extra space at the top to get good alignment of exponents.
84 \def\rddots{\mathinner{\mkern1mu\raise\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
85 \raise4\p@\hbox{.}\mkern2mu\raise7\p@\hbox{.}\raise11\p@\hbox{}\mkern1mu}}
90 \def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\bf\the\footcnt}$}{#1}}}
98 %\font\twelverm=pplr8z at 12pt
99 %\font\twelveit=pplri8z at 12pt
100 %\font\twelvebf=pplb8z at 12pt
102 \font\twelvesl=cmsl12
104 \font\twelvesc=cmcsc12
106 \def\mathf@nt#1#2#3#4{%
107 \toks0=\expandafter{\csname#1#2\endcsname}%
108 \expandafter\ifx\the\toks0\relax%
109 %\immediate\write-1{bb \the\toks0=#4#2#3}%
110 \global\expandafter\font\the\toks0=#4#2#3%
112 \edef\m@@f{\the\toks0}}
115 \def\fntmathtok{twelve}
117 \def\fntmathstok{eight}
118 \def\fntmathsssize{6}
119 \def\fntmathsstok{six}
121 \mathf@nt{\fntmathtok}{r}{\fntmathsize}{cm}\textfont0=\m@@f
122 \mathf@nt{\fntmathstok}{r}{\fntmathssize}{cm}\scriptfont0=\m@@f
123 \mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cm}\scriptscriptfont0=\m@@f
124 \mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
125 \mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
126 \mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
127 \mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
128 \mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
129 \mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
130 \mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
131 \mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cm}\textfont\itfam=\m@@f
132 \mathf@nt{\fntmathstok}{ti}{\fntmathssize}{cm}\scriptfont\itfam=\m@@f
133 \mathf@nt{\fntmathsstok}{ti}{\fntmathssize}{cm}\scriptscriptfont\itfam=\m@@f
134 \mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cm}\textfont\slfam=\m@@f
135 \mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cm}\textfont\bffam=\m@@f
136 \mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cm}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
137 \mathf@nt{\fntmathtok}{msam}{\fntmathsize}{}\textfont\msafam=\m@@f
138 \mathf@nt{\fntmathstok}{msam}{\fntmathssize}{}\scriptfont\msafam=\m@@f
139 \mathf@nt{\fntmathsstok}{msam}{\fntmathsssize}{}\scriptscriptfont\msafam=\m@@f
140 \mathf@nt{\fntmathtok}{msbm}{\fntmathsize}{}\textfont\msbfam=\m@@f
141 \mathf@nt{\fntmathstok}{msbm}{\fntmathssize}{}\scriptfont\msbfam=\m@@f
142 \mathf@nt{\fntmathsstok}{msbm}{\fntmathsssize}{}\scriptscriptfont\msbfam=\m@@f
144 % Blackboard bold font
149 \textfont\bbfam=\bbtwelve
150 \scriptfont\bbfam=\bbeight
151 \scriptscriptfont\bbfam=\bbsix
152 \def\bb{\bbtwelve\fam\bbfam}
155 \def\rm{\fam\z@\twelverm}
156 \def\it{\fam\itfam\twelveit}
157 \def\bo{\fam\bffam\twelveb}
158 \def\bf{\fam\bffam\twelvebf}
159 \def\tt{\fam\ttfam\twelvett\hyphenchar\twelvett=-1\relax}
161 \def\sl{\fam\slfam\twelvesl}
163 % Switch to 12pt baselines
167 \setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
170 \font\chapfont=csssdc17 scaled \magstep1
172 \font\secitfont=csbxti14
175 \footline={\hss\twelverm\folio\hss}
177 % We have to redefine \big and friends as we are using 12pt symbols
178 \def\big#1{{\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}}
179 \def\Big#1{{\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}}
180 \def\bigg#1{{\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}}
181 \def\Bigg#1{{\hbox{$\left#1\vbox to20.5\p@{}\right.\n@space$}}}
183 %%% Enumerated lists %%%
185 \newif\ifitem\itemtrue
189 \def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
191 \def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
192 \advance\leftskip by 2.5em\fi\rightskip=\leftskip}
194 \def\inititemize{\interlistskip\begingroup
195 \parskip=1pt plus 0.3pt minus 0.1pt
198 \def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
201 \def\singleitem{\par\leavevmode\copy\itembox}
203 \def\endlist{\interlistskip\endgroup}
205 \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
206 \def\icirc{\raise0.2ex\hbox{$\circ$}} % Signs frequently used for \itemize
207 \def\idot{\raise0.2ex\hbox{$\cdot$}}
208 \def\istar{\raise0.2ex\hbox{$\ast$}}
210 \def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
211 \let\itemnumbering=#1}
213 \def\numbereditem{\par\leavevmode\advance\itemcount by 1
214 \llap{\itemnumbering\hskip 0.4em}}
216 \def\nnorm{\the\itemcount}
217 \def\ndotted{\nnorm.}
219 \def\nroman{\romannumeral\itemcount}
220 \def\nromanp{\nroman)}
221 \def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
222 \def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
223 \def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
224 \zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
225 \or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
227 % New \frenchspacing, which doesn't leave unwanted spaces in text.
228 \def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
229 \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
231 %%% Local verbatim mode %%%
233 \def\make@ther#1{\catcode`#1=12\relax}
234 \def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
235 \let\do=\make@ther\dospecials\obeyspaces}
239 \gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
242 \global\chardef\sp@ce=32
243 \gdef\showspaces{\let =\sp@ce}
246 \catcode124=\active % Make | active
247 \def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
250 %%% Verbatim mode for text in { } %%%
252 \newskip\verbglue\newskip\verblineglue
253 \verbglue=3pt plus 1pt minus 0.3pt
254 \verblineglue=0pt plus 1.5pt
263 \def\v@rbend{\par\endgroup\vskip\verbglue}
264 \def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
265 \def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
266 \def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
267 \rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
268 \catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
270 \def\startb@x{\setbox0=\hbox\bgroup}
271 \def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
272 \everypar{\startb@x}}
274 {\catcode`\^^I=\active
275 \gdef\setupt@bs{\catcode`\^^I=\active
276 \setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
277 \def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
278 \multiply\t@b by \tabwidth%
279 \advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
283 \catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
284 \gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
285 \let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
288 \def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
292 % \algo{jmeno algoritmu}
293 % \algin popis vstupu
297 % \algout popis vystupu
304 \parskip=1pt plus 1pt minus 0.3pt
309 \def\endalgo{\interlistskip\endgroup}
317 \algopar\advance\itemcount by 1
318 \hbox to 2em{\hss \the\itemcount. }%
319 \futurelet\next\algoitemh}
320 \def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
321 \def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
322 \def\algin{\par{\sl Input:\/} }
323 \def\algout{\par{\sl Output:\/} }
325 %%% Constructs used in algorithms %%%
328 \def\cmt#1{~~{\sl (#1)}}
330 %%% Chapters, sections and proclamations %%%
342 \def\appendices{\chapcount=99}
348 \hglue 1in \vfill\supereject
353 \def\rawchapter#1{\vfill\supereject
355 \leftline{\chapfont #1}
361 \writetoc{unchap}{#1}
364 \def\chapter#1{\advance\chapcount by 1
371 \advance\tmpcount by -100
372 \edef\currentchap{\ifcase\tmpcount A\or B\or C\or D\or E\or ZZZ\fi}
374 \edef\currentchap{\the\chapcount}
376 \edef\currentid{\currentchap}
377 \rawchapter{\currentid. #1}
381 \def\vensure#1{\dimen0=#1
382 \vskip 0pt plus \dimen0
384 \vskip 0pt plus -\dimen0
387 \def\rawsection#1{\bigskip\vensure{0.5in}
388 \leftline{\secfont #1}
394 \def\section#1{\advance\seccount by 1
396 \edef\currentid{\currentchap.\the\seccount}
397 \rawsection{\currentid. #1}
401 \def\para{\advance\thmcount by 1
402 \edef\currentid{\currentchap.\the\seccount.\the\thmcount}
403 \noindent {\bo \currentid.\enspace}}
405 \def\proclaim#1{\para {\bo #1.\enspace}}
407 \def\thm{\proclaim{Theorem}}
408 \def\lemma{\proclaim{Lemma}}
409 \def\defn{\proclaim{Definition}}
410 \def\problem{\proclaim{Problem}}
411 \def\obs{\proclaim{Observation}}
412 \def\rem{\proclaim{Remark}}
413 \def\alg{\proclaim{Algorithm}}
414 \def\impl{\proclaim{Implementation}}
415 \def\cor{\proclaim{Corollary}}
416 \def\nota{\proclaim{Notation}}
417 \def\example{\proclaim{Example}}
419 \def\label#1{{\sl (#1)\/}\enspace}
420 \def\labelx#1{\label{#1}\hfil\break\eatspaces}
421 \def\eatspaces{\kern0pt}
423 \def\thmn{\thm\labelx}
424 \def\lemman{\lemma\labelx}
425 \def\defnn{\defn\labelx}
426 \def\corn{\cor\labelx}
427 \def\algn{\alg\label}
428 \def\notan{\nota\labelx}
429 \def\examplen{\example\labelx}
430 \def\problemn{\problem\labelx}
431 \def\remn{\rem\labelx}
433 \def\paran#1{\para {\sl #1.\/}\enspace\eatspaces}
435 \def\proof{\noindent {\sl Proof.}\enspace}
436 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
438 %%% Table of contents %%%
441 \immediate\openout\toc=\jobname.toc
448 \edef\tocaux{\write\toc{\noexpand\expandafter\noexpand\string\noexpand\csname toc#1\noexpand\endcsname{\currentid}{#2}{\the\toks0}}}
455 \immediate\openin\tok=\jobname.tok
460 \immediate\closein\tok
463 \def\tocchap#1#2#3{\smallskip\line{\bo #1.~~#2 \dotfill ~#3}}
464 \def\tocsec#1#2#3{\line{#1.~~#2 \dotfill ~#3}}
465 \def\tocunchap#1#2#3{\smallskip\line{\bo #2 \dotfill ~#3}}
470 \def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
472 \immediate\openin\ids=\jobname.ids
477 \immediate\closein\ids
478 \immediate\openout\ids=\jobname.ids
480 \def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
482 \immediate\write16{*** Warning: Reference #1 undefined ***}%
484 \csname id#1\endcsname
488 \def\id#1{\writeid{#1}{\currentid}}
492 %\bibliographystyle{abbrv}
493 \bibliographystyle{mjalpha}
495 \def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
496 \bibliography{biblio}
501 \def\float#1#2{\midinsert
509 \def\figure#1#2#3{\float{\epsfxsize=#2\epsfbox{pic/#1}}{#3}}
513 \vbox{\hsize=0.7\hsize
515 \leftskip=0pt plus 0.3\hsize
521 %%% Stand-alone chapters %%%
524 \section{Bibliography}
526 \vfill\supereject\end
531 \hyphenation{Ra-ma-chan-dran}
533 %%% Output routine %%%
539 \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}%