\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{spioncamp}[2011/09/22]
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\RequirePackage[ngerman]{babel}
\RequirePackage[scaled=1]{helvet}
\RequirePackage{geometry}
\RequirePackage{graphicx}
\RequirePackage{titling}
\RequirePackage{tikz}
\RequirePackage{framed}
\RequirePackage{color}
\RequirePackage{wrapfig}
\RequirePackage{setspace}
\RequirePackage{tabularx}
\RequirePackage{scrpage2}
\pagestyle{scrheadings}

\def\sheettype{}
\DeclareOption{SB}{\def\sheettype{}}
\DeclareOption{LB}{\def\sheettype{Lösungen}}
\DeclareOption{AB}{\def\sheettype{Arbeitsblatt}}
\DeclareOption{MA}{\def\sheettype{Material}}
%\DeclareOption*{\def\sheettype{\CurrentOption}}
\ProcessOptions\relax

\clearscrheadfoot

\usepackage{paralist}

\newcommand{\todo}[1]{\textbf{\textsc{\textcolor{red}{(TODO: #1)}}}}
%\renewcommand{\todo}[1]{}

\def\version{1}
\def\school{Uni Wuppertal}

\renewcommand{\familydefault}{\sfdefault}

\setlength{\fboxsep}{0mm}
\setlength{\parindent}{0mm}
\onehalfspacing
\definecolor{col_bg}{rgb}{0.7,0.9,0.7}
\definecolor{col_bg_light}{rgb}{0.9,0.98,0.9}
% text color for reddish text
\definecolor{col_high}{rgb}{0.6353,0.1569,0.1569}

\newcommand{\abb}[2]{\vspace{-2mm}\begin{center}\includegraphics[#1]{#2}\end{center}\vspace{-4mm}}

\newcommand{\parage}[3]{
  \colorbox{#1}{
    \begin{tabularx}{\textwidth}{lc}       
      \begin{minipage}[t]{0.1\linewidth}
        \vspace{0px}
        #2
      \end{minipage} &
      \begin{minipage}[t]{0.85\linewidth}
        \vspace{0.4ex}
        #3
        \vspace*{1ex}
      \end{minipage}
    \end{tabularx}
  }
  \smallskip
}

\newcommand{\paragen}[3]{
  \colorbox{#1}{
    \begin{tabularx}{\textwidth}{cc}       
      \begin{minipage}[t]{0.15\linewidth}
        \vspace{0px}
        \centering\textbf{\small #2}
      \end{minipage} &
      \begin{minipage}[t]{0.8\linewidth}
        \vspace{0px}
        #3
        \vspace*{1ex}        
      \end{minipage}
    \end{tabularx}
  }
  \smallskip
}

\newcommand{\boxintro}[2]{\paragen{col_bg}{#1}{#2}}

\newcommand{\boxintrofullwidth}[1]{\fboxrule0.3mm\fboxsep5mm\colorbox{col_bg}{#1}}

%\newcommand{\boxintrofullwidth}[1]{\colorbox{col_bg}{%       
%  \begin{minipage}[t]{\linewidth}\vspace{0px}#1\end{minipage}
%  \smallskip
%}}

% displays "Aufgabe"-pic and text
\newcommand{\exercise}[2]{\vspace*{1.5ex}\parage{white}{%
\setlength{\unitlength}{0.1mm}
\begin{picture}(0,50)%
    \put(0,0){\includegraphics[scale=0.75]{./abbildungen/style/marker-exercise}}%
    \put(110,-73){\includegraphics[scale=0.75]{./abbildungen/digit#1}}%
\end{picture}}{#2}}

% displays "Lösung"-pic and text
\newcommand{\solution}[2]{\vspace*{1.5ex}\parage{white}{%
\setlength{\unitlength}{0.1mm}
\begin{picture}(0,50)%
    \put(0,0){\includegraphics[scale=0.75]{./abbildungen/style/marker-solution}}%
    \put(115,-75){\includegraphics[scale=0.75]{./abbildungen/digit#1}}%
\end{picture}}{#2}}

% displays "Beispiel"-pic and text
\newcommand{\example}[2]{\parage{col_bg_light}{%
    \includegraphics[scale=0.75]{./abbildungen/style/marker-example}\\#1}{#2}}

\newcommand{\high}[1]{\textbf{\textcolor{col_high}{#1}}}


%%%%%%%%%%%%%%%%%%%%%%%%%
% Skript - Beschreibung %
%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\level}[2]{\fboxrule0.3mm\fboxsep5mm\colorbox{#2}{\textbf{Schwierigkeit: #1}}\\}
 
\newenvironment{material}{% 
  \vspace*{2ex} 
  \textbf{benötigtes Material:} 
  \begin{list}{$\circ$}{\setlength\topsep{-0.5ex}\setlength\itemsep{-0.5ex}} 
  \let\olditem\item
  \renewcommand\item{\olditem}
}{%
  \end{list}
  \vspace{2ex}
}

\newcommand{\degree}{$^\circ$}

\newcommand{\spioncampurl}{\url{http://ddi.uni-wuppertal.de/material/spioncamp}}

\newenvironment{fshaded}{%
\def\FrameCommand{\fboxrule0.3mm\fboxsep5mm\fcolorbox{col_bg}{col_bg_light}}%
%\def\FrameCommand{\fboxrule0.3mm\fboxsep5mm\colorbox{col_bg_light}}%
\MakeFramed {\FrameRestore}}%
{\endMakeFramed}

\newenvironment{colbox}{%
\begin{fshaded}}{\end{fshaded}}

%\newenvironment{crafting}{%
%\begin{wrapfigure}{l}{2cm}\includegraphics[scale=0.05]
%{./abbildungen/style/crafting}\end{wrapfigure}}{}

\newenvironment{crafting}{%
\vspace*{3ex}
\begin{minipage}{0.1\linewidth}
\vspace*{0pt}  
  \includegraphics[width=1.0\linewidth]{./abbildungen/style/crafting}
\end{minipage}
\begin{minipage}{0.8\linewidth}}
{\end{minipage}}

\newcounter{excounter}
\newenvironment{excercises}{% 
  \begin{list}{\theexcounter}{}
  \let\olditem\item
  \renewcommand\item{\olditem}
}{%
  \end{list}
}

\geometry{a4paper,
 left=25mm,right=15mm,top=10mm,bottom=15mm,
 portrait, 
 heightrounded, 
 marginparwidth=0pt,
 nomarginpar,
 headheight=15mm,
 textwidth=16cm, 
% showframe, 
 includehead, 
 includefoot,
 footnotesep=0mm,
 twoside}

\RequirePackage{pdfcomment}
%\RequirePackage{pdfmarginpar}
\RequirePackage{hyperref}
\RequirePackage{zref-totpages}

%%%%%%%%%%%%%%%%%%%%%
% HEADER and FOOTER %
%%%%%%%%%%%%%%%%%%%%%

\renewcommand*{\headfont}{\normalfont\sffamily}
\renewcommand*{\footfont}{\normalfont\sffamily}

\ihead{\includegraphics[width=25mm]{./abbildungen/SpionCamp-OhneBUW}}
\ohead{\Large{\thetitle}\\\normalsize{\@subtitle}\\~}
\ifoot{\includegraphics[width=30mm]{./abbildungen/Logo_BUW-Schwarz}}
\cfoot{\ifthenelse{\ztotpages > 1}{\thepage}{}}
\ofoot{\includegraphics[width=20mm]{./abbildungen/cc-by-nc-sa}\\\tiny v\version}
\chead{\textbf{\sheettype}}
