-
Notifications
You must be signed in to change notification settings - Fork 0
/
osm-thesis.sty
158 lines (139 loc) · 8.76 KB
/
osm-thesis.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
\ProvidesPackage{osm-thesis}
% language options
\DeclareOption{ngerman}{
\PassOptionsToPackage{english,ngerman}{babel}
\PassOptionsToPackage{ngerman,onelanguage}{algorithm2e}
\AtBeginDocument{\selectlanguage{ngerman}}
}
\DeclareOption{english}{
\PassOptionsToPackage{ngerman,english}{babel}
\PassOptionsToPackage{english}{algorithm2e}
\AtBeginDocument{\selectlanguage{english}}
}
\DeclareOption{bibtex}{\PassOptionsToPackage{backend=bibtex}{biblatex}}
\DeclareOption{biber}{\PassOptionsToPackage{backend=biber}{biblatex}}
\ProcessOptions\relax
\RequirePackage[l2tabu,orthodox]{nag} % Detecting and warning about obsolete LaTeX commands
\RequirePackage[T1]{fontenc} % Standard package for selecting font encodings
\RequirePackage{textcomp} % LaTeX support for the Text Companion fonts
\RequirePackage[utf8]{inputenc} % Accept different input encodings
\RequirePackage[dvipsnames,usenames]{xcolor} % Driver-independent color extensions for LaTeX and pdfLaTeX
\RequirePackage[bibencoding=utf8]{biblatex} % Sophisticated Bibliographies in LaTeX
\RequirePackage{amsmath} % AMS mathematical facilities for LaTeX
\RequirePackage{array} % Extending the array and tabular environments
\RequirePackage{chngcntr} % Change the resetting of counters
\RequirePackage[automark]{scrlayer-scrpage} % Define and manage page styles
\RequirePackage{hyperref} % Extensive support for hypertext in LaTeX
% \RequirePackage{refcheck} % Check references (in figures, table, equations, etc)
\RequirePackage{babel} % Multilingual support for Plain TeX or LaTeX
\RequirePackage{csquotes} % Context sensitive quotation facilities
\RequirePackage{colortbl} % Add colour to LaTeX tables
\RequirePackage{etoolbox} % e-TeX tools for LaTeX
\RequirePackage{enumitem} % Control layout of itemize, enumerate, description
\RequirePackage{float} % Improved interface for floating objects
\RequirePackage{footnote} % Improve on LaTeX's footnote handling
\RequirePackage{fnpct}\setfnpct{after-punct-space={-.2em}} % Manage footnote marks’ interaction with punctuation
\RequirePackage{graphicx} % Enhanced support for graphics
\RequirePackage{listings} % Typeset source code listings using LaTeX
\RequirePackage[algochapter]{algorithm2e} % Floating algorithm environment with algorithmic keywords
\RequirePackage{caption} % Customising captions in floating environments
\RequirePackage{makeidx} % Standard LaTeX package for creating indexes
\RequirePackage{multirow} % Create tabular cells spanning multiple rows
\RequirePackage{scrhack} % KOMA-Script File, contains improvement proposals for other packages
\RequirePackage[stretch=9,shrink=15,step=3,tracking=smallcaps,letterspace=75,final,babel=true]{microtype} % Subliminal refinements towards typographical perfection
\RequirePackage[osf,sc]{mathpazo} % Fonts to typeset mathematics to match Palatino
\RequirePackage[scale=.9,semibold]{sourcecodepro} % Use SourceCodePro with TeX(-alike) systems
\RequirePackage[osf]{sourcesanspro} % Use SourceSansPro with TeX(-alike) systems
\RequirePackage{textcase} % Case conversion ignoring mathematics, etc
\RequirePackage{tikz} % Create PostScript and PDF graphics in TeX
\RequirePackage{tocbasic} % Management of tables/lists of contents (and the like)
\RequirePackage{todonotes} % Marking things to do in a LaTeX document
%\RequirePackage{prelim2e} % Allows the marking of preliminary versions of a document
% mathpazo fix for luatex & xetex
\RequirePackage{ifxetex,ifluatex} % Am I running under XeTeX?, Provides the \ifluatex switch
\ifthenelse{\boolean{luatex} \or \boolean{xetex}} {\setmainfont{texgyrepagella}[ExternalLocation,Numbers={Proportional,OldStyle},UprightFont=*-regular,BoldFont=*-bold,ItalicFont=*-italic,BoldItalicFont=*-bolditalic]}
% determine document class
\@ifclassloaded{scrbook}{\newif\ifisbook\isbooktrue}{\newif\ifisbook\isbookfalse}
% document options
\newcommand\bcor{12mm} % <= Bindungskorrektur für Druckversion
\KOMAoptions{titlepage=firstiscover,open=right,headings=big,numbers=noenddot}
%\KOMAoptions{DIV=12,fontsize=11pt}
\KOMAoptions{DIV=10,fontsize=10pt}
\ifisbook %
\KOMAoptions{paper=A4,BCOR=\bcor} %
\pdfcatalog{/PageLayout/TwoColumnRight} %
\else %
\KOMAoptions{paper=210mm-\bcor:297mm}
\fi
\AtBeginDocument{\recalctypearea}
\linespread{1.1}
\setlist{itemsep=0pt}
\widowpenalty10000
\clubpenalty10000
\tolerance1000
\DisableLigatures{encoding=*,family=tt* }
\AtBeginDocument{\hypersetup{pdftitle={\hpititle},pdfsubject={\hpitype},pdfauthor={\hpiauthor},pdfcreator={osm-thesis}, bookmarksnumbered=true,breaklinks=true}}
\ifisbook\renewcommand{\raggedchapter}{\raggedleft}\fi
% title page
\addtokomafont{title}{\huge}
\addtokomafont{publishers}{\normalfont\normalsize}
% headings
\pagestyle{scrheadings}
\automark[chapter]{chapter}
\automark*[section]{}
% footnotes
\counterwithout*{footnote}{chapter}
\makesavenoteenv{tabular}\makesavenoteenv{table}
% list of contents
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
% names
\let\defaultlstlistingname\lstlistingname\renewcommand\lstlistingname{\iflanguage{ngerman}{Quelltext}{\defaultlstlistingname}}
% bibliography
\ExecuteBibliographyOptions{backref=false,backrefstyle=three+,url=true,urldate=comp,abbreviate=false,maxbibnames=20}
\DeclareBibliographyCategory{cited}
\let\defaultcite\cite\renewcommand*\cite[2][]{\addtocategory{cited}{#2}\defaultcite[#1]{#2}}
\let\defaulttextcite\textcite\renewcommand*\textcite[2][]{\addtocategory{cited}{#2}\defaulttextcite[#1]{#2}}
\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{8000}
\AfterPackage{biblatex}{
\PreventPackageFromLoading[\errmessage{You tried to load the cite package that is not compatible with biblatex.}]{cite}
}
% captions
\addtokomafont{caption}{\small}
\addtokomafont{captionlabel}{\bfseries\sffamily\small}
\setcapindent{\parindent}
% tables
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0cm}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0cm}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0cm}}m{#1}}
\captionsetup[table]{belowskip=.5\baselineskip,aboveskip=.5\baselineskip}
% listings
\lstset{basicstyle=\linespread{1}\ttfamily\small,floatplacement=htbp,captionpos=t,abovecaptionskip=.5\baselineskip,belowcaptionskip=.5\baselineskip,upquote=true,showstringspaces=false,inputencoding=utf8,tabsize=4}
\lstset{literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1 {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1 {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1 {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1 {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1 {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1 {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1 {€}{{\EUR}}1 {£}{{\pounds}}1 {~}{{\textasciitilde}}1 {-}{{-}}1 }
\makeatletter\renewcommand\verbatim@font{\ttfamily}\makeatother
\makeatletter\renewcommand\lstinline[1][]{ \errmessage{In diesem Template bitte die 'code'-Umgebung nutzen (an Stelle von 'lstinline').} }\makeatother
% \code-Umgebung mit Silbentrennung (Alternative für lstinline)
\newcommand{\code}[1]{\texttt{\selectlanguage{english}#1}}
% normalfont comment boxes (for listings)
\lstset{escapeinside={(*@}{@*)}}
\newcommand{\commentbox}[2][,] { %
\begin{tikzpicture}[overlay,auto,>=latex] %
\normalfont %
\node[anchor=south] (target) {}; %
\node[right=of target,align=left,anchor=west,#1] (box) { #2 }; %
\draw[thin] (box.south west) |- (box.north west); %
\draw[->,thin] (box.south west) |- (target.east); %
\end{tikzpicture} %
}
% theorems
\newtheorem{definition}{\iflanguage{ngerman}{Definition}{Definition}}
\newtheorem{hypothesis}{\iflanguage{ngerman}{Hypothese}{Hypothesis}}
% algorithms
\SetAlCapNameFnt{\usekomafont{caption}}
\SetAlCapFnt{\usekomafont{captionlabel}}
\makeatletter\renewcommand{\@algocf@capt@plain}{above}\makeatother
% part-page with text
\makeatletter\let\LaTeXStandardPart\part\newcommand{\unstarredpart@@noopt}[1]{\unstarredpart@@opt[#1]{#1}}\newcommand{\unstarredpart@@opt}[2][]{\cleardoublepage\begingroup\let\newpage\relax\LaTeXStandardPart[#1]{#2}\endgroup}\newcommand{\starredpart}[1]{\LaTeXStandardPart*{#1}}\newcommand{\unstarredpart}{\@ifnextchar[{\unstarredpart@@opt}{\unstarredpart@@noopt}}\renewcommand{\part}{\@ifstar{\starredpart}{\unstarredpart}}
% fix verbadd bug with TeXLive
\makeatletter\def\blx@maxline{77}\makeatother