% -*- coding: utf-8; -*-
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% (C)opyright A. Hilbig, mail@andrehilbig.de                                                       |
%             http://www.andrehilbig.de/Publications                                               |
%                                                                                                  | 
% diese Datei: ahilbig-comics.sty                                                                  |
%                                                                                                  |
% Das Dokument steht unter der Lizenz: Creative Commons by-nc-sa Version 4.0                       |
% http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de                                         |
%                                                                                                  |
% Nach dieser Lizenz darf das Dokument beliebig kopiert und bearbeitet werden,                     |
% sofern das Folgeprodukt wiederum unter gleichen Lizenzbedingungen vertrieben                     |
% und auf die ursprünglichen Urheber verwiesen wird.                                               |
% Eine kommerzielle Nutzung ist ausdrücklich ausgeschlossen.                                       |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% HINWEISE/ERWEITERUNG                                                                             |
% Diese Pakete basieren auf den entsprechenden Paketen von Prof. Dr. Ludger Humbert                |
% (http://ddi.uni-wuppertal.de/ -- humbert@uni-wuppertal.de) und wurden zum Teil angepasst. Seine  |
% Pakete basieren wiederum auf Entwicklungen von Prof. Dr. Till Tantau                             |
% (http://www.tcs.uni-luebeck.de/de/mitarbeiter/tantau/). Beiden gilt mein Dank hierfür.           |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |

\ProvidesPackage{ahilbig-comics}

\@ifclassloaded{beamer}{}{\RequirePackage{beamerarticle}}

\RequirePackage{emerald}
\RequirePackage{tikz}

\usetikzlibrary{calc,matrix}

\pgfkeys{/comics/.cd,
  professor says/.code=\ddiprofessorsays{#1},
  professor thinks/.code=\ddiprofessorthinks{#1},
  student says/.code=\ddistudentsays{#1},
  student thinks/.code=\ddistudentthinks{#1},
  bingo/.code={\alt<article>{\ddibingo#1}{\def\ddibingonow{\ddibingo#1}}},
  done/.code=\ddicomicdone,
}

\def\ddicomicpicture[#1]{
  \begin{tikzpicture}[baseline={([yshift=1.2cm]people)},inner sep=0pt,outer sep=0pt]
    \coordinate (last) at (0,0);
    \coordinate (last professor) at (0,0);
    \coordinate (last student) at (0,0);
    \ddicomicspokendonefalse
    \def\ddibingonow{}
    \pgfkeys{/comics/.cd,#1,done}
  \end{tikzpicture}
}

\mode
<article>

\def\ddicomic[#1]{
  {%
    \setlength{\marginparsep}{.65cm}%
    \setlength{\marginparwidth}{4.1cm}%
    \marginpar{%
      \ddicomicpicture[#1]
    }%
  }\refstepcounter{framenumber}%
  \ignorespaces%
}

\mode
<presentation>

\def\ddicomic[#1]{
  \begin{frame}
    \begin{center}
      \ddicomicpicture[#1]
    \end{center}
  \end{frame}
}

\mode
<all>

\newif\ifddicomicspokendone
\newif\ifddicomicspokenprofessor
\newif\ifddicomicspokenstudent
\newif\ifddicomicthoughtprofessor
\newif\ifddicomicthoughtstudent

\def\ddicomicdone{
  \ifddicomicspokendone\else\ddicomicpeople\fi

  \ifddicomicthoughtprofessor
    \draw[overlay,black!50]
    {
      [shift=(people),xshift=.3cm,yshift=.5cm]
      \foreach \angle/\radius in {0/1,20/1.2,40/1.4,60/1.6,80/1.7}
      { (90+\angle:.5cm) circle[radius=\radius*1pt] }
      let \p1 = ($ (people) - (professor thinks) + (0,10pt) $)
      in \foreach \pos in {3,8,...,\y1} { (-.5cm,-\pos pt) circle
        [radius=1.7pt] \pgfextra{\global\let\lastpos\pos} }
      (-.5cm+3pt,-\lastpos pt-4pt) circle [radius=1.7pt]
    };
    \fi

  \ifddicomicthoughtstudent
    \draw[overlay,black!50]
    {
      [shift=(people),xshift=3.9cm,yshift=.6cm]
      \foreach \angle/\radius in {10/1.2,40/1.4,80/1.7}
      { (90-\angle:.3cm) circle[radius=\radius*1pt] }
      let \p1 = ($ (people) - (student thinks) + (0,10pt) $)
      in \foreach \pos in {3,8,...,\y1} { (.3cm,-\pos pt) circle
        [radius=1.7pt] \pgfextra{\global\let\lastpos\pos} }
      (.3cm-3pt,-\lastpos pt-4pt) circle [radius=1.7pt]
    };
    \fi
}


\def\ddibingo#1#2#3#4#5#6#7#8#9{%
  \alt<presentation>{\tikzset{where/.style={matrix anchor=south east,at={(-20pt,10pt)}}}}{\tikzset{where/.style={matrix anchor=north west,at=(last)}}}
  \matrix [where,anchor=center] (last bingo) 
  [text width=1.1cm,align=center,matrix of nodes, inner sep=2pt,
  nodes={fill=black!10, anchor=center, minimum height=1.2cm, minimum width=1.2cm}, column sep=1mm, row sep=1mm, 
  execute at begin
    cell=\ECFAugie\fontsize{6}{7}\selectfont\hskip0pt,ampersand replacement=\&] 
    {#1\par\&#2\par\&#3\par\\#4\par\&#5\par\&#6\par\\#7\par\&#8\par\&#9\par\\};
  \node [above] at ([yshift=1em]last bingo.north)
  {\ECFAugie\fontsize{8}{9}\selectfont Bingo gegen Langeweile};
  \coordinate (last) at ([yshift=-2em]last bingo.south west);
}

\newbox\testbox
\long\def\ddiprofessorsays#1{%
  \node [below right] (last professor) at (last)
    [text width=3.5cm,align=left] 
    {\ECFAugie \fontsize{8}{9}\selectfont\ignorespaces#1\par};
  \coordinate (last) at ([yshift=-1em]last professor.south west);
  \ddicomicspokenprofessortrue
}

\newif\ifddicomicwide

\def\dditestwide#1{
  \pgfinterruptpicture%
    \setbox\testbox=\hbox{\ECFAugie \fontsize{8}{9}\selectfont #1}%
    \ifdim\wd\testbox>3.5cm%
    \global\ddicomicwidetrue%
    \else%
    \global\ddicomicwidefalse%
    \fi%
  \endpgfinterruptpicture%
}

\long\def\ddistudentsays#1{%
  \dditestwide{#1}
  \node [below right] (last student) at (last)
    [text width=3.5cm,xshift=5mm,align/.expanded=\ifddicomicwide
    left\else flush right\fi] 
    {\ECFAugie \fontsize{8}{9}\selectfont\ignorespaces#1\par};
  \coordinate (last) at ([xshift=-5mm,yshift=-1em]last student.south west);
  \ddicomicspokenstudenttrue
}


\long\def\ddiprofessorthinks#1{%
  \ifddicomicspokendone\else\ddicomicpeople\fi
  \node [below right] (x) at (last)
    [text width=3.5cm,align=left,text=black!50] 
    {\ECFAugie \fontsize{8}{9}\selectfont\ignorespaces#1\par};
  \coordinate (last) at ([yshift=-1em]x.south west);
  \ifddicomicthoughtprofessor
  \else  
    \ddicomicthoughtprofessortrue
    \coordinate (professor thinks) at (x.north west);
  \fi
}

\long\def\ddistudentthinks#1{%
  \dditestwide{#1}
  \ifddicomicspokendone\else\ddicomicpeople\fi
  \node [below right] (x) at (last)
    [xshift=5mm,text width=3.5cm,align/.expanded=\ifddicomicwide
    left\else flush right\fi,text=black!50] 
    {\ECFAugie \fontsize{8}{9}\selectfont\ignorespaces#1\par};
  \coordinate (last) at ([xshift=-5mm,yshift=-1em]x.south west);
  \ifddicomicthoughtstudent
  \else  
    \ddicomicthoughtstudenttrue
    \coordinate (student thinks) at (x.north east);
  \fi
}

\def\ddicomicpeople{%
  \ddicomicspokendonetrue
  
  \begin{scope}[shift=(last),yshift=-1.6cm]

    % Professor
    \begin{scope}[shift={(0.5,1)}]
      \node (head) [minimum size=6pt, draw, inner sep=0pt, circle] {};
    
      \draw (head.south) -- ++(0,-7pt) coordinate (groin);
      
      \draw (groin) -- ++(-70:8pt) (groin) -- ++(-110:8pt);
      
      \draw ([yshift=-2pt]head.south) coordinate (shoulders) -- ++(10:5pt) (shoulders) -- ++(-30:5pt);
    \end{scope}
  
  \foreach \j in {3,2,1}{
  \begin{scope}[xshift=1cm,shift=(20:\j*0.6)]
    
    \foreach \i in {1,...,5}
    {
      \begin{scope}[shift={(0.2,1.3)},shift=(-45:\i*.25)]
        \node (head) [minimum size=5pt, draw, inner sep=0pt, fill=white,circle] {};
        \pgfmathsetmacro{\dir}{0.5}
        \draw (head.south) -- ++(70+\dir*20:-8pt) coordinate [near start] (shoulders\i);
      \end{scope}
    } 

    \draw [line join=round] (0,1) -- (1,0) -- (1,-0.3) -- (0,0.7) -- (0,1);
    \filldraw [fill=white,line join=round] (0,1) -- (0.2,1) -- (1.2,0) -- (1,0) -- cycle;
      
    \foreach \i in {1,...,5}
    {
      \draw (shoulders\i) -- ++(-180+0.5*20:5pt) (shoulders\i) -- ++(-150+0.5*20:5pt);
    }
  \end{scope}
  }

  \ifddicomicspokenprofessor
    \draw[overlay] (.6,1.1) to [out=100,in=-86] (-0.2,1.7)
    to [out=94,in=-94] ([xshift=-2mm]last professor.south west)
    to [out=86,in=-135] ([yshift=2mm,xshift=-1mm]last professor.south west);
  \fi
  
  \ifddicomicspokenstudent
    \draw[overlay] (3.75,1.15) to [out=100,in=-94] (4.2,1.9)
    to [out=86,in=-86] ([xshift=2mm]last student.south east)
    to [out=94,in=-45] ([yshift=2mm,xshift=1mm]last student.south east);
  \fi

  \coordinate (last) at (0,-.3);
  \coordinate (people) at (0,0);

  \only<presentation>{\ddibingonow}
  \end{scope}
  
}


\def\defddicomic#1[#2]{
  \expandafter\def\csname ddi@comic@#1\endcsname{#2}
}

\def\useddicomic#1{%
  \expandafter\let\expandafter\dditemp\csname ddi@comic@#1\endcsname
  \expandafter\ddicomic\expandafter[\dditemp]}

\endinput

ahilbig-common.sty0000644000175000001440000007517712505473413013561 0ustar  iorekusers% -*- coding: utf-8; -*-
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% (C)opyright A. Hilbig, mail@andrehilbig.de                                                       |
%             http://www.andrehilbig.de/Publications                                               |
%                                                                                                  | 
% diese Datei: ahilbig-common.sty                                                                  |
%                                                                                                  |
% Das Dokument steht unter der Lizenz: Creative Commons by-nc-sa Version 4.0                       |
% http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de                                         |
%                                                                                                  |
% Nach dieser Lizenz darf das Dokument beliebig kopiert und bearbeitet werden,                     |
% sofern das Folgeprodukt wiederum unter gleichen Lizenzbedingungen vertrieben                     |
% und auf die ursprünglichen Urheber verwiesen wird.                                               |
% Eine kommerzielle Nutzung ist ausdrücklich ausgeschlossen.                                       |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% HINWEISE/ERWEITERUNG                                                                             |
% Diese Pakete basieren auf den entsprechenden Paketen von Prof. Dr. Ludger Humbert                |
% (http://ddi.uni-wuppertal.de/ -- humbert@uni-wuppertal.de) und wurden zum Teil angepasst. Seine  |
% Pakete basieren wiederum auf Entwicklungen von Prof. Dr. Till Tantau                             |
% (http://www.tcs.uni-luebeck.de/de/mitarbeiter/tantau/). Beiden gilt mein Dank hierfür.           |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
\ProvidesPackage{ahilbig-common}

\RequirePackage[german=guillemets]{csquotes}

% Automatische Skalierung zu grosser (breiter) Grafiken
\RequirePackage[Export]{adjustbox}
\adjustboxset{max size={\textwidth}{0.9\textheight}}

\RequirePackage{svn-multi}
%\RequirePackage[all]{svn-multi}
%\RequirePackage[filehooks,autokw]{svn-multi}
\RequirePackage{staves}
\RequirePackage{rotating} 
\RequirePackage{scalerel}  
\RequirePackage{longtable}
\RequirePackage[official]{eurosym} 
\RequirePackage{fancybox} 
\RequirePackage{tabularx} 
\RequirePackage{xmpmulti} 
\RequirePackage{pdfcomment} 
\RequirePackage{xspace} 

%\RequirePackage{paralist}  % < führt zu Problemen mit beamer

%\RequirePackage[svgnames,rgb]{color} % Option Clash ....

\RequirePackage[curves]{struktex} 

% Vorlesung 2
\newcommand\specparrightplus[3]{%
\begin{flushleft}
  \newdimen\breite
  \breite=#1cm
  \scaleleftright[\breite]{.}{\parbox{2.\breite}{#2}}{\}}{\parbox{2.\breite}{#3}}
\end{flushleft}
}

% ab Vorlesung 9
\newcommand\kreisc[1]{\ensuremath{\mathbin{\settowidth{\dimen7}{\mbox{$\bigcirc$}}%
              \makebox[0pt][l]{$\bigcirc$}\raisebox{-0.2mm}{\makebox[\dimen7]{#1}}}}}

 
\RequirePackage{bookmark}

\RequirePackage{amsmath}
\RequirePackage{accents}

\RequirePackage{array}

\RequirePackage{delarray}

\RequirePackage{comment}

\newif\ifdraftversion
\newif\ifbw
\newif\ifcd

\DeclareOption{draft}{\draftversiontrue}
\DeclareOption{blackandwhite}{\bwtrue}
\DeclareOption{cd}{\cdtrue}

\ProcessOptions


\@ifclassloaded{beamer}{}{\RequirePackage{beamerarticle}}
\RequirePackage{pgfkeys}
\RequirePackage{ifluatex}
\ifluatex
 \RequirePackage[utf8]{luainputenc}
\else
 \RequirePackage[utf8]{inputenc}
\fi

\def\UrlFont{}


%%\ifcd\else
%\RequirePackage{futura}
%% \RequirePackage{utopia}
%%\fi
%\RequirePackage{Myriad}
%\RequirePackage{droid}
\RequirePackage{lmodern}
\RequirePackage{courier}


\def\headingfont{\small\sffamily}


% Basic colors

\colorlet{structure.fg}{orange!80!red}
\definecolor{black50}{rgb}{.50,.50,.51}

\definecolor{black90}{rgb}{.90,.90,.91}
\definecolor{black95}{rgb}{.94,.94,.95}

\long\def\hilight#1{{\ifbw\else\color{structure.fg}\fi#1}}
\ifbw
  \colorlet{head.bg}{black}
\else
  \colorlet{head.bg}{structure.fg}
\fi

\ifcd
%  \RequirePackage[mixedgreek,textlf]{Myriad}
  \RequirePackage{microtype}
  \let\sfdefault\rmdefault
  \definecolor{oceangreen}{cmyk}{1,0,.2,.78} 
  \colorlet{structure.fg}{oceangreen!75!white}
  \colorlet{head.bg}{oceangreen}
  \def\headingfont{\sffamily}
  \AtBeginDocument{
    % \renewcommand\scshape{\error}
    \DeclareTextFontCommand{\orig@textsc}{\scshape}
    \edef\MyriadText{\sfdefault}
    \DeclareRobustCommand\textsc[1]{\ifx\f@family\MyriadText{\ifdim\f@size pt=10pt\relax\small\fi\edef\ddi@temp{#1}\expandafter\uppercase\expandafter{\ddi@temp}}\else\orig@textsc{#1}\fi}
  }
\fi

\RequirePackage{ahilbig-letterspace}

\mode<article>
{
%%  \ifcmmath
%%  \else
    \RequirePackage{mathptmx}
    \DeclareSymbolFont{symbols}     {OMS}{cmsy}{m}{n}
    \DeclareSymbolFont{largesymbols}{OMX}{cmex}{m}{n}
    \DeclareSymbolFont{rmletters}   {OML}{ztmcm}{m}{it}
    \DeclareSymbolFont{letters}     {OML}{ztmcm} {m}{it}
%    \ifcd\My@Greek@Mix\fi
%%  \fi
  %\RequirePackage[bookmarksnumbered,pdfborder={0 0 0}]{hyperref}
  %\RequirePackage[plainpages=false,bookmarksnumbered,pdfborder={0 0 0}]{hyperref}
\RequirePackage{paralist} %% wg. pasternak
\RequirePackage{tcolorbox} 

}
\def\rmdefault{qtm}
%\ifcd\else\def\sfdefault{Futura}\fi


\mode<article>
{


% Lists/enumerations/descriptions
  
\def\@listI{\leftmargin\leftmargini
  \parsep 0pt
  \topsep 5\p@   \@plus3\p@ \@minus5\p@
  \itemsep0pt}
\let\@listi=\@listI
\def\@listii{\leftmargin\leftmarginii
  \parsep 0pt
  \topsep 3\p@ \@plus3\p@ \@minus3\p@
  \itemsep0pt}
\leftmargini=1.85em

\parindent=0pt
\parskip=2pt plus 1pt minus 1pt

\renewenvironment{description}
{
  \list{}{\advance\leftmargin by1cm
    \labelwidth\leftmargin
    \itemindent0pt
    \let\makelabel\descriptionlabel
    \itemsep3pt plus2pt minus 2pt}}
{\endlist}

\renewcommand*\descriptionlabel[1]{%
  \hfil\hspace\labelsep{\normalfont\headingfont\hilight{#1}}}


\def\enumerate{%
  \ifnum \@enumdepth >\thr@@\@toodeep\else
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \expandafter
      \list
        \csname label\@enumctr\endcsname
        {\usecounter\@enumctr\def\makelabel##1{\hss\llap{\footnotesize\sffamily##1}}}%
  \fi}

\def\itemize{%
  \ifnum \@itemdepth >\thr@@\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list
      \csname\@itemitem\endcsname
      {\def\makelabel##1{\hss\llap{\sffamily##1}}}%
  \fi}

\renewcommand\labelitemi{\normalfont\hilight{\bfseries–}}
\renewcommand\labelitemii{\normalfont\bfseries–}

\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@arabic\c@enumi.\@arabic\c@enumii}
\renewcommand\theenumiii{\@arabic\c@enumi.\@arabic\c@enumii.\@arabic\c@enumiii}

\renewcommand\labelenumi{\hilight{\theenumi.}}
\renewcommand\labelenumii{\textcolor{black}{\theenumii}}

\setbeamertemplate{block begin}
  {\avoidwiddow{2cm}{50}\par\vskip\medskipamount\penalty-100\parskip0pt{\raggedright\headingfont{\noindent\hilight{\insertblocktitle}}\par}\noindent\ignorespaces}
\setbeamertemplate{block alerted begin}
  {\avoidwiddow{2cm}{50}\par\vskip\medskipamount\penalty-100\parskip0pt{\raggedright\headingfont{\noindent\color{red!90!black}\insertblocktitle}\par}\noindent\ignorespaces}
}


% Common packages

%\RequirePackage[german]{babel}

\RequirePackage[T1]{fontenc}
\RequirePackage{colortbl}


% Chapter-like Headline

\newcommand\chapterlikeheadline[3]{
  {%
    \rightskip0pt plus1fil
    \parindent=0pt
    \sffamily
    \vskip2em%
    {\fontsize{36pt}{36pt}\selectfont #1 \par\vskip2pt}
    {\fontsize{24pt}{28pt}\selectfont \hilight{#2}\par\vskip4pt}
    \expandafter\def\expandafter\temp\expandafter{#3}%
    \ifx\temp\@empty\else{\Large\selectfont \color{black} \temp\par}\fi
    \vskip10pt
  }
  \par
  \vskip 1.5em%
}


\theoremstyle{definition}
\newtheorem{notation}[theorem]{Notation}


\mode
<article>


% Sections

\let\origstartsection=\@startsection
\def\@startsection#1#2#3#4#5#6{%
  \origstartsection{#1}{#2}{#3}{#4}{#5}{#6\raggedright\normalfont\sffamily\ifodd#2\relax\else\ifbw\color{black}\else\color{structure.fg}\fi\fi\selectfont}}

\def\avoidwiddow#1#2{\par\vskip 0pt plus #1\penalty-#2\vskip 0pt plus -#1\ignorespaces}

\renewcommand\section{\avoidwiddow{3cm}{600}
  \@startsection {section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus.2ex}%
  {\normalfont\Large\bfseries}}
\renewcommand\subsection{\avoidwiddow{3cm}{300}\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\renewcommand\subsubsection{\avoidwiddow{3cm}{250}\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}

% Theorems and such

\newenvironment{definitionlike}[2][]{%
  \def\test{#1}%
%  \par%
%  \color{structure.fg}%
%  \hbox\bgroup\hskip-1.5ex\vrule width .5ex\hskip1ex\vbox\bgroup%
%  \color{black}%
  \block{\ddibordericon{{\ddiborderpointer}}%
    #2\ifx\test\@empty\else: \textcolor{black}{#1}\fi}
  \ignorespaces
}
{\endblock}

\newenvironment{examplelike}[2][]{%
  \def\test{#1}
  \block{%
    #2\ifx\test\@empty\else: \textcolor{black}{#1}\fi}
  \ignorespaces
}
{\endblock}

\newenvironment{theoremlike}[2][]{%
  \def\mytest{#1}
  \block{\ddibordericon{{\ddiborderpointer}}%
    #2\ifx\mytest\@empty\else: \textcolor{black}{#1}\fi}
  \itshape\ignorespaces
}
{\endblock}

\newcommand\ddiborderpointer{{\textcolor{structure.fg}{\large$\blacktriangleright$}}}%\LARGE\ding{43}}}}
%\newcommand\ddiborderpointer{{\includegraphics[height=2em]{ddi-icon-bulb-red-ccas.png}}}
\newcommand\ddiborderannote{{\textcolor{structure.fg}{\staveVI}}} 

\renewenvironment{problem}[1][]{\definitionlike[#1]{Problem}}{\enddefinitionlike}
\renewenvironment{definition}[1][]{\definitionlike[#1]{\translate{Definition}}}{\enddefinitionlike}
\renewenvironment{example}[1][]{\examplelike[#1]{\translate{Beispiel}}}{\endexamplelike}
\renewenvironment{examples}[1][]{\examplelike[#1]{\translate{Beispiele}}}{\endexamplelike}
\renewenvironment{theorem}[1][]{\theoremlike[#1]{\translate{Satz}}}{\endtheoremlike}
\renewenvironment{lemma}[1][]{\theoremlike[#1]{\translate{Lemma}}}{\endtheoremlike}
\renewenvironment{corollary}[1][]{\theoremlike[#1]{\translate{Folgerung}}}{\endtheoremlike}
\renewenvironment{notation}[1][]{\definitionlike[#1]{Notation}}{\enddefinitionlike}

\mode
<all>

\providetranslation[to=German]{Einordnung}{Einordnung}
\providetranslation[to=English]{Einordnung}{Qualifying}

\providetranslation[to=German]{Erläuterung}{Erläuterung}
\providetranslation[to=English]{Erläuterung}{Annotation}
\providetranslation[to=German]{Erläuterungen}{Erläuterungen}
\providetranslation[to=English]{Erläuterungen}{Annotations}

\providetranslation[to=German]{Erklärung}{Erklärung}
\providetranslation[to=English]{Erklärung}{Explanation}
\providetranslation[to=German]{Erklärungen}{Erklärungen}
\providetranslation[to=English]{Erklärungen}{Explanations}

\providetranslation[to=German]{Beispiel}{Beispiel}
\providetranslation[to=English]{Beispiel}{Example}

\providetranslation[to=German]{Beispiele}{Beispiele}
\providetranslation[to=English]{Beispiele}{Examples}

\providetranslation[to=German]{Satz}{Satz}
\providetranslation[to=English]{Satz}{Theorem}

\providetranslation[to=German]{Folgerung}{Folgerung}
\providetranslation[to=English]{Folgerung}{Corollary}

%~~
\newtranslation[to=German]{Advantages}{Vorteile}
\newtranslation[to=English]{Advantages}{Advantages}

\newtranslation[to=German]{Disadvantages}{Nachteile}
\newtranslation[to=English]{Disadvantages}{Disadvantages}

\newenvironment{advantages}[1][\translate{Advantages}]{
  \setbeamercolor{structure}{fg=green!50!black}
  \only<article>{\colorlet{structure.fg}{green!50!black}}
  \begin{block}{#1}%
    \alt<article>{\renewcommand\labelitemi{\normalfont\hilight{\bfseries+}}}%
    {\setbeamertemplate{itemize item}{+}}%
  }
  {\end{block}}
\newenvironment{disadvantages}[1][\translate{Disadvantages}]{
  \setbeamercolor{structure}{fg=red!50!black}
  \only<article>{\colorlet{structure.fg}{red!75!black}}
  \begin{block}{#1}%
    \only<presentation>{\setbeamertemplate{itemize item}{–}}%
  }
  {\end{block}}
  

% Typesetting Listings

\RequirePackage{listings}
\lstset{extendedchars=true}

\newif\ifemphlistings
\def\colorunlessemph#1{\ifemphlistings\else\color{#1}\fi}

% Allow German umlauts:
\lstset{%
  literate={ä}{{\"a}}1
           {ö}{{\"o}}1
           {ü}{{\"u}}1
           {Ä}{{\"A}}1
           {Ö}{{\"O}}1
           {Ü}{{\"U}}1
           {ß}{{\ss}}1
}

\lstset{%
  basicstyle=\footnotesize\ttfamily,
  commentstyle=\itshape\colorunlessemph{green!50!black},
  keywordstyle=\bfseries\colorunlessemph{structure.fg},
  identifierstyle=\colorunlessemph{blue},
  stringstyle=\colorunlessemph{violet},
  emphstyle=\color{red},
  numbersep=1em,
  breaklines=true,
  breakatwhitespace=true,
  numberstyle=\scriptsize\color{black!50}
}

\only<article>
{
  \lstset{%
    basicstyle=\ttfamily\small,
    backgroundcolor=\color{structure.fg!10},
    frame=lines,
    framerule=1pt,
    rulecolor=\color{structure.fg},
    numberstyle=\scriptsize\sffamily\color{black!50}
  }
  \ifbw
    \lstset{backgroundcolor=}
  \fi
  \ifcd
    \lstset{backgroundcolor=\color{structure.fg!5}}
  \fi
}

\alt<article>
{
  \lstdefinestyle{presentationscriptsize}{}
}
{
  \lstdefinestyle{presentationscriptsize}{basicstyle=\ttfamily\scriptsize}
}

\alt<article>
{
  \lstdefinestyle{presentationtinysize}{basicstyle=\ttfamily\scriptsize}
}
{
  \lstdefinestyle{presentationtinysize}{basicstyle=\ttfamily\tiny}
}

\lstdefinelanguage{css}{
   morekeywords={
      border,padding,color,font,font-size,height,width,margin,background-image,
      red,green,blue,float,left,right,top,bottom,position,absolute,relative,
      solid,
      margin-top,margin-bottom,margin-left,margin-right,
      border-top,border-bottom,border-left,border-right,
      padding-top,padding-bottom,padding-left,padding-right
    },%
   morecomment=[s]{/*}{*/},%
   morestring=[b]",%
   alsoletter={-},%
}
\lstdefinelanguage{MySQL}[]{SQL}{
  morekeywords={ADD,ALL,ALTER,ANALYZE,AND,AS,ASC,ASENSITIVE,BEFORE,BETWEEN,BIGINT,BINARY
    BLOB,BOTH,BY,CALL,CASCADE,CASE,CHANGE,CHAR,CHARACTER,CHECK,COLLATE,COLUMN,
    CONDITION,CONSTRAINT,CONTINUE,CONVERT,CREATE,CROSS,CURRENT_DATE,
    CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,DATABASE,DATABASES,
    DAY_HOUR,DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DEC,DECIMAL,DECLARE,DEFAULT,
    DELAYED,DELETE,DESC,DESCRIBE,DETERMINISTIC,DISTINCT,DISTINCTROW,DIV,DOUBLE,
    DROP,DUAL,EACH,ELSE,ELSEIF,ENCLOSED,ESCAPED,EXISTS,EXIT,EXPLAIN,FALSE,FETCH,
    FLOAT,FLOAT4,FLOAT8,FOR,FORCE,FOREIGN,FROM,FULLTEXT,GRANT,
    GROUP,HAVING,HIGH_PRIORITY,HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,
    IF,IGNORE,IN,INDEX,INFILE,INNER,INOUT,INSENSITIVE,INSERT,
    INT,INT1,INT2,INT3,INT4,INT8,INTEGER,INTERVAL,INTO,
    IS,ITERATE,JOIN,KEY,KEYS,KILL,LEADING,LEAVE,LEFT,
    LIKE,LIMIT,LINES,LOAD,LOCALTIME,LOCALTIMESTAMP,LOCK,LONG,LONGBLOB,
    LONGTEXT,LOOP,LOW_PRIORITY,MATCH,MEDIUMBLOB,MEDIUMINT,MEDIUMTEXT,
    MIDDLEINT,MINUTE_MICROSECOND,MINUTE_SECOND,MOD,MODIFIES,NATURAL,NOT,
    NO_WRITE_TO_BINLOG,NULL,NUMERIC,ON,OPTIMIZE,OPTION,OPTIONALLY,
    OR,ORDER,OUT,OUTER,OUTFILE,PRECISION,PRIMARY,PROCEDURE,PURGE,
    READ,READS,REAL,REFERENCES,REGEXP,RELEASE,RENAME,REPEAT,REPLACE,
    REQUIRE,RESTRICT,RETURN,REVOKE,RIGHT,RLIKE,SCHEMA,SCHEMAS,SECOND_MICROSECOND,
    SELECT,SENSITIVE,SEPARATOR,SET,SHOW,SMALLINT,SONAME,SPATIAL,SPECIFIC,
    SQL,SQLEXCEPTION,SQLSTATE,SQLWARNING,SQL_BIG_RESULT,SQL_CALC_FOUND_ROWS,
    SQL_SMALL_RESULT,SSL,STARTING,STRAIGHT_JOIN,TABLE,TERMINATED,
    THEN,TINYBLOB,TINYINT,TINYTEXT,TO,TRAILING,TRIGGER,TRUE,UNDO,
    UNION,UNIQUE,UNLOCK,UNSIGNED,UPDATE,USAGE,USE,USING,UTC_DATE,
    UTC_TIME,UTC_TIMESTAMP,VALUES,VARBINARY,VARCHAR,VARCHARACTER,
    VARYING,WHEN,WHERE,WHILE,WITH,WRITE,XOR,YEAR_MONTH,ZEROFILL,
    ASENSITIVE,CALL,CONDITION,CONNECTION,CONTINUE,CURSOR,
    DECLARE,DETERMINISTIC,EACH,ELSEIF,EXIT,FETCH,
    GOTO,INOUT,INSENSITIVE,ITERATE,LABEL,LEAVE,
    LOOP,MODIFIES,OUT,READS,RELEASE,REPEAT,
    RETURN,SCHEMA,SCHEMAS,SENSITIVE,SPECIFIC,SQL,
    SQLEXCEPTION,SQLSTATE,SQLWARNING,
    TRIGGER,UNDO,UPGRADE,WHILE
  }
}

\lstdefinelanguage{pseudocode}{
  morekeywords={
    if,then,else,while,do,repeat,until,seq,seqdo,return,call,
    for,pardo,in,foreach,print,output,input,exit,
    break,loop,end,begin,goto,pardo,par,global,read,write,to,stop,idle,procedure,function
  },
  sensitive=true,
  morecomment=[l]{//},
  morecomment=[l]{\%},
  morestring=[b]",
}

\lstdefinestyle{text}{
  basicstyle=\ttfamily\footnotesize,
}

\lstdefinestyle{pseudocodebase}{
  language=pseudocode,
  numbers=left,
  basicstyle=\rmfamily\footnotesize,
  keywordstyle=\bfseries\itshape\colorunlessemph{structure.fg},
  columns=fullflexible,
  mathescape=true,
  identifierstyle=\itshape,
  literate={<}{{$<$}}1
           {>}{{$>$}}1
           {-}{{-}}1
           {+}{{$+$}}1
           {*}{{$\cdot$}}1
           {<-}{{$\gets$\ }}2
           {<=}{{$\leq$}}1
           {>=}{{$\geq$}}1
           {!=}{{$\neq$}}1
           {==}{{$=$}}1
           {ä}{{\"a}}1
           {ö}{{\"o}}1
           {ü}{{\"u}}1
           {Ä}{{\"A}}1
           {Ö}{{\"O}}1
           {Ü}{{\"U}}1
           {ß}{{\ss}}1
}

\lstdefinelanguage{while}{
   morekeywords={
      uint,return,while,loop
    }
}

  
\lstdefinelanguage{MuML}{
   morekeywords={
      fun,0,succ,min
    }
}
\alt<article>
{\lstdefinestyle{pseudocode}{style=pseudocodebase,basicstyle=\rmfamily}}
{\lstdefinestyle{pseudocode}{xleftmargin=1em,style=pseudocodebase,basicstyle=\sffamily\small,keywordstyle=\itshape\colorunlessemph{structure.fg}}}

\lstdefinestyle{alerts}{% We want easy hilighting
  moredelim=**[is][\color{red}\emphlistingstrue]{(!}{!)}%
}

\lstdefinestyle{escapes}{
  escapechar=\#
}

\def\pythoncode{\lstinline[language=Python]}
\def\javacode{\lstinline[language=Java]}
\def\ccode{\lstinline[language=C]}
\def\htmlcode{\lstinline[language=html]}
\def\csscode{\lstinline[language=css]}
\def\sqlcode{\lstinline[language=MySQL]}
\def\pseudocode{\lstinline[style=pseudocode]}
\def\texcode{\lstinline[language={[LaTeX]tex}]}
\def\whilecode{\lstinline[language=while,mathescape=true]}
\def\mucode{\lstinline[language=MuML]}

\alt<article>
{
  \def\verbatim@font{\normalfont\small\ttfamily}
}
{
  \def\verbatim@font{\normalfont\footnotesize\ttfamily}
}

% New useful definitions:

\newbox\mytempbox
\newdimen\mytempdimen

\newcommand\includegraphicscopyright[3][]{%
  \leavevmode\vbox{\vskip3pt\raggedright\setbox\mytempbox=\hbox{\includegraphics[#1]{#2}}%
    \mytempdimen=\wd\mytempbox\box\mytempbox\par\vskip1pt%
    \sffamily\fontsize{3}{3.5}\selectfont\spaceskip=.333em\xspaceskip=.5em{\color{black}{\vbox{\hsize=\mytempdimen#3}}}\vskip3pt%
}}


\newenvironment{colortabular}[1]{\medskip\rowcolors[]{1}{structure.fg!10}{structure.fg!3}\tabular{#1}\rowcolor{structure.fg!20}}{\endtabular\medskip}

\def\equad{\leavevmode\hbox{}\quad}

\newenvironment{greencolortabular}[1]
{\medskip\rowcolors[]{1}{green!50!black!20}{green!50!black!5}%
  \tabular{#1}\rowcolor{green!50!black!40}}%
{\endtabular\medskip}

\only<article>{\let\greencolortabular=\colortabular\let\endgreencolortabular=\endcolortabular}



% Exercises

\mode<article>

\newif\ifbonus

\pgfkeys{
  /ddi/exercise/title/.initial=,
  /ddi/exercise/credits/.initial=,
  /ddi/exercise/@credits/.initial=,
  /ddi/exercise/level/.initial=,
  /ddi/exercise/how/.initial=,
  /ddi/exercise/@solution/.initial=,
  /ddi/exercise/solution/.style={@solution=mit~Lösung},
  /ddi/exercise/@examtext/.initial=,
  /ddi/exercise/exam/.is choice,
  /ddi/exercise/exam/no/.style={@examtext=nicht~klausurrelevant},
  /ddi/exercise/exam/used/.style={@examtext=original~Klausuraufgabe},
  /ddi/exercise/exam/typical/.style={@examtext=typische~Klausuraufgabe},
  /ddi/exercise/bonus/.is if=bonus,
  /ddi/exercise/time/.initial=,
  /ddi/exercise/label/.store in=\exerciselabel}
  
\newif\ifignorekey
\def\ddiyestext{yes}

\def\possiblyuse#1{%
  \ignorekeyfalse%
  \pgfkeysifdefined{/ddi/exercise/#1/ignore}
  {%
    \pgfkeysgetvalue{/ddi/exercise/#1/ignore}\dditemp
    \ifx\dditemp\ddiyestext%
      \ignorekeytrue%
    \fi%
  }%
  {}%
  \ifignorekey
  \else
    \pgfkeysgetvalue{/ddi/exercise/#1}{\mymacro}%
    \ifx\mymacro\@empty%
    \else%
      \ifx\infostring\@empty%
        \let\infostring=\mymacro%
      \else
        \expandafter\expandafter\expandafter\def
        \expandafter\expandafter\expandafter\infostring
        \expandafter\expandafter\expandafter
        {\expandafter\infostring\expandafter,\expandafter\ \mymacro}% 
      \fi%
    \fi%
  \fi%
}

\newbox\mybox

\newenvironment{exercise}[1][]%
{
  \pgfkeys{/ddi/exercise/.cd,/ddi/every exercise/.try,#1}%
  \parindent0pt%
  \refstepcounter{exercisenumber}%
  \goodbreak\medskip\noindent
  {%
    \parskip=0pt%
    \raggedright%
    \headingfont%
    \hilight{%
    \setbox\mybox=\hbox{%
      \insertexercisetext%
      \pgfkeysifdefined{/ddi/exercise/bonus/ignore}{}{{\ifbonus*\fi}}\
      \theexercisenumber%
      \hskip2ex% 
    }%
    \ddisetupcredits%
    \leftskip\wd\mybox%
    \llap{\box\mybox}%
    \def\infostring{}%
    \possiblyuse{title}%
    \possiblyuse{level}%
    \possiblyuse{@credits}%
    \possiblyuse{how}%
    \possiblyuse{time}%
    \possiblyuse{@examtext}%
    \possiblyuse{@solution}%
    \ifx\infostring\@empty\else{\textcolor{black}{\infostring}}\fi\hfill%
  \par}%
  }%
  \ifx\exerciselabel\@undefined\else\expandafter\label\expandafter{\exerciselabel}\fi%
  \pgfkeys{/ddi/exercise/at begin/.try}%
  \ignorespaces
}
{
  \parskip0pt
  \par\medskip
}

\newcommand\insertexercisetext{\translate{Aufgabe}}
\newcommand\insertpointtext{Punkt}
\newcommand\insertpointstext{Punkte}
\newcommand\insertbonuspointtext{Bonuspunkt}
\newcommand\insertbonuspointstext{Bonuspunkte}
\newtranslation[to=German]{Aufgabe}{Aufgabe}
\newtranslation[to=English]{Aufgabe}{Problem}

\def\ddisetupcredits{%
  \pgfkeysgetvalue{/ddi/exercise/credits}{\ddipoints}%
  \ifx\ddipoints\@empty%
    \ddi@plain@numberfalse%
  \else%
    \afterassignment\ddi@check\expandafter\@tempcnta\expandafter1\ddipoints\relax%
  \fi%
  \ifddi@plain@number%
    \ifbonus%
      \ifnum\ddipoints=1\relax%
        \pgfkeys{/ddi/exercise/@credits/.expanded=\ddipoints\ \insertbonuspointtext}%
      \else%
        \pgfkeys{/ddi/exercise/@credits/.expanded=\ddipoints\ \insertbonuspointstext}%
      \fi%
    \else%
      \ifnum\ddipoints=1\relax%
        \pgfkeys{/ddi/exercise/@credits/.expanded=\ddipoints\ \insertpointtext}%
      \else%
        \pgfkeys{/ddi/exercise/@credits/.expanded=\ddipoints\ \insertpointstext}%
      \fi%
    \fi%
  \else%
    \pgfkeys{/ddi/exercise/@credits/.expanded=\ddipoints}%
  \fi%
}
\newif\ifddi@plain@number

\def\ddi@check{%
  \@ifnextchar\relax{\ddi@plain@numbertrue\ddi@gobble@to@stop}{\ddi@plain@numberfalse\ddi@gobble@to@stop}%
}
\def\ddi@gobble@to@stop#1\relax{}%




% Solutions

\pgfkeys{/ddi/solution/of/.initial=}


\renewenvironment{solution}[1][]
{
  \pgfkeys{/ddi/solution/.cd,/ddi/every solution/.try,#1}
  \parindent0pt%
  \goodbreak\medskip\noindent
  {\sffamily%
    \parskip0pt\hilight{%
    Beispiellösung zu \refexercise{\pgfkeysvalueof{/ddi/solution/of}}}\hfill
  \par%
  }%
  \ignorespaces
}
{
  \parskip0pt
  \par\medskip
}

\newcommand\refexercise[1]{\insertexercisetext~\ref{#1}}

\mode
<all>


\newcommand\ddibordericon[1]{%
  \llap{\smash{\hbox{#1}}\kern1ex}%
}


% Rezept
\pgfkeys{/ddi/proof method/title/.initial=}
\pgfkeys{/ddi/proof method/goal/.initial=}
\pgfkeys{/ddi/proof method/also on frame/.initial=}

\mode
<article>

% \newenvironment{proof method}[1][]
% {
%   \pgfkeys{/ddi/proof method/.cd,#1}
%   \par%
%   \vfil\penalty100\vfilneg%
%   \begin{frame}{}
%     \addcontentsline{lop}{subsection}{\pgfkeysvalueof{/ddi/proof method/title}}
%     \advance\hsize by-20pt
%     \setbox\mybox=\vbox
%     \bgroup
%       \begin{minipage}[t]{\textwidth-2.5cm-20pt}
%         \textsf{\hilight{Beweisrezept f\"ur}\\ \large\pgfkeysvalueof{/ddi/proof method/title}\smallskip}      

%         \begin{block}{Ziel}
%           \pgfkeysvalueof{/ddi/proof method/goal}
%         \end{block}
%       \end{minipage}\hskip5mm
%       \begin{minipage}[t]{2cm}
%         \ \par\vskip-1em\includegraphics[width=2cm]{ddi-icon-kochmuetze.pdf}
%       \end{minipage}
%       \par
%       \begin{minipage}{\textwidth-20pt}
%       \begin{block}{Rezept}
% }
% {
%       \end{block}
%     \end{minipage}
%     \egroup%
%     \parskip0pt
%     \advance\hsize by20pt
%     \vskip-1em{\fboxsep=1em%
%       \color{structure.fg}\hrule height2pt depth0pt%
%       \color{black}\colorbox{black90}{\box\mybox}%
%       \color{structure.fg}\hrule height2pt%
%     }\medskip
%     \pgfkeysvalueof{/ddi/proof method/also on frame}   
%   \end{frame}  
% }


\newenvironment{proof method}[1][]
{
  \pgfkeys{/ddi/proof method/.cd,#1}
  \par%
  \vfil\penalty100\vfilneg%
	\begin{frame}{\ddibordericon{\lower3pt\hbox{}}%\includegraphics[height=1.5em]{ddi-icon-kochmuetze.pdf}{}}}%
      Rezept: \emph{\hilight{\pgfkeysvalueof{/ddi/proof method/title}}}}
    \addcontentsline{lop}{subsection}{\pgfkeysvalueof{/ddi/proof method/title}}
    \begin{block}{Ziel}
      \emph{\pgfkeysvalueof{/ddi/proof method/goal}}
    \end{block}
    \begin{block}{Rezept}
}
{
    \end{block}
    \pgfkeysvalueof{/ddi/proof method/also on frame}   
  \end{frame}  
}


\mode
<all>


%
% TikZ styles
%

\RequirePackage{tikz}
\usetikzlibrary{mindmap,trees,backgrounds,arrows,calendar,fadings,shadows,  
                matrix,shapes,shapes.geometric,shapes.misc,petri,fit,
                decorations.markings,
                decorations.pathmorphing,
                decorations.pathreplacing,
}

\tikzset{
  plain/.style={minimum  size=0mm,shape=rectangle,font=,draw=none,thin,fill=none,inner
    sep=0.333em,text depth=,text height=,text width=},
  node/.style={minimum size=6mm,shape=circle,font=\small,draw=structure.fg,thick, 
    fill=structure.fg!10,inner sep=1pt
  },
  tiny node/.style={minimum size=3mm,shape=circle,font=\tiny,draw=structure.fg,thick, 
    fill=structure.fg!10,inner sep=0.3pt
  },
  long label/.style={shape=rounded rectangle,text depth=0.15em,text
    height=0.7em},
  rectangular/.style={rectangle,minimum height=1cm,minimum width=4cm,rounded corners},
  box/.style={node,shape=rectangle},
  blue node/.style={node,fill=blue!20,draw=blue},
  tiny blue node/.style={tiny node,fill=blue!20,draw=blue},
  red node/.style={node,fill=red!20,draw=red},
  tiny red node/.style={tiny node,fill=red!20,draw=red},
  orange node/.style={node,fill=orange!20,draw=orange},
  tiny orange node/.style={tiny node,fill=orange!20,draw=orange},
  green node/.style={node,fill=green!50!black!20,draw=green!50!black},
  tiny green node/.style={tiny node,fill=green!50!black!20,draw=green!50!black},
  black node/.style={node,fill=black!20,draw=black},
  tiny black node/.style={tiny node,fill=black!20,draw=black},
  gray node/.style={node,fill=black!20,draw=black!50,text=black!50},
  tiny gray node/.style={tiny node,fill=black!20,draw=black!50,text=black!50},
  graph/.style={semithick,>=spaced stealth'},
  tree/.style={
    every node/.style={node,long label},
    edge from parent/.style={draw,>=spaced stealth',semithick},
    grow=down,
    level 1/.style={level distance=1cm,sibling distance=2cm},
    level 2/.style={sibling distance=1cm}
  },
  reverse tree/.style={tree,edge from
    parent/.style={draw,>=spaced stealth',semithick,<-}},
  graphs/suffix tree/.style={
    trie,
    simple,
    edges={nodes={inner sep=1pt,anchor=mid,fill=white}},
    nodes={tiny node},
    sibling distance=1.5cm,
    empty nodes,
    /tikz/every edge quotes/.style={}
  },
  graphs/trie graph/.style={
    trie,
    simple,
    edges={nodes={inner sep=1pt,anchor=mid,fill=white}},
    nodes={tiny node},
    sibling distance=1.5cm,
    put node text on incoming edges
  },
  labeling/.style={below right,inner sep=2pt,font=\scriptsize},
  gate/.style={node,rectangle,minimum height=6mm,minimum width=4mm},
  tiny gate/.style={gate,minimum size=0pt,inner sep=1pt,thin},  
  numbering/.style={circle,fill=structure.fg,text=white,inner sep=0.5pt,font=\footnotesize\sffamily,minimum size=1.25em},
  tiny numbering/.style={numbering,font=\tiny\sffamily},
  memory/.style={thick,draw=blue,fill=blue!20,rectangle,minimum width=#1cm,minimum height=5mm},
  memory/.default=1,
  var/.style={node,long label,minimum height=4.5mm,minimum width=1cm},
  pointer/.style={shorten <=-8pt,*-spaced stealth',semithick},
  petrinet/.style={
    graph,
    every transition/.style={font=\small,draw=blue,thick,fill=blue!20},
    every place/.style={font=\small,draw=structure.fg,thick,fill=structure.fg!10,minimum
      size=7mm}
  },
  automaton/.style={graph,every state/.style=node},
  dot/.style={circle,fill=structure.fg,minimum size=4pt,inner sep=0pt,outer sep=0pt,draw=none},
  slide/.style={
    execute at end picture={
      \pgfonlayer{background}
        \fill [rounded corners,draw=black!15,very thick,fill=black!5]
        ([shift={(-3mm,-3mm)}]current bounding box.south west) rectangle ([shift={(3mm,3mm)}]current bounding box.north east);
        \def\temp{#1}
        \ifx\temp\pgfutil@empty
        \path ([yshift=1.5mm]current bounding box.north);
        \else
        \node[node,draw=black!15,very thick,fill=white,long label,text
        depth=1.5pt,text height=5pt,minimum height=3mm,minimum
        width=6mm,font=\tiny\sffamily,right] at ([xshift=3mm]current bounding box.north west)
        {#1};
        \fi
        \path ([yshift=-1.5mm]current bounding box.south);
      \endpgfonlayer
    }
  },
  slide/.default=
}

\pgfarrowsdeclarecombine*{spaced stealth'}{spaced
  stealth'}{stealth'}{stealth'}{space}{space}

% Myriad fixes

\ifcd
\let\epsilon\varepsilon
\let\phi\varphi
\fi

% Till's two favorite macros

\mode
<presentation>
\newcommand\Class[1]{\mathsf{#1}}
\newcommand\Lang[1]{\text{\normalfont\footnotesize{\uppercase{#1}}}}

\mode
<article>
\newcommand\Class[1]{\mathchoice{\text{\upshape\small$\mathrm{#1}$}}{\text{\upshape\small$\mathrm{#1}$}}{\text{\upshape$\mathrm{#1}$}}{\text{\upshape$\mathrm{#1}$}}}
\newcommand\Lang[1]{\text{\normalfont\textsc{\lowercase{#1}}}}


\mode
<all>

ahilbig-letterspace.sty0000644000175000001440000000700612505473447014575 0ustar  iorekusers% -*- coding: utf-8; -*-
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% (C)opyright A. Hilbig, mail@andrehilbig.de                                                       |
%             http://www.andrehilbig.de/Publications                                               |
%                                                                                                  | 
% diese Datei: ahilbig-letterspace.sty                                                             |
%                                                                                                  |
% Das Dokument steht unter der Lizenz: Creative Commons by-nc-sa Version 4.0                       |
% http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de                                         |
%                                                                                                  |
% Nach dieser Lizenz darf das Dokument beliebig kopiert und bearbeitet werden,                     |
% sofern das Folgeprodukt wiederum unter gleichen Lizenzbedingungen vertrieben                     |
% und auf die ursprünglichen Urheber verwiesen wird.                                               |
% Eine kommerzielle Nutzung ist ausdrücklich ausgeschlossen.                                       |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% HINWEISE/ERWEITERUNG                                                                             |
% Diese Pakete basieren auf den entsprechenden Paketen von Prof. Dr. Ludger Humbert                |
% (http://ddi.uni-wuppertal.de/ -- humbert@uni-wuppertal.de) und wurden zum Teil angepasst. Seine  |
% Pakete basieren wiederum auf Entwicklungen von Prof. Dr. Till Tantau                             |
% (http://www.tcs.uni-luebeck.de/de/mitarbeiter/tantau/). Beiden gilt mein Dank hierfür.           |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |

\ProvidesPackage{ahilbig-letterspace}

\RequirePackage{ifluatex}

\def\textlsuppercase#1{\edef\temp{#1}\textls{\expandafter\uppercase\expandafter{\temp}}}

\newbox\lectureletterbox
\newif\iflec@uppercasetextls

\ifluatex

\def\textls#1{%
  \begingroup
  \def\.{\relax}
  \lec@uppercasetextlsfalse
  \edef\lec@temp{#1}%
  \expandafter\textls@\lec@temp\pgf@stop%
}
\def\textlsuppercase#1{%
  \begingroup
  \def\.{\relax}
  \lec@uppercasetextlstrue
  \edef\lec@temp{#1}%
  \expandafter\textls@word\lec@temp\. \pgf@stop%
}
\def\textls@word#1 #2\pgf@stop{%
  \textls@#1\pgf@stop%
  \def\pgf@temp{#2}%
  \ifx\pgf@temp\pgfutil@empty%
    \endgroup%
  \else%
    \ \kern.3ex%
    \textls@word#2\pgf@stop%
  \fi%
}

\def\textls@{%
  \pgfutil@ifnextchar\pgf@stop{\pgfutil@gobble}{%
    \pgfutil@ifnextchar\unhbox{\textls@@gobbeltwo}{%
      \pgfutil@ifnextchar\penalty{\textls@@gobbeltwo}{%
        \textls@@}}}%
}
\def\textls@@#1{%
  \iflec@uppercasetextls\uppercase{#1}\else#1\fi\kern0.3ex\textls@%
}
\def\textls@@gobbeltwo#1#2{\textls@}

\fi
ahilbig-presentation.sty0000644000175000001440000013532312505473545015000 0ustar  iorekusers% -*- coding: utf-8; -*-
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% (C)opyright A. Hilbig, mail@andrehilbig.de                                                       |
%             http://www.andrehilbig.de/Publications                                               |
%                                                                                                  | 
% diese Datei: ahilbig-presentation.sty                                                            |
%                                                                                                  |
% Das Dokument steht unter der Lizenz: Creative Commons by-nc-sa Version 4.0                       |
% http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de                                         |
%                                                                                                  |
% Nach dieser Lizenz darf das Dokument beliebig kopiert und bearbeitet werden,                     |
% sofern das Folgeprodukt wiederum unter gleichen Lizenzbedingungen vertrieben                     |
% und auf die ursprünglichen Urheber verwiesen wird.                                               |
% Eine kommerzielle Nutzung ist ausdrücklich ausgeschlossen.                                       |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% HINWEISE/ERWEITERUNG                                                                             |
% Diese Pakete basieren auf den entsprechenden Paketen von Prof. Dr. Ludger Humbert                |
% (http://ddi.uni-wuppertal.de/ -- humbert@uni-wuppertal.de) und wurden zum Teil angepasst. Seine  |
% Pakete basieren wiederum auf Entwicklungen von Prof. Dr. Till Tantau                             |
% (http://www.tcs.uni-luebeck.de/de/mitarbeiter/tantau/). Beiden gilt mein Dank hierfür.           |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |

\ProvidesPackage{ahilbig-seminar}

\newif\ifcmmath
\DeclareOption{cmmath}{\cmmathtrue}
\newif\ifonelecture
\DeclareOption{onelecture}{\onelecturetrue}
\ProcessOptions

%\RequirePackage[draft]{ddi-common}
%\RequirePackage[blackandwhite]{ddi-common}
%\RequirePackage[cd]{ddi-common}
\RequirePackage{ahilbig-common}

\RequirePackage{ahilbig-semester}

%\RequirePackage[height=5cm,keepaspectratio,digitcolor=white,
%	backgroundcolor=none]{ddiLogo} % benutzt in Zeile 388

%\RequirePackage{chapterbib}

\RequirePackage{graphicx}
\RequirePackage{pifont}
\RequirePackage{ahilbig-comics}
\RequirePackage{wrapfig}
\RequirePackage{smartdiagram}

\RequirePackage{varsfromjobname} % Element[e] aus \jobname extrahieren
%\RequirePackage{qrcode}          % Wird in maintitle genutzt - auskommentiert

%\RequirePackage{pdfpages}

% Default lecture
\providecommand\insertshortlecture{0}
\providecommand\insertlecture{Vortrag}
\providecommand\lecturename{Vortragtitel}

\providecommand\versionsinfo{%
%  \textcolor{blue!50}{%
%   \begin{tabular}{ll}
%    Version:         &\svnfilerev                                    \\ %\hline
%    Stand:           &\svnfiletoday, \svnfilehour:\svnfileminute ~Uhr\\ %\hline
%    Zuletzt bearbeitet von:&\svnFullAuthor{\svnfileauthor}  
%   \end{tabular}
%  }
}


% Common packages
%
\usepackage{babel}
\mode<article>
{
  \usepackage[left=1.75cm,right=6.5cm,top=2.5cm,bottom=2cm,twoside,
  	a4paper]{geometry}
  \usepackage{fancyhdr}
  \setlength\columnsep{1.5cm}
}
%%\usepackage{hyperref}
\usepackage{calc}
\usepackage{tikz}
%\usepackage{yfonts}
\usepackage{translator}
\usepackage{amssymb}
\usetikzlibrary{scopes,backgrounds,positioning}

\usepackage[absolute]{textpos}
\usepackage{multimedia} 



\def\UrlFont{}

    
% Common settings for all lectures in this course

\title{\insertlecture}


% The body environment

\mode<article>{
  \parskip.5em plus 1pt minus 1pt
  \newenvironment{body}{\parskip=2pt plus 1pt minus 1pt}{}
}
\mode<presentation>{
  \newenvironment{body}{\document\ifcd\setbeamertemplate{sidebar
      right}{}\fi}{\input{bib-config.tex}\enddocument}
%  \newcommand{\newblock}{}  
}


% Common theorem-like environments

\theoremstyle{definition}
\newtheorem{lectureexercise@}[theorem]{\translate{Zur Uebung}}
\newtheorem{discussion@}[theorem]{\translate{Zur Diskussion}}

\pgfkeys{/ddi/lines/.initial=0}
\pgfkeys{/ddi/border lines/.initial=4}
\pgfkeys{/ddi/name/.initial=}
\pgfkeys{/ddi/title/.style={/ddi/name=#1}}

\newenvironment{lecture exercise}[1][]{\pgfkeys{/ddi/.cd,#1}%
  \edef\marshal{\noexpand\lectureexercise@[\pgfkeysvalueof{/ddi/name}]}
  \marshal\ignorespaces}
{\endlectureexercise@
}

% \def\lineblock
% {%
%   %
%   \ifnum\pgfkeysvalueof{/ddi/border lines}>0\relax%
%   \only<article>{%
%     \setlength{\marginparsep}{.5cm}%
%     \setlength{\marginparwidth}{4cm}%
%     \marginpar{%
%       \color{black!35}
%       \edef\temp{1,...,\pgfkeysvalueof{/ddi/border lines}}
%       \foreach \i in \temp
%       {\ifnum\i>1\vskip1.5em\else\ding{46}\vskip2pt\fi\hrule width4cm height0.4pt}      
%       \vskip1.5em
%     }%
%   }%
%   \fi%
% }

\def\lineblock{\llap{\ding{46}\ \ }}

\newenvironment{discussion}[1][]{\pgfkeys{/ddi/.cd,#1}%
  \edef\marshal{\noexpand\discussion@[\pgfkeysvalueof{/ddi/name}]}
  \marshal\ignorespaces}
{\enddiscussion@
}


%
% New environments
%

\newdimen\gapskip
\gapskip=5cm

\newenvironment{presentation itemize}
{\alt<presentation>{\itemize}{\ddi@save@item\let\item=\relax\ignorespaces}}
{\alt<presentation>{\enditemize}{}}

\newenvironment{presentation enumerate}
{\alt<presentation>{\itemize}{\ddi@save@item\c@enumi=0\def\item{\advance\c@enumi
    by 1\relax\the\c@enumi.\ }\ignorespaces}}
{\alt<presentation>{\enditemize}{}}

\def\ddi@save@item{\ifx\ddi@reinstall@item\relax\let\orig@item=\item\def\ddi@reinstall@item{\let\item=\orig@item}\fi}

\let\ddi@reinstall@item\relax
\let\orig@list=\list
\def\list{\ddi@reinstall@item\orig@list}


%
% Special wide pages
 
\def\ddistartwidepages{
  \setlength\textwidth{\paperwidth-17.5mm-17.5mm}
  \setlength\oddsidemargin{17.5mm-1in}
  \setlength\evensidemargin{17.5mm-1in}
  \setlength\gapskip{0.25cm}
}
\newenvironment{wide pages}
{
  \begingroup
  \ddistartwidepages
  \onecolumn
}
{
  \clearpage
  \endgroup
  \onecolumn
}


% Learning targets and TOC

\mode<beamer>
{
\newenvironment{learning targets}
{
  \translatelet\temp{Kompetenzen}
%  \section*{\temp}
  \begin{frame}[fragile=singleslide]{\translate{Kompetenzen}~\insertshortlecture}
    \begin{enumerate}%\rightskip-1.5cm plus1fil
    }
  {
    \end{enumerate}
  \end{frame}
\begin{frame}{\translate{Gliederung}~\insertshortlecture}
  \tableofcontents
\end{frame}
\aftergroup\setupsidebar
}
}

\mode<article>
{
  \newcommand\maintableofcontents{{%
      \parskip0pt%
%  \addvspace{3em \@plus\p@}%
%  \avoidwiddow{2.5cm}{500}
      \tableofcontents
    }}
\renewcommand*\l@part[2]{%
  \addpenalty{-\@highpenalty}%
  \addvspace{5em \@plus\p@}%
  \avoidwiddow{3cm}{750}
  \setlength\@tempdima{4em}%
  \begingroup
    \parindent \z@
    \leavevmode
    \raggedright
    \leftskip0em%
    \Large\sffamily
    \long\def\numberline##1{{\fontsize{20pt}{24pt}\selectfont%
    	\textcolor{structure.fg}{##1}\par}\leavevmode}%
    #1
    \par
  \endgroup
}
\renewcommand*\l@chapter[2]{%
  \addvspace{3em \@plus\p@}%
  \avoidwiddow{2.5cm}{500}
  \@tempdima=4em%
    \begingroup
      \parindent \z@
      \leavevmode
      \raggedright
      \advance\leftskip4em
      \hskip -4em
      {\Large\color{black} \textsf{#1}\par}
    \endgroup
  }
\renewcommand*\l@section[2]{%
  \addvspace{1.0em \@plus\p@}%
  \avoidwiddow{2cm}{200}
  \@tempdima=4em%
    \begingroup
      \parindent \z@
      \leavevmode
      \rightskip\@pnumwidth plus1fil
      \advance\leftskip4em
      \hskip -4em
      {\small\color{structure.fg} \textsf{#1}}
%      \ifmicrotoc
%      \else
      \nobreak\normalsize\normalfont
     \hfill
     \nobreak
     \rlap{\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}}%
%     \fi
      \par
    \endgroup
  }
\def\subsectionnumberline#1{\hb@xt@\@tempdima{\small\sffamily#1\hfil}}

\renewcommand*\l@subsection[2]{\@tempdima=4em%
    \begingroup
      \parindent \z@
      \leavevmode
      \advance\leftskip4em
      \rightskip\@pnumwidth plus1fil
      \hskip -4em
      \let\numberline\subsectionnumberline
      #1
%     \ifmicrotoc
%      \else
      \nobreak\normalsize\normalfont
     \leaders\hbox{$\m@th
       \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
       mu$}\hfill
     \nobreak
     \rlap{\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}}%
%     \fi
      \par
    \endgroup}
\let\l@chapterstar\l@subsection  
\def\toclevel@chapterstar{1}
\renewcommand*\l@subsubsection[2]{}
\newenvironment{learning targets}
{
  \begin{frame}
    \ifodd\c@page%
    \else%
    \hskip-4.75cm
    \fi
  \noindent\begin{minipage}[t]{8cm}
    \section*{\textcolor{structure.fg}{\translate{Kompetenzen}}}
    \medskip
    \begin{enumerate}
      \raggedright
}
{
  \end{enumerate}
\end{minipage}\qquad\textcolor{gray}{\vrule width.4pt}\qquad
  \rlap{
  \begin{minipage}[t]{8cm}
    \section*{\textcolor{structure.fg}{\translate{Inhalte dieses Vortrags}}}
    \raggedright
    \the\microtoc%
  \end{minipage}}
\vskip2em
    \refstepcounter{framenumber}%
  \end{frame}
}
}


% Microtocs

\mode<article>
{
\def\chaptertext{chapter}
\def\chapterstartext{chapterstar}
\def\parttext{part}
\newtoks\microtoc
\newif\ifmicrotoc
{
  \def\contentsline#1#2#3#4{%
    \extractchapter{#1}{#2}{#3}{#4}#4..\relax%
  }
  \def\extractchapter#1#2#3#4#5.#6.#7\relax{%
    \def\test{#1}%
    \ifx\test\chaptertext%
    \else%
    \ifx\test\chapterstartext%
      \else%
        \ifx\test\parttext%
        \else%
        \expandafter\global\expandafter\microtoc\expandafter{%
        	\the\microtoc\filteredcontentsline{#1}{#2}{#3}{#4}{#6}}
        \fi%
      \fi%
    \fi%
  }
  \@input{\jobname.toc}
}

\newcommand\filteredcontentsline[5]{%
  {
    \microtoctrue
    \ifnum#5=\c@chapter\relax%
      \contentsline{#1}{#2}{#3}{#4}%
    \fi%
  }
}
}


% Parts

\def\ddiparttext{part}

\def\part#1{%
  \clearpage
  \null\vskip4cm
  \refstepcounter{part}%
  \chapterstarmark{\partname\ \thepart}{#1}
  \addcontentsline{toc}{part}{\protect\numberline{\partname\ \thepart}#1}%
  \interlinepenalty \@M
  \normalfont{\raggedright
  \sffamily
  {\fontsize{36pt}{40pt}\selectfont{ \color{structure.fg} \partname\ 
  	 \thepart}\par
    \fontsize{24pt}{30pt}\selectfont#1\par}}
  \vskip2em
  \ifx\@currenvir\ddiparttext
    \parskip.75em plus 1pt minus 1pt
  \else
  \endpart
  \fi
}
\def\endpart{
  \clearpage%
}


% Table of Contents

\mode<article>
{
  \renewcommand\tableofcontents{%
    \begin{wide pages}
      \chapterstarmark{\contentsname}{}
      \twocolumn[
      \vskip2cm
      {\fontsize{36pt}{40pt} \sffamily\hilight{\contentsname}}\par
      \vskip2cm]
      \@starttoc{toc}%
    \end{wide pages}
    }
}


% List of proof methods

\newcommand\listofproofmethods{%
  \begin{wide pages}
  \parskip0pt%
  \chapterstarmark{Verzeichnis der Rezepte}{}
  \twocolumn[
  \vskip2cm
  {\fontsize{36pt}{40pt} \sffamily\hilight{Verzeichnis der Rezepte\par}}
  \vskip1cm]
  \@starttoc{lop}%
  \end{wide pages}
}

\newcommand\listofproofmethodsinline{%
  {
    \parskip0pt
    \@starttoc{lop}%
  }
}


% Discussion
\mode<article>
{
  \renewenvironment{lectureexercise@}[1][]{\begingroup
    \setlength{\marginparsep}{.5cm}%
    \setlength{\marginparwidth}{4cm}%
    \examplelike[#1]{\lineblock \translate{Zur Uebung}}}{
    \endexamplelike
    \endgroup}
  \renewenvironment{discussion@}[1][]{\begingroup
    \setlength{\marginparsep}{.5cm}%
    \setlength{\marginparwidth}{4cm}%
    \examplelike[#1]{\lineblock \translate{Zur Diskussion}}}{%
    	\endexamplelike\endgroup}
}

% Map

\newcommand\insertmap[1]{
  {
    \null
    \parskip0pt
    \setbox\mybox=\vbox{%
      \hsize=100cm\includegraphics[width=\paperheight-1.41cm,
      	height=\paperwidth-1cm,angle=90]{../map/#1-map.pdf}\hss%
    }
    \ht\mybox=0cm
    \wd\mybox=0cm
    \vskip-1.8cm
    \vskip-2.9\baselineskip
    \hbox{}
    \hskip-6cm
    \box\mybox
    \thispagestyle{empty}
    \clearpage
  }
}


% Summary

\newenvironment{summary}
{
  \only<article>{%
    \section*{\translate{Zusammenfassung dieses Vortrags}}
    \sectionstarmark{\translate{Zusammenfassung dieses Vortrags}}
  }
  \only<presentation>{
    \translatelet\temp{Zusammenfassung}
    \section*{\temp}
  }
  \begin{frame}[fragile,environment=summary]
    \frametitle<presentation>{\translate{Zusammenfassung}}
    \only<article>{\vskip-2.5\baselineskip\hbox{}}
}
{
  \end{frame}
}

\newenvironment<>{further reading}
{
  \mode<presentation>{\vfill}
  \def\refname{\translate{Zum Weiterlesen}}
  \actionenv#1
  \begin{thebibliography}{10}
    \setbeamertemplate{bibliography item}[book]
}
{
\end{thebibliography}
\endactionenv
}

\newenvironment{bibitem comments}
{
  \begin{onlyenv}<article>
    \par\medskip
    \small
}
{
  \par\medskip
  \end{onlyenv}
}


\newenvironment<>{summary item}[1]{\actionenv#2\block{\only<article>{%
	\ddibordericon{{\ddiborderpointer}}}#1}}{\endblock\endactionenv}

% Exercise frame

\newif\ifmulti

\pgfkeys{/ddi/minutes/.initial=5}
\pgfkeys{/ddi/multiple exercises/.is if=multi}

\newenvironment{exercise frame}[1][]
{
  \pgfkeys{/ddi/.cd,#1}
  \begin{frame}[fragile=singleslide]
    \frametitle<presentation>{\pgfkeysvalueof{/ddi/minutes}\ifmulti\translate{%
    	Minuten-Aufgaben}\else\translate{Minuten-Aufgabe}\fi}
    \only<article>{\vskip-2.5\baselineskip\hbox{}}%
    \ifmulti\else%
      \begin{lecture exercise}%
    \fi%
    \ignorespaces%    
}
{
    \ifmulti\else%
      \end{lecture exercise}%
    \fi%
  \end{frame}
}

\newenvironment{discussion frame}[1][]
{
  \pgfkeys{/ddi/.cd,#1}
  \begin{frame}[fragile=singleslide]
    \only<presentation>{\frametitle{\translate{Zur Diskussion}: 
    	\pgfkeysvalueof{/ddi/name}}\pgfkeys{/ddi/title=}}
    \only<article>{\vskip-2.5\baselineskip\hbox{}}%
    \only<article>{\begin{discussion}}%
    \ignorespaces%    
}
{
    \only<article>{\end{discussion}}%
  \end{frame}
}


% New frame numbering

\mode<article>{\renewcommand\insertframenumber{%
	\ifonelecture
		\@arabic\c@framenumber\ von \inserttotalframenumber
	\else
		\insertshortlecture-\@arabic\c@framenumber
	\fi
	}
}
\mode<presentation>{%
	\renewcommand\insertframenumber{%
		\ifonelecture
			\@arabic\c@framenumber\ von \inserttotalframenumber
		\else
			\beamer@shortlecturename-\@arabic\c@framenumber
		\fi
	}
}
%\mode<presentation>{\renewcommand\insertframenumber{6-\@arabic\c@framenumber}}
%\mode<presentation>{\renewcommand\insertframenumber{7-\@arabic\c@framenumber}}
\mode<article>{\def\name@of@slide{framenumber}} % shut up hyperref



% Beamer version theme settings

\useoutertheme[height=0pt,width=2cm,right]{sidebar}
\ifcd
\else
\usecolortheme{rose,sidebartab}
\useinnertheme{circles}
\fi

\definecolor{websitebg}{rgb}{0.8509,0.8509,0.8784}
\ifcd\else\setbeamercolor{sidebar right}{bg=websitebg}\fi
\setbeamercolor{structure}{fg=orange!80!red}
\ifcd
%  \setbeamercolor{sidebar right}{bg=oceangreen!3}
  \setbeamercolor{structure}{fg=oceangreen!65}
  \setbeamercolor{alerted text}{fg=oceangreen!50}
  \setbeamerfont{alerted text}{shape=\ifmmode\else\itshape\fi}
\fi
\setbeamercolor{author}{parent=structure}
\setbeamercolor{institute}{parent=structure,fg=blue!65}
\setbeamercolor{subtitle}{fg=black}

\ifcd
\setbeamerfont{title in sidebar}{size=\fontsize{6.5}{7}}
\setbeamerfont{chapter in sidebar}{size=\fontsize{6.5}{7}}
\setbeamerfont{slide in sidebar}{size=\fontsize{6.5}{7}}
\setbeamerfont{sidebar}{size=\fontsize{5}{5.25}}
\setbeamerfont{section in sidebar}{size=\fontsize{5}{5.5}}
\setbeamerfont{subsection in sidebar}{size=\fontsize{4.5}{5}}
\setbeamercolor{section in sidebar shaded}{use=section in sidebar,
	fg=section in sidebar.fg}
\setbeamercolor{subsection in sidebar shaded}{use=subsection in sidebar,
	fg=subsection in sidebar.fg}

\setbeamertemplate{subsection in sidebar}
{%
  \beamer@sidebarformat{3pt}{subsection in
    sidebar}{\leavevmode\llap{\fontsize{3.75}{3.75}%
    	\selectfont$\blacktriangleright$ }\insertsubsectionhead}%
}

\setbeamertemplate{subsection in sidebar shaded}
{%
  \beamer@sidebarformat{3pt}{subsection in sidebar shaded}{%
  	\insertsubsectionhead}%
}


\setbeamertemplate{section in sidebar}
{%
  \vbox{%
    \vskip.75em%
    \beamer@sidebarformat{3pt}{section in
      sidebar}{\leavevmode\llap{\fontsize{4.5}{5}\selectfont \insertshortlecture.\insertsectionheadnumber\
        \ }\insertsectionhead~{\color{black}\fontsize{3.75}{3.75}\selectfont$\blacktriangleleft$}}%
  }%
}

\setbeamertemplate{section in sidebar shaded}
{%
  \vbox{%
    \vskip.75em%
    \beamer@sidebarformat{3pt}{section in sidebar
      shaded}{\leavevmode\llap{\fontsize{4.5}{5}\selectfont\insertshortlecture.\insertsectionheadnumber\
        \ }\insertsectionhead~\phantom{{\fontsize{3.75}{3.75}\selectfont$\blacktriangleleft$}}}%
  }%
}


\else
\setbeamerfont{title in sidebar}{series=\bfseries}
\setbeamerfont{slide in sidebar}{size=\scriptsize}
\fi

\setbeamerfont{title}{series=\normalfont,size=\LARGE}
\setbeamerfont*{item}{series=}
\ifcd
\setbeamerfont{frametitle}{size=\large}
\setbeamerfont{info in title}{size=\scriptsize}
\setbeamercolor{info in title}{parent=structure}
\else
\setbeamerfont{frametitle}{size=}
\setbeamerfont{info in title}{size=\scriptsize}
\setbeamercolor{info in title}{parent=structure}
\fi
\ifcd\setbeamerfont{block title}{size=\normalsize}\else\setbeamerfont{block title}{size=\small}\fi
\setbeamerfont{subtitle}{size=\normalsize,series=\normalfont}

\setbeamerfont{subtitle}{size=\normalsize,series=\normalfont}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{bibliography item}[book]

\ifcd
\else
\pgfdeclarehorizontalshading{mytransition}{\the\paperheight}{color(0cm)=(white); color(1.5mm)=(websitebg)}

\setbeamertemplate{background canvas}
{\hskip\paperwidth\hskip-2.14cm\pgfuseshading{mytransition}}
\fi

\def\insertlogo{}

\def\setupsidebar{
\setbeamertemplate{sidebar right}
{
  \ifcd
  {
    \vskip2.6em%
    \usebeamerfont{chapter in sidebar}%
    \hskip3pt%
  \translate{Vortrag}~\insertshortlecture\par}
  \fi
  {\usebeamerfont{title in sidebar}%
    \ifcd\vskip1pt\else\vskip1.5em\fi%
    \hskip3pt%
    \usebeamercolor[fg]{title in sidebar}%
    \ifcd
    \insertshorttitle[width=2cm-6pt,left,respectlinebreaks]
    \else
    \insertshorttitle[width=2cm-6pt,center,respectlinebreaks]\fi\par%
\ifcd\vskip.75em\else    \vskip1.25em\fi
  }%
\ifcd\else  {%
    \hskip3pt%
    \usebeamercolor[fg]{author in sidebar}%
    \usebeamerfont{author in sidebar}%
    \ifcd
    \insertshortauthor[width=2cm-6pt,left,respectlinebreaks]
    \else
    \insertshortauthor[width=2cm-2pt,center,respectlinebreaks]\fi\par%
    \vskip1.25em%
  }\fi%
  \ifcd\else\hbox to2cm{\hss\insertlogo\hss}
  \vskip1.25em\fi%
  \insertverticalnavigation{2cm}%
  \ifcd\vskip2em\else\vfill\fi
	\hbox to 2cm{\hfill\insertshortinstitute\hskip 2.5pt}
	\vskip3pt

  \hbox to 2cm{\hfill\normalfont\strut\usebeamerfont{slide in sidebar}\insertframenumber\hskip5pt}%
  \vskip3pt%
	\hbox to 2cm{\hfill\insertCC\hskip 2.5pt}
	\vskip3pt
}%
}
\setupsidebar

\setbeamertemplate{title page}
{
  \vbox{}
	\ifcd\vskip-5mm\leavevmode\hbox{\hskip-3mm}%\includegraphics[scale=0.25]{hglion.pdf}}%
%  \hfill{}
%  \includegraphics[scale=0.25]{hglion.pdf}
\par
  \leftskip3mm\else
  \vskip1em\fi
  {\huge \translate{Vortrag} \insertshortlecture\par}
  {\usebeamercolor[fg]{title}\usebeamerfont{title}\inserttitle\par}%
  \ifx\insertsubtitle\@empty%
  \else%
    \vskip0.25em%
    {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
  \fi%     
  \vskip4pt\par
  {\usebeamerfont{info in title} \translate{Vortrag}
    {\usebeamercolor[fg]{info in title}\lecturename} \hbox{\translate{vom}
      \insertdate}%
      \vfill
      \begin{tiny}
       %\versionsinfo
							Quellen: \url{\inserturl}
      \end{tiny}
      \vfill
      \ifcd\hbox{\translate{ von}
      {\usebeamercolor[fg]{info in title}\insertauthor}}\fi}\par
  \ifcd\else\vskip6em
  {\usebeamercolor[fg]{author}\insertauthor}\par\fi
  \ifcd\vskip1em
  {\scalebox{2}{\hbox{\insertlogo}}}
  \vskip0pt plus1filll\else
	{\usebeamercolor[fg]{institute} \insertinstitute}\vskip1em\fi
}


\pgfdeclareimage[width=2cm]{logo}{}%../../planning/logo}
\logo{
	%\pgfuseimage{logo}
}
\ifcd

\setbeamertemplate{section in toc}
{\leavevmode\leftskip=3em\rlap{\hskip-3em\insertshortlecture.\inserttocsectionnumber}\inserttocsection\par}
\setbeamertemplate{subsection in toc}
{\leavevmode\leftskip=3em\rlap{\hskip-3em\insertshortlecture.\inserttocsectionnumber.\inserttocsubsectionnumber}\inserttocsubsection\par}
\else

\setbeamertemplate{enumerate item}
{
  \usebeamerfont*{item projected}%
  \usebeamercolor[bg]{item projected}%
  \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
    \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
    \pgfusepath{fill}
    \pgftext[base]{\color{fg}\insertenumlabel}
  \end{pgfpicture}%
}

\setbeamertemplate{enumerate subitem}
{
  \usebeamerfont*{subitem projected}%
  \usebeamercolor[bg]{subitem projected}%
  \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
    \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
    \pgfusepath{fill}
    \pgftext[base]{\color{fg}\insertsubenumlabel}
  \end{pgfpicture}%
}

\setbeamertemplate{enumerate subsubitem}
{
  \usebeamerfont*{subsubitem projected}%
  \usebeamercolor[bg]{subsubitem projected}%
  \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
    \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
    \pgfusepath{fill}
    \pgftext[base]{\color{fg}\insertsubsubenumlabel}
  \end{pgfpicture}%
}


\setbeamertemplate{section in toc}
{\leavevmode\leftskip=1em%
  \llap{%
    \usebeamerfont*{section number projected}%
    \usebeamercolor{section number projected}%
    \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
      \color{bg}
      \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
      \pgfusepath{fill}
      \pgftext[base]{\color{fg}\inserttocsectionnumber}
    \end{pgfpicture}\kern0.6em%
  }%
  \inserttocsection\par}
\fi

\alt<presentation>{
  \newenvironment{under construction}{}{}
}
{
\newenvironment{under construction}{
  \underconstructiontrue
  \marginpar{%
    \color{red}%
    \hrule width 1cm height 1.6pt%
    \vskip1pt
    \hrule width 1cm height .8pt%
    \vskip1pt
    \hrule width 1cm height .4pt%
    \vskip1pt
    \hbox to 1cm{\hss$\downarrow$\hss}
    \hbox to 1cm{\hss\scriptsize\sffamily\strut in Arbeit\hss}
  }
  \vskip1em
}
{
  \marginpar{%
    \color{red}%
    \hbox to 1cm{\hss$\uparrow$\hss}%
    \vskip1pt
    \hrule width 1cm height .4pt%
    \vskip1pt
    \hrule width 1cm height .8pt%
    \vskip1pt
    \hrule width 1cm height 1.6pt%
  }
  \vskip1em
  \global\underconstructionendedonthispagetrue%
}
}

% Article version layout settings

\mode<article>

\def\ddimarginmark#1{%
  % Put a mark on both sides (one will be correct...)
  \par\noindent\leavevmode%
  \llap{\textcolor{gray}{\ddiputinbox{#1}}\hskip\marginparsep}%
  \rlap{\hskip\textwidth\hskip\marginparsep\textcolor{gray}{\ddiputinbox{#1}}}%
}

\def\ddiputinbox#1{%
  \scriptsize\sffamily%
  \setbox\marginbox=\hbox to1cm{\hfil%
  \begin{minipage}[t]{1cm}%
    \leftskip0pt plus 1fill\relax%
    \rightskip0pt plus 1fill\relax%
    #1%
  \end{minipage}\hfil%
  }%
  \dp\marginbox=0pt%
  \box\marginbox%
}
\newbox\marginbox

\setbeamertemplate{frame begin}{%
  \def\@currentlabel{\insertframenumber}%
  \avoidwiddow{2cm}{150}%
  \par\vskip\medskipamount\penalty-100%
  \ddimarginmark{\insertframenumber}\ignorespaces%
}
\setbeamertemplate{frametitle}{%
  \unskip{%
    \raggedright%
    \normalsize\selectfont\noindent%
    \textsf{%
      \ifcd\color{structure.fg}\fi
      \insertframetitle%
      \ifx\insertframesubtitle\@empty%
      \else%
        \hfil\break\small\textcolor{structure.fg}{\insertframesubtitle}%
      \fi%
    }\par%
  }\noindent\expandafter\ignorespaces
}

\setbeamertemplate{frame end}{%
  \par
}
\setlength{\marginparwidth}{1cm}
\setlength{\marginparsep}{5cm}


\renewcommand\maketitle{
  \par
  \thispagestyle{onlypagenumber}
  \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}\insertlecture}
  \null
  \ifodd\c@page%
  \else%
  \leftskip-4.75cm
  \fi
  \chapterlikeheadline{\translate{Vortrag} \insertshortlecture}{\insertlecture}{\insertsubtitle\newline\newline
  \begin{footnotesize}
   \versionsinfo 
  \end{footnotesize}
  }
}

\renewenvironment{titlepage}{\clearpage\null}{\vfill\vfill\clearpage}
\newcommand\maintitle{
  \thispagestyle{empty}
  {%
    \rightskip-4cm plus 1fil\relax%
    \leftskip6.5mm\relax%
    \vskip-2.2cm
		\leavevmode\hbox{\hskip-1.2cm{}%\includegraphics[scale=0.35]{hglion.pdf}%
			\hskip4cm{}\scalebox{3.2}{}%\ddiLogo}%
\hskip5cm{}\vskip1cm%\includegraphics[scale=0.4]{ddi_qr_url.pdf}}\vskip1cm
%      {\vskip-2.75cm{}\hskip16.5cm{}\qrcode[height=2.5cm]{http://ddi.uni-wuppertal.de/}}}\vskip1cm
    \sffamily
    {\fontsize{48pt}{48pt}\selectfont \translate{Skript} \par\vskip6pt}
    {\fontsize{36pt}{44pt}\selectfont \color{structure.fg}
      \lecturename\par\vskip8pt}
    {\fontsize{24pt}{28pt}\selectfont \color{black} \insertsemester\vskip6pt\par}
    {\normalsize Fassung vom \today}
    \vskip3em\par
    \large
    {\color{structure.fg}\@author}\par
    \vfill
  }
}


\def\thesection{\insertshortlecture.\the\c@section}
\def\thesubsection{\insertshortlecture.\the\c@section.\the\c@subsection}

\def\sectionmarktext#1{%
  \typesetheadlinemain{%
    \hbox to3em{\ \ \insertshortlecture\hss}\quad\insertlecture\\[1pt]%
    \hbox to3em{\ \ \thesection\hss}\quad#1%
  }%
}

\def\sectionstarmarktext#1{%
  \typesetheadlinemain{%
    \hbox to3em{\ \ \insertshortlecture\hss}\quad\insertlecture\\[1pt]%
    \hbox to3em{\ \ \hss}\quad#1%
  }%
}

\def\chapterstarmarktext#1#2{%
  \typesetheadlinemain{%
    \quad#1\\[1pt]%
    \hbox{}\quad#2%
  }%
}

\def\sectionmark#1{%
  \markboth{\noexpand\sectionmarktext{#1}}{\noexpand\sectionmarktext{#1}}%
}

\def\sectionstarmark#1{%
  \markboth{\noexpand\sectionstarmarktext{#1}}{\noexpand\sectionstarmarktext{#1}}%
}

\def\chapterstarmark#1#2{%
  \markboth{\noexpand\chapterstarmarktext{#1}{#2}}{\noexpand\chapterstarmarktext{#1}{#2}}%
}

\def\ps@onlypagenumber{
  \def\@oddhead{\rightbgbar{4.6cm}\setupheadcolor\typesetheadlinemain{\hbox to3em{\ \
        \insertshortlecture\hss}\quad\insertlecture\\}%
    \hfill\oddouterborder}
  \def\@evenhead{\leftbgbar{4.6cm}\setupheadcolor\evenouterborder\typesetheadlinemain{\hbox to3em{\ \ \insertshortlecture\hss}\quad\insertlecture\\}}
}

\def\@oddfoot{}
\def\@evenfoot{}

\newif\ifunderconstruction
\newif\ifunderconstructionendedonthispage




\def\typesetheadlinemain#1{%
  \smash{%
    \sffamily\normalsize%
    \fboxsep=3pt%
    \colorbox{head.bg}{\vrule height15pt depth1pt width0pt%
      \smash{\hbox to \textwidth{%
        \hss{%
          \fontsize{7}{8}\selectfont%
          \hsize=\textwidth
          \vbox{%
            \textcolor{white}{#1}
          }%
        }%
      }}\hskip-6pt}}%
}

\def\typesetpagenumber{%
  \hbox to1cm{%
    \sffamily\normalsize%
    \hss%
    \fboxsep=3pt%
    \colorbox{head.bg}{%
      \vrule height15pt depth1pt width0pt%
      \raise4pt\hbox to 16pt{\hss\textcolor{white}{\thepage}\hss}}%
    \hss%
  }%
}

\def\setupheadcolor{%
  \ifunderconstruction\colorlet{head.bg}{red}\fi%
  \ifunderconstructionendedonthispage\colorlet{head.bg}{red}\fi%
  \global\underconstructionendedonthispagefalse%
}

\def\oddouterborder{\smash{\rlap{\rlap{\hskip-3pt\hskip2em\copy\fancypicturebox}\hskip\gapskip\typesetpagenumber}}}
\def\evenouterborder{\smash{\llap{\typesetpagenumber\hskip\gapskip\llap{\copy\fancypicturebox\hskip2em}}}}

\def\@oddhead{\rightbgbar{0pt}\setupheadcolor\rightmark\hfill\oddouterborder}
\def\@evenhead{\leftbgbar{0pt}\setupheadcolor\evenouterborder\leftmark}

\newdimen\extraheight
\extraheight=\paperheight
\advance\extraheight by 2cm

\pgfdeclarehorizontalshading{bgleft}{\extraheight}{color(0pt)=(black95); color(4pt)=(white)}
\pgfdeclarehorizontalshading{bgright}{\extraheight}{color(0pt)=(white);  color(4pt)=(black95)}


\def\leftbgbar#1{%
  \llap{%
    \setbox\mybox=\hbox{%
      \textcolor{black95}{\vrule width 7cm height \extraheight}%
      \pgfuseshading{bgleft}\hskip1em\hskip-2pt\hskip#1%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
  \rlap{%
    \hskip\textwidth%    
    \setbox\mybox=\hbox{%
      \hskip1em\hskip-2pt%
      \pgfuseshading{bgright}%
      \textcolor{black95}{\vrule width 2cm height \extraheight}%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
}


\def\rightbgbar#1{%
  \llap{%
    \setbox\mybox=\hbox{%
      \textcolor{black90}{\vrule width 2cm height \extraheight}%
      \pgfuseshading{bgleft}\hskip1em\hskip-2pt%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
  \rlap{%
    \hskip\textwidth%    
    \setbox\mybox=\hbox{%
      \hskip#1\hskip1em\hskip-2pt%
      \pgfuseshading{bgright}%
      \textcolor{black90}{\vrule width 7cm height \extraheight}%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
}

% Cannot print this:
\def\leftbgbar#1{}
\def\rightbgbar#1{}

\def\insertsubtitle{}

\newenvironment{frontmatter}
{
  \pagenumbering{roman}
}
{
  \cleardoublepage
  \pagenumbering{arabic}
}


% Fancy mini pictures

\newbox\fancypicturebox
\newcommand\fancypictures[1]{%
  \global\setbox\fancypicturebox=\hbox{#1}}

\let\ddi@fancy@other@option=\@empty
\let\ddi@fancy@filename=\@empty
\def\ddi@fancy@view@lx{0}
\def\ddi@fancy@view@ly{0}
\def\ddi@fancy@view@ux{25}
\def\ddi@fancy@view@uy{25}
\newif\ifddi@fancy@size@set

\pgfkeys{/ddi/fancypicture/extra options/.store in=\ddi@fancy@other@option}
\pgfkeys{/ddi/fancypicture/x/.code={%
  \pgfmathparse{#1}%
  \let\ddi@fancy@view@lx=\pgfmathresult%
}}
\pgfkeys{/ddi/fancypicture/y/.code={%
  \pgfmathparse{#1}%
  \let\ddi@fancy@view@ly=\pgfmathresult%
}}
\pgfkeys{/ddi/fancypicture/size/.code={%
  \pgfmathparse{\ddi@fancy@view@lx+#1}%
  \let\ddi@fancy@view@ux=\pgfmathresult%
  \pgfmathparse{\ddi@fancy@view@ly+#1}%
  \let\ddi@fancy@view@uy=\pgfmathresult%
  \ddi@fancy@size@settrue}%
}
\pgfkeys{/ddi/fancypicture/filename/.store in=\ddi@fancy@filename}

\newcommand\fancypicture[1][]{%
  {\ddi@fancy@size@setfalse%
    \pgfkeys{/ddi/fancypicture/.cd,#1}%
  \edef\ddi@marshal{\noexpand
  \includegraphics[
    clip,height=50pt,width=50pt, % angepasst -- ursprünglich 22 x 22, lh
    \ifddi@fancy@size@set viewport=\ddi@fancy@view@lx\space\ddi@fancy@view@ly\space\ddi@fancy@view@ux\space\ddi@fancy@view@uy,\fi%
    \ddi@fancy@other@option]
    {\ddi@fancy@filename}}%
  \lower4pt\hbox{\ddi@marshal}%
  }\ignorespaces
}

\mode
<all>

\mode<presentation>{\def\fancypictures#1{}}


\mode<article>

% Bibliography
\renewenvironment{thebibliography}[1]
     { 
%\begin{comment}
%\subsection*{\refname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
%\end{comment}

\mode
<all>


% Lectures in article mode

\mode
<article>
{
  \renewcommand\lecture[3][]{
    \clearpage
    \gdef\insertlecture{#2}
    \gdef\insertshortlecture{#1}
    \refstepcounter{chapter}
    \setcounter{framenumber}{0}%
    \label{#3}%
  }
  \renewcommand\thechapter{\insertshortlecture}
}


% Chapters like Introdcution

\def\chapter#1{
  \clearpage
  \null
  \addcontentsline{toc}{chapterstar}{#1}
  \ifodd\c@page%
  \else%
  \leftskip-4.75cm
  \fi
  \chapterlikeheadline{#1}{}{}
  \chapterstarmark{#1}{}
}



% New useful definitions:

\newcommand\ddiborderpicture[1]{%
  \hbox{}\par%
  {%
    \setlength{\marginparsep}{2em}%
    \setlength{\marginparwidth}{5cm-2em}%
    \ddibordercommentpicture{#1}%
    \par%
    \vskip-\baselineskip%
  }
  \ignorespaces%
}

\newcommand\ddibordercommentpicture[1]{%
  \marginpar{\begin{minipage}[t]{4cm}\small\raggedright\hrule
      width0pt\par\vskip-4pt\par%
      \color{black!50}\scriptsize\sffamily\tikzset{every picture/.append style={black,font=\small}}#1\end{minipage}}%
}


\newcommand\includegraphicscopyrightborder[3][]{%
  \hbox{}\par%
  {%
    \setbox\mytempbox=\hbox{\includegraphicscopyright[#1]{#2}{#3}}%
    \setlength{\marginparsep}{2em}%
    \setlength{\marginparwidth}{\wd\mytempbox}%
    \marginpar{\leavevmode\raise\baselineskip\hbox{\lower\ht\mytempbox\box\mytempbox}}%
    \par%
    \vskip-\baselineskip%
  }
  \ignorespaces%
}

\newcommand\includegraphicscopyrightborderautowidth[3][]{%
  \includegraphicscopyrightborder[#1,width=4cm]{#2}{#3}
}
\only<presentation>{
  \let\includegraphicscopyrightborder=\includegraphicscopyright
  \let\includegraphicscopyrightborderautowidth=\includegraphicscopyright
}



\only<presentation>{\newcommand\tafel{\hfill\beamergotobutton{Tafel}}}
\only<article>{\newcommand\tafel{\par\smallskip{\noindent (Details an der Tafel)}}}




% Regie

\mode<article>
{
\newenvironment{lecture notes only}[1][]{
\everythingsmaller
\par\bigskip
\noindent
\ddimarginmark{#1}%
\parskip.5em plus 1pt minus 1pt
\ignorespaces
}
{
\bigskip
}
}

\mode<beamer>
{
  \newenvironment{lecture notes
    only}[1][]{\bgroup\setbox0=\hbox\bgroup}
  {\egroup\egroup}
}

\newenvironment{lecture notes intro}
{\begin{lecture notes only}[\translate{Worum es heute geht}]\normalsize\ignorespaces}{\end{lecture notes only}}

\newenvironment{lecture notes reference}[1][]
{
  \par
  \mode<article>{#1}%
  \noindent%
  \ddimarginmark{\translate{Skript-Referenz}}%
  \everythingsmaller%
  \noindent%
  \ignorespaces%
  }{\bigskip}



% Exercises 
  
\newif\ifddiwideexercises

\mode<article>

\newenvironment{lecture exercises}
{
  \ifddiwideexercises
    \begin{wide pages}\twocolumn[]
    \fi
  \small
  \parskip=2pt plus 1pt minus 1pt
  {\def\thesection{}\let\@seccntformat=\@gobble\translatelet\mytemp{Uebungen zu diesem Vortrag}\section{\mytemp}}
  \sectionstarmark{\translate{Uebungen zu diesem Vortrag}}
}
{
  \ifddiwideexercises
  \end{wide pages}
  \fi
}

\newenvironment{exam exercises}
{  \parskip=2pt plus 1pt minus 1pt\avoidwiddow{3cm}{550}\subsection*{\translate{Pruefungsaufgaben zu
				diesem Vortrag}}
}
{}

\newcommand\appendixchapter[3]
{
  \clearpage
  \parskip=2pt plus 1pt minus 1pt
  \null
  \chapterlikeheadline{Anhang}{#1}{#2}
  \chapterstarmark{Anhang}{#3}
  \addcontentsline{toc}{subsection}{#3}
}

\newenvironment{lecture solutions}
{
  \appendixchapter{Lösungen}{Beispiellösungen zu ausgewählten Übungsaufgaben}{Lösungen zu ausgewählten Übungsaufgaben}
}
{}


\renewcommand\appendix{
  \clearpage
  \chapterstarmark{Anhang}{}
  \addcontentsline{toc}{part}{\protect\numberline{Anhang}}
}


\pgfkeys{
  /ddi/exercise/@credits/ignore/.initial=yes,
  /ddi/exercise/how/ignore/.initial=yes,
  /ddi/exercise/time/ignore/.initial=yes,
  /ddi/exercise/bonus/ignore/.initial=yes,
  /ddi/every exercise/.code=\everythingsmaller,
  /ddi/every solution/.code=\everythingsmaller}

\newcounter{exercisenumber}[chapter]
\renewcommand{\theexercisenumber}{\insertshortlecture.\the\c@exercisenumber}

\renewcommand\insertexercisetext{\translate{Uebung}}

\newcommand\everythingsmaller{%
\small%
\def\@listI{\leftmargin\leftmargini
  \parsep 0pt
  \topsep 3\p@   \@plus2\p@ \@minus3\p@
  \itemsep0pt}%
\let\@listi=\@listI%
\def\@listii{\leftmargin\leftmarginii
  \parsep 0pt
  \topsep 3\p@ \@plus2\p@ \@minus3\p@
  \itemsep0pt}%
\lstset{%
    basicstyle=\ttfamily\footnotesize,
}%
}


\mode
<all>




% Sorting sparklines

\colorlet{varcolor1}{orange!80!red}
\colorlet{varcolor2}{blue}
\colorlet{varcolor3}{violet!70}
\colorlet{varcolor4}{red}
\colorlet{varcolor5}{green!50!black}

\pgfkeys{/algolab/sorting/seq/.code={\global\algolabseq#1\relax}}
\pgfkeys{/algolab/sorting/max value/.initial=5}
\pgfkeys{/algolab/sorting/num values/.initial=5}
\pgfkeys{/algolab/sorting/num vars/.initial=2}
\pgfkeys{/algolab/sorting/compare/.code args={#1 and #2}{\def\possiblecompare{\showcompare{#1}{#2}}}}
\pgfkeys{/algolab/sorting/swap/.code args={#1 and #2}{\def\possibleswap{\showswap{#1}{#2}}}}

\def\possiblecompare{}
\def\possibleswap{}

\def\showcompare#1#2{
  \draw[red!50,very thick,line join=round]
  (\csname algolabvalue#1\endcsname,#1) -- (\pgfkeysvalueof{/algolab/sorting/max value}+2,#1)
  -- (\pgfkeysvalueof{/algolab/sorting/max value}+2,#2) -- (\csname algolabvalue#2\endcsname,#2);
}
\def\showswap#1#2{
  \coordinate (s1) at (\csname algolabvalue#1\endcsname,#1);
  \coordinate (s2) at (\pgfkeysvalueof{/algolab/sorting/max value},#1);
  \coordinate (t1) at (\csname algolabvalue#2\endcsname,#2);
  \coordinate (t2) at (\pgfkeysvalueof{/algolab/sorting/max value},#2);
  \draw[red,very thick,line join=round]
     (s1) -- ([shift={(0.5,0)}]s2) -- ([shift={(1.5,0)}]t2) -- ([shift={(2,0)}]t2) --
     ([shift={(2,0)}]s2)  --  ([shift={(1.5,0)}]s2) -- ([shift={(0.5,0)}]t2) -- (t1);
}

\pgfkeys{/algolab/sorting/offset/.code args={#1=#2}{\pgfkeysalso{/algolab/sorting/vars/offsets/#1/.initial=#2}}}

\pgfkeys{/algolab/sorting/vars/.initial=}
\pgfkeys{/algolab/sorting/@show vars/phantom/.code=\advance\algolabsortingcount by 1\relax}
\pgfkeys{/algolab/sorting/@show vars/.unknown/.code=
  {
    {
      \colorlet{current}{varcolor\the\algolabsortingcount}
      \let\name=\pgfkeyscurrentname
      \let\value=\pgfkeyscurrentvalue
      \pgfkeysifdefined{/algolab/sorting/vars/offsets/\name}
      {\pgfkeysgetvalue{/algolab/sorting/vars/offsets/\name}{\offset}}{\def\offset{0}}
      \@tempcnta=\value\relax
      \advance\@tempcnta by\offset\relax
      \edef\pos{\the\@tempcnta}
      \node [current] (x) at (-1*\pgfkeysvalueof{/algolab/sorting/num vars}-2,2*\algolabsortingcount-2)
      [anchor=mid east,inner sep=1pt]
      {\scriptsize{$\mathit{\name}=\value$}}; 
      \draw [current,semithick] (x.mid east) --
      ++(\pgfkeysvalueof{/algolab/sorting/num vars}-\the\algolabsortingcount+1,0) -- (-1.5,\pos) -- (0,\pos);
      \algolabsortline[current]{\csname algolabvalue\pos\endcsname}{\pos}
    }
    \advance\algolabsortingcount by 1\relax
  }
}
\pgfkeys{/algolab/sorting/values/.initial=0}
\newcount\algolabsortingcount
\newcount\algolabvarnum


\newcommand\algolabsortline[3][]{
  \ifnum#2<0\relax
  \else
    \draw[black!50,line width=.75ex,#1] ([xshift=-0.4pt]0,#3) -- (#2,#3);
  \fi
}

\newcount\algolabseq
\newenvironment{sorting example}[1][]
{
  \global\algolabseq=0\relax
  \pgfkeys{/algolab/sorting/.cd,#1}
}
{}

\newcommand\sortsparkline[1]{%
  \global\advance\algolabseq by1\relax%
  \begin{tikzpicture}[x=.725ex,y=-1ex,join=round]
    \pgfkeys{/algolab/sorting/.cd,#1}
    \path (\pgfkeysvalueof{/algolab/sorting/max value}+3,0);
%    \fill[blue!20]
%      (-10-\pgfkeysvalueof{/algolab/sorting/num vars},-3) rectangle
%      (\pgfkeysvalueof{/algolab/sorting/max value}+3,\pgfkeysvalueof{/algolab/sorting/num values});

%    \fill[blue!20]
%      (-10-\pgfkeysvalueof{/algolab/sorting/num vars},-3) rectangle
%      (\pgfkeysvalueof{/algolab/sorting/max
%        value}+3,\pgfkeysvalueof{/algolab/sorting/num vars}*2-1);

%    \path ([yshift=-2mm]current bounding box.south);

    \tikzset{slide=\the\algolabseq}
%    \node[tiny numbering,below right] at
%    (-9.5-\pgfkeysvalueof{/algolab/sorting/num vars},-2.5) {\the\algolabseq};
      
    \pgfkeysgetvalue{/algolab/sorting/values}{\values}
    \algolabsortingcount=0\relax%
    \expandafter\foreach\expandafter \i\expandafter i\expandafter n\expandafter {\values}
    {
      \algolabsortline{\i}{\algolabsortingcount}
      \expandafter\xdef\csname algolabvalue\the\algolabsortingcount\endcsname{\i}
      \global\advance\algolabsortingcount by 1\relax
    }

    \pgfkeysgetvalue{/algolab/sorting/vars}{\vars}

    \possiblecompare
    \possibleswap
    
    \algolabsortingcount=1\relax%
    \pgfkeys{/algolab/sorting/@show vars/.cd,/utils/exec=\expandafter\pgfkeysalso\expandafter{\vars}}
  \end{tikzpicture}%
  \hfil\penalty0\hfilneg\hskip1mm\ignorespaces
  % 
}



% Typesetting memory models

\newcount\ddimemoryline

\newenvironment{object}[1]
{
  \def\objectname{#1}
  \ddimemoryline=0\relax
  \lstset{basicstyle=\scriptsize\ttfamily}
  \tikzset{@kind/.style=memory}
  \scope
}
{
  \endscope
}

\newenvironment{variables}[1]
{
  \def\objectname{#1}
  \ddimemoryline=0\relax
  \lstset{basicstyle=\scriptsize\ttfamily}
  \tikzset{@kind/.style=var,y=.5cm}
  \scope
}
{
  \endscope
}

\def\attribute#1 #2=#3;{%
  \node [@kind,minimum height=4mm,text height=1mm,text depth=0pt,anchor=base west] (\objectname-#2) at (0,-1*\ddimemoryline) {\scantokens{\javacode|#3|}};
  \node [text height=1mm,text depth=0pt,minimum height=4mm,anchor=base east] at (0,-1*\ddimemoryline) {\javacode|#1 #2|};
  \advance\ddimemoryline by 1\relax
}


% Bars

\pgfdeclareverticalshading{ddibar}{\textwidth}{
  color(0pt)=(white);
  color(1.5pt)=(structure.fg!50);
  color(3pt)=(white)}
  
\newcommand\articlebar{%
  \only<article>{\parskip=0pt\baselineskip=0pt\medskip%
  %\textcolor{structure.fg!50}{\hrule height1pt}%
  \par%
  \pgfuseshading{ddibar}
  \par\medskip}}
  

% Quotations

\mode<article>{
\renewenvironment{quotation}{
  \list{}{\small}\item
  \parindent0em
  \parskip.75em plus 1pt minus 1pt
  \ignorespaces
}
{\endlist}
}


% Rezepte

\newcount\proofcomments

\mode<article>{
  \newenvironment{commented proof}[1][\translate{Proof}]{
    \only<article>{\parskip.1em plus 1pt minus 1pt\proofcomments=0\relax}
    \proof[#1]%
      \setlength{\marginparsep}{2em}%
      \setlength{\marginparwidth}{5cm-2em}%
      \proofcomment[]{\textcolor{structure.fg}{Kommentare zum Rezept}}\noindent\ignorespaces%
  }
  {
    \endproof
  }
  \newcommand\proofcomment[2][\the\proofcomments]{%
    \def\temp{#1}\ifx\temp\pgfutil@empty\else%
    \advance\proofcomments by1\relax%
    \leavevmode\smash{$^{\hbox{\fontsize{6}{7}\selectfont\textcolor{black!50}{#1}}}$}\fi%
    \marginpar{\scriptsize\sffamily\raggedright\textcolor{black!50}{\llap{\smash{\raise 2.8pt\hbox{\tiny#1\ }}}#2}}%
  }%
  \newenvironment{commented definition}[1][]{
    \only<article>{\parskip.1em plus 1pt minus 1pt}
    \definition[#1]%
      \setlength{\marginparsep}{2em}%
      \setlength{\marginparwidth}{5cm-2em}%
      \par\definitioncomment[]{\textcolor{structure.fg}{Kommentare zur Definition}}\noindent\ignorespaces%
  }
  {
    \enddefinition
  }
  \newenvironment{commented paragraph}[1][]{
    \begingroup
      \setlength{\marginparsep}{2em}%
      \setlength{\marginparwidth}{5cm-2em}%
  }
  {
      \par
    \endgroup
  }
}
  
\mode<presentation>

\newenvironment{proof method}[1][]
{
  \pgfkeys{/ddi/proof method/.cd,#1}
  \begin{frame}[fragile=singleslide,t]
    \frametitle{Rezept: \emph{\textcolor{black}%
        {\pgfkeysvalueof{/ddi/proof method/title}}}}
    \begin{columns}[onlytextwidth]
      \column{\textwidth-2.5cm}
        \begin{block}{Ziel}
          \emph{\pgfkeysvalueof{/ddi/proof method/goal}}
        \end{block}
      \column{2cm}
        \vskip1mm
        %\includegraphics[width=1.5cm]{ddi-icon-kochmuetze.pdf}
      \end{columns}
      \begin{block}{Rezept}
}
{
        \end{block}
   \pgfkeysvalueof{/ddi/proof method/also on frame}   
\end{frame}
}


\newcommand\proofcomment[1]{\par{\leftskip0pt plus1fill\rightskip0pt\textcolor{black!50}{(#1)}\par}}
\newenvironment{commented proof}{\proof}{\endproof}
\newenvironment{commented definition}{\definition}{\enddefinition}




% Handling of seminar files

\mode<presentation>{\def\bodydir{.}}

\mode
<article>

\let\ddilecturelist\@empty

\def\InsertLectureAndExercises#1{
 \IfFileExists{../#1/body.bib}{
  \begin{refsection}[../#1/body.bib]
 }{
	\begin{refsection}
 }
   \def\bodydir{../#1}
   \g@addto@macro\ddilecturelist{\InputIfFileExists{../#1/solutions.tex}{}{}}
   \InputIfFileExists{../#1/body.tex}{}{}
   \InputIfFileExists{../#1/exercises.tex}{}{}
  \end{refsection} 
}

\def\InsertSolutions{%
  %\fancypictures{}
  \appendix
  \begin{lecture solutions}
    \ddilecturelist
  \end{lecture solutions}
}

\mode
<all>



\let\definitioncomment=\proofcomment


% Translations

\providetranslation[to=German]{Skript}{Skript}
\providetranslation[to=English]{Skript}{Notes}

\providetranslation[to=German]{DDI}{Fachgebiet Didaktik der Informatik}
\providetranslation[to=English]{DDI}{Department of Didactics of Informatics}

\providetranslation[to=German]{BUW}{\universitaet}
\providetranslation[to=English]{BUW}{\university}

%\providetranslation[to=German]{Vortrag}{Vortrag}
%\providetranslation[to=English]{Vortrag}{Talk}

\providetranslation[to=German]{Seminar -- Kompetenzen}{Seminar -- Kompetenzen}
\providetranslation[to=English]{Seminar -- Kompetenzen}{Seminar---Competencies}

%\providetranslation[to=German]{Inhalte dieses Vortags}{Inhalte dieses Vortrags}
%\providetranslation[to=English]{Inhalte dieses Vortrags}{Contents}

%\providetranslation[to=German]{Zusammenfassung dieses Vortrags}{Zusammenfassung dieses Vortrags}
%\providetranslation[to=English]{Zusammenfassung dieses Vortrags}{Summary for this Talk}

\providetranslation[to=German]{Zusammenfassung}{Zusammenfassung}
\providetranslation[to=English]{Zusammenfassung}{Summary}

\providetranslation[to=German]{Uebung}{Übung}
\providetranslation[to=English]{Uebung}{Problem}

\providetranslation[to=German]{Zur Uebung}{Zur Übung}
\providetranslation[to=English]{Zur Uebung}{Exercise}

\providetranslation[to=German]{Zur Diskussion}{Zur Diskussion}
\providetranslation[to=English]{Zur Diskussion}{Discussion}

\providetranslation[to=German]{Worum es heute geht}{Worum es heute geht}
\providetranslation[to=English]{Worum es heute geht}{Today's topic}

\providetranslation[to=German]{Zum Weiterlesen}{Zum Weiterlesen}
\providetranslation[to=English]{Zum Weiterlesen}{For Further Reading}

\providetranslation[to=German]{Kompetenzen}{Ziele}
\providetranslation[to=English]{Kompetenzen}{Ziele}

%\providetranslation[to=German]{Kompetenzen}{Kompetenzen}
%\providetranslation[to=English]{Kompetenzen}{Chapter---Competencies}

\providetranslation[to=German]{Gliederung}{Gliederung}
\providetranslation[to=English]{Gliederung}{Outline of Chapter}

%\providetranslation[to=German]{Vortrag}{Vortrag}
%\providetranslation[to=English]{Vortrag}{Talk}

\providetranslation[to=German]{ vom}{ vom}
\providetranslation[to=English]{ vom}{,}

\providetranslation[to=German]{ von}{ von}
\providetranslation[to=English]{ von}{ by}

\providetranslation[to=German]{Minuten-Aufgaben}{-Minuten-Aufgaben}
\providetranslation[to=English]{Minuten-Aufgaben}{-Minute Exercises}

\providetranslation[to=German]{Minuten-Aufgabe}{-Minuten-Aufgabe}
\providetranslation[to=English]{Minuten-Aufgabe}{-Minute Exercise}

\providetranslation[to=German]{Skript-Referenz}{Skript-\penalty0Referenz}
\providetranslation[to=English]{Skript-Referenz}{Lecture notes material}

ahilbig-script.sty0000644000175000001440000014044512505474625013572 0ustar  iorekusers% -*- coding: utf-8; -*-
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% (C)opyright A. Hilbig, mail@andrehilbig.de                                                       |
%             http://www.andrehilbig.de/Publications                                               |
%                                                                                                  | 
% diese Datei: ahilbig-script.sty                                                                  |
%                                                                                                  |
% Das Dokument steht unter der Lizenz: Creative Commons by-nc-sa Version 4.0                       |
% http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de                                         |
%                                                                                                  |
% Nach dieser Lizenz darf das Dokument beliebig kopiert und bearbeitet werden,                     |
% sofern das Folgeprodukt wiederum unter gleichen Lizenzbedingungen vertrieben                     |
% und auf die ursprünglichen Urheber verwiesen wird.                                               |
% Eine kommerzielle Nutzung ist ausdrücklich ausgeschlossen.                                       |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% HINWEISE/ERWEITERUNG                                                                             |
% Diese Pakete basieren auf den entsprechenden Paketen von Prof. Dr. Ludger Humbert                |
% (http://ddi.uni-wuppertal.de/ -- humbert@uni-wuppertal.de) und wurden zum Teil angepasst. Seine  |
% Pakete basieren wiederum auf Entwicklungen von Prof. Dr. Till Tantau                             |
% (http://www.tcs.uni-luebeck.de/de/mitarbeiter/tantau/). Beiden gilt mein Dank hierfür.           |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |

\ProvidesPackage{ahilbig-script}

\newif\ifcmmath
\DeclareOption{cmmath}{\cmmathtrue}
\newif\ifonelecture
\DeclareOption{onelecture}{\onelecturetrue}
\ProcessOptions

%\RequirePackage{caption}
%\RequirePackage{minitoc}
%\RequirePackage[draft]{ddi-common}
%\RequirePackage[blackandwhite]{ddi-common}
%\RequirePackage[cd]{ddi-common}
\RequirePackage{ahilbig-common}

\RequirePackage{ahilbig-semester}

%\RequirePackage[height=5cm,keepaspectratio,digitcolor=white,
%	backgroundcolor=none]{ddiLogo} % benutzt in Zeile 388

%\RequirePackage{chapterbib}

\RequirePackage{graphicx}
\RequirePackage{pifont}
\RequirePackage{ahilbig-comics}
\RequirePackage{wrapfig}
\RequirePackage{smartdiagram}
\RequirePackage{pdflscape}
\RequirePackage{placeins}

\RequirePackage{varsfromjobname} % Element[e] aus \jobname extrahieren
%\RequirePackage{qrcode}          % Wird in maintitle genutzt - auskommentiert

%\RequirePackage{pdfpages}

% Default lecture
\providecommand\insertshortlecture{0}
\providecommand\insertlecture{Vortrag}
\providecommand\lecturename{Vortragtitel}

\providecommand\versionsinfo{%
  %\textcolor{blue!50}{%
  % \begin{tabular}{ll}
  %  Version:         &\svnfilerev                                    \\ %\hline
  %  Stand:           &\svnfiletoday, \svnfilehour:\svnfileminute ~Uhr\\ %\hline
  %  Zuletzt bearbeitet von:&\svnFullAuthor{\svnfileauthor}  
  % \end{tabular}
  %}
}


\ifonelecture
	\RequirePackage{chngcntr}
	\counterwithout{figure}{chapter}
	\counterwithout{table}{chapter}
\fi

% Common packages
%
\usepackage{babel}
\mode<article>
{
  \usepackage[left=1.75cm,right=6.5cm,top=2.5cm,bottom=2cm,twoside,
  	a4paper]{geometry}
  \usepackage{fancyhdr}
  \setlength\columnsep{1.5cm}
}
%%\usepackage{hyperref}
\usepackage{calc}
\usepackage{tikz}
%\usepackage{yfonts}
\usepackage{translator}
\usepackage{amssymb}
\usetikzlibrary{scopes,backgrounds,positioning}

\usepackage[absolute]{textpos}
\usepackage{multimedia} 



\def\UrlFont{}

    
% Common settings for all lectures in this course

\title{\insertlecture}

% The body environment

\mode<article>{
  \parskip.5em plus 1pt minus 1pt
  \newenvironment{body}{\parskip=2pt plus 1pt minus 1pt}{}
}
\mode<presentation>{
  \newenvironment{body}{\document\ifcd\setbeamertemplate{sidebar
      right}{}\fi}{\enddocument}
%  \newcommand{\newblock}{}  
}


% Common theorem-like environments

\theoremstyle{definition}
\newtheorem{lectureexercise@}[theorem]{\translate{Zur Uebung}}
\newtheorem{discussion@}[theorem]{\translate{Zur Diskussion}}

\pgfkeys{/ddi/lines/.initial=0}
\pgfkeys{/ddi/border lines/.initial=4}
\pgfkeys{/ddi/name/.initial=}
\pgfkeys{/ddi/title/.style={/ddi/name=#1}}

\newenvironment{lecture exercise}[1][]{\pgfkeys{/ddi/.cd,#1}%
  \edef\marshal{\noexpand\lectureexercise@[\pgfkeysvalueof{/ddi/name}]}
  \marshal\ignorespaces}
{\endlectureexercise@
}

% \def\lineblock
% {%
%   %
%   \ifnum\pgfkeysvalueof{/ddi/border lines}>0\relax%
%   \only<article>{%
%     \setlength{\marginparsep}{.5cm}%
%     \setlength{\marginparwidth}{4cm}%
%     \marginpar{%
%       \color{black!35}
%       \edef\temp{1,...,\pgfkeysvalueof{/ddi/border lines}}
%       \foreach \i in \temp
%       {\ifnum\i>1\vskip1.5em\else\ding{46}\vskip2pt\fi\hrule width4cm height0.4pt}      
%       \vskip1.5em
%     }%
%   }%
%   \fi%
% }

\def\lineblock{\llap{\ding{46}\ \ }}

\newenvironment{discussion}[1][]{\pgfkeys{/ddi/.cd,#1}%
  \edef\marshal{\noexpand\discussion@[\pgfkeysvalueof{/ddi/name}]}
  \marshal\ignorespaces}
{\enddiscussion@
}


%
% New environments
%

\newdimen\gapskip
\gapskip=5cm

\newenvironment{presentation itemize}
{\alt<presentation>{\itemize}{\ddi@save@item\let\item=\relax\ignorespaces}}
{\alt<presentation>{\enditemize}{}}

\newenvironment{presentation enumerate}
{\alt<presentation>{\itemize}{\ddi@save@item\c@enumi=0\def\item{\advance\c@enumi
    by 1\relax\the\c@enumi.\ }\ignorespaces}}
{\alt<presentation>{\enditemize}{}}

\def\ddi@save@item{\ifx\ddi@reinstall@item\relax\let\orig@item=\item\def\ddi@reinstall@item{\let\item=\orig@item}\fi}

\let\ddi@reinstall@item\relax
\let\orig@list=\list
\def\list{\ddi@reinstall@item\orig@list}


%
% Special wide pages
 
\def\ddistartwidepages{
  \setlength\textwidth{\paperwidth-17.5mm-17.5mm}
  \setlength\oddsidemargin{17.5mm-1in}
  \setlength\evensidemargin{17.5mm-1in}
  \setlength\gapskip{0.25cm}
}
\newenvironment{wide pages}
{
  \begingroup
  \ddistartwidepages
  \onecolumn
}
{
  \clearpage
  \endgroup
  \onecolumn
}


% Learning targets and TOC

\mode<beamer>
{
\newenvironment{learning targets}
{
  \translatelet\temp{Kompetenzen}
%  \section*{\temp}
  \begin{frame}[fragile=singleslide]{\translate{Kompetenzen -- 
  	Seminar}~\insertshortlecture}
    \begin{enumerate}%\rightskip-1.5cm plus1fil
    }
  {
    \end{enumerate}
  \end{frame}
\begin{frame}{\translate{Gliederung -- Vortrag}~\insertshortlecture}
  \tableofcontents
\end{frame}
\aftergroup\setupsidebar
}
}

\mode<article>
{
  \newcommand\maintableofcontents{{%
      \parskip0pt%
%  \addvspace{3em \@plus\p@}%
%  \avoidwiddow{2.5cm}{500}
      \tableofcontents
    }}
\renewcommand*\l@part[2]{%
  \addpenalty{-\@highpenalty}%
  \addvspace{5em \@plus\p@}%
  \avoidwiddow{3cm}{750}
  \setlength\@tempdima{4em}%
  \begingroup
    \parindent \z@
    \leavevmode
    \raggedright
    \leftskip0em%
    \Large\sffamily
    \long\def\numberline##1{{\fontsize{20pt}{24pt}\selectfont%
    	\textcolor{structure.fg}{##1}\par}\leavevmode}%
    #1
    \par
  \endgroup
}
\renewcommand*\l@chapter[2]{%
  \addvspace{3em \@plus\p@}%
  \avoidwiddow{2.5cm}{500}
  \@tempdima=4em%
    \begingroup
      \parindent \z@
      \leavevmode
      \raggedright
      \advance\leftskip4em
      \hskip -4em
      {\Large\color{black} \textsf{#1}\par}
    \endgroup
  }
\renewcommand*\l@section[2]{%
  \addvspace{1.0em \@plus\p@}%
  \avoidwiddow{2cm}{200}
  \@tempdima=4em%
    \begingroup
      \parindent \z@
      \leavevmode
      \rightskip\@pnumwidth plus1fil
      \advance\leftskip4em
      \hskip -4em
      {\small\color{structure.fg} \textsf{#1}}
%      \ifmicrotoc
%      \else
      \nobreak\normalsize\normalfont
     \hfill
     \nobreak
     \rlap{\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}}%
%     \fi
      \par
    \endgroup
  }
\def\subsectionnumberline#1{\hb@xt@\@tempdima{\small\sffamily#1\hfil}}

\renewcommand*\l@subsection[2]{\@tempdima=4em%
    \begingroup
      \parindent \z@
      \leavevmode
      \advance\leftskip4em
      \rightskip\@pnumwidth plus1fil
      \hskip -4em
      \let\numberline\subsectionnumberline
      #1
%     \ifmicrotoc
%      \else
      \nobreak\normalsize\normalfont
     \leaders\hbox{$\m@th
       \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
       mu$}\hfill
     \nobreak
     \rlap{\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}}%
%     \fi
      \par
    \endgroup}
\let\l@chapterstar\l@subsection  
\def\toclevel@chapterstar{1}
\renewcommand*\l@subsubsection[2]{}
\newenvironment{learning targets}
{
  \begin{frame}
    \ifodd\c@page%
    \else%
    \hskip-4.75cm
    \fi
  \noindent\begin{minipage}[t]{8cm}
    \section*{\textcolor{structure.fg}{\translate{Vortrag -- Kompetenzen}}}
    \medskip
    \begin{enumerate}
      \raggedright
}
{
  \end{enumerate}
\end{minipage}\qquad\textcolor{gray}{\vrule width.4pt}\qquad
  \rlap{
  \begin{minipage}[t]{8cm}
    \section*{\textcolor{structure.fg}{\translate{Inhalte dieses Vortrags}}}
    \raggedright
		%\minitoc
		\the\microtoc%
  \end{minipage}}
\vskip2em
    \refstepcounter{framenumber}%
  \end{frame}
}
}


% Microtocs

\mode<article>
{
\def\chaptertext{chapter}
\def\chapterstartext{chapterstar}
\def\parttext{part}
\newtoks\microtoc
\newif\ifmicrotoc
{
  \def\contentsline#1#2#3#4{%
    \extractchapter{#1}{#2}{#3}{#4}#4..\relax%
  }
  \def\extractchapter#1#2#3#4#5.#6.#7\relax{%
    \def\test{#1}%
    \ifx\test\chaptertext%
    \else%
    \ifx\test\chapterstartext%
      \else%
        \ifx\test\parttext%
        \else%
        \expandafter\global\expandafter\microtoc\expandafter{%
								\the\microtoc\filteredcontentsline{#1}{#2}{#3}{#4}{#5}{#6}
				}
        \fi%
      \fi%
    \fi%
  }
  \@input{\jobname.toc}
}

\newcommand\filteredcontentsline[6]{%
  {
    \microtoctrue
    \ifnum#6=\c@chapter\relax%
			\ifthenelse{\equal{#5}{section}}{
      	\contentsline{#1}{#2}{#3}{#4}%
			}{}
    \fi%
    %\ifnum#5=\c@chapter\relax%
    %  \contentsline{#1}{#2}{#3}{#4}%
    %\fi%

  }
}
}

%NEU HILBIG
\newcommand*\addchap{\secdef\@addchap\@saddchap}
\newcommand*{\@addchap}{}
\def\@addchap[#1]#2{\chapterlikeheadline{#2}{}{}%
  \addcontentsline{toc}{chapter}{#1}%
  \if@twoside\ifx\@mkboth\markboth\markright{#1}\fi\fi
}
\newcommand*{\@saddchap}[1]{\chapterlikeheadline{#1}\@mkboth{}{}}

\newcommand*\addsec{\secdef\@addsec\@saddsec}
\newcommand*{\@addsec}{}
\def\@addsec[#1]#2{\section*{#2}\addcontentsline{toc}{section}{#1}
  \if@twoside\ifx\@mkboth\markboth\markright{#1}\fi\fi
}
\newcommand*{\@saddsec}[1]{\section*{#1}\@mkboth{}{}}

\newcommand*\addsubsec{\secdef\@addsubsec\@saddsubsec}
\newcommand*{\@addsubsec}{}
\def\@addsubsec[#1]#2{\subsection*{#2}\addcontentsline{toc}{subsection}{#1}
  \if@twoside\ifx\@mkboth\markboth\markright{#1}\fi\fi
}
\newcommand*{\@saddsubsec}[1]{\subsection*{#1}\@mkboth{}{}}
%ENDE NEU HILBIG

% Parts

\def\ddiparttext{part}

\def\part#1{%
  \clearpage
  \null\vskip4cm
  \refstepcounter{part}%
  \chapterstarmark{\partname\ \thepart}{#1}
  \addcontentsline{toc}{part}{\protect\numberline{\partname\ \thepart}#1}%
  \interlinepenalty \@M
  \normalfont{\raggedright
  \sffamily
  {\fontsize{36pt}{40pt}\selectfont{ \color{structure.fg} \partname\ 
  	 \thepart}\par
    \fontsize{24pt}{30pt}\selectfont#1\par}}
  \vskip2em
  \ifx\@currenvir\ddiparttext
    \parskip.75em plus 1pt minus 1pt
  \else
  \endpart
  \fi
}
\def\endpart{
  \clearpage%
}


% Table of Contents

\mode<article>
{
	\newcommand\printTables{
  	\ddistartwidepages
    \begin{wide pages}
			\tableofcontents

			\listoffigures

			\listoftables
		\end{wide pages}
	}
  \renewcommand\tableofcontents{%
      \chapterstarmark{\contentsname}{}
			\vskip2cm
      {\fontsize{36pt}{40pt} \sffamily\hilight{\contentsname}}\par
			\vskip2cm
			\begin{multicols}{2}
	      \@starttoc{toc}%
			\end{multicols}
    }
	\renewcommand\listoffigures{
      \chapterstarmark{\listfigurename}{}
			\vskip2cm
			{\fontsize{36pt}{40pt} \sffamily\hilight{\listfigurename}}\par
			\vskip2cm
			\begin{multicols}{2}
	      \@starttoc{lof}%
			\end{multicols}
	}
	\renewcommand\listoftables{
      \chapterstarmark{\listtablename}{}
			\vskip2cm
			{\fontsize{36pt}{40pt} \sffamily\hilight{\listtablename}}\par
			\vskip2cm
			\begin{multicols}{2}
	      \@starttoc{lot}%
			\end{multicols}
	}
}


% List of proof methods

\newcommand\listofproofmethods{%
  \begin{wide pages}
  \parskip0pt%
  \chapterstarmark{Verzeichnis der Rezepte}{}
  \twocolumn[
  \vskip2cm
  {\fontsize{36pt}{40pt} \sffamily\hilight{Verzeichnis der Rezepte\par}}
  \vskip1cm]
  \@starttoc{lop}%
  \end{wide pages}
}

\newcommand\listofproofmethodsinline{%
  {
    \parskip0pt
    \@starttoc{lop}%
  }
}


% Discussion
\mode<article>
{
  \renewenvironment{lectureexercise@}[1][]{\begingroup
    \setlength{\marginparsep}{.5cm}%
    \setlength{\marginparwidth}{4cm}%
    \examplelike[#1]{\lineblock \translate{Zur Uebung}}}{
    \endexamplelike
    \endgroup}
  \renewenvironment{discussion@}[1][]{\begingroup
    \setlength{\marginparsep}{.5cm}%
    \setlength{\marginparwidth}{4cm}%
    \examplelike[#1]{\lineblock \translate{Zur Diskussion}}}{%
    	\endexamplelike\endgroup}
}

% Map

\newcommand\insertmap[1]{
  {
    \null
    \parskip0pt
    \setbox\mybox=\vbox{%
      \hsize=100cm\includegraphics[width=\paperheight-1.41cm,
      	height=\paperwidth-1cm,angle=90]{../map/#1-map.pdf}\hss%
    }
    \ht\mybox=0cm
    \wd\mybox=0cm
    \vskip-1.8cm
    \vskip-2.9\baselineskip
    \hbox{}
    \hskip-6cm
    \box\mybox
    \thispagestyle{empty}
    \clearpage
  }
}


% Summary

\newenvironment{summary}
{
  \only<article>{%
    \section*{\translate{Zusammenfassung dieses Vortrags}}
    \sectionstarmark{\translate{Zusammenfassung dieses Vortrags}}
  }
  \only<presentation>{
    \translatelet\temp{Zusammenfassung}
    \section*{\temp}
  }
  \begin{frame}[fragile,environment=summary]
    \frametitle<presentation>{\translate{Zusammenfassung}}
    \only<article>{\vskip-2.5\baselineskip\hbox{}}
}
{
  \end{frame}
}

\newenvironment<>{further reading}
{
  \mode<presentation>{\vfill}
  \def\refname{\translate{Zum Weiterlesen}}
  \actionenv#1
  \begin{thebibliography}{10}
    \setbeamertemplate{bibliography item}[book]
}
{
\end{thebibliography}
\endactionenv
}

\newenvironment{bibitem comments}
{
  \begin{onlyenv}<article>
    \par\medskip
    \small
}
{
  \par\medskip
  \end{onlyenv}
}


\newenvironment<>{summary item}[1]{\actionenv#2\block{\only<article>{%
	\ddibordericon{{\ddiborderpointer}}}#1}}{\endblock\endactionenv}

% Exercise frame

\newif\ifmulti

\pgfkeys{/ddi/minutes/.initial=5}
\pgfkeys{/ddi/multiple exercises/.is if=multi}

\newenvironment{exercise frame}[1][]
{
  \pgfkeys{/ddi/.cd,#1}
  \begin{frame}[fragile=singleslide]
    \frametitle<presentation>{\pgfkeysvalueof{/ddi/minutes}\ifmulti\translate{%
    	Minuten-Aufgaben}\else\translate{Minuten-Aufgabe}\fi}
    \only<article>{\vskip-2.5\baselineskip\hbox{}}%
    \ifmulti\else%
      \begin{lecture exercise}%
    \fi%
    \ignorespaces%    
}
{
    \ifmulti\else%
      \end{lecture exercise}%
    \fi%
  \end{frame}
}

\newenvironment{discussion frame}[1][]
{
  \pgfkeys{/ddi/.cd,#1}
  \begin{frame}[fragile=singleslide]
    \only<presentation>{\frametitle{\translate{Zur Diskussion}: 
    	\pgfkeysvalueof{/ddi/name}}\pgfkeys{/ddi/title=}}
    \only<article>{\vskip-2.5\baselineskip\hbox{}}%
    \only<article>{\begin{discussion}}%
    \ignorespaces%    
}
{
    \only<article>{\end{discussion}}%
  \end{frame}
}


% New frame numbering

\mode<article>{%
	\renewcommand\insertframenumber{%
		\ifonelecture
			Folie~\@arabic\c@framenumber%\ von \inserttotalframenumber
		\else
			\insertshortlecture-\@arabic\c@framenumber
		\fi
	}
}
\mode<presentation>{%
	\renewcommand\insertframenumber{%
		\ifonelecture
			\@arabic\c@framenumber\ von \inserttotalframenumber
		\else
			\beamer@shortlecturename-\@arabic\c@framenumber
		\fi
	}
}


% Beamer version theme settings

\useoutertheme[height=0pt,width=2cm,right]{sidebar}
\ifcd
\else
\usecolortheme{rose,sidebartab}
\useinnertheme{circles}
\fi

\definecolor{websitebg}{rgb}{0.8509,0.8509,0.8784}
\ifcd\else\setbeamercolor{sidebar right}{bg=websitebg}\fi
\setbeamercolor{structure}{fg=orange!80!red}
\ifcd
%  \setbeamercolor{sidebar right}{bg=oceangreen!3}
  \setbeamercolor{structure}{fg=oceangreen!65}
  \setbeamercolor{alerted text}{fg=oceangreen!50}
  \setbeamerfont{alerted text}{shape=\ifmmode\else\itshape\fi}
\fi
\setbeamercolor{author}{parent=structure}
\setbeamercolor{subtitle}{fg=black}

\ifcd
\setbeamerfont{title in sidebar}{size=\fontsize{6.5}{7}}
\setbeamerfont{chapter in sidebar}{size=\fontsize{6.5}{7}}
\setbeamerfont{slide in sidebar}{size=\fontsize{6.5}{7}}
\setbeamerfont{sidebar}{size=\fontsize{5}{5.25}}
\setbeamerfont{section in sidebar}{size=\fontsize{5}{5.5}}
\setbeamerfont{subsection in sidebar}{size=\fontsize{4.5}{5}}
\setbeamercolor{section in sidebar shaded}{use=section in sidebar,
	fg=section in sidebar.fg}
\setbeamercolor{subsection in sidebar shaded}{use=subsection in sidebar,
	fg=subsection in sidebar.fg}

\setbeamertemplate{subsection in sidebar}
{%
  \beamer@sidebarformat{3pt}{subsection in
    sidebar}{\leavevmode\llap{\fontsize{3.75}{3.75}%
    	\selectfont$\blacktriangleright$ }\insertsubsectionhead}%
}

\setbeamertemplate{subsection in sidebar shaded}
{%
  \beamer@sidebarformat{3pt}{subsection in sidebar shaded}{%
  	\insertsubsectionhead}%
}


\setbeamertemplate{section in sidebar}
{%
  \vbox{%
    \vskip.75em%
    \beamer@sidebarformat{3pt}{section in
      sidebar}{\leavevmode\llap{\fontsize{4.5}{5}\selectfont \insertshortlecture.\insertsectionheadnumber\
        \ }\insertsectionhead~{\color{black}\fontsize{3.75}{3.75}\selectfont$\blacktriangleleft$}}%
  }%
}

\setbeamertemplate{section in sidebar shaded}
{%
  \vbox{%
    \vskip.75em%
    \beamer@sidebarformat{3pt}{section in sidebar
      shaded}{\leavevmode\llap{\fontsize{4.5}{5}\selectfont\insertshortlecture.\insertsectionheadnumber\
        \ }\insertsectionhead~\phantom{{\fontsize{3.75}{3.75}\selectfont$\blacktriangleleft$}}}%
  }%
}


\else
\setbeamerfont{title in sidebar}{series=\bfseries}
\setbeamerfont{slide in sidebar}{size=\scriptsize}
\fi

\setbeamerfont{title}{series=\normalfont,size=\LARGE}
\setbeamerfont*{item}{series=}
\ifcd
\setbeamerfont{frametitle}{size=\large}
\setbeamerfont{info in title}{size=\scriptsize}
\setbeamercolor{info in title}{parent=structure}
\else
\setbeamerfont{frametitle}{size=}
\setbeamerfont{info in title}{size=\scriptsize}
\setbeamercolor{info in title}{parent=structure}
\fi
\ifcd\setbeamerfont{block title}{size=\normalsize}\else\setbeamerfont{block title}{size=\small}\fi
\setbeamerfont{subtitle}{size=\normalsize,series=\normalfont}

\setbeamerfont{subtitle}{size=\normalsize,series=\normalfont}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{bibliography item}[book]

\ifcd
\else
\pgfdeclarehorizontalshading{mytransition}{\the\paperheight}{color(0cm)=(white); color(1.5mm)=(websitebg)}

\setbeamertemplate{background canvas}
{\hskip\paperwidth\hskip-2.14cm\pgfuseshading{mytransition}}
\fi

\def\setupsidebar{
\setbeamertemplate{sidebar right}
{
  \ifcd
  {
    \vskip2.6em%
    \usebeamerfont{chapter in sidebar}%
    \hskip3pt%
  \translate{Seminar}~\insertshortlecture\par}
  \fi
  {\usebeamerfont{title in sidebar}%
    \ifcd\vskip1pt\else\vskip1.5em\fi%
    \hskip3pt%
    \usebeamercolor[fg]{title in sidebar}%
    \ifcd
    \insertshorttitle[width=2cm-6pt,left,respectlinebreaks]
    \else
    \insertshorttitle[width=2cm-6pt,center,respectlinebreaks]\fi\par%
\ifcd\vskip.75em\else    \vskip1.25em\fi
  }%
\ifcd\else  {%
    \hskip3pt%
    \usebeamercolor[fg]{author in sidebar}%
    \usebeamerfont{author in sidebar}%
    \ifcd
    \insertshortauthor[width=2cm-6pt,left,respectlinebreaks]
    \else
    \insertshortauthor[width=2cm-2pt,center,respectlinebreaks]\fi\par%
    \vskip1.25em%
  }\fi%
  \ifcd\else\hbox to2cm{\hss\insertlogo\hss}
  \vskip1.25em\fi%
  \insertverticalnavigation{2cm}%
  \ifcd\vskip2em\else\vfill\fi
  \hbox to 2cm{\hfill\normalfont\strut\usebeamerfont{slide in sidebar}\insertframenumber\hskip5pt}%
  \vskip3pt%
}%
}
\setupsidebar

\setbeamertemplate{title page}
{
  \vbox{}
	\ifcd\vskip-5mm\leavevmode\hbox{\hskip-3mm}%\includegraphics[scale=0.25]{hglion.pdf}}%
%  \hfill{}
%  \includegraphics[scale=0.25]{hglion.pdf}
\par
  \leftskip3mm\else
  \vskip1em\fi
  {\huge \translate{Seminar} \insertshortlecture\par}
  {\usebeamercolor[fg]{title}\usebeamerfont{title}\inserttitle\par}%
  \ifx\insertsubtitle\@empty%
  \else%
    \vskip0.25em%
    {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
  \fi%     
  \vskip4pt\par
  {\usebeamerfont{info in title} \translate{Seminar}
    {\usebeamercolor[fg]{info in title}\lecturename} \hbox{\translate{vom}
      \insertdate}%
      \vfill
      \begin{tiny}
       \versionsinfo
      \end{tiny}
      \vfill
      \ifcd\hbox{\translate{ von}
      {\usebeamercolor[fg]{info in title}\insertauthor}}\fi}\par
  \ifcd\else\vskip6em
  {\usebeamercolor[fg]{author}\insertauthor}\par\fi
  \ifcd\vskip1em
  {\scalebox{2}{\hbox{\insertlogo}}}
  \vskip0pt plus1filll\else
  \insertinstitute\vskip1em\fi
}


\pgfdeclareimage[width=2cm]{logo}{../../planning/logo}
\logo{\pgfuseimage{logo}}
\ifcd

\setbeamertemplate{section in toc}
{\leavevmode\leftskip=3em\rlap{\hskip-3em\insertshortlecture.\inserttocsectionnumber}\inserttocsection\par}
\setbeamertemplate{subsection in toc}
{\leavevmode\leftskip=3em\rlap{\hskip-3em\insertshortlecture.\inserttocsectionnumber.\inserttocsubsectionnumber}\inserttocsubsection\par}
\else

\setbeamertemplate{enumerate item}
{
  \usebeamerfont*{item projected}%
  \usebeamercolor[bg]{item projected}%
  \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
    \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
    \pgfusepath{fill}
    \pgftext[base]{\color{fg}\insertenumlabel}
  \end{pgfpicture}%
}

\setbeamertemplate{enumerate subitem}
{
  \usebeamerfont*{subitem projected}%
  \usebeamercolor[bg]{subitem projected}%
  \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
    \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
    \pgfusepath{fill}
    \pgftext[base]{\color{fg}\insertsubenumlabel}
  \end{pgfpicture}%
}

\setbeamertemplate{enumerate subsubitem}
{
  \usebeamerfont*{subsubitem projected}%
  \usebeamercolor[bg]{subsubitem projected}%
  \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
    \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
    \pgfusepath{fill}
    \pgftext[base]{\color{fg}\insertsubsubenumlabel}
  \end{pgfpicture}%
}


\setbeamertemplate{section in toc}
{\leavevmode\leftskip=1em%
  \llap{%
    \usebeamerfont*{section number projected}%
    \usebeamercolor{section number projected}%
    \begin{pgfpicture}{-.55em}{0ex}{.55em}{1em}
      \color{bg}
      \pgfpathcircle{\pgfpoint{0pt}{.33em}}{0.6em}
      \pgfusepath{fill}
      \pgftext[base]{\color{fg}\inserttocsectionnumber}
    \end{pgfpicture}\kern0.6em%
  }%
  \inserttocsection\par}
\fi

\alt<presentation>{
  \newenvironment{under construction}{}{}
}
{
\newenvironment{under construction}{
  \underconstructiontrue
  \marginpar{%
    \color{red}%
    \hrule width 1cm height 1.6pt%
    \vskip1pt
    \hrule width 1cm height .8pt%
    \vskip1pt
    \hrule width 1cm height .4pt%
    \vskip1pt
    \hbox to 1cm{\hss$\downarrow$\hss}
    \hbox to 1cm{\hss\scriptsize\sffamily\strut in Arbeit\hss}
  }
  \vskip1em
}
{
  \marginpar{%
    \color{red}%
    \hbox to 1cm{\hss$\uparrow$\hss}%
    \vskip1pt
    \hrule width 1cm height .4pt%
    \vskip1pt
    \hrule width 1cm height .8pt%
    \vskip1pt
    \hrule width 1cm height 1.6pt%
  }
  \vskip1em
  \global\underconstructionendedonthispagetrue%
}
}

% Article version layout settings

\mode<article>

\def\ddimarginmark#1{%
  % Put a mark on both sides (one will be correct...)
  \par\noindent\leavevmode%
  \llap{\textcolor{gray}{\ddiputinbox{#1}}\hskip\marginparsep}%
  \rlap{\hskip\textwidth\hskip\marginparsep\textcolor{gray}{\ddiputinbox{#1}}}%
}

\def\ddiputinbox#1{%
  \scriptsize\sffamily%
  \setbox\marginbox=\hbox to1cm{\hfil%
  \begin{minipage}[t]{1cm}%
    \leftskip0pt plus 1fill\relax%
    \rightskip0pt plus 1fill\relax%
    #1%
  \end{minipage}\hfil%
  }%
  \dp\marginbox=0pt%
  \box\marginbox%
}
\newbox\marginbox

\setbeamertemplate{frame begin}{%
  \def\@currentlabel{\insertframenumber}%
  \avoidwiddow{2cm}{150}%
  \par\vskip\medskipamount\penalty-100%
  \ddimarginmark{\insertframenumber}\ignorespaces%
}
\setbeamertemplate{frametitle}{%
  \unskip{%
    \raggedright%
    \normalsize\selectfont\noindent%
    \textsf{%
      \ifcd\color{structure.fg}\fi
      \insertframetitle%
      \ifx\insertframesubtitle\@empty%
      \else%
        \hfil\break\small\textcolor{structure.fg}{\insertframesubtitle}%
      \fi%
    }\par%
  }\noindent\expandafter\ignorespaces
}

\setbeamertemplate{frame end}{%
  \par
}
\setlength{\marginparwidth}{1cm}
\setlength{\marginparsep}{5cm}


\renewcommand\maketitle{
  \par
  \thispagestyle{onlypagenumber}
  \ifonelecture
		\addcontentsline{toc}{chapter}{\protect\textcolor{structure.fg}{\translate{Vortrag}} \insertlecture}
	\else
		\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}\insertlecture}
	\fi
  \null
  \ifodd\c@page%
  \else%
  \leftskip-4.75cm
  \fi
  \chapterlikeheadline{\translate{Vortrag}%\insertshortlecture
		}{\insertlecture}{\insertsubtitle\newline\newline
  \begin{footnotesize}
   \versionsinfo 
  \end{footnotesize}
  }
}

%\renewenvironment{titlepage}{\clearpage\null}{\vfill\vfill\clearpage}
\renewenvironment{titlepage}{}{}
\newcommand\maintitle{
  \thispagestyle{empty}
  {%
    \rightskip-4cm plus 1fil\relax%
    \leftskip6.5mm\relax%
    \vskip-2.2cm
    \leavevmode\hbox{\hskip-1.2cm{}%\includegraphics[scale=0.35]{hglion.pdf}%
			\hskip4cm{}\scalebox{3.2}{}%\ddiLogo}%
\hskip5cm{}%\includegraphics[scale=0.4]{ddi_qr_url.pdf}
			}\vskip1cm
%      {\vskip-2.75cm{}\hskip16.5cm{}\qrcode[height=2.5cm]{http://ddi.uni-wuppertal.de/}}}\vskip1cm
    \sffamily
    {\fontsize{48pt}{48pt}\selectfont \translate{Skript} \par\vskip6pt}
    {\fontsize{36pt}{44pt}\selectfont \color{structure.fg}
      \lecturename\par\vskip8pt}
    {\fontsize{24pt}{28pt}\selectfont \color{black} \insertsemester\vskip6pt\par}
    {\normalsize Fassung vom \today}
    \vskip3em\par
    \large
    {\color{structure.fg}\@author}\par
		%\maintableofcontents 
  }
}


%\def\thesection{\insertshortlecture.\the\c@section}
%\def\thesubsection{\insertshortlecture.\the\c@section.\the\c@subsection}

\def\sectionmarktext#1{%
  \typesetheadlinemain{%
    %\hbox to3em{\ \ \insertshortlecture\hss}\quad\insertlecture\\[1pt]%
    %\hbox to3em{\ \ \thesection\hss}\quad#1%
    \hbox to3em{\ \ \hss}\quad\insertlecture\\[1pt]%
    \hbox to3em{\ \ \thesection\hss}\quad#1%
  }%
}

\def\sectionstarmarktext#1{%
  \typesetheadlinemain{%
   % \hbox to3em{\ \ \insertshortlecture\hss}\quad\insertlecture\\[1pt]%
   % \hbox to3em{\ \ \hss}\quad#1%
    \hbox to3em{\ \ \hss}\quad\insertlecture\\[1pt]%
    \hbox to3em{\ \ \hss}\quad#1%
  }%
}

\def\chapterstarmarktext#1#2{%
  \typesetheadlinemain{%
    \quad#1\\[1pt]%
    \hbox{}\quad#2%
  }%
}

\def\sectionmark#1{%
  \markboth{\noexpand\sectionmarktext{#1}}{\noexpand\sectionmarktext{#1}}%
}

\def\sectionstarmark#1{%
  \markboth{\noexpand\sectionstarmarktext{#1}}{\noexpand\sectionstarmarktext{#1}}%
}

\def\chapterstarmark#1#2{%
  \markboth{\noexpand\chapterstarmarktext{#1}{#2}}{\noexpand\chapterstarmarktext{#1}{#2}}%
}

\def\ps@onlypagenumber{
  \def\@oddhead{\rightbgbar{4.6cm}\setupheadcolor\typesetheadlinemain{\hbox to3em{\ \
        \insertshortlecture\hss}\quad\insertlecture\\}%
    \hfill\oddouterborder}
  \def\@evenhead{\leftbgbar{4.6cm}\setupheadcolor\evenouterborder\typesetheadlinemain{\hbox to3em{\ \ \insertshortlecture\hss}\quad\insertlecture\\}}
}

\def\@oddfoot{}
\def\@evenfoot{}

\newif\ifunderconstruction
\newif\ifunderconstructionendedonthispage




\def\typesetheadlinemain#1{%
  \smash{%
    \sffamily\normalsize%
    \fboxsep=3pt%
    \colorbox{head.bg}{\vrule height15pt depth1pt width0pt%
      \smash{\hbox to \textwidth{%
        \hss{%
          \fontsize{7}{8}\selectfont%
          \hsize=\textwidth
          \vbox{%
            \textcolor{white}{#1}
          }%
        }%
      }}\hskip-6pt}}%
}

\def\typesetpagenumber{%
  \hbox to1cm{%
    \sffamily\normalsize%
    \hss%
    \fboxsep=3pt%
    \colorbox{head.bg}{%
      \vrule height15pt depth1pt width0pt%
      \raise4pt\hbox to 16pt{\hss\textcolor{white}{\thepage}\hss}}%
    \hss%
  }%
}

\def\setupheadcolor{%
  \ifunderconstruction\colorlet{head.bg}{red}\fi%
  \ifunderconstructionendedonthispage\colorlet{head.bg}{red}\fi%
  \global\underconstructionendedonthispagefalse%
}

\def\oddouterborder{\smash{\rlap{\rlap{\hskip-3pt\hskip2em\copy\fancypicturebox}\hskip\gapskip\typesetpagenumber}}}
\def\evenouterborder{\smash{\llap{\typesetpagenumber\hskip\gapskip\llap{\copy\fancypicturebox\hskip2em}}}}

\def\@oddhead{\rightbgbar{0pt}\setupheadcolor\rightmark\hfill\oddouterborder}
\def\@evenhead{\leftbgbar{0pt}\setupheadcolor\evenouterborder\leftmark}

\newdimen\extraheight
\extraheight=\paperheight
\advance\extraheight by 2cm

\pgfdeclarehorizontalshading{bgleft}{\extraheight}{color(0pt)=(black95); color(4pt)=(white)}
\pgfdeclarehorizontalshading{bgright}{\extraheight}{color(0pt)=(white);  color(4pt)=(black95)}


\def\leftbgbar#1{%
  \llap{%
    \setbox\mybox=\hbox{%
      \textcolor{black95}{\vrule width 7cm height \extraheight}%
      \pgfuseshading{bgleft}\hskip1em\hskip-2pt\hskip#1%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
  \rlap{%
    \hskip\textwidth%    
    \setbox\mybox=\hbox{%
      \hskip1em\hskip-2pt%
      \pgfuseshading{bgright}%
      \textcolor{black95}{\vrule width 2cm height \extraheight}%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
}


\def\rightbgbar#1{%
  \llap{%
    \setbox\mybox=\hbox{%
      \textcolor{black90}{\vrule width 2cm height \extraheight}%
      \pgfuseshading{bgleft}\hskip1em\hskip-2pt%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
  \rlap{%
    \hskip\textwidth%    
    \setbox\mybox=\hbox{%
      \hskip#1\hskip1em\hskip-2pt%
      \pgfuseshading{bgright}%
      \textcolor{black90}{\vrule width 7cm height \extraheight}%
    }%
    \ht\mybox=0pt%
    \dp\mybox=0pt%
    \hbox{\vbox{\vskip\paperheight\vskip-1cm\box\mybox\vskip-\paperheight\vskip1cm}}%
  }%
}

% Cannot print this:
\def\leftbgbar#1{}
\def\rightbgbar#1{}

\def\insertsubtitle{}

\newenvironment{frontmatter}
{
  \pagenumbering{roman}
}
{
  \cleardoublepage
  \pagenumbering{arabic}
}


% Fancy mini pictures

\newbox\fancypicturebox
\newcommand\fancypictures[1]{%
  \global\setbox\fancypicturebox=\hbox{#1}}

\let\ddi@fancy@other@option=\@empty
\let\ddi@fancy@filename=\@empty
\def\ddi@fancy@view@lx{0}
\def\ddi@fancy@view@ly{0}
\def\ddi@fancy@view@ux{25}
\def\ddi@fancy@view@uy{25}
\newif\ifddi@fancy@size@set

\pgfkeys{/ddi/fancypicture/extra options/.store in=\ddi@fancy@other@option}
\pgfkeys{/ddi/fancypicture/x/.code={%
  \pgfmathparse{#1}%
  \let\ddi@fancy@view@lx=\pgfmathresult%
}}
\pgfkeys{/ddi/fancypicture/y/.code={%
  \pgfmathparse{#1}%
  \let\ddi@fancy@view@ly=\pgfmathresult%
}}
\pgfkeys{/ddi/fancypicture/size/.code={%
  \pgfmathparse{\ddi@fancy@view@lx+#1}%
  \let\ddi@fancy@view@ux=\pgfmathresult%
  \pgfmathparse{\ddi@fancy@view@ly+#1}%
  \let\ddi@fancy@view@uy=\pgfmathresult%
  \ddi@fancy@size@settrue}%
}
\pgfkeys{/ddi/fancypicture/filename/.store in=\ddi@fancy@filename}

\newcommand\fancypicture[1][]{%
  {\ddi@fancy@size@setfalse%
    \pgfkeys{/ddi/fancypicture/.cd,#1}%
  \edef\ddi@marshal{\noexpand
  \includegraphics[
    clip,height=50pt,width=50pt, % angepasst -- ursprünglich 22 x 22, lh
    \ifddi@fancy@size@set viewport=\ddi@fancy@view@lx\space\ddi@fancy@view@ly\space\ddi@fancy@view@ux\space\ddi@fancy@view@uy,\fi%
    \ddi@fancy@other@option]
    {\ddi@fancy@filename}}%
  \lower4pt\hbox{\ddi@marshal}%
  }\ignorespaces
}

\mode
<all>

\mode<presentation>{\def\fancypictures#1{}}


\mode<article>

% Bibliography
\renewenvironment{thebibliography}[1]
     { 
%\begin{comment}
%\subsection*{\refname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
%\end{comment}

\mode
<all>


% Lectures in article mode

\mode
<article>
{
  \renewcommand\lecture[3][]{
    \clearpage
    \gdef\insertlecture{#2}
    \gdef\insertshortlecture{#1}
    \refstepcounter{chapter}
    \setcounter{framenumber}{0}%
    \label{#3}%
  }
  \renewcommand\thechapter{\insertshortlecture}
	\ifonelecture
		\renewcommand*{\thesection}{\arabic{section}}
		\renewcommand*{\thesubsection}{\arabic{section}.\arabic{subsection}}
		\renewcommand*{\thesubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}
	\fi
}


% Chapters like Introdcution

\def\chapter#1{
  \clearpage
  \null
  \addcontentsline{toc}{chapterstar}{#1}
  \ifodd\c@page%
  \else%
  \leftskip-4.75cm
  \fi
  \chapterlikeheadline{#1}{}{}
  \chapterstarmark{#1}{}
}



% New useful definitions:

\newcommand\ddiborderpicture[1]{%
  \hbox{}\par%
  {%
    \setlength{\marginparsep}{2em}%
    \setlength{\marginparwidth}{5cm-2em}%
    \ddibordercommentpicture{#1}%
    \par%
    \vskip-\baselineskip%
  }
  \ignorespaces%
}

\newcommand\ddibordercommentpicture[1]{%
  \marginpar{\begin{minipage}[t]{4cm}\small\raggedright\hrule
      width0pt\par\vskip-4pt\par%
      \color{black!50}\scriptsize\sffamily\tikzset{every picture/.append style={black,font=\small}}#1\end{minipage}}%
}


\newcommand\includegraphicscopyrightborder[3][]{%
  \hbox{}\par%
  {%
    \setbox\mytempbox=\hbox{\includegraphicscopyright[#1]{#2}{#3}}%
    \setlength{\marginparsep}{2em}%
    \setlength{\marginparwidth}{\wd\mytempbox}%
    \marginpar{\leavevmode\raise\baselineskip\hbox{\lower\ht\mytempbox\box\mytempbox}}%
    \par%
    \vskip-\baselineskip%
  }
  \ignorespaces%
}

\newcommand\includegraphicscopyrightborderautowidth[3][]{%
  \includegraphicscopyrightborder[#1,width=4cm]{#2}{#3}
}
\only<presentation>{
  \let\includegraphicscopyrightborder=\includegraphicscopyright
  \let\includegraphicscopyrightborderautowidth=\includegraphicscopyright
}



\only<presentation>{\newcommand\tafel{\hfill\beamergotobutton{Tafel}}}
\only<article>{\newcommand\tafel{\par\smallskip{\noindent (Details an der Tafel)}}}




% Regie

\mode<article>
{
\newenvironment{lecture notes only}[1][]{
\everythingsmaller
\par\bigskip
\noindent
\ddimarginmark{#1}%
\parskip.5em plus 1pt minus 1pt
\ignorespaces
}
{
\bigskip
}
}

\mode<beamer>
{
  \newenvironment{lecture notes
    only}[1][]{\bgroup\setbox0=\hbox\bgroup}
  {\egroup\egroup}
}

\newenvironment{lecture notes intro}
{\begin{lecture notes only}[\translate{Worum es heute geht}]\normalsize\ignorespaces}{\end{lecture notes only}}

\newenvironment{lecture notes reference}[1][]
{
  \par
  \mode<article>{#1}%
  \noindent%
  \ddimarginmark{\translate{Skript-Referenz}}%
  \everythingsmaller%
  \noindent%
  \ignorespaces%
  }{\bigskip}



% Exercises 
  
\newif\ifddiwideexercises

\mode<article>

\newenvironment{lecture exercises}
{
  \ifddiwideexercises
    \begin{wide pages}\twocolumn[]
    \fi
  \small
  \parskip=2pt plus 1pt minus 1pt
  {\def\thesection{}\let\@seccntformat=\@gobble\translatelet\mytemp{Uebungen zu diesem Vortrag}\section{\mytemp}}
  \sectionstarmark{\translate{Uebungen zu diesem Vortrag}}
}
{
  \ifddiwideexercises
  \end{wide pages}
  \fi
}

\newenvironment{exam exercises}
{  \parskip=2pt plus 1pt minus 1pt\avoidwiddow{3cm}{550}\subsection*{\translate{Pruefungsaufgaben zu diesem Seminar}}
}
{}

\newcommand\appendixchapter[3]
{
  \clearpage
  \parskip=2pt plus 1pt minus 1pt
  \null
  \chapterlikeheadline{Anhang}{#1}{#2}
  \chapterstarmark{Anhang}{#3}
  \addcontentsline{toc}{subsection}{#3}
}

\newenvironment{lecture solutions}
{
  \appendixchapter{Lösungen}{Beispiellösungen zu ausgewählten Übungsaufgaben}{Lösungen zu ausgewählten Übungsaufgaben}
}
{}


\renewcommand\appendix{
  \clearpage
  \chapterstarmark{Anhang}{}
  \addcontentsline{toc}{part}{\protect\numberline{Anhang}}
}


\pgfkeys{
  /ddi/exercise/@credits/ignore/.initial=yes,
  /ddi/exercise/how/ignore/.initial=yes,
  /ddi/exercise/time/ignore/.initial=yes,
  /ddi/exercise/bonus/ignore/.initial=yes,
  /ddi/every exercise/.code=\everythingsmaller,
  /ddi/every solution/.code=\everythingsmaller}

\newcounter{exercisenumber}[chapter]
\renewcommand{\theexercisenumber}{\insertshortlecture.\the\c@exercisenumber}

\renewcommand\insertexercisetext{\translate{Uebung}}

\newcommand\everythingsmaller{%
\small%
\def\@listI{\leftmargin\leftmargini
  \parsep 0pt
  \topsep 3\p@   \@plus2\p@ \@minus3\p@
  \itemsep0pt}%
\let\@listi=\@listI%
\def\@listii{\leftmargin\leftmarginii
  \parsep 0pt
  \topsep 3\p@ \@plus2\p@ \@minus3\p@
  \itemsep0pt}%
\lstset{%
    basicstyle=\ttfamily\footnotesize,
}%
}


\mode
<all>




% Sorting sparklines

\colorlet{varcolor1}{orange!80!red}
\colorlet{varcolor2}{blue}
\colorlet{varcolor3}{violet!70}
\colorlet{varcolor4}{red}
\colorlet{varcolor5}{green!50!black}

\pgfkeys{/algolab/sorting/seq/.code={\global\algolabseq#1\relax}}
\pgfkeys{/algolab/sorting/max value/.initial=5}
\pgfkeys{/algolab/sorting/num values/.initial=5}
\pgfkeys{/algolab/sorting/num vars/.initial=2}
\pgfkeys{/algolab/sorting/compare/.code args={#1 and #2}{\def\possiblecompare{\showcompare{#1}{#2}}}}
\pgfkeys{/algolab/sorting/swap/.code args={#1 and #2}{\def\possibleswap{\showswap{#1}{#2}}}}

\def\possiblecompare{}
\def\possibleswap{}

\def\showcompare#1#2{
  \draw[red!50,very thick,line join=round]
  (\csname algolabvalue#1\endcsname,#1) -- (\pgfkeysvalueof{/algolab/sorting/max value}+2,#1)
  -- (\pgfkeysvalueof{/algolab/sorting/max value}+2,#2) -- (\csname algolabvalue#2\endcsname,#2);
}
\def\showswap#1#2{
  \coordinate (s1) at (\csname algolabvalue#1\endcsname,#1);
  \coordinate (s2) at (\pgfkeysvalueof{/algolab/sorting/max value},#1);
  \coordinate (t1) at (\csname algolabvalue#2\endcsname,#2);
  \coordinate (t2) at (\pgfkeysvalueof{/algolab/sorting/max value},#2);
  \draw[red,very thick,line join=round]
     (s1) -- ([shift={(0.5,0)}]s2) -- ([shift={(1.5,0)}]t2) -- ([shift={(2,0)}]t2) --
     ([shift={(2,0)}]s2)  --  ([shift={(1.5,0)}]s2) -- ([shift={(0.5,0)}]t2) -- (t1);
}

\pgfkeys{/algolab/sorting/offset/.code args={#1=#2}{\pgfkeysalso{/algolab/sorting/vars/offsets/#1/.initial=#2}}}

\pgfkeys{/algolab/sorting/vars/.initial=}
\pgfkeys{/algolab/sorting/@show vars/phantom/.code=\advance\algolabsortingcount by 1\relax}
\pgfkeys{/algolab/sorting/@show vars/.unknown/.code=
  {
    {
      \colorlet{current}{varcolor\the\algolabsortingcount}
      \let\name=\pgfkeyscurrentname
      \let\value=\pgfkeyscurrentvalue
      \pgfkeysifdefined{/algolab/sorting/vars/offsets/\name}
      {\pgfkeysgetvalue{/algolab/sorting/vars/offsets/\name}{\offset}}{\def\offset{0}}
      \@tempcnta=\value\relax
      \advance\@tempcnta by\offset\relax
      \edef\pos{\the\@tempcnta}
      \node [current] (x) at (-1*\pgfkeysvalueof{/algolab/sorting/num vars}-2,2*\algolabsortingcount-2)
      [anchor=mid east,inner sep=1pt]
      {\scriptsize{$\mathit{\name}=\value$}}; 
      \draw [current,semithick] (x.mid east) --
      ++(\pgfkeysvalueof{/algolab/sorting/num vars}-\the\algolabsortingcount+1,0) -- (-1.5,\pos) -- (0,\pos);
      \algolabsortline[current]{\csname algolabvalue\pos\endcsname}{\pos}
    }
    \advance\algolabsortingcount by 1\relax
  }
}
\pgfkeys{/algolab/sorting/values/.initial=0}
\newcount\algolabsortingcount
\newcount\algolabvarnum


\newcommand\algolabsortline[3][]{
  \ifnum#2<0\relax
  \else
    \draw[black!50,line width=.75ex,#1] ([xshift=-0.4pt]0,#3) -- (#2,#3);
  \fi
}

\newcount\algolabseq
\newenvironment{sorting example}[1][]
{
  \global\algolabseq=0\relax
  \pgfkeys{/algolab/sorting/.cd,#1}
}
{}

\newcommand\sortsparkline[1]{%
  \global\advance\algolabseq by1\relax%
  \begin{tikzpicture}[x=.725ex,y=-1ex,join=round]
    \pgfkeys{/algolab/sorting/.cd,#1}
    \path (\pgfkeysvalueof{/algolab/sorting/max value}+3,0);
%    \fill[blue!20]
%      (-10-\pgfkeysvalueof{/algolab/sorting/num vars},-3) rectangle
%      (\pgfkeysvalueof{/algolab/sorting/max value}+3,\pgfkeysvalueof{/algolab/sorting/num values});

%    \fill[blue!20]
%      (-10-\pgfkeysvalueof{/algolab/sorting/num vars},-3) rectangle
%      (\pgfkeysvalueof{/algolab/sorting/max
%        value}+3,\pgfkeysvalueof{/algolab/sorting/num vars}*2-1);

%    \path ([yshift=-2mm]current bounding box.south);

    \tikzset{slide=\the\algolabseq}
%    \node[tiny numbering,below right] at
%    (-9.5-\pgfkeysvalueof{/algolab/sorting/num vars},-2.5) {\the\algolabseq};
      
    \pgfkeysgetvalue{/algolab/sorting/values}{\values}
    \algolabsortingcount=0\relax%
    \expandafter\foreach\expandafter \i\expandafter i\expandafter n\expandafter {\values}
    {
      \algolabsortline{\i}{\algolabsortingcount}
      \expandafter\xdef\csname algolabvalue\the\algolabsortingcount\endcsname{\i}
      \global\advance\algolabsortingcount by 1\relax
    }

    \pgfkeysgetvalue{/algolab/sorting/vars}{\vars}

    \possiblecompare
    \possibleswap
    
    \algolabsortingcount=1\relax%
    \pgfkeys{/algolab/sorting/@show vars/.cd,/utils/exec=\expandafter\pgfkeysalso\expandafter{\vars}}
  \end{tikzpicture}%
  \hfil\penalty0\hfilneg\hskip1mm\ignorespaces
  % 
}



% Typesetting memory models

\newcount\ddimemoryline

\newenvironment{object}[1]
{
  \def\objectname{#1}
  \ddimemoryline=0\relax
  \lstset{basicstyle=\scriptsize\ttfamily}
  \tikzset{@kind/.style=memory}
  \scope
}
{
  \endscope
}

\newenvironment{variables}[1]
{
  \def\objectname{#1}
  \ddimemoryline=0\relax
  \lstset{basicstyle=\scriptsize\ttfamily}
  \tikzset{@kind/.style=var,y=.5cm}
  \scope
}
{
  \endscope
}

\def\attribute#1 #2=#3;{%
  \node [@kind,minimum height=4mm,text height=1mm,text depth=0pt,anchor=base west] (\objectname-#2) at (0,-1*\ddimemoryline) {\scantokens{\javacode|#3|}};
  \node [text height=1mm,text depth=0pt,minimum height=4mm,anchor=base east] at (0,-1*\ddimemoryline) {\javacode|#1 #2|};
  \advance\ddimemoryline by 1\relax
}


% Bars

\pgfdeclareverticalshading{ddibar}{\textwidth}{
  color(0pt)=(white);
  color(1.5pt)=(structure.fg!50);
  color(3pt)=(white)}
  
\newcommand\articlebar{%
  \only<article>{\parskip=0pt\baselineskip=0pt\medskip%
  %\textcolor{structure.fg!50}{\hrule height1pt}%
  \par%
  \pgfuseshading{ddibar}
  \par\medskip}}
  

% Quotations

\mode<article>{
\renewenvironment{quotation}{
  \list{}{\small}\item
  \parindent0em
  \parskip.75em plus 1pt minus 1pt
  \ignorespaces
}
{\endlist}
}


% Rezepte

\newcount\proofcomments

\mode<article>{
  \newenvironment{commented proof}[1][\translate{Proof}]{
    \only<article>{\parskip.1em plus 1pt minus 1pt\proofcomments=0\relax}
    \proof[#1]%
      \setlength{\marginparsep}{2em}%
      \setlength{\marginparwidth}{5cm-2em}%
      \proofcomment[]{\textcolor{structure.fg}{Kommentare zum Rezept}}\noindent\ignorespaces%
  }
  {
    \endproof
  }
  \newcommand\proofcomment[2][\the\proofcomments]{%
    \def\temp{#1}\ifx\temp\pgfutil@empty\else%
    \advance\proofcomments by1\relax%
    \leavevmode\smash{$^{\hbox{\fontsize{6}{7}\selectfont\textcolor{black!50}{#1}}}$}\fi%
    \marginpar{\scriptsize\sffamily\raggedright\textcolor{black!50}{\llap{\smash{\raise 2.8pt\hbox{\tiny#1\ }}}#2}}%
  }%
  \newenvironment{commented definition}[1][]{
    \only<article>{\parskip.1em plus 1pt minus 1pt}
    \definition[#1]%
      \setlength{\marginparsep}{2em}%
      \setlength{\marginparwidth}{5cm-2em}%
      \par\definitioncomment[]{\textcolor{structure.fg}{Kommentare zur Definition}}\noindent\ignorespaces%
  }
  {
    \enddefinition
  }
  \newenvironment{commented paragraph}[1][]{
    \begingroup
      \setlength{\marginparsep}{2em}%
      \setlength{\marginparwidth}{5cm-2em}%
  }
  {
      \par
    \endgroup
  }
}
  
\mode<presentation>

\newenvironment{proof method}[1][]
{
  \pgfkeys{/ddi/proof method/.cd,#1}
  \begin{frame}[fragile=singleslide,t]
    \frametitle{Rezept: \emph{\textcolor{black}%
        {\pgfkeysvalueof{/ddi/proof method/title}}}}
    \begin{columns}[onlytextwidth]
      \column{\textwidth-2.5cm}
        \begin{block}{Ziel}
          \emph{\pgfkeysvalueof{/ddi/proof method/goal}}
        \end{block}
      \column{2cm}
        \vskip1mm
        %\includegraphics[width=1.5cm]{ddi-icon-kochmuetze.pdf}
      \end{columns}
      \begin{block}{Rezept}
}
{
        \end{block}
   \pgfkeysvalueof{/ddi/proof method/also on frame}   
\end{frame}
}


\newcommand\proofcomment[1]{\par{\leftskip0pt plus1fill\rightskip0pt\textcolor{black!50}{(#1)}\par}}
\newenvironment{commented proof}{\proof}{\endproof}
\newenvironment{commented definition}{\definition}{\enddefinition}




% Handling of seminar files

\mode<presentation>{\def\bodydir{.}}

\mode
<article>

\let\ddilecturelist\@empty
	
\defbibheading{bibchap}[\bibname]{%
		%\chapter{#1}
		\addchap{#1}
  	\addcontentsline{toc}{section}{}
  	%\if@twoside\ifx\@mkboth\markboth\markright{#1}\fi\fi
		%\addcontentsline{toc}{chapter}{#1}
	}
		

\def\InsertLectureAndExercises#1{
 %\IfFileExists{../#1/body.bib}{
  %\begin{refsection}[../#1/body.bib]
 %}{
	%\begin{refsection}
 %}
   \def\bodydir{../#1}
   \g@addto@macro\ddilecturelist{\InputIfFileExists{../#1/solutions.tex}{}{}}
   \InputIfFileExists{../#1/body.tex}{}{}
   \InputIfFileExists{../#1/bib-config.tex}{}{}
   \InputIfFileExists{../#1/exercises.tex}{}{}
  %\end{refsection} 
}

\def\InsertSolutions{%
  %\fancypictures{}
  \appendix
  \begin{lecture solutions}
    \ddilecturelist
  \end{lecture solutions}
}

\mode
<all>



\let\definitioncomment=\proofcomment


% Translations

\providetranslation[to=German]{Skript}{Skript}
\providetranslation[to=English]{Skript}{Notes}

\providetranslation[to=German]{DDI}{Fachgebiet Didaktik der Informatik}
\providetranslation[to=English]{DDI}{Department of Didactics of Informatics}

\providetranslation[to=German]{BUW}{\universitaet}
\providetranslation[to=English]{BUW}{\university}

\providetranslation[to=German]{Uebung}{Übung}
\providetranslation[to=English]{Uebung}{Problem}

\providetranslation[to=German]{Zur Uebung}{Zur Übung}
\providetranslation[to=English]{Zur Uebung}{Exercise}

\providetranslation[to=German]{Zur Diskussion}{Zur Diskussion}
\providetranslation[to=English]{Zur Diskussion}{Discussion}

\providetranslation[to=German]{Uebungen zu diesem Vortrag}{Übungen zu diesem Vortrag}
\providetranslation[to=English]{Uebungen zu diesem Vortrag}{Problems for this talk}

\providetranslation[to=German]{Pruefungsaufgaben zu diesem Vortrag}{Prüfungsaufgaben zu diesem
Vortrag}
\providetranslation[to=English]{Pruefungsaufgaben zu diesem Vortrag}{Exam Problems}

\providetranslation[to=German]{Worum es heute geht}{Worum es heute geht}
\providetranslation[to=English]{Worum es heute geht}{Today's topic}

\providetranslation[to=German]{Zum Weiterlesen}{Zum Weiterlesen}
\providetranslation[to=English]{Zum Weiterlesen}{For Further Reading}

\providetranslation[to=German]{Kompetenzen}{Kompetenzen}
\providetranslation[to=English]{Kompetenzen}{Competencies}

\providetranslation[to=German]{Zusammenfassung}{Zusammenfassung}
\providetranslation[to=English]{Zusammenfassung}{Summary}

\providetranslation[to=German]{ vom}{ vom}
\providetranslation[to=English]{ vom}{,}

\providetranslation[to=German]{ von}{ von}
\providetranslation[to=English]{ von}{ by}

\providetranslation[to=German]{Minuten-Aufgaben}{-Minuten-Aufgaben}
\providetranslation[to=English]{Minuten-Aufgaben}{-Minute Exercises}

\providetranslation[to=German]{Minuten-Aufgabe}{-Minuten-Aufgabe}
\providetranslation[to=English]{Minuten-Aufgabe}{-Minute Exercise}

\providetranslation[to=German]{Skript-Referenz}{Skript-\penalty0Referenz}
\providetranslation[to=English]{Skript-Referenz}{Lecture notes material}

ahilbig-semester.sty0000644000175000001440000004377212505500166014110 0ustar  iorekusers% -*- coding: utf-8; -*-
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% (C)opyright A. Hilbig, mail@andrehilbig.de                                                       |
%             http://www.andrehilbig.de/Publications                                               |
%                                                                                                  | 
% diese Datei: ahilbig-semester.sty                                                                |
%                                                                                                  |
% Das Dokument steht unter der Lizenz: Creative Commons by-nc-sa Version 4.0                       |
% http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de                                         |
%                                                                                                  |
% Nach dieser Lizenz darf das Dokument beliebig kopiert und bearbeitet werden,                     |
% sofern das Folgeprodukt wiederum unter gleichen Lizenzbedingungen vertrieben                     |
% und auf die ursprünglichen Urheber verwiesen wird.                                               |
% Eine kommerzielle Nutzung ist ausdrücklich ausgeschlossen.                                       |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |
% HINWEISE/ERWEITERUNG                                                                             |
% Diese Pakete basieren auf den entsprechenden Paketen von Prof. Dr. Ludger Humbert                |
% (http://ddi.uni-wuppertal.de/ -- humbert@uni-wuppertal.de) und wurden zum Teil angepasst. Seine  |
% Pakete basieren wiederum auf Entwicklungen von Prof. Dr. Till Tantau                             |
% (http://www.tcs.uni-luebeck.de/de/mitarbeiter/tantau/). Beiden gilt mein Dank hierfür.           |
%                                                                                                  |
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
%                                                                                                  |

\ProvidesPackage{ahilbig-semester}
 
\RequirePackage{pgffor}
\RequirePackage{pgfcalendar}
\RequirePackage{soul,color}  % wg. \hl ... = highlight
\RequirePackage{multicol}

\RequirePackage[
   backend=biber      
  ,sortlocale=de_DE%.UTF-8  
  ,style=authoryear
  ,bibencoding=UTF8  
  ,block=space
  ,autocite=inline % \autocite[..][..]{..} erzeugt Literaturverweise mit runden Klammern 
]{biblatex}


\RequirePackage[scale=1.9]{ccicons}
\newenvironment{topcolumns}{\begin{columns}[t]}{\end{columns}}
\RequirePackage{isodate}
\newcommand*\jahr{\number\year}
\newcounter{jahrp}
\addtocounter{jahrp}{\jahr}
\stepcounter{jahrp}
\newcommand*\sommersemester{\jahr}
\newcommand*\wintersemester{\jahr/\thejahrp}

%
% Semester dates
%

% Sets the dates of the semester.
%
% Usage: \setsummerdates{first date of semester}{first lecture date}%
%                   {last lecture date}{last date of semester}

\def\setsummerdates#1#2#3#4{%
  \edef\lec@summerstart{#1}
  \edef\lec@summerfirstlec{#2}
  \edef\lec@summerlastlec{#3}
  \edef\lec@summerend{#4}
}

\def\setwinterdates#1#2#3#4{%
  \edef\lec@winterstart{#1}
  \edef\lec@winterfirstlec{#2}
  \edef\lec@winterlastlec{#3}
  \edef\lec@winterend{#4}
}

% Getter and setter:

\def\getsummerstartdate{\lec@summerstart}
\def\getsummerfirstlecturedate{\lec@summerfirstlec}
\def\getsummerlastlecturedate{\lec@summerlastlec}
\def\getsummerenddate{\lec@summerend}

\def\getwinterstartdate{\lec@winterstart}
\def\getwinterfirstlecturedate{\lec@winterfirstlec}
\def\getwinterlastlecturedate{\lec@winterlastlec}
\def\getwinterenddate{\lec@winterend}

%
% Lectures
%

% Sets the lecture dates.
%
% Usage:
%
% \lecturelistofdates{
%   2013-01-01,
%   2013-02-28,
%   2013-12-24,
% }

\def\lecturelistofdates#1{
  \foreach \lec@date[count=\lec@i] in {#1} {
    \expandafter\xdef\csname lec@date@\lec@i\endcsname{\lec@date}
  }
}

% Sets the exercise dates.
%
% Usage:
%
% \exerciselistofdates{
%   2013-01-01->2013-01-08,
%   2013-02-28->2013-03-07,
%   2013-12-24->2013-12-31,
% }

\def\exerciselistofdates#1{%
  \def\ex@parsedates##1->##2\foo{%
    \def\ex@tutorial{##1}%
    \def\ex@deadline{##2}%
  }%
  \foreach \ex@date[count=\ex@i] in {#1} {%
    \edef\ex@tmpdate{\ex@date}%
    \expandafter\ex@parsedates\ex@tmpdate\foo
    \expandafter\xdef\csname ex@tutorial@\ex@i\endcsname{\ex@tutorial}%
    \expandafter\xdef\csname ex@deadline@\ex@i\endcsname{\ex@deadline}%
  }%
}

\newcount\lec@lastlecnumber % stores the last lecture id
\newcount\ex@lastexercisenumber % same for exercise id

% Sets the chronological list of lectures with their ids. 
%
% \lecturelistofids{
%   <lecture id>,
%   <lecture id>,
%   <lecture id>,
% }

\def\lecturelistofids#1{
  \foreach \lec@id[count=\lec@i] in {#1} {
    \expandafter\xdef\csname lec@id@\lec@i\endcsname{\lec@id}%
    \expandafter\xdef\csname lec@number@\lec@id\endcsname{\lec@i}%
    \global\lec@lastlecnumber=\lec@i
  }
}

% Sets the chronological list of exercises with their ids. 
%
% \exerciselistofids{
%   <exercise id>,
%   <exercise id>,
%   <exercise id>,
% }

\def\exerciselistofids#1{
  \foreach \ex@id[count=\ex@i] in {#1} {
    \expandafter\xdef\csname ex@id@\ex@i\endcsname{\ex@id}%
    \expandafter\xdef\csname ex@number@\ex@id\endcsname{\ex@i}%
    \global\ex@lastexercisenumber=\ex@i
  }
}


% Testing whether a lecture exists

\def\ddiiflectureidexists#1#2#3{%
  \expandafter\ifx\csname lec@number@#1\endcsname\relax%
  #3\else#2\fi%
}


% Testing whether an exercise exists

\def\ddiifexerciseidexists#1#2#3{%
  \expandafter\ifx\csname ex@number@#1\endcsname\relax%
  #3\else#2\fi%
}


% Starts a new lecture. This defines the lecture title, subtitle, and
% the date for the next \maketitle command. Furthermore it sets the
% lecture number and defines a corresponding label.
%
% Usage: \lecturewithid{<lecture id>}

\def\lecturewithid#1#2#3{
  \lecture[\getlecturenumberfromid{#1}]{#2}{lecture-#1}
  \subtitle{#3}
  \date{\getlecturedatefromid{#1}}
}

% Starts a new exercise. This defines the sheet number, date of the
% tutorial, and the date for the next \maketitle command. Furthermore
% it sets the exercise number and defines a corresponding label.
%
% Usage: \exercisewithid{<exercise id>}

\def\exercisewithid#1{%
  \def\insertsheetnumber{\getexercisenumberfromid{#1}}%
  \edef\ddi@tmpdeadline{\get@exercisedeadlinedatefromid{#1}}%
  \def\ddi@none{none}%
  \let\insertdeadline=\undefined
  \ifx\ddi@none\ddi@tmpdeadline\else
    \def\insertdeadline{\getexercisedeadlinedatefromid{#1}}%
  \fi
}

% Getter and setter:
%
% Lecture
\def\getlecturedatefromid#1{%
  \edef\ddi@tmp@isodate{\csname lec@date@\getlecturenumberfromid{#1}\endcsname}%
  \expandafter\ddi@isodatetohumanreadable\ddi@tmp@isodate\pgf@stop%
}
\def\sem@getisodatefromlectureid#1{\csname lec@date@\getlecturenumberfromid{#1}\endcsname}
\def\getlecturenumberfromid#1{\csname lec@number@#1\endcsname}

% Exercise
\def\getexercisedeadlinedatefromid#1{%
  \edef\ddi@tmp@deadlineisodate{\csname ex@deadline@\getexercisenumberfromid{#1}\endcsname}%
  \edef\ddi@tmp@none{none}%
  \edef\ddi@tmp{\ddi@tmp@deadlineisodate}%
    \ifx\ddi@tmp@none\ddi@tmp
      \def\ddi@tmp@deadlinedate{keine Abgabe}%
    \else
      \def\ddi@tmp@deadlinedate{\expandafter\ddi@isodatetohumanreadable\ddi@tmp@deadlineisodate\pgf@stop}%
    \fi
  \ddi@tmp@deadlinedate%
}

\def\get@exercisedeadlinedatefromid#1{%
  \csname ex@deadline@\getexercisenumberfromid{#1}\endcsname
}

\def\getexercisetutorialdatefromid#1{%
  \edef\ddi@tmp@isodate{\csname ex@tutorial@\getexercisenumberfromid{#1}\endcsname}%
  \expandafter\ddi@isodatetohumanreadable\ddi@tmp@isodate\pgf@stop%
}
\def\sem@getisodatefromexerciseid#1{\csname ex@date@\getexercisenumberfromid{#1}\endcsname}
\def\getexercisenumberfromid#1{\csname ex@number@#1\endcsname}

\def\lecturegetfirstdate{\sem@getisodatefromlectureid{1}}
\def\lecturegetlastdate{\sem@getisodatefromlectureid{\lec@lastlecnumber}}

\def\setsummerfirstlectureid#1{\edef\lec@summerfirstlectureid{#1}}
\def\setsummerlastlectureid#1{\edef\lec@summerlastlectureid{#1}}
\def\setwinterfirstlectureid#1{\edef\lec@winterfirstlectureid{#1}}
\def\setwinterlastlectureid#1{\edef\lec@winterlastlectureid{#1}}

\def\getsummerfirstlectureid{\lec@summerfirstlectureid}
\def\getsummerlastlectureid{\lec@summerlastlectureid}
\def\getwinterfirstlectureid{\lec@winterfirstlectureid}
\def\getwinterlastlectureid{\lec@winterlastlectureid}

%
% Lecture titles and subtitles.
%

\def\getlecturetitlefromid#1{\sem@getlecturetitlesfromid{#1}\sem@lecturetitle}
\def\getlecturesubtitlefromid#1{\sem@getlecturetitlesfromid{#1}\sem@lecturesubtitle}

\newif\ifsem@continuereadfile

\def\sem@empty{}
\def\sem@lecturetitle{}
\def\sem@lecturesubtitle{}

\newread\sem@lecturetitlesinputstream
\newread\sem@exercisetitlesinputstream

% Searches the body file of lecture with id #1 for the first
% occurrence of \lecturewithid at the very beginning of a line and
% stores the corresponding lecture title and subtitle in the macros
% \sem@lecturetitle and \sem@lecturesubtitle respectively.
%
\newread\sem@inputstream%

\def\sem@getlecturetitlesfromid#1{%
  % Set iteration condition.
  \sem@continuereadfiletrue%
  %
  % Macro for extracting and saving the result.
  \def\sem@extractlecturetitles##1##2##3 \lecturewithid{%
    \def\sem@lecturetitle{##2}%
    \def\sem@lecturesubtitle{##3}%
  }%
  %
  % Macro for examining the line.
  \long\def\sem@checkandgetargument##1\lecturewithid##2\pgf@stop{%
    % Prepare for \ifx check.
    \def\sem@tmp{##1}%
    \def\sem@tmpa{##2}%
    \ifx\sem@tmp\sem@empty%
      \ifx\sem@tmpa\sem@empty%
      \else%
        % We found the line!
        \sem@continuereadfilefalse%
        % Extract and store the result.
        \expandafter\sem@extractlecturetitles##2%
      \fi%
    \fi%
  }%
  %
  % Open the corresponding file.
  \immediate\openin\sem@lecturetitlesinputstream=\sem@lecgetbodyfilefromid{#1}%
  % Iterate over the lines.
  \loop \ifsem@continuereadfile%
    % Read the next line.
    \immediate\read\sem@lecturetitlesinputstream to \sem@nextline
    % Examine the line.
    \expandafter\sem@checkandgetargument\sem@nextline\lecturewithid\pgf@stop%
  \repeat%
  % We're done. Close the input stream.
  \immediate\closein\sem@lecturetitlesinputstream
}

\def\sem@getexercisetitlesfromid#1{%
  % Set iteration condition.
  \sem@continuereadfiletrue%
  %
  % Macro for extracting and saving the result.
  \def\sem@extractexercisetitles##1 \title{%
    \def\sem@exercisetitle{##1}%
  }%
  %
  % Macro for examining the line.
  \long\def\sem@checkandgetargument##1\title##2\pgf@stop{%
    % Prepare for \ifx check.
    \def\sem@tmp{##1}%
    \def\sem@tmpa{##2}%
    \ifx\sem@tmp\sem@empty%
      \ifx\sem@tmpa\sem@empty%
      \else%
        % We found the line!
        \sem@continuereadfilefalse%
        % Extract and store the result.
        \expandafter\sem@extractexercisetitles##2%
      \fi%
    \fi%
  }%
  %
  % Open the corresponding file.
  \immediate\openin\sem@exercisetitlesinputstream=\sem@exgetbodyfilefromid{#1}%
  % Iterate over the lines.
  \loop \ifsem@continuereadfile%
    % Read the next line.
    \immediate\read\sem@exercisetitlesinputstream to \sem@nextline
    % Examine the line.
    \expandafter\sem@checkandgetargument\sem@nextline\title\pgf@stop%
  \repeat%
  % We're done. Close the input stream.
  \immediate\closein\sem@exercisetitlesinputstream
}

% To my future me: 
% You once really liked the two macros above.

%
% Lecture Parts
%

\newcount\sem@numberofparts % stores the number of ranges

% Sets the lecture parts.
%
% Usage:
% \lecturelistofparts{
%   <id of first lecture in part>=<parttitle>,
%   <id of first lecture in part>=<parttitle>,
% }

\def\lecturelistofparts#1{
  \foreach \sem@partstartidandtitle[count=\map@i] in {#1} {
    \expandafter\sem@parse@partstartidandtitle\sem@partstartidandtitle\pgf@stop{\map@i}
    \global\sem@numberofparts=\map@i
  }
}

\def\sem@parse@partstartidandtitle#1=#2\pgf@stop#3{
  \expandafter\gdef\csname sem@partstart@lectureid@#3\endcsname{#1}
  \expandafter\gdef\csname sem@partstart@title@#3\endcsname{#2}
}

% Getter and setter.

\def\sem@getnumberofsemesterparts{\the\sem@numberofparts}
\def\sem@getlectureidfrompartnumber#1{\csname sem@partstart@lectureid@#1\endcsname}
\def\sem@getparttitlefrompartnumber#1{\csname sem@partstart@title@#1\endcsname}


% Translates lecture ids to file names. This is required for
%   - automatically inserting the lecture targets into the map,
%   - extraction of the lecture titles and subtitles of the body
%     files.
%
% This translation process should be removed, but this requires
% appropriate renaming of the folders within lecture_slides.

\def\lectureidstofoldernamelist#1{
  \foreach \sem@idfilenametuple in {#1} {
    \expandafter\sem@parse@idandfilename\sem@idfilenametuple\pgf@stop
  }
}

\def\sem@parse@idandfilename#1=#2\pgf@stop{
  \expandafter\xdef\csname sem@filename@#1\endcsname{../#2/body.tex}
}

\def\sem@getbodyfilefromid#1{\csname sem@filename@#1\endcsname}
\def\sem@lecgetbodyfilefromid#1{../lecture_slides/#1/body.tex}
\def\sem@exgetbodyfilefromid#1{../exercises/#1/body.tex}



% The following macro creates the file  podcasts.aux  that is required
% for creating the XML files for Till's podcasts. In this file, the
% i'th line consists of the title and the subtitle of the i'th
% lecture, separated by two hashmarks.

\def\makeauxfiles{%
  % Open outstreams
  \message{^^JOpening outstreams.^^J}
  \newwrite\pod@auxfile       \immediate\openout\pod@auxfile=podcasts.aux
  \newwrite\pres@auxfile      \immediate\openout\pres@auxfile=upload-presentation-files.aux
  \newwrite\preswiki@auxfile  \immediate\openout\preswiki@auxfile=wiki-presentation-files.aux
  \newwrite\ex@auxfile        \immediate\openout\ex@auxfile=upload-exercise-files.aux
  \newwrite\exwiki@auxfile    \immediate\openout\exwiki@auxfile=wiki-exercise-files.aux

  % Define counters for the following loop that iterates over all the
  % lecture numbers.
  \newcount\pod@tmpcnt \pod@tmpcnt=0
  \newcount\pod@lecmax \pod@lecmax=\lec@lastlecnumber

  \newcount\ex@tmpcnt \ex@tmpcnt=0
  \newcount\ex@maxcnt \ex@maxcnt=\ex@lastexercisenumber

  % Create temporary token registers
  \newtoks\pod@titletoks
  \newtoks\pod@subtitletoks

  % Generate lecture files
  \message{^^JGenerating lecture files.}
  \message{Considering the following lecture IDs:^^J}
  \loop
    \def\lectureid{\csname lec@id@\the\pod@tmpcnt\endcsname}
    \advance\pod@tmpcnt by 1
    {
      \sem@getlecturetitlesfromid{\lectureid}
      \expandafter\global\expandafter\pod@titletoks\expandafter=\expandafter{\sem@lecturetitle}
      \expandafter\global\expandafter\pod@subtitletoks\expandafter=\expandafter{\sem@lecturesubtitle}
      \message{\the\pod@tmpcnt. \lectureid: \the\pod@titletoks^^J}
    }
    \immediate\write\pod@auxfile{\the\pod@titletoks__\the\pod@subtitletoks}
    \immediate\write\pres@auxfile{\lectureid}
    \edef\ddi@tmp@isodate{\csname lec@date@\getlecturenumberfromid{\lectureid}\endcsname}%
    \immediate\write\preswiki@auxfile{%
      1. [attachment:\lectureid.pdf Vorlesung: \the\pod@titletoks],
      \expandafter\ddi@isodatetohumanreadable\ddi@tmp@isodate\pgf@stop%
    }
  \ifnum\pod@tmpcnt<\pod@lecmax
  \repeat

  \message{^^JFinished generating lecture files.^^J}

  % Create temporary token registers
  \newtoks\ex@titletoks

  \message{^^JGenerating exercise files.}
  \message{Considering the following exercise IDs:^^J}

  % Generate exercise files
  \loop
    \def\exerciseid{\csname ex@id@\the\ex@tmpcnt\endcsname}
    \advance\ex@tmpcnt by 1
    {
      \sem@getexercisetitlesfromid{\exerciseid}
      \expandafter\global\expandafter\ex@titletoks\expandafter=\expandafter{\sem@exercisetitle}
      \message{\the\ex@tmpcnt. \exerciseid: \the\ex@titletoks^^J}
    }
    \immediate\write\ex@auxfile{\exerciseid}
    \edef\ddi@tmp@tutorialisodate{\csname ex@tutorial@\getexercisenumberfromid{\exerciseid}\endcsname}%
    \edef\ddi@tmp@tutorialdate{\expandafter\ddi@isodatetohumanreadable\ddi@tmp@tutorialisodate\pgf@stop}%
    \edef\ddi@tmp@deadlineisodate{\csname ex@deadline@\getexercisenumberfromid{\exerciseid}\endcsname}%
    % Check whether sheet has deadline or not
    \def\ddi@tmp@none{none}%
    \edef\ddi@tmp{\ddi@tmp@deadlineisodate}%
    \ifx\ddi@tmp@none\ddi@tmp
      \def\ddi@tmp@deadlinedate{keine Abgabe}
    \else
      \def\ddi@tmp@deadlinedate{\expandafter\ddi@isodatetohumanreadable\ddi@tmp@deadlineisodate\pgf@stop}%
    \fi
    \immediate\write\exwiki@auxfile{%
      || [attachment:\exerciseid.pdf \the\ex@tmpcnt. Übung: \the\ex@titletoks] 
      || \ddi@tmp@tutorialdate || \ddi@tmp@deadlinedate ||%
    }
  \ifnum\ex@tmpcnt<\ex@maxcnt
  \repeat

  \message{^^JFinished generating exercise files.^^J}
  \message{^^JClosing outstreams.^^J}

  % Close outstreams
  \closeout\pod@auxfile     
  \closeout\pres@auxfile  
