%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ------------------------------------------------------------------------------------- %
% - chemexec - chemexec_en.tex -------------------------------------------------------- %
% - creating (chemical) exercise sheets, chemical macros ------------------------------ %
% ------------------------------------------------------------------------------------- %
% - Clemens Niederberger -------------------------------------------------------------- %
% - 2011/03/06 ------------------------------------------------------------------------ %
% ------------------------------------------------------------------------------------- %
% - http://www.niederberger-berlin.net/2010/08/latex-chemische-formeln-erstellen-iiv/ - %
% - kontakt@niederberger-berlin.net --------------------------------------------------- %
% ------------------------------------------------------------------------------------- %
% - If you have any ideas, questions, suggestions or bugs to report, please feel free - %
% - to contact me. -------------------------------------------------------------------- %
% ------------------------------------------------------------------------------------- %
% Copyright 2011 Clemens Niederberger                                                   %
%                                                                                       %
% This work may be distributed and/or modified under the                                %
% conditions of the LaTeX Project Public License, either version 1.3                    %
% of this license or (at your option) any later version.                                %
% The latest version of this license is in                                              %
%   http://www.latex-project.org/lppl.txt                                               %
% and version 1.3 or later is part of all distributions of LaTeX                        %
% version 2005/12/01 or later.                                                          %
%                                                                                       %
% This work has the LPPL maintenance status `maintained'.                               %
%                                                                                       %
% The Current Maintainer of this work is Clemens Niederberger.                          %
%                                                                                       %
% This work consists of the files chemexec.sty, chemexec_de.tex                         %
% and chemexec_en.tex                                                                   %
% ------------------------------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[DIV10]{scrartcl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% = PAKETE/EINSTELLUNGEN ============================================================== %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{array,slashbox}
\setlength\extrarowheight{7pt}
\usepackage{graphicx}
\usepackage[exercise,exersize=large,english]{chemexec}
  \usetikzlibrary{fadings,patterns}
\usepackage{xcolor,wrapfig}
\definecolor{dunkelblau}{rgb}{0,0.33,0.62}
\definecolor{dunkelrot}{rgb}{0.4392,0.0627,0.0627}
\usepackage{url,paralist}
\usepackage[perpage,multiple]{footmisc}          % Fußnoten
\usepackage[english]{varioref}                   % flexibles Referenzieren
  \labelformat{section}{section #1}
  \labelformat{subsection}{section #1}
  \labelformat{subsubsection}{section #1}
% = Hyperlinks ======================================================================== %
\usepackage{hyperref}
  \hypersetup{colorlinks=true,                   % Setup der Hyperlinks und des pdf
              linkcolor=black,
              urlcolor=blue!70,
              citecolor=black,
              plainpages=false,
              bookmarksopen=true,
              bookmarksopenlevel=1,
              bookmarksnumbered=true,
              pdfstartview=FitH,,
              pdfauthor={Clemens Niederberger},
              pdftitle={chemexec},
              pdfsubject={customizing you (chemical) exercise sheets},
              pdfkeywords={chemexec},
              pdfcreator={LaTeX}
  }
\usepackage{times,amssymb,chemfig,xspace}
% = Listings einstellen =============================================================== %
\lstset{
   basicstyle={\ttfamily\footnotesize},          % Grundstil
   extendedchars=true,
   numbers=left,                                 % Zeilennummern
   numberstyle=\tiny,                            % Größe des Zeilennummern
   numberblanklines=true,                        % Leerzeilen nummerieren
   gobble=1,                                     % das erste Leerzeichen abschneiden
   xleftmargin=20pt,                             % Einrückung links
   breaklines=true,                              % Zeilenumbruch
   moredelim=[is][\color{red}]{||}{||}                    % Hervorhebung
   }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - Kopf- und Fußzeile ---------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{scrpage2}
\pagestyle{scrheadings}
\setheadwidth{textwithmarginpar}
\automark{section}
\ihead{\CEx \CEversion}
\ifoot{\small\color{gray}-~page~\thepage~-}
\cfoot{}
\ofoot{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - Komascript ------------------------------------------------------------------------ %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setkomafont{disposition}{\rmfamily\bfseries}    % Gewicht fett und Schriftart roman

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - neue Befehle ---------------------------------------------------------------------- %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\option}[1]{`\texttt{#1}'\xspace}
\newcommand{\TikZ}{\mbox{Ti{\bfseries\itshape k}Z}\xspace}
\newcommand{\eg}{\mbox{e.\,g.}\xspace}
%\newcommand{\zB}{\mbox{z.\,B.}\xspace}
\newlength{\chemx}
\newlength{\chemy}
\newcommand{\CEx}[1][8]{%
{\color{dunkelrot}\fontfamily{pag}\fontsize{#1}{#1}\selectfont chemexec}\xspace
}
\let\saveversion\CEversion
\def\CEversion{\saveversion\xspace}

\begin{document}
\begin{titlepage}
  % inspired by the titlepage of chemfig's documentation
  \begin{tikzpicture}[remember picture,overlay]
    \shade [color=dunkelrot,right color=white](current page.south west) rectangle ([yshift=3cm,xshift=-3cm]current page.center);
    \shade[top color=black,bottom color=dunkelrot]([yshift=7cm]current page.east)rectangle([yshift=2.5cm]current page.west);
  \end{tikzpicture}
  \begin{center}
    \vspace*{-1.5cm}
    \CEx[45]\par
    \Large\CEversion\par\bigskip
    \footnotesize\CEdate{en}\par
    \normalsize Clemens Niederberger\par\vskip1.5cm
    \color{white}\huge creating (chemical) exercise sheets%
  \end{center}
  \vskip3cm
  
\end{titlepage}

\tableofcontents

\section{Licence}
\CEx \CEversion underlies the LaTeX Project Public License Version 1.3 or any later version.\newline(\url{http://www.latex-project.org/lppl.txt})

\section{About}
The \CEx package provides some environments and commands I needed when I created exercise sheets and other teaching material. There is a \verb=definition= environment, the \verb=beispiel= environment for examples (`beispiel' is german for example) and lots of other little commands I found useful.\\
For the exercise sheets I especially wanted an easy way to create numbered exercises and a flexible way to print out the corresponding solutions (see \ref{sec:aufgaben}).\\
\CEx also replaces \verb=echem.sty= for OCHEM\footnote{by Ingo Kl\"ockl \url{http://tug.ctan.org/tex-archive/support/ochem/}}.

\section{New in version \CEversion}
\CEx lost the commands \verb=\lw=, \verb=\lwbar=, \verb=\atomconnect= and the \verb=Schema= environment, because Lewis formul\ae\ can more easily be created with the `ChemFig' package and several other packages (\eg myChemistry) also provide reaction scheme environments.\\
\CEx now nicely works with \verb=pdflatex=, since there are no more commands using pstricks. I used \TikZ instead.

\section{Package options}
You can load \CEx with different options:
\begin{itemize}
 \item The \verb=chapter= option changes the counter of the exercises and solutions (see \ref{sec:aufgaben}) and of the \verb=beispiel= environment (see \ref{ssec:beispiele}).
 \item The \verb+color=<color>+ changes the color of the numbers with which the exercises ans solutions are numbered. It also changes the color of the lines bordering the \verb=beispiel= environments and the color of the title of the \verb=definition= environment.\\
 Default color is \verb=dunkelblau= defined by\\
 \verb=\xdefinecolor{dunkelblau}{rgb}{0,0.33,0.62}=.
 \item The \verb=english= option changes the german titles into english ones: "Aufgabe" $\leftrightarrow$ "Exercise", "L\"osung" $\leftrightarrow$ "Solution", "Beispiel" $\leftrightarrow$ "Example" and "Exkurs" $\leftrightarrow$ "Excursus".
 \item The \verb=exercise= option activates the commands for creating exercises and the corresponding solutions.
 \item The \verb+exersize=<fontsize>+ changes the fontsize of the titles of the exercises and their solutions.
 %\item Die Option \option{here} legt f"ur die \texttt{Schema}-Gleitumgebung als Positionierung \texttt{H} (genau hier) fest.
 \item The \verb+shade=<boolean>+ changes the layout of the \verb=definition= environment. Default is \verb=false=.
 \item The option \verb+shadecolor=<color>+ changes the background color of the\\ \verb=definition= environment if the option \verb+shade=true+ is used. Default is \verb=pink!50=.
 \item The \verb+numcolor=<color>+ changes the color of the numbers numbering the exercises and solutions.
\end{itemize}

\section{New commands}
\subsection{Maths}
Just some small macros I found useful:
\begin{itemize}
 \item \verb=\vek{}= writing vectors with an arrow: \verb=\vek{a}, \vek{A}= \vek{a}, \vek{A}.
 \item \verb=$\abs{}$= absolute value: \verb=\abs{\vek{a}}, \abs{-\frac{i}{2}}= \abs{\vek{a}}, \abs{-\frac{i}{2}}.
\end{itemize}
These commands can be used both in math mode and in text mode.

\subsection{Chemistry}
More macros I found useful. All chemistry commands can be used both in math mode and in text mode.
\subsubsection{Particles ans charges}
\begin{itemize}
 \item \verb=\el= electron: \el
 \item \verb=\prt= proton: \prt
 \item \verb=\ntr= neutron: \ntr
 \item \verb=\Hpl= proton: \Hpl
 \item \verb=\Hyd= hydroxide: \Hyd
 \item \verb=\ox{}{}= oxidation states\\
       \verb=Ca\ox{-1}{F}$_2$=  Ca\ox{-1}{F}$_2$;\\
       the first argument is the oxidation state, the second one the element.
 \item \verb=\om= and \verb=\op= charges \om\ und \op.\\
       These commands have an optional argument for the number of charges:\\\verb=Ca\op[2]=  Ca\op[2], \verb=\phosphat\om[3]=  \phosphat\om[3].
\end{itemize}

\subsubsection{Stereo descriptors}\label{sssec:stereo}
Some descriptors to make it easier writing the correct IUPAC name:
\begin{itemize}
 \item \verb=\Rcip= and \verb=\Scip=, rectus and sinister: \Rcip\ \Scip
 \item \verb=\Dfi= and \verb=\Lfi=, dexter and laevus: \Dfi\ \Lfi
 \item \verb=\E= and \verb=\Z=, opposite (german: entgegen) and together (german: zusammen): \E\ \Z
 \item \verb=\rconf= and \verb=\sconf= R/S configuration: \rconf\ and \sconf. Both commands have an optional argument changing the letter: \verb=\rconf[] \sconf[A]= \rconf[] \sconf[A]
\end{itemize}
\subsubsection{Anions}
I don't use them anymore since I found the `mhchem' package, but they're defined anyway:
\begin{itemize}
 \item \verb=\nitrat= : \nitrat
 \item \verb=\nitrit= : \nitrit
 \item \verb=\sulfat= : \sulfat
 \item \verb=\sulfit= : \sulfit
 \item \verb=\phosphat= : \phosphat
 \item \verb=\phosphit= : \phosphit
 \item \verb=\carbonat= : \carbonat
\end{itemize}

\subsubsection{Compatibility with `mhchem'}
You can use all chemistry commands in the formula commands of the `mhchem' package\footnote{by Martin Hensel \url{http://www.ctan.org/tex-archive/macros/latex/contrib/mhchem/}} like \verb=\ce{}=. `mhchem' is loaded automatically by \CEx if it is installed. If you want to load `mhchem' with other options than \verb+version=3+ you need to load it seperately \emph{before} loading \CEx.
\begin{lstlisting}[numbers=none,basicstyle=\normalsize\ttfamily,showspaces=true]
 \ce{2|| ||\ox{0}{Ca} +|| ||\ox{0}{O}_2 ->T[{~~~REDOX~~~}] 2Ca|| ||\op[2] + 2O|| ||\om[2]}
\end{lstlisting}
\ce{ 2 \ox{0}{Ca} + \ox{0}{O}_2 ->T[{~~~REDOX~~~}] 2Ca \op[2] + 2O \om[2] }\\
Please keep in mind that you need to leave the blanks before \verb=\om=, \verb=\op=, \verb=\ox{}{}=. Else you might get unexpected results:\verb=\ce{Ca\op[2]}=  \ce{ Ca\op[2] }.

\noindent Some more examples:
\begin{lstlisting}[numbers=none,basicstyle=\normalsize\ttfamily]
 \begin{align*}
  \cee{Na                  &->T[ox] Na\op||{}|| + \el}\\
  \cee{HCl_{aq}            &<=>> H\op_{aq} + Cl\om_{aq}}\\
  \cee{H2O                 &<<=> \Hpl + \Hyd}\\
  \cee{CaCl2 + H2\sulfat||{}|| &-> Ca\sulfat||{}|| v + 2 HCl}
 \end{align*}
\end{lstlisting}
\begin{align*}
 \cee{Na                  &->T[ox] Na\op{} + \el}\\
 \cee{HCl_{aq}            &<=>> H\op_{aq} + Cl\om_{aq}}\\
 \cee{H2O                 &<<=> \Hpl + \Hyd}\\
 \cee{CaCl2 + H2\sulfat{} &-> Ca\sulfat{} v + 2 HCl}
\end{align*}

\subsubsection{Commands for `mhchem'}
\CEx also provides some commands for numbered and centered reactions created by `mh\-chem'.
\begin{lstlisting}
 Reaction with a number:
 \reaction{2 H2 + O2 -> 2 H2O}%
 Reaction without a number:
 \reaction*{2 CO + O2 -> 2 CO2}
 More reactions at once, aligned:
 \reactions{Cl_2 ||&||-> 2 Cl. ||\\|| Cl. + CH4 ||&||-> HCl + {}.CH3}
\end{lstlisting}
Reaction with a number:
\reaction{2 H2 + O2 -> 2 H2O}%
Reaction without a number:
\reaction*{2 CO + O2 -> 2 CO2}
More reactions at once, aligned:
\reactions{Cl2 &-> 2 Cl. \\ Cl. + CH4 &-> HCl + {}.CH3}

\section{New environments}
\subsection{The {\ttfamily beispiel} environment - creating examples}\label{ssec:beispiele}
The \verb=beispiel= environment is an environment for examples. Examples automatically are numbered and placed between two lines. The fontsize of the examples is \verb=\small=.
\begin{lstlisting}
 ||\begin{beispiel}||
  an example
 ||\end{beispiel}||
\end{lstlisting}
\begin{beispiel}
 an example
\end{beispiel}
\noindent If you want to give two or more examples in between the same two lines, you can use \verb=\bsp=:
\begin{lstlisting}
 \begin{beispiel}
  first example
  ||\bsp||
  second one
 \end{beispiel}
\end{lstlisting}
\begin{beispiel}
 first example
 \bsp
 second one
\end{beispiel}

\subsubsection{The options \texttt{color}, \texttt{linecolor} \&\ \texttt{english}}
The \verb+linecolor=<color>+ option changes the color of the lines:
\begin{lstlisting}
 % preamble:
 \usepackage||[linecolor={rgb:red,4;green,6}]||{chemexec}
 % in the document:
 \begin{beispiel}
  green lines through package option
 \end{beispiel}
\end{lstlisting}
folgenden Output:
\begin{beispiel}[linecolor={rgb:red,4;green,6}]
 green lines through package option
\end{beispiel}
\noindent The option \verb+color=<color>+ also changes the color of the lines (but also changes the color of other things,too).\\
By using the key \verb+linecolor=<color>+ you can change the color of a single example:
\begin{lstlisting}
 \begin{beispiel}||[linecolor=purple]||
  the lonely purple one
 \end{beispiel}
\end{lstlisting}
folgenden Output:
\begin{beispiel}[linecolor=purple]
 the lonely purple one
\end{beispiel}
\noindent The \verb=english= option translates "Beispiel" into "Example".

\subsubsection{Not numbered examples}
If you don't like the numbering you can redefine the counter as usual.
\begin{lstlisting}
 \renewcommand{\thebeispiel}{}
 \begin{beispiel}
  now without counter
 \end{beispiel}
\end{lstlisting}
\renewcommand{\thebeispiel}{}
\begin{beispiel}
 now without counter
\end{beispiel}
\begin{lstlisting}
 \renewcommand{\thebeispiel}{\alph{beispiel})}
 \begin{beispiel}
  or alphabetically \ldots
 \end{beispiel}
\end{lstlisting}
\renewcommand{\thebeispiel}{\alph{beispiel})}
\begin{beispiel}
 or alphabetically \ldots
\end{beispiel}

\subsection{The {\ttfamily definition} environment}\label{sec:definition}
The \verb=definition= environment creates a box with a colored title:
\begin{lstlisting}
 ||\begin{definition}||
  The absolut value of a vector in $\mathbb{R}^3$ is
  \begin{equation}
   ||\abs{\vek{||a||}}||=\sqrt{a_x^2+a_y^2+a_z^2}
  \end{equation}
 ||\end{definition}||
\end{lstlisting}
\begin{definition}
 The absolut value of a vector in $\mathbb{R}^3$ is
 \begin{equation}
  \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
 \end{equation}
\end{definition}

\subsubsection{The options \texttt{shade}, \texttt{shadecolor} \& \texttt{color}}
With the key \verb+shade=<boolean>+ you can change the layout:
\begin{lstlisting}
 \begin{definition}||[shade=true]||
  The absolut value of a vector in $\mathbb{R}^3$ is
  \begin{equation}
   \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
  \end{equation}
 \end{definition}
\end{lstlisting}
\begin{definition}[shade=true]
 The absolut value of a vector in $\mathbb{R}^3$ is:
 \begin{equation}
  \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
 \end{equation}
\end{definition}
By using the keys \verb+shadecolor=<color>+ und \verb+color=<color>+ you can customize the environment:
\begin{lstlisting}
 \begin{definition}||[shade=true,shadecolor=green!15,color=black]||
  The absolut value of a vector in $\mathbb{R}^3$ is
  \begin{equation}
   \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
  \end{equation}
 \end{definition}
\end{lstlisting}
\begin{definition}[shade=true,shadecolor=green!15,color=black]
 The absolut value of a vector in $\mathbb{R}^3$ is:
 \begin{equation}
  \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
 \end{equation}
\end{definition}
You can use all of these keys as package options as well. This way, you can change the layout of every \verb=definition= environment at once. Please keep in mind, that in this case \verb+color=<color>+ also has effects on other commands and environments.
\begin{lstlisting}
 % preamble:
 \usepackage||[shade=true,shadecolor=yellow!15]||{chemexec}
 % in the document:
 \begin{definition}
  The absolut value of a vector in $\mathbb{R}^3$ is
  \begin{equation}
   \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
  \end{equation}
 \end{definition}
\end{lstlisting}
\begin{definition}[shade=true,shadecolor=yellow!15]
 The absolut value of a vector in $\mathbb{R}^3$ is:
 \begin{equation}
  \abs{\vek{a}}=\sqrt{a_x^2+a_y^2+a_z^2}
 \end{equation}
\end{definition}

\subsubsection{The \texttt{defformel} environment}
There is an additional environment, which only creates a white box. It has an optional argument for the width of the box.
\begin{lstlisting}
 \begin{definition}[shade=true]
  A carbon atom with four different substituents is called \textbf{asymmetric}. Asymmetric carbon atoms often are labelled with a \textasteriskcentered.
  ||\begin{defformel}[.5\textwidth]||
   \setatomsep{1.8em}
   \chemfig{R_1-[:30](-[2]R|_2)(-[6]R|_3)(-[:30,.15,,,white]{\text{\textasteriskcentered}})-[:-30]R_4}
  ||\end{defformel}||
 \end{definition}
\end{lstlisting}

\begin{definition}[shade=true]
  A carbon atom with four different substituents is called \textbf{asymmetric}. Asymmetric carbon atoms often are labelled with a \textasteriskcentered.
  \begin{defformel}[.5\textwidth]
   \setatomsep{1.8em}
   \chemfig{R_1-[:30](-[2]R|_2)(-[6]R|_3)(-[:30,.15,,,white]{\text{\stec}})-[:-30]R_4}
  \end{defformel}
 \end{definition}

\subsection{The \texttt{exkurs} environment}
The \verb=exkurs= environment is used to visually highlight an excursus (in a book or longer text) and produce an entry in the table of contents.
\begin{lstlisting}[numbers=none,basicstyle=\normalsize\ttfamily]
 \begin{exkurs}[options]{title}
  ...
 \end{exkurs}
\end{lstlisting}
You have two options: the \verb+toc=<toclevel>+ option with \verb=section= as default and the\linebreak\verb+color=<color>+ option.
\begin{lstlisting}
 ||\begin{exkurs}[color=-yellow]{Lorem ipsum}||
  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ...
 ||\end{exkurs}||
\end{lstlisting}
\begin{exkurs}[color=-yellow,toc=paragraph]{Lorem ipsum}
 Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zuril delenit augue duis dolore te feugait nulla facilisi.
\end{exkurs}
If you use \verb+color=<color>+ it also chages the color in other environments. The package option \verb=english= changes the german caption "Exkurs" into "Excursus".

\section[Exercises/solutions]{The option \texttt{exercise}: numbered exercises/solutions}\label{sec:aufgaben}
The main part of \CEx provides the commands for exercises and their solutions, which can be activated by the package option \verb=exercise=. Exercises have "Aufgabe" or "Exercise", respectively, as default title, which can be changed with the argument.
\begin{lstlisting}[numbers=none,basicstyle=\normalsize\ttfamily]
 \aufgabe{<title>}
\end{lstlisting}
For creating the solutions to the exercises, there are three commands:
\begin{lstlisting}[numbers=none,basicstyle=\normalsize\ttfamily]
 \loesung[<title>]{<solution>} % remember the solution
 \doloesung % writing the solutions sectionwise
 \makeloesung % writing all solutions
\end{lstlisting}
The first command \verb=\loesung{}= is used, to write the solution of an exercise \emph{directly after the exercise}. The second command \verb=\doloesung= writes all the solutions gathered in the actual \verb=section= by the \verb=\loesung{}= commands. Since sections reset the counter of the exercises and \verb=\doloesung= resets gathering of the solutions, you should use \verb=\doloesung= at the end of a section. Otherwise, the numbers of the solutions might not be the numbers of the corresponding exercises anymore. If you're creating a document which has chapters, you should keep in mind, that \verb=\doloesung= should be used at the end of a chapter, if you had exercises in that chapter.\\
Instead of \verb=\doloesung=, you can use \verb=\makeloesung= once after \emph{all} exercises and solutions are set to write all the solutions.

\subsection{Options}
With the \verb+exersize=<fontsize>+ option you can change the fontsize of the exercises' and solutions' titles. Possible values are the usual ones: \verb=tiny=, \verb=scriptsize=, \verb=footnotesize=, \verb=small=, \verb=normalsize=, \verb=large=, \verb=Large=, \verb=LARGE=, \verb=huge= and \verb=Huge=.\\
Default font size is \verb=normalsize=.\\
The \verb+numcolor=<color>+ package option changes the color of the numbers with which the exercises are numbered. The \verb=english= package option translates "Aufgabe" into "Exercise" and "L\"osung" into "Solution".\\
In the default behaviour \CEx resets the numbers of the exercises with each new \verb=\section=. If you use the \verb=chapter= package option, the counter is reset with each new \verb=\chapter=.

\subsection{The {\ttfamily alphlist} environment}
The \texttt{alphlist} environment creates a list similar to the \verb=enumerate= environment, but counts the items with a), b) etc.
\begin{lstlisting}
 \begin{alphlist}
  \item first item
  \item second item
 \end{alphlist}
\end{lstlisting}
\begin{alphlist}
 \item first item
 \item second item
\end{alphlist}

\subsection{Example}
In the following example you see the \verb=\aufgabe=, \verb=\loesung= and \verb=doloesung= commands in action.
\begin{lstlisting}
 % preamble:
 \usepackage||[exercise,exersize=large]||{chemexec}
 % Im Dokument:
 \par{\Large\bfseries\noindent Exercises}
 ||\aufgabe{}||
  Write down the protolysis reactions of phosphoric acid.||\loesung{||\ce{H3PO4 <=> \Hpl{} + H2PO4\om{} <=> 2\Hpl{} + HPO4 \om[2]{} <=> 3\Hpl{} + PO4 \om[3]}||}||
 ||\aufgabe{||Oxidation states||}||
  Which oxidation state has nitrogen in thze following compounds: ammonia, nitric oxide, nitrogen dioxide, nitric acid?||\loesung[||Oxidation states||]{||
  \ce{ \ox{-3}{N} H3}, \ce{ \ox{+2}{N} O}, \ce{ \ox{+4}{N} O2}, \ce{H \ox{+5}{N} O3}||}||
 ||\aufgabe{||Nomenclature||}||
  Name the molecules:\\\setatomsep{1.4em}
  \begin{inparaenum}[a)]
   \item\chemfig{-[::30](=[::60]O)-[::-60]OH}
   \item\chemfig{-[::30](=[::60]O)-[::-60]O-[::60]-[::-60]}
   \item\chemfig{HO-[::-30](=[::-60]O)-[::60]-[::-60]-[::60](=[::60]O)-[::-60]OH}
  \end{inparaenum}
 ||\loesung[||Nomenclature||]{||
  \begin{inparaenum}[a)]
   \item ethanoic acid
   \item ethyl ethanoate
   \item butanedioic acid
  \end{inparaenum}
 ||}||
 ||\aufgabe{}||
  Sketch the skeletal formula of glycerol. Also give the IUPAC name.
 ||\loesung{\chemname{\chemfig{HO-[::-30]-[::60](-[::60]OH)-[::-60]-[::60]OH}}{1,2,3-Propantriol}}||
 \vspace{\baselineskip}
 \par{\Large\bfseries\noindent Solutions}
 ||\doloesung||
\end{lstlisting}
\newpage
\par{\Large\bfseries\noindent Exercises}
\aufgabe{}
 Write down the protolysis reactions of phosphoric acid.\loesung{\ce{H3PO4 <=> \Hpl{} + H2PO4\om{} <=> 2\Hpl{} + HPO4 \om[2]{} <=> 3\Hpl{} + PO4 \om[3]}}
\aufgabe{Oxidation states}
 Which oxidation state has nitrogen in thze following compounds: ammonia, nitric oxide, nitrogen dioxide, nitric acid?\loesung[Oxidation states]{\ce{ \ox{-3}{N} H3}, \ce{ \ox{+2}{N} O}, \ce{ \ox{+4}{N} O2}, \ce{H \ox{+5}{N} O3}}
\aufgabe{Nomenclature}
 Name the molecules:\\\setatomsep{1.4em}
 \begin{inparaenum}[a)]
  \item\chemfig{-[::30](=[::60]O)-[::-60]OH} \item \chemfig{-[::30](=[::60]O)-[::-60]O-[::60]-[::-60]} \item \chemfig{HO-[::-30](=[::-60]O)-[::60]-[::-60]-[::60](=[::60]O)-[::-60]OH}
 \end{inparaenum}
 \loesung[Nomenclature]{
 \begin{inparaenum}[a)]
 \item ethanoic acid
 \item ethyl ethanoate
 \item butanedioic acid
 \end{inparaenum}
}
\aufgabe{}
 Sketch the skeletal formula of glycerol. Also give the IUPAC name.
\loesung{\chemname{\chemfig{HO-[::-30]-[::60](-[::60]OH)-[::-60]-[::60]OH}}{propan-1,2,3-triol}}
\vspace{\baselineskip}
\par{\Large\bfseries\noindent Solutions}
\doloesung

\subsection{Bugs?}
It is very likely, that either \verb=\doloesung= or \verb=\makeloesung= or both have bugs. If you detect any, please let me know.

\section{Replacement for \texttt{echem.sty}}
The \verb=echem.sty= is part of Ingo Kl\"ockls OCHEM\footnote{\url{http://tug.ctan.org/tex-archive/support/ochem/}}. It enables the lewis representation of electrons. Additionally \verb=echem.sty= provides the commands \verb=\sbond= und \verb=\dbond= with which you can typeset a single or a double bond in normal text. Both commands are defined in the `mhchem' package as well-
\begin{itemize}
 \item `mhchem':
 \begin{itemize}
  \item\texttt{\textbackslash ce\{F\textbackslash sbond F\}}: \ce{F\sbond F}
  \item\texttt{\textbackslash ce\{O\textbackslash dbond O\}}: \ce{O\dbond O}
 \end{itemize}
 \item\newcommand{\sibond}{\,\ensuremath{\cdot}\,}\newcommand{\dobond}{\,=\,} `echem':
 \begin{itemize}
  \item\texttt{F\textbackslash sbond F}: F\sibond F
  \item\texttt{O\textbackslash dbond O}: O\dobond O
 \end{itemize}
\end{itemize}
To avoid conflicts with `mhchem' besides these two commands and the commands \verb=\2= and \verb=\3= \CEx has the same functionality as \verb=echem.sty=. So it can be used instead of \verb=echem.sty= in OCHEM's \verb=chemspecial= environment.
\begin{lstlisting}
 % preamble
 \usepackage{ochem,chemexec}
 % in the document:
 \begin{chemspecial}
  ||package("chemexec")||
 \end{chemspecial}
 \begin{chemistry}
  formula(L,R){
    bond(30;-30;30)
    branch { bond(90,=C)
             atom("||\vdd{||O||}||O\vdd{O}");
           }
    bond(-30;30;-30)
    atom("||\hdl[\echhbar]{||O||}\hdu||[\echhbar]||{||O||}||O",L,R)
    bond(30;-30)
  }
 \end{chemistry}
\end{lstlisting}
\includegraphics{./formel.jpg}%\\% formel.jpg: 131x44 pixel, 100dpi, 3.33x1.12 cm, bb=0 0 94 32

\section{Epilogue}
I tried using real chemical reactions but I didn't make sure, that they all make sense chemically. So you shouldn't trust the examples in respect to chemistry but rather take a look into a real chemistry teaching book.\\
I apologize for any bad or wrong English. I hope you understood the documention anyway.
\end{document}