]> mj.ucw.cz Git - diplomky.git/blob - macros.tex
Metadata: We prefer British English in comments
[diplomky.git] / macros.tex
1 %%% This file contains definitions of various useful macros and environments %%%
2 %%% Please add more macros here instead of cluttering other files with them. %%%
3
4 %%% Switches based on thesis type
5
6 \def\TypeBc{bc}
7 \def\TypeMgr{mgr}
8 \def\TypePhD{phd}
9 \def\TypeRig{rig}
10
11 \ifx\ThesisType\TypeBc
12 \def\ThesisTypeName{bachelor}
13 \def\ThesisTypeTitle{BACHELOR THESIS}
14 \fi
15
16 \ifx\ThesisType\TypeMgr
17 \def\ThesisTypeName{master}
18 \def\ThesisTypeTitle{MASTER THESIS}
19 \fi
20
21 \ifx\ThesisType\TypePhD
22 \def\ThesisTypeName{doctoral}
23 \def\ThesisTypeTitle{DOCTORAL THESIS}
24 \fi
25
26 \ifx\ThesisType\TypeRig
27 \def\ThesisTypeName{rigorosum}
28 \def\ThesisTypeTitle{RIGOROSUM THESIS}
29 \fi
30
31 \ifx\ThesisTypeName\undefined
32 \PackageError{thesis}{Unknown thesis type.}{Please check the definition of ThesisType in metadata.tex.}
33 \fi
34
35 %%% Switches based on study program language
36
37 \def\LangCS{cs}
38 \def\LangEN{en}
39
40 \ifx\StudyLanguage\LangCS
41 \else\ifx\StudyLanguage\LangEn
42 \else\PackageError{thesis}{Unknown study language.}{Please check the definition of StudyLanguage in metadata.tex.}
43 \fi\fi
44
45 %%% Minor tweaks of style
46
47 % These macros employ a little dirty trick to convince LaTeX to typeset
48 % chapter headings sanely, without lots of empty space above them.
49 % Feel free to ignore.
50 \makeatletter
51 \def\@makechapterhead#1{
52   {\parindent \z@ \raggedright \normalfont
53    \Huge\bfseries \thechapter. #1
54    \par\nobreak
55    \vskip 20\p@
56 }}
57 \def\@makeschapterhead#1{
58   {\parindent \z@ \raggedright \normalfont
59    \Huge\bfseries #1
60    \par\nobreak
61    \vskip 20\p@
62 }}
63 \makeatother
64
65 % This macro defines a chapter, which is not numbered, but is included
66 % in the table of contents.
67 \def\chapwithtoc#1{
68 \chapter*{#1}
69 \addcontentsline{toc}{chapter}{#1}
70 }
71
72 % Draw black "slugs" whenever a line overflows, so that we can spot it easily.
73 \overfullrule=1mm
74
75 %%% Macros for definitions, theorems, claims, examples, ... (requires amsthm package)
76
77 \theoremstyle{plain}
78 \newtheorem{thm}{Theorem}
79 \newtheorem{lemma}[thm]{Lemma}
80 \newtheorem{claim}[thm]{Claim}
81
82 \theoremstyle{plain}
83 \newtheorem{defn}{Definition}
84
85 \theoremstyle{remark}
86 \newtheorem*{cor}{Corollary}
87 \newtheorem*{rem}{Remark}
88 \newtheorem*{example}{Example}
89
90 %%% An environment for proofs
91
92 \newenvironment{myproof}{
93   \par\medskip\noindent
94   \textit{Proof}.
95 }{
96 \newline
97 \rightline{$\qedsymbol$}
98 }
99
100 %%% An environment for typesetting of program code and input/output
101 %%% of programs. (Requires the fancyvrb package -- fancy verbatim.)
102
103 \DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small, frame=single}
104
105 %%% The field of all real and natural numbers
106 \newcommand{\R}{\mathbb{R}}
107 \newcommand{\N}{\mathbb{N}}
108
109 %%% Useful operators for statistics and probability
110 \DeclareMathOperator{\pr}{\textsf{P}}
111 \DeclareMathOperator{\E}{\textsf{E}\,}
112 \DeclareMathOperator{\var}{\textrm{var}}
113 \DeclareMathOperator{\sd}{\textrm{sd}}
114
115 %%% Transposition of a vector/matrix
116 \newcommand{\T}[1]{#1^\top}
117
118 %%% Various math goodies
119 \newcommand{\goto}{\rightarrow}
120 \newcommand{\gotop}{\stackrel{P}{\longrightarrow}}
121 \newcommand{\maon}[1]{o(n^{#1})}
122 \newcommand{\abs}[1]{\left|{#1}\right|}
123 \newcommand{\dint}{\int_0^\tau\!\!\int_0^\tau}
124 \newcommand{\isqr}[1]{\frac{1}{\sqrt{#1}}}
125
126 %%% Various table goodies
127 \newcommand{\pulrad}[1]{\raisebox{1.5ex}[0pt]{#1}}
128 \newcommand{\mc}[1]{\multicolumn{1}{c}{#1}}
129
130 %%% TODO items: remove before submitting :)
131 \newcommand{\xxx}[1]{\textcolor{red!}{#1}}