%!TEX TS-program = pdflatexmk
%!TEX root = ../handbook.tex

% Copyright 2020 Martin Scheidt (Attribution 4.0 International, CC-BY 4.0)
% You are free to copy and redistribute the material in any medium or format. You are free to remix, transform, and build upon the material for any purpose, even commercially. You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. No warranties are given.

% --------[  Coding and Language  ]----------
\usepackage{scrhack}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[main=english,ngerman]{babel}
\usepackage{iflang}
\newcommand{\IfLanguage}[2]{\IfLanguageName{#1}{#2}{}}

% % --------[   revision history    ]----------
\usepackage{vhistory}
% % --------[ Creative Commons License ]-------
\usepackage[scale=1.5]{ccicons}

% --------[       drafting        ]----------
\usepackage{ifdraft}
\ifdraft{%
  \usepackage{draftwatermark}
  \SetWatermarkColor{base1!10}
}{}
%
\setlength{\marginparwidth }{2cm}
\usepackage[obeyDraft,textsize=footnotesize]{todonotes}

% --------[ Layout  ]-----------
\pretolerance=8000
\tolerance=9500
\hbadness=8000
\vbadness=10000
\displaywidowpenalty=10000
\clubpenalty=10000
\widowpenalty=10000
\usepackage{lmodern,microtype,mathptmx,courier}
\usepackage[scaled=0.92]{helvet}

\usepackage[
  automark,
  headsepline,
  draft=false
]{scrlayer-scrpage}

\pagestyle{scrheadings}

\usepackage{framed}

\usepackage{etoolbox}

% -------[ Symbols ]---------
\usepackage{amsmath,amsthm}
\usepackage{xfrac} % provides slanted fractures with \sfrac{}{}
\usepackage{wasysym} % \permil
\usepackage{siunitx} % for SI-Units
\sisetup{
  per-mode=fraction,
  fraction-function=\sfrac
}

% -------[ Tables and Figures ]---------
\usepackage{graphicx}
\setkeys{Gin}{draft=false} % disable draft for graphicx to see pictures in draft-mode

\usepackage{booktabs,longtable,tabularx,ltxtable}

\usepackage{enumerate}
\usepackage{enumitem} % change numbering
\usepackage{tikz,adjustbox}
\usetikzlibrary{babel}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{patterns}

% -------[ costum commands ]---------
\newcommand{\TODO}[1]{\todo[linecolor=orange,backgroundcolor=orange!20,bordercolor=orange,inline,]{\textcolor{orange}{Todo:~}#1}}
\newcommand{\REWRITE}[1]{\todo[linecolor=magenta,backgroundcolor=magenta!20,bordercolor=magenta,noline]{\textcolor{magenta}{Rewrite:~}#1}}
\newcommand{\ADDFIGURE}[1]{\missingfigure[figcolor=white]{#1}}

\newcounter{task}[chapter] % reset couter <<task>> with each new chapter
\DeclareRobustCommand{\task}{\stepcounter{task}\bigskip\par\noindent{\normalfont\large\bfseries\IfLanguage{english}{Task~}\IfLanguage{ngerman}{Aufgabe~}\arabic{chapter}.\arabic{task}}\medskip\par\noindent}
\DeclareRobustCommand{\setup}{\bigskip\par\noindent{\normalfont\large\bfseries\IfLanguage{english}{Setup}\IfLanguage{ngerman}{Ausgangssituation}}\medskip\par\noindent}
\DeclareRobustCommand{\roles}{\bigskip\par\noindent{\normalfont\large\bfseries\IfLanguage{english}{Roles}\IfLanguage{ngerman}{Rollen}}\medskip\par\noindent}
\DeclareRobustCommand{\material}{\bigskip\par\noindent{\normalfont\large\bfseries\IfLanguage{english}{Material}\IfLanguage{ngerman}{Material}}\medskip\par\noindent}
\DeclareRobustCommand{\phase}[1]{\noindent{\normalfont\itshape\IfLanguage{english}{Phase #1:}\IfLanguage{ngerman}{Phase #1:~}}}

\DeclareRobustCommand{\tikzfigure}[2][0.995\textwidth]{
  \begin{adjustbox}{width=#1}
    \begin{tikzpicture}[font=\sffamily]
      \input{\ROOT/figures/#2}
    \end{tikzpicture}
  \end{adjustbox}
}

% -----------[ PDF linking ]----------------
\usepackage[
  pdftex,
  pdfpagelabels, % modify PDF page labels
  hyperindex,
  hyperfigures,
  bookmarksopen,
  bookmarksnumbered,
  draft=false,
  pageanchor=true, % Determines whether every page is given an implicit anchor at the top left corner
  %pagebackref, % Adds backlink text to the end of each item in the bibliography, as a list of page numbers
  %linktocpage, % make page number, not text, be link on TOC, LOF and LOT
  breaklinks=true, % allow links to break over lines by making links over multiple lines into PDF links to the same target
  colorlinks=true, % Colors the text of links and anchors
  citecolor=violet, % Color for bibliographical citations in text
  linkcolor=base01, % Color for normal internal links
  urlcolor=blue, % Color for web links
]{hyperref} % PDF with a linked TableOfContent
\usepackage{bookmark} % Adding package bookmark improves bookmarks handling.
\usepackage{url}

\usepackage[prefix=]{xcolor-solarized}
\definecolor{signalgreen}{RGB}{0,181,26}
\definecolor{signalyellow}{RGB}{255,230,0}
\definecolor{signalred}{RGB}{255,0,0}
