summaryrefslogtreecommitdiff
path: root/latexHeaders
diff options
context:
space:
mode:
Diffstat (limited to 'latexHeaders')
-rw-r--r--latexHeaders/commands.sty49
-rw-r--r--latexHeaders/layout.sty81
-rw-r--r--latexHeaders/layout.tex43
-rw-r--r--latexHeaders/listings.sty106
-rw-r--r--latexHeaders/listings.tex84
-rw-r--r--latexHeaders/math.sty98
-rw-r--r--latexHeaders/math.tex70
7 files changed, 408 insertions, 123 deletions
diff --git a/latexHeaders/commands.sty b/latexHeaders/commands.sty
new file mode 100644
index 0000000..abe589d
--- /dev/null
+++ b/latexHeaders/commands.sty
@@ -0,0 +1,49 @@
+% custom commands
+\newcommand{\optional}[1]{
+ \ifoptional
+ #1
+ \fi}
+\newcommand{\runtime}[1]{\ensuremath{\mathcal{O}\left(#1\right)}}
+\newcommand{\code}[1]{\lstinline[breaklines=true]{#1}}
+
+\usepackage{tikz}
+
+
+%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]{%
+ \nobreak%
+% \needspace{3\baselineskip}%
+% \nopagebreak%
+ \lstinputlisting{#1}%
+ \penalty -1000%
+}
+\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%
+} \ No newline at end of file
diff --git a/latexHeaders/layout.sty b/latexHeaders/layout.sty
new file mode 100644
index 0000000..1c8dc00
--- /dev/null
+++ b/latexHeaders/layout.sty
@@ -0,0 +1,81 @@
+% 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}
diff --git a/latexHeaders/layout.tex b/latexHeaders/layout.tex
deleted file mode 100644
index 843798a..0000000
--- a/latexHeaders/layout.tex
+++ /dev/null
@@ -1,43 +0,0 @@
-% 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{scrpage2}
-\pagestyle{scrheadings}
-\clearscrheadfoot
-\ihead{\university}
-\chead{\teamname}
-\ohead{\pagemark}
-
-% Shift the title up to waste less space.
-\usepackage{titling}
-\setlength{\droptitle}{-9em}
-
-% Reduce spaces around sections and subsections.
-\usepackage{titlesec}
-\titlespacing*{\section}{0pt}{0pt}{0pt}
-\titlespacing*{\subsection}{0pt}{0pt}{0pt}
-
-% Nice enumerations without wasting space above and below.
-\usepackage{enumitem}
-\setlist{nosep}
-
-% Multicol layout for the table of contents.
-\usepackage{multicol}
-\usepackage{multirow}
-
-% Automatically have table fill horizontal space.
-\usepackage{tabularx}
-
-% Nice table line.
-\usepackage{booktabs}
-
-% Dingbats symbols.
-\usepackage{pifont}
diff --git a/latexHeaders/listings.sty b/latexHeaders/listings.sty
new file mode 100644
index 0000000..d1aa5f0
--- /dev/null
+++ b/latexHeaders/listings.sty
@@ -0,0 +1,106 @@
+% 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{keyword}{HTML}{2750A0}
+\definecolor{string}{HTML}{7B3294}
+\definecolor{comment}{HTML}{1A9641}
+\definecolor{identifier}{HTML}{000000}
+
+% Source code listings.
+\usepackage[scaled=0.80]{beramono}
+
+\usepackage{listings}
+\lstset{
+ language={C++},
+ numbers=left,
+ stepnumber=1,
+ numbersep=6pt,
+ numberstyle=\small,
+ breaklines=true,
+ breakautoindent=true,
+ breakatwhitespace=false,
+ numberblanklines=true,
+ postbreak=\space,
+ tabsize=2,
+ 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},
+ frame=trbl,
+ aboveskip=3pt,
+ belowskip=3pt,
+ escapechar=@
+ %moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}
+}
+
+% Listings doesn't support UTF8. This is just enough for German umlauts.
+\lstset{literate=%
+ {Ö}{{\"O}}1
+ {Ä}{{\"A}}1
+ {Ü}{{\"U}}1
+ {ß}{{\ss}}1
+ {ü}{{\"u}}1
+ {ä}{{\"a}}1
+ {ö}{{\"o}}1
+ {~}{{\textasciitilde}}1
+}
+
+\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}} \ No newline at end of file
diff --git a/latexHeaders/listings.tex b/latexHeaders/listings.tex
index 135b2af..caac6b1 100644
--- a/latexHeaders/listings.tex
+++ b/latexHeaders/listings.tex
@@ -1,34 +1,51 @@
% Colors, used for syntax highlighting.
% To print this document, set all colors to black!
\usepackage{xcolor}
-\definecolor{keyword}{rgb}{0, 0, 1}
-\definecolor{string}{rgb}{1, 0, 0}
-\definecolor{comment}{rgb}{0.2, 0.6, 0.2}
-\definecolor{identifier}{rgb}{0, 0, 0}
+\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{keyword}{HTML}{2750A0}
+\definecolor{string}{HTML}{7B3294}
+\definecolor{comment}{HTML}{1A9641}
+\definecolor{identifier}{HTML}{000000}
% Source code listings.
-\usepackage{pxfonts}
+\usepackage[scaled=0.80]{beramono}
+
\usepackage{listings}
\lstset{
language={C++},
numbers=left,
stepnumber=1,
numbersep=6pt,
- numberstyle=\footnotesize,
+ numberstyle=\small,
breaklines=true,
breakautoindent=true,
breakatwhitespace=false,
+ numberblanklines=true,
postbreak=\space,
tabsize=2,
- basicstyle=\ttfamily\small,
+ basicstyle=\ttfamily\normalsize,
showspaces=false,
showstringspaces=false,
extendedchars=true,
keywordstyle=\color{keyword}\bfseries,
stringstyle=\color{string}\bfseries,
- commentstyle=\color{comment}\bfseries,
- identifierstyle=\color{identifier},
- frame=trbl
+ commentstyle=\color{comment}\bfseries\itshape,
+ identifierstyle=\color{identifier},
+ frame=trbl,
+ aboveskip=3pt,
+ belowskip=3pt,
+ escapechar=@
+ %moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}
}
% Listings doesn't support UTF8. This is just enough for German umlauts.
@@ -42,3 +59,50 @@
{ö}{{\"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}};
+ }%
+}
+\makeatother
+
+\newcommand{\hl}[1]{\btHL[fill=safeOrange,draw=black,thin]{#1}} \ No newline at end of file
diff --git a/latexHeaders/math.sty b/latexHeaders/math.sty
new file mode 100644
index 0000000..c34cc99
--- /dev/null
+++ b/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}}
diff --git a/latexHeaders/math.tex b/latexHeaders/math.tex
deleted file mode 100644
index 9293898..0000000
--- a/latexHeaders/math.tex
+++ /dev/null
@@ -1,70 +0,0 @@
-% Display math.
-\usepackage{amsmath}
-\usepackage{mathtools}
-\usepackage{amssymb}
-\usepackage{ntheorem}
-
-% New enviroment for remarks.
-\theoremstyle{break}
-\newtheorem{bem}{Bemerkung}
-
-% New commands for math operators.
-% Binomial coefficients.
-\renewcommand{\binom}[2]{
- \biggl(
- \begin{matrix}
- #1 \\
- #2
- \end{matrix}
- \biggr)
-}
-% Euler numbers, first kind.
-\newcommand{\eulerI}[2]{
- \biggl\langle
- \begin{matrix}
- #1 \\
- #2
- \end{matrix}
- \biggr\rangle
-}
-% Euler numbers, second kind.
-\newcommand{\eulerII}[2]{
- \biggl\langle
- \negthinspace
- \biggl\langle
- \begin{matrix}
- #1 \\
- #2
- \end{matrix}
- \biggr\rangle
- \negthinspace
- \biggr\rangle
-}
-% Stirling numbers, first kind.
-\newcommand{\stirlingI}[2]{
- \biggl[
- \begin{matrix}
- #1 \\
- #2
- \end{matrix}
- \biggr]
-}
-% Stirling numbers, second kind.
-\newcommand{\stirlingII}[2]{
- \biggl\{
- \begin{matrix}
- #1 \\
- #2
- \end{matrix}
- \biggr\}
-}
-% Legendre symbol.
-\newcommand{\legendre}[2]{
- \biggl(
- \frac{#1}{#2}
- \biggr)
-}
-% Expectation values.
-\newcommand{\E}{\text{E}}
-% Greates common divisor.
-\newcommand{\ggT}{\text{ggT}}