summaryrefslogtreecommitdiff
path: root/content/latexHeaders
diff options
context:
space:
mode:
Diffstat (limited to 'content/latexHeaders')
-rw-r--r--content/latexHeaders/code.sty141
-rw-r--r--content/latexHeaders/commands.sty56
-rw-r--r--content/latexHeaders/layout.sty82
-rw-r--r--content/latexHeaders/math.sty98
4 files changed, 377 insertions, 0 deletions
diff --git a/content/latexHeaders/code.sty b/content/latexHeaders/code.sty
new file mode 100644
index 0000000..3ebdda3
--- /dev/null
+++ b/content/latexHeaders/code.sty
@@ -0,0 +1,141 @@
+% Colors, used for syntax highlighting.
+% To print this document, set all colors to black!
+\usepackage{xcolor}
+\definecolor{safeRed}{HTML}{D7191C}
+\definecolor{safeOrange}{HTML}{FFDE71}
+\definecolor{safeYellow}{HTML}{FFFFBF}
+\definecolor{safeGreen}{HTML}{99CF8F}
+\definecolor{safeBlue}{HTML}{2B83BA}
+
+%try printer friendly colors?
+%\colorlet{keyword}{safeBlue}
+%\colorlet{string}{safeRed}
+%\colorlet{comment}{safeGreen}
+%\colorlet{identifier}{black}
+\definecolor{type}{HTML}{2750A0}
+\definecolor{string}{HTML}{7B3294}
+\definecolor{comment}{HTML}{1A9641}
+\definecolor{identifier}{HTML}{000000}
+\definecolor{keyword}{HTML}{900000}
+
+% Source code listings.
+\usepackage[scaled=0.80]{beramono}
+
+\usepackage{listings}
+\lstset{
+ language={[11]C++},
+ numbers=left,
+ stepnumber=1,
+ numbersep=6pt,
+ numberstyle=\small,
+ breaklines=true,
+ breakautoindent=true,
+ breakatwhitespace=false,
+ numberblanklines=true,
+ postbreak=\space,
+ tabsize=2,
+ upquote=true,
+ basicstyle=\ttfamily\normalsize,
+ showspaces=false,
+ showstringspaces=false,
+ extendedchars=true,
+ keywordstyle=\color{keyword}\bfseries,
+ stringstyle=\color{string}\bfseries,
+ commentstyle=\color{comment}\bfseries\itshape,
+ identifierstyle=\color{identifier},
+ directivestyle=\color{keyword}\bfseries,
+ emph={auto, int, long, long long, float, double, long double, char, bool, void, ll, ld, pt, lll, __int128, __float128, true, false, this, nullptr, INF, inf, EPS, eps},
+ emphstyle=\color{type}\bfseries,
+ frame=trbl,
+ aboveskip=3pt,
+ belowskip=3pt,
+ deletestring=[b]{'},%fix digit separator but break char highlighting (fixed again with literate)
+ escapechar=@
+ %moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}
+}
+
+\newcommand{\formatChar}[1]{{\color{string}\bfseries\textquotesingle{}#1\textquotesingle{}}}
+
+% Listings doesn't support UTF8. This is just enough for German umlauts. and commonly used chars
+\lstset{literate=%
+ {'a'}{{\formatChar{a}}}3
+ {'z'}{{\formatChar{z}}}3
+ {'A'}{{\formatChar{A}}}3
+ {'Z'}{{\formatChar{Z}}}3
+ {'0'}{{\formatChar{0}}}3
+ {'1'}{{\formatChar{1}}}3
+ {'\$'}{{\formatChar{\$}}}3
+ {'\#'}{{\formatChar{\#}}}3
+ {Ö}{{\"O}}1
+ {Ä}{{\"A}}1
+ {Ü}{{\"U}}1
+ {ß}{{\ss}}1
+ {ü}{{\"u}}1
+ {ä}{{\"a}}1
+ {ö}{{\"o}}1
+ {~}{{\textasciitilde}}1
+}
+
+\makeatletter
+\let\orig@lstnumber=\thelstnumber
+\newcommand\lstresetnumber{\global\let\thelstnumber=\orig@lstnumber}
+\let\orig@placelstnumber=\lst@PlaceNumber
+\gdef\lst@PlaceNumber{\orig@placelstnumber\lstresetnumber}
+\newcommand\lstsettmpnumber[1]{\gdef\thelstnumber{#1}}
+
+\lst@AddToHook{OnEmptyLine}{%
+ \ifnum\value{lstnumber}>99
+ \lstsettmpnumber{\_\_\_}
+ \else\ifnum\value{lstnumber}>9
+ \lstsettmpnumber{\_\_}
+ \else
+ \lstsettmpnumber{\_}
+ \fi\fi
+% \lstsettmpnumber{\_\_\kern-6pt}%
+ \vspace{-1.75ex}%
+ \addtocounter{lstnumber}{-1}%
+}
+% old: (change numberblanklines=false!)
+%\lst@AddToHook{OnEmptyLine}{%
+% \vspace{\dimexpr\baselineskip+0.5em}%
+% \addtocounter{lstnumber}{-1}%
+%}
+
+\newenvironment{btHighlight}[1][]
+{\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
+{\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup}
+
+\newcommand\btHL[1][]{%
+ \begin{btHighlight}[#1]\bgroup\aftergroup\bt@HL@endenv%
+ }
+ \def\bt@HL@endenv{%
+ \end{btHighlight}%
+ \egroup%
+}
+\newcommand{\bt@HL@box}[2][]{%
+ \tikz[#1]{%
+ \pgfpathrectangle{\pgfpoint{1pt}{0pt}}{\pgfpoint{\wd #2}{\ht #2}}%
+ \pgfusepath{use as bounding box}%
+ \node[anchor=base west, fill=orange!30,outer sep=0pt,inner xsep=2.2pt, inner ysep=0pt, rounded corners=3pt, minimum height=\ht\strutbox+1pt,#1]{\raisebox{1pt}{\strut}\strut\usebox{#2}};
+ }%
+}
+
+\newcommand{\hl}[1]{\btHL[fill=safeOrange,draw=black,thin]{#1}}
+
+\ifthenelse{\isundefined{\gitorigin}}{}{
+ \usepackage{ocgx2}
+ \usepackage{fontawesome}
+ \lst@AddToHook{Init}{%
+ \ifthenelse{\equal{\lst@name}{}}{}{%
+ \begin{minipage}[t][0pt]{\linewidth}%
+ \vspace{0pt}%
+ \hfill%
+ \begin{ocg}[printocg=never]{Source links}{srclinks}{1}%
+ \hfill\href{\gitorigin\lst@name}{\faExternalLink}%
+ \end{ocg}%
+ \end{minipage}%
+ }%
+ }
+}
+\makeatother
+
diff --git a/content/latexHeaders/commands.sty b/content/latexHeaders/commands.sty
new file mode 100644
index 0000000..edbba1b
--- /dev/null
+++ b/content/latexHeaders/commands.sty
@@ -0,0 +1,56 @@
+% custom commands
+\newcommand{\optional}[1]{
+ \ifoptional
+ #1
+ \fi}
+\newcommand{\runtime}[1]{\ensuremath{\mathcal{O}\left(#1\right)}}
+\newcommand{\code}[1]{\lstinline[breaklines=true]{#1}}
+\let\codeSafe\lstinline
+
+\usepackage{tikz}
+\usetikzlibrary{angles,quotes}
+
+
+%new environment to define algorithms
+\usepackage{ifthen}
+\NewDocumentEnvironment{algorithm}{ O{required} m +b }{}{
+ \ifthenelse{\equal{#1}{optional}}{%
+ \optional{
+ \needspace{4\baselineskip}%
+ \subsection{#2\textcolor{gray}{(optional)}}%
+ #3%
+ }
+ }{%
+ \needspace{4\baselineskip}%
+ \subsection{#2}%
+ #3%
+ }
+}
+
+%\ifthenelse{\equal{#3}{}}{}{\runtime{#3}}
+
+\newcommand{\sourcecode}[1]{%
+ \label{code:#1}%
+ \nobreak%
+% \needspace{3\baselineskip}%
+% \nopagebreak%
+ \lstinputlisting{#1}%
+ \penalty -1000%
+}
+\newcommand{\sourceref}[1]{{%
+ \color{comment}\bfseries\itshape{}Seite \pageref{code:#1}%
+}}
+
+\newcommand{\method}[4][]{\texttt{#2}~~#3~~\runtime{#4}#1\par}
+
+\newenvironment{methods}[1][lll]{%
+ %\begin{minipage}{\linewidth}%
+ \renewcommand{\method}[4][]{\texttt{##2}&##3&\ifthenelse{\equal{##4}{}}{}{\runtime{##4}}##1\\}%
+ \begin{tabular}{@{}#1@{}}%
+}{%
+ \end{tabular}%
+ %\end{minipage}%
+ \nobreak%
+ \needspace{3\baselineskip}%
+ \nobreak%
+}
diff --git a/content/latexHeaders/layout.sty b/content/latexHeaders/layout.sty
new file mode 100644
index 0000000..096cf23
--- /dev/null
+++ b/content/latexHeaders/layout.sty
@@ -0,0 +1,82 @@
+% Don't waste space at the page borders. Use two column layout.
+\usepackage[
+ top=2cm,
+ bottom=1cm,
+ left=1cm,
+ right=1cm,
+ landscape
+]{geometry}
+
+% Headline and bottomline.
+\usepackage{scrlayer-scrpage}
+\pagestyle{scrheadings}
+\clearscrheadfoot
+\ihead{\university}
+\chead{\teamname}
+\ohead{\pagemark}
+
+% Shift the title up to waste less space.
+\usepackage{titling}
+\setlength{\droptitle}{-8em}
+
+% Multicol layout for the table of contents.
+\usepackage{multicol}
+\usepackage{multirow}
+\usepackage{array}
+
+% Automatically have table fill horizontal space.
+\usepackage{makecell}
+\usepackage{tabularx}
+\newcolumntype{C}{>{\centering\arraybackslash}X}
+\newcolumntype{L}{>{\raggedright\arraybackslash}X}
+\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
+\newcolumntype{I}{!{\color{lightgray}\vrule}}
+\usepackage{colortbl}
+\newcommand{\grayhline}{\arrayrulecolor{lightgray}\hline
+ \arrayrulecolor{black}}
+
+% Nice table line.
+\usepackage{booktabs}
+
+% Dingbats symbols.
+\usepackage{pifont}
+
+% use less space...
+%\usepackage[subtle, sections, indent, leading, charwidths]{savetrees}
+\usepackage[moderate,sections]{savetrees}
+\RedeclareSectionCommands[
+ beforeskip=1pt plus 5pt,
+ afterskip=0.1pt plus 1.5pt
+]{section,subsection,subsubsection}
+\RedeclareSectionCommands[
+ beforeskip=1pt plus 5pt,
+ afterskip=-1.2ex
+]{paragraph}
+
+% dont indent paragagraphs
+\setlength{\parindent}{0em}
+\parskip=0pt
+
+% dont encourage breaks before lists
+\@beginparpenalty=10000
+
+% Nice enumerations without wasting space above and below.
+\usepackage{relsize}
+\usepackage{enumitem}
+\setlist{nosep,leftmargin=2ex,labelwidth=1ex,labelsep=1ex}
+\setlist[2]{leftmargin=3ex,label=\smaller[2]\ding{228}}
+\setlist[3]{leftmargin=3ex,label=\larger\textbf{--}}
+\setlist[description]{leftmargin=0pt}
+
+% decrease space for tables
+\tabcolsep=2pt
+\setlength\extrarowheight{0.3pt plus 1pt}
+
+\newenvironment{expandtable}{%
+ \begin{addmargin}{-3.4pt}
+}{%
+ \end{addmargin}
+}
+
+\usepackage{needspace}
+\usepackage{setspace}
diff --git a/content/latexHeaders/math.sty b/content/latexHeaders/math.sty
new file mode 100644
index 0000000..c34cc99
--- /dev/null
+++ b/content/latexHeaders/math.sty
@@ -0,0 +1,98 @@
+% For Headlines with math
+\usepackage{bm}
+
+% Display math.
+\usepackage{amsmath}
+\usepackage{mathtools}
+\usepackage{amssymb}
+\usepackage{ntheorem}
+
+%\usepackage{pxfonts}
+\usepackage[scaled=0.945,largesc,looser]{newpxtext}%better than pxfonts...
+\usepackage[scaled=0.945,bigdelims]{newpxmath}
+\let\mathbb\vmathbb
+
+\DeclareFontFamily{LMX}{npxexx}{}
+\DeclareFontShape{LMX}{npxexx}{m}{n}{<-> s * [1.045] zplexx}{}
+\DeclareFontShape{LMX}{npxexx}{b}{n}{<-> s * [1.045] zplbexx}{}
+%\DeclareFontShape{LMX}{npxexx}{m}{n}{<-> s * [0.78] zplexx}{}
+%\DeclareFontShape{LMX}{npxexx}{b}{n}{<-> s * [0.78] zplbexx}{}
+\DeclareFontShape{LMX}{npxexx}{bx}{n}{<->ssub * npxexx/b/n}{}
+
+%\usepackage[scaled=0.91]{XCharter}
+%\usepackage[scaled=0.89,type1]{cabin}% sans serif
+%\usepackage[charter,varbb,scaled=1.00,noxchvw]{newtxmath}
+
+%\usepackage{libertine}
+%\usepackage[libertine]{newtxmath}
+
+% New enviroment for remarks.
+\theoremstyle{break}
+\newtheorem{bem}{Bemerkung}
+
+% New commands for math operators.
+% Binomial coefficients.
+\renewcommand{\binom}[2]{
+ \Bigl(
+ \begin{matrix}
+ #1 \\
+ #2
+ \end{matrix}
+ \Bigr)
+}
+% Euler numbers, first kind.
+\newcommand{\eulerI}[2]{
+ \Bigl\langle
+ \begin{matrix}
+ #1 \\
+ #2
+ \end{matrix}
+ \Bigr\rangle
+}
+% Euler numbers, second kind.
+\newcommand{\eulerII}[2]{
+ \Bigl\langle\mkern-4mu\Bigl\langle
+ \begin{matrix}
+ #1 \\
+ #2
+ \end{matrix}
+ \Bigr\rangle\mkern-4mu\Bigr\rangle
+}
+% Stirling numbers, first kind.
+\newcommand{\stirlingI}[2]{
+ \Bigl[
+ \begin{matrix}
+ #1 \\
+ #2
+ \end{matrix}
+ \Bigr]
+}
+% Stirling numbers, second kind.
+\newcommand{\stirlingII}[2]{
+ \Bigl\{
+ \begin{matrix}
+ #1 \\
+ #2
+ \end{matrix}
+ \Bigr\}
+}
+% Legendre symbol.
+\newcommand{\legendre}[2]{
+ \Bigl(
+ \dfrac{#1}{#2}
+ \Bigr)
+}
+% Expectation values.
+\newcommand{\E}{\text{E}}
+% Greates common divisor.
+\newcommand{\ggT}{\text{ggT}}
+% sign for negative values
+\newcommand{\sign}{\scalebox{0.66}[1.0]{\( - \)}}
+% absolute values
+\newcommand{\abs}[1]{\left|#1\right|}
+% ceiling function
+\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
+% floor function
+\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
+% multiplication
+\renewcommand{\*}{\ensuremath{\cdotp}}