%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------------------------- %
% - the CHEMMACROS bundle                                                   - %
% - chemmacros_doc_en.tex                                                   - %
% - macros and commands for chemists                                        - %
% --------------------------------------------------------------------------- %
% - Clemens Niederberger                                                    - %
% - 2012/03/14                                                              - %
% --------------------------------------------------------------------------- %
% - https://bitbucket.org/cgnieder/chemmacros/                              - %
% - contact@mychemistry.eu                                                  - %
% --------------------------------------------------------------------------- %
% - If you have any ideas, questions, suggestions or bugs to report, please - %
% - feel free to contact me.                                                - %
% --------------------------------------------------------------------------- %
% - Copyright 2011-2012 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.            - %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% if you want to compile this documentation:
%
% > xelatex chemmacros_doc_en (2 or 3 times)
% > biber chemmacros_doc_en
% > makeindex -sl index_en.ist chemmacros_doc_en.idx
% > xelatex chemmacros_doc_en
%
\documentclass[DIV11,toc=index,toc=bib]{scrartcl}
\usepackage{fontspec,xltxtra}
\usepackage{polyglossia}
  \setmainlanguage{english}
\usepackage[normalem]{ulem}
\usepackage{chemfig,chemstyle,upgreek,textgreek,multicol,makeidx,booktabs,csquotes,cancel}
\usepackage{chemmacros}
\usepackage[version=3]{mhchem}
\usepackage[para]{footmisc}

% Setup:
\setmainfont[SmallCapsFont=Linux Libertine Capitals O,SlantedFont=Linux Libertine Slanted O]{Linux Libertine O}
\setsansfont[Scale=MatchLowercase,SmallCapsFont=Linux Biolinum Capitals O,SlantedFont=Linux Biolinum Slanted O]{Linux Biolinum O}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
\chemsetup[option]{synchronize}
\colorlet{chemformula}{darkgray}
\chemsetup[chemformula]{font-spec={[Color=chemformula]Latin Modern Sans}}
\reversemarginpar
\input{chemmacros-codehelper}

\begin{filecontents}{index_en.ist}
 preamble "\\begin{theindex}\n Section titles are indicated \\textbf{bold}, packages \\textsf{sans serif}, commands \\textcolor{code}{\\texttt{\\textbackslash brown}}, keys \\textcolor{key}{\\texttt{green}} and modules (only \\chemmacros) \\textcolor{module}{\\texttt{red}}.\\newline\n\n"
 heading_prefix "{\\bfseries "
 heading_suffix "\\hfil}\\nopagebreak\n"
 headings_flag  1
 delim_0 "\\dotfill "
 delim_1 "\\dotfill "
 delim_2 "\\dotfill "
 delim_r "\\textendash"
 suffix_2p "\\nohyperpage{\\,f.}"
 suffix_3p "\\nohyperpage{\\,ff.}"
\end{filecontents}

\usepackage[backend=biber,style=alphabetic,maxbibnames=20]{biblatex}
\addbibresource{\jobname.bib}
\begin{filecontents}{\jobname.bib}
@book{iupac:greenbook,
  author    = {E. Richard Cohan and Tomislav Cvita\v{s} and Jeremy G. Frey and Bertil Holmström and Kozo Kuchitsu and Roberto Marquardt and Ian Mills and Franco Pavese and Martin Quack and Jürgen Stohner and Herbert L. Strauss and Michio Takami and Anders J Thor},
  title     = {“Quantities, Symbols and Units in Physical Chemistry”, \IUPAC Green Book},
  edition   = {3rd Edition. 2nd Printing},
  year      = {2008},
  publisher = { \IUPAC \&\ RSC Publishing, Cambridge}
}
@misc{eu:ghsystem_regulation,
  author   = {{The European Parliament and The Council of the European Union}},
  title    = {Regulation (EC) No 1272/2008 of the European Parliament and of the Council},
  subtitle = {on classification, labelling and packaging of substances and mixtures, amending and repealing Directives 67/548/EEC and 1999/45/EC, and amending Regulation (EC) No 1907/2006},
  journal  = {Official Journal of the European Union},
  date     = {2008-12-16}
}
@online{unece:ghsystem_implementation,
  author   = {United Nations Economic Commission for Europe},
  title    = {GHS Implementation},
  url      = {http://www.unece.org/trans/danger/publi/ghs/implementation_e.html},
  urldate  = {2012-03-20},
  date     = {2012-03-20}
}
\end{filecontents}

\DeclareInstance{xfrac}{chemformula-text-frac}{text}
  {
    scale-factor        = 1 ,
    denominator-bot-sep = -.2ex ,
    denominator-format  = \scriptsize #1 ,
    numerator-top-sep   = -.2ex ,
    numerator-format    = \scriptsize #1
  }

\usepackage{hyperref}
  \hypersetup{colorlinks         = true,
              allcolors          = myblue,
              plainpages         = false,
              bookmarksopen      = true,
              bookmarksopenlevel = 1,
              bookmarksnumbered  = true,
              bookmarksdepth     = paragraph,
              pdfauthor          = {Clemens Niederberger},
              pdftitle           = {chemmacros bundle - English documentation},
              pdfsubject         = {macros and commands for chemists},
              pdfkeywords        = {chemmacros,chemformula,ghsystem},
              pdfcreator         = {XeLaTeX},
              pdfstartview       = FitH
  }

\newcommand*\chemmacros{{\scshape\textcolor{myblue}{chemmacros}}\xspace}
\newcommand*\chemformula{{\scshape\textcolor{myblue}{chemformula}}\xspace}
\newcommand*\ghsystem{{\scshape\textcolor{myblue}{ghsystem}}\xspace}

\newcommand*\Chemmacros{{\fontspec[Color=myblue,Scale=1.2]{Linux Biolinum Shadow O}chemmacros}}
\newcommand*\Chemformula{{\fontspec[Color=myblue,Scale=1.2]{Linux Biolinum Shadow O}chemformula}}
\newcommand*\Ghsystem{{\fontspec[Color=myblue,Scale=1.2]{Linux Biolinum Shadow O}ghsystem}}

\newcommand*\eg{\mbox{e.\,g.}\xspace}
\newcommand*\ie{\mbox{i.\,e.}\xspace}
\newcommand*\etc{\mbox{etc.}\xspace}
\newcommand*\TIKZ{Ti\textbf{\textit{k}}Z}
\newcommand*\TikZ{\index{TikZ@\TIKZ}\mbox{\TIKZ}\xspace}

\newcommand*\pdfTeX{\textsc{pdf\kern-.2ex\TeX}}
\renewcommand*\LuaTeX{{Lua\kern-.2ex\TeX}}

\providecommand\glqq{„}
\providecommand\grqq{“}

\makeindex
\begin{document}
\GetFileInfo{chemmacros}

\begin{center}
 % title:
 \Huge the \Chemmacros\ bundle \\[.5cm]
 \fileversion \qquad \filedate \\[.5cm]
 \Large packages \Chemmacros, \Chemformula\ and \Ghsystem \\[.5cm]
 % author and contact:
 \large Clemens \textsc{Niederberger} \\[.5cm]
 \normalsize\url{https://bitbucket.org/cgnieder/chemmacros/}\\
 \href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu}\\[1cm]
 % picture:
 \large\ch[font-spec={[Color=chemformula]Augie}]{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}" \pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
 \redox(o1,o2)[red,-cf]{\small\ch[font-spec={[Color=red]Augie},math-space=.3em]{$-$ 2 e-}}
 \redox(r1,r2)[blue,-cf][-1]{\small\ch[font-spec={[Color=blue]Augie},math-space=.3em]{$+$ 2 e-}}
\end{center}
\vskip1cm
\begin{multicols}{2}
 \tableofcontents
\end{multicols}

\part{Preliminaries}\secidx{PRELIMINARIES}
\section{Licence, Requirements and README}
The \chemmacros bundle underlies the \LaTeX\ project public license (lppl) version 1.3 or later. (\url{http://www.latex-project.org/lppl.txt})

The \chemmacros bundle needs the bundles \paket{l3kernel} and \paket{l3packages}. It also needs the packages \paket{siunitx}, \paket{mathtools}, \paket{bm}, \paket{nicefrac} and \paket{environ} as well as \paket*{tikz}\footnote{CTAN: \href{http://www.ctan.org/pkg/pgf/}{pgf}} and the \TikZ libraries \texttt{calc} and \texttt{arrows}.

Package option \key{bpchem} (section \ref{sec:optionen}) needs the package \paket{bpchem}, package option \key{xspace} needs the package \paket{xspace} and package option \key{method}{mhchem} needs the package \paket{mhchem}.

With v3.0 the \chemmacros package has been bundled with the new packages \chemformula and \ghsystem. \chemformula provides an alternative to \paket{mhchem}. This leads to some internal changes in \chemmacros. On the same time the documentation has been redesigned.

You might remember that \chemmacros' options all belong to different modules, see section \ref{sec:setup} for further information. These are typeset in the left margin when the option is first mentioned. In section \ref{sec:overview} all options and the module the belong to are listed. Throughout the document options are typeset \textcolor{key}{\texttt{green}} and modules \textcolor{module}{\texttt{red}}.

The package \ghsystem needs the packages \chemmacros, \paket{tabu}, \paket{longtable}, \paket{ifpdf} and \paket{graphicx}. \ghsystem has no own package options but passes all options on to \chemmacros.

\achtung{There are some deprecated commands and options which are not explained in the manual any more but still exist to ensure backwards compatibility. These commands issue a warning. They may be dropped some time in the future.}

\section{Motivation and Background}
\chemmacros started some years ago as a growing list of custom macros that I frequently used. I cannot completely recall when and why I decided to release them as a package. Well \textendash\ here we go and you might find it useful, too, I hope.

I would guess that nearly every chemist using \LaTeXe\ is aware of the great \paket{mhchem} package by Martin Hensel. There have always been some difficulties intertwining it with \chemmacros, though. Also, some other minor points in \paket{mhchem} always bothered me, but they hardly seemed enough for a new package. They weren't even enough for a feature request to the \paket{mhchem} author. The challenge and the fun of creating a new package and the wish for a highly customizable alternative led to \chemformula after all.

\chemformula works very similar to \paket{mhchem} but is more strict as to how compounds, stoichiometric factors and arrows are input. In the same time \chemformula offers possibilities to customize the output that \paket{mhchem} does not. Since \chemformula is meant as an \emph{alternative} to \paket{mhchem} \chemmacros offers a package option allowing you to choose which one of the two is used.

As a chemist you are probably aware of the fact that the \textsc{United Nations} have developed the \enquote{\textbf{G}lobally \textbf{H}armonized \textbf{S}ystem of Classification and Labelling of Chemicals} (GHS) as a global replacement for the various different systems in different countries. While it has not been implemented by all countries yet\cite{unece:ghsystem_implementation}, it as only a matter of time.

The package \ghsystem now enables you to typeset all the hazard and precautionary statements and pictograms in a very easy way. The statements are taken from EU regulation 1272/2008 \cite{eu:ghsystem_regulation}.

There are four points I hope I have achieved with this bundle:
\begin{itemize}
 \item intuitive usage as far as the syntax of the commands is concerned
 \item the commands shall not only make typesetting easier and faster but also the document source more readable with respect to semantics  (\lstinline=\ortho-dichlorobenzene= is easier to read and understand than \lstinline=\textsl{o}-dichlorobenzene=)
 \item as much customizability as I could think of so every user can adapt the commands to his or her own wishes
 \item \IUPAC compliant default settings
\end{itemize}
Especially the last point needed some pushing from users to get things right in many places. If you find anything not compliant with \IUPAC recommendations\footnote{This does not convern the \cmd{ox} command. The \IUPAC version is \cmd[oxa]{ox*}.} I would welcome an email very much!

\section{Installation, Loading the Bundle}\secidx{Loading the Bundle}\secidx{Installation}
The bundle comes with three style files\footnote{Those ending \texttt{sty}.}, a directory called \texttt{language/} containing the language-definition files for GHS (ending \texttt{def}), and a directory \texttt{pictures/} containing \texttt{eps}, \texttt{jpg} and \texttt{png} files (the GHS pictogramms). If you install the bundle manually \emph{please make sure to place the directories \texttt{language/} and \texttt{pictures/} in the \emph{same} directory as the style files}.

Loading \chemmacros with
\begin{beispiel}[code only]
 \usepackage{chemmacros} % `chemmacros', `chemformula' and `ghsystem' are loaded
\end{beispiel}
will also load \chemformula and \ghsystem. However, you can prevent \chemmacros from loading \ghsystem:
\begin{beispiel}[code only]
 \usepackage[ghsystem=false]{chemmacros} % `chemmacros' and `formula' are loaded
\end{beispiel}

Loading \chemformula or \ghsystem explicitly is possible and will also load \chemmacros if it hasn't been loaded yet, and will therefore implicitly load the other package, too.
\begin{beispiel}[code only]
 \usepackage{chemformula} % `chemmacros', `formula' and `ghs' are loaded
 or
 \usepackage[ghs=false]{chemformula} % `chemmacros' and `formula' are loaded
\end{beispiel}

However, it is recommended to simply use \lstinline=\usepackage{chemmacros}= and setup the required options with \lstinline=\chemsetup= (also see section \ref{sec:setup}).
\secidx*{Installation}\secidx*{Loading the Bundle}

\section{Package Options}\label{sec:optionen}\secidx{Package Options}
\chemmacros has several package options. They all are used as key/value pairs like
\begin{beispiel}[code only]
 \usepackage[option1 = <value1>, option2 = <value2>]{chemmacros}
\end{beispiel}
Some also can be used without value (\lstinline+\usepackage[option1]{chemmacros}+), which means that the \uline{underlined} value is used.

Both \chemformula and \ghsystem don't have package options of their own. If you load them explicitly you can give them \chemmacros' options instead and they will pass them on to \chemmacros.
\begin{description}
 \item \key[option]{bpchem}{\uline{true}/false} This option loads the package \paket{bpchem} and adjusts the layout of the \cmd{NMR} command to the \paket{bpchem} commands \lstinline+\HNMR+ and \lstinline+\CNMR+. (default = \texttt{false})
 \item \key[option]{circled}{\uline{formal}/all/none} \chemmacros uses two different kinds of charges which indicate the usage of real ($+/-$) and formal (\fplus/\fminus) charges. The option \texttt{formal} distinguishes between them, option \texttt{none} displays them all without circle, option \texttt{all} circles all (default = \texttt{formal})
 \item \key[option]{circletype}{\uline{chem}/math} This option switches between two kinds of circled charge symbols: \cmd{fplus} \fplus\ and \lstinline+$\oplus$+ $\oplus$. (default = \texttt{chem})
 \item \key[option]{cmversion}{1/2/bundle} This option restores the old definitions of some commands, so documents set with v1.* will still compile correctly. (default = \texttt{bundle}). Actually \texttt{2} and \texttt{bundle} are only aliases. This option can only be chosen in the preamble. Note: this is a new name for the now deprecated option \key{version}.
 \item \key[option]{detect-bold}{\uline{true}/false} \emph{This option is deprecated!}
 \item \key[option]{EZ}{\uline{chemmacros}/cool} \emph{This option is deprecated!}
 \item \key[option]{german}{\uline{true}/false} This option changes the commands \cmd{pKa}, \cmd{sld} and \cmd{lqd} (default = \texttt{false}). This option has the alias \key[option]{ngerman}.
 \item \key[option]{ghsystem}{\uline{true}/false} Disable the use of the \ghsystem package. Setting \key{ghs}{false} will prevent \chemmacros from loading \ghsystem. (default = \texttt{true})
 \item \key[option]{iupac}{auto/restricted/strict} Take care of how iupac naming commands are defined, see page \pageref{key:iupac} (default = \texttt{auto})
 \item \key[option]{method}{\uline{chemformula}/mhchem} You can choose the method which \chemmacros will use for the reaction environments (see section \ref{ssec:mhchem_reaktionen}) and the typesetting of the particles (see section \ref{sec:teilchen}). (default = \texttt{chemformula}). This option can only be chosen in the preamble.
 \item \key[option]{Nu}{\uline{chemmacros}/mathspec} The package \paket{mathspec} also defines a macro \cmd{Nu}. This option chooses which definition holds, see page \pageref{Nu}. (default = \texttt{chemmacros}). This option can only be chosen in the preamble.
 \item \key[option]{strict}{\uline{true}/false} Setting \key{strict}{true} will turn all warning messages into erros messages. (default = \texttt{false})
 \item \key[option]{synchronize}{\uline{true}/false} The setting \texttt{true} will tell \chemmacros the adapt the font settings of \chemformula if that method has been chosen (default = \texttt{false}). In order to demonstrate this feature this document is set with \key{synchronize}{true} and the \chemformula setting \lstinline+\chemsetup[chemformula]{font-spec={[Color=darkgray]Latin Modern Sans}}+.
 \item \key[option]{upgreek}{none/textgreek/\uline{upgreek}} This Options determines how the letters \cmd{Chemalpha} and friends are typeset. See page \pageref{key:upgreek} for more information. This option can only be chosen in the preamble. (default = \texttt{upgreek})
 \item \key[option]{version} \emph{This option does nothing and only exists for backwards compatibility}. The functionality is now provided by the option \key{cmversion}. The option has been renamed so \chemmacros is compatible with the global option \texttt{version} of \paket[koma-script]{KOMA-script}.
 \item \key[option]{xspace}{\uline{true}/false} With this option most commands are defined with a \lstinline+\xspace+. (default = \texttt{true})
\end{description}
\secidx*{Package Options}

\section{Setup}\label{sec:setup}\secidx{Setup}
Various of \chemmacros', \chemformula's and \ghsystem's commands have key/value pairs with which they can be customized. Most times they can be used as (optional) argument of the commands themselves. They also can most times be used with the \cmd{chemsetup} command.
\begin{description}
 \item \cmd{chemsetup}[<module>]{<key> = <value>} or
 \item \cmd{chemsetup}{<module>/<key> = <value>}
\end{description}
The keys each belong to a module, which defines for which commands they are intended for. If a key is presented, you'll see the module to which it belongs in the left margin. You have two ways to use keys with the \cmd{chemsetup}, as you can see above.

The package options can also be seen as keys belonging to the module \textcolor{module}{\ttfamily option}. This means they can also be used with the \cmd{chemsetup} command (except for the option \key[option]{version}{1/2/3}).
\begin{beispiel}
 \chemsetup[option]{circled=none}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\
 \chemsetup[option]{circled=formal}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\
 \chemsetup[option]{circletype=math}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\
 \chemsetup{option/circletype=chem,option/circled=all}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt \\
 \chemsetup{option/circletype=math}\mch\ \pch\ \fmch\ \fpch\ \el\ \prt
\end{beispiel}
Keys \emph{not} belonging to a module \emph{cannot} be used with \cmd{chemsetup}!

All options of \chemformula belong to the module \textcolor{module}{\texttt{chemformula}} and all of \ghsystem's options belong to the module \textcolor{module}{\texttt{ghs}}.
\secidx*{Setup}
\secidx*{PRELIMINARIES}

\part{\texorpdfstring{\Chemmacros}{chemmacros}}\secidx{CHEMMACROS}
\section{Particles, Ions and Symbols}\label{sec:teilchen}\secidx{Particles, Ions and Symbols}
\subsection{Predefined}\secidx[predefined]{Particles, Ions and Symbols}
\chemmacros defines some simple macros for displaying often needed particles and symbols. Please note, that they're displayed differently depending on the package options used, see section \ref{sec:optionen}. These commands can be used in text as well as in math mode.
\begin{description}
 \item \cmd{Hpl} \Hpl (proton)
 \item \cmd{Hyd} \Hyd (hydroxide)
 \item \cmd{HtO} \HtO (oxonium ion) (\textbf{H} \textbf{t}hree \textbf{O})
 \item \cmd{water} \water
 \item \cmd{el} \el (electron)
 \item \cmd{prt} \prt (proton)
 \item \cmd{ntr} \ntr (neutron)
 \item \cmd{Nu} \Nu (nucleophile). The package \paket{mathspec} also defines a macro \cmd{Nu}. If you chose package option \key[option]{Nu}{mathspec} \chemmacros defines \cmd{Nuc} instead\label{Nu}.
 \item \cmd{El} \El (electrophile)
 \item \cmd{ba} \ba (base)
 \item \cmd{fplus} \fplus
 \item \cmd{fminus} \fminus
 \item \cmd{transitionstatesymbol} \transitionstatesymbol
 \item \cmd{standardstate} \standardstate. This symbol is only provided by \chemmacros, if the package \paket{chemstyle} is not loaded; the idea is borrowed from there\footnote{many thanks to the package author \href{http://www.texdev.net/}{Joseph Wright}.}.
 \item \cmd{Chemalpha} \Chemalpha
 \item \cmd{Chembeta} \Chembeta
 \item \cmd{Chemgamma} \Chemgamma
 \item \cmd{Chemdelta} \Chemdelta
 \item \cmd{Chemomega} \Chemomega
 \item \cmd{ChemDelta} \ChemDelta
\end{description}

\achtung{The command \cmd{Rad} has been dropped!}

The two particles \cmd{Nu} and \cmd{ba} can be modified. To do that you use the option
\begin{description}
 \item\key[particle]{elpair}{false/\uline{dots}/dash}.
\end{description}
It only has any effect, if the package \paket{chemfig} is loaded, since it uses it's command \lstinline+\Lewis+.
\begin{beispiel}
 % needs package `chemfig'
 \ba[elpair] \Nu[elpair=dash]
 
 \chemsetup[particle]{elpair}
 \ba \Nu
\end{beispiel}

\label{key:upgreek}The greek letters aren't newly defined symbols but are defined differently depending on the packages you've loaded. The default definition is the corresponding math letter. If you have loaded the \paket{textgreek} package the letters are taken from there, and if you have loaded the package \paket{upgreek} the macros of that package are used. This documentation uses \paket{upgreek} for instance. If you load both \paket{upgreek} and \paket{textgreek} the letters from \paket{upgreek} are used.

If you don't want \chemmacros to use a package automatically but want to decide for yourself, there is the option \key[option]{upgreek}. \ref{tab:upgreek_mode} shows the different styles for some of the letters.

\begin{table}[h]
 \centering
 \begin{tabular}{lccc}\toprule
                  & none     & upgreek    & textgreek \\\midrule
  \cmd{Chemalpha} & $\alpha$ & $\upalpha$ & \textalpha \\
  \cmd{Chembeta}  & $\beta$  & $\upbeta$  & \textbeta \\
  \cmd{ChemDelta} & $\Delta$ & $\Updelta$ & \textDelta \\ \bottomrule
 \end{tabular}
 \caption{The greek letters}\label{tab:upgreek_mode}
\end{table}

The reason why \chemmacros defines these macros in the first place is \IUPAC compliance. \IUPAC recommends to use upright greek letters in nomenclature.

\begin{myquote}[\IUPAC Green Book \cite[][p.\,9]{iupac:greenbook}]
 Greek letters are used in systematic organic, inorganic, macromolecular and biochemical nomenclature. These should be roman (upright), since they are not symbols for physical quantities.
\end{myquote}

\chemmacros uses these commands now to defined nomenclature commands, see page \pageref{par:greek_letters}.

\subsection{Own Particles}\secidx[own]{Particles, Ions and Symbols}
Surely sometimes it can be handy to have other particle macros defined such as \lstinline+\positron+ or \lstinline+\photon+. This can easily be done with this command:
\begin{description}
 \item \cmd{DeclareChemParticle}{<cmd>}\ma{<definition>}
 \item \cmd{RenewChemParticle}{<cmd>}\ma{<definition>}
\end{description}
Depending on the \key{method} you chose as option the \texttt{<definition>} will either be a formula defined with \paket{mhchem} or with \chemformula. The particle defined this way behaves like the predefined ones with one exception: if you chose \key{method}{mhchem} the particle \emph{will not} obey the option \key{circled}. If you want formal charges with this method you need to use \chemmacros' commands (see section \ref{sec:ladungen}) explicitly. If you chose \key{method}{chemformula} the partictle \emph{will} obey the \key{circled} option.
\begin{beispiel}
 % uses the `upgreek' package
 \DeclareChemParticle{\positron}{$\upbeta$+}
 \DeclareChemParticle{\photon}{$\upgamma$}
 \RenewChemParticle{\el}{$\upbeta$-}
 \positron\ \photon\ \el
\end{beispiel}
\cmd{DeclareChemParticle} only defines a particle if \texttt{<cmd>} is not already used by any other command. If it \emph{is} already used \chemmacros will either give a warning or an error, depending on the option \key{strict}. \cmd{RenewChemParticle} \emph{only} defines a particle if \texttt{<cmd>} \emph{is} already used and issues a warning/error otherwise.
\secidx*{Particles, Ions and Symbols}

\section{Nomenclature, Stereo Descriptors, Latin Phrases}\label{sec:stereo}
\subsection{\IUPAC Names}\secidx{IUPAC Names}
Similar to the \paket{bpchem} package \chemmacros provides a command\footnote{The idea and the implementation is shamelessly borrowed from \paket*{bpchem} by BjÃ¸rn Pedersen.} to typeset \IUPAC names. Why is that useful? \IUPAC names can get very long. So long indeed that they span over more than two lines, especially in two-column documents. This means they must be allowed to be broken more than one time. This is what the following command does.
\begin{description}
 \item\cmd{iupac}{<IUPAC name>} Inside this command use \cmd{\textbar} and \cmd{-} to indicate a breaking point or a breaking dash. Use \cmd{\textasciicircum} as a shortcut for \lstinline=\textsuperscript=\footnote{Actually \cmd{\textasciicircum} uses a \chemformula command instead.}.
\end{description}
\begin{beispiel}
 \begin{minipage}{.4\linewidth}
  \iupac{Tetra\|cyclo[2.2.2.1\^{1,4}]\-un\|decane-2\-dodecyl\-5\-(hepta\|decyl\|iso\|dodecyl\|thio\|ester)}
 \end{minipage}
\end{beispiel}
The \cmd{iupac} command is more of a semantic command. Most times you can achieve (nearly) the same thing by using \cmd{-} instead of \cmd{\textbar}, \texttt{-} instead of \cmd{-} and \lstinline=\textsuperscript= instead of \cmd{\textasciicircum}.

The command \cmd{iupac} serves another purpose, too, however. Regardless of the setting of the \key[option]{iupac} option all the commands presented in this section are always defined \emph{inside} \cmd{iupac}. Quite a number of the naming commands have very general names: \cmd{meta}, \cmd{D}, \cmd{E}, \cmd{L}, \cmd{R}, \cmd{S}, \cmd{trans} and so forth. This means they either are predefined already (\cmd{L} \L) or are easily defined by another package or class (the \paket{cool} package defines both \cmd{D} and \cmd{E}, for example). In order to give you control which commands are defined in which way, there is the package option \key[option]{iupac}\label{key:iupac}. It has three modes:
\begin{itemize}
 \item \key{iupac}{auto}: if the commands are \emph{not} defined by any package or class you're using they are available generally, otherwise only \emph{inside} \cmd{iupac}.
 \item \key{iupac}{restricted}: all naming commands are \emph{only} defined inside \cmd{iupac}. If the commands are defined by another package they of course have that meaning outside. They're not defined outside otherwise.
 \item \key{iupac}{strict}: \chemmacros overwrites any other definition and makes the commands available throughout the document. Of course the commands can be redefined (but only in the document body). They will still be available inside \cmd{iupac} then.
\end{itemize}
\ref{tab:iupac_modes} demonstrates the different modes.

\begin{table}[h]
 \centering
 \begin{tabular}{lccc}\toprule
                         & auto       & restricted & strict \\\midrule
  \lstinline=\L=         & \L         & \L         & \iupac{\L} \\
  \lstinline=\iupac{\L}= & \iupac{\L} & \iupac{\L} & \iupac{\L} \\
  \lstinline=\D=         & \D         & --         & \D \\
  \lstinline=\iupac{\D}= & \iupac{\D} & \iupac{\D} & \iupac{\D} \\\bottomrule
 \end{tabular}
 \caption{Demonstration of \protect\key{iupac}'s modes.}\label{tab:iupac_modes}
\end{table}

\subsubsection{Predefined Commands}\secidx[predefined]{IUPAC Names}\secidx{Stereo Descriptors and Nomenclature}
The macros in this section are intended to make the writing of \IUPAC names more convenient.
\paragraph{Greek Letters}\label{par:greek_letters}\secidx[greek letters]{IUPAC Names}
Greek letters in compound names are typeset upright. For this there are the packages \paket{upgreek} and \paket{textgreek}. If you have loaded one of them \chemmacros typesets the following commands upright:
\begin{description}
 \item \cmd{a} \iupac{\a}
 \item \cmd{b} \iupac{\b}
 \item \cmd{g} \iupac{\g}
 \item \cmd{d} \iupac{\d}
 \item \cmd{w} \iupac{\w}
\end{description}
\begin{beispiel}
 \iupac{5\a\-androstan\-3\b\-ol} \\
 \iupac{\a\-(tri\|chloro\|methyl)\-\w\-chloro\|poly(1,4\-phenylene\|methylene)}
\end{beispiel}

\paragraph{Hetero Atoms and added Hydrogen}\secidx[hetero atoms]{IUPAC Names}
Attachments to hetero atoms and added hydrogen atoms are indicated by italic letters \cite{iupac:greenbook}. \chemmacros defines a few shortcuts for the most common ones.
\begin{description}
 \item \cmd{H} \iupac{\H}
 \item \cmd{O} \iupac{\O}
 \item \cmd{N} \iupac{\N}
 \item \cmd{Sf} \iupac{\Sf}
 \item \cmd{P} \iupac{\P}
\end{description}
\begin{beispiel}
 \iupac{\N\-methyl\|benz\|amide} \\
 \iupac{3\H\-pyrrole} \\
 \iupac{\O\-ethyl hexanethioate}
\end{beispiel}

\paragraph{Cahn-Ingold-Prelog}\index{Cahn-Ingold-Prelog}\secidx[Cahn-Ingold-Prelog]{IUPAC Names}
\begin{description}
 \item \cmd{cip}{<conf>} \eg: \cmd{cip}{R,S} \cip{R,S}
 \item \cmd{R} \iupac{\R}
 \item \cmd{S} \iupac{\S}
\end{description}
Since the command \cmd{S} has another meaning already (\S) it is only available inside \cmd{iupac} in the default setting.

\paragraph{Fischer}\index{Fischer}\secidx[Fischer]{IUPAC Names}
\begin{description}
 \item \cmd{D} \iupac{\D}
 \item \cmd{L} \iupac{\L}
\end{description}
Since the command \cmd{L} has another meaning already (\L) it is only available inside \cmd{iupac} in the default setting.

\paragraph{cis/trans, zusammen/entgegen, syn/anti \& tert}\index{tert}\secidx[tert]{IUPAC Names}\index{cis/trans}\secidx[cis/trans]{IUPAC Names}\index{zusammen/entgegen}\secidx[zusammen/entgegen]{IUPAC Names}\secidx[syn/anti]{IUPAC Names}
\begin{description}
 \item \cmd{cis} \cis
 \item \cmd{trans} \trans
 \item \cmd{Z} \Z
 \item \cmd{E} \E
 \item \cmd{syn} \syn
 \item \cmd{anti} \anti
 \item \cmd{tert} \tert
\end{description}
The package \paket{cool} defines the commands \cmd{E} and \cmd{D}, too. If you load it, the \chemmacros version will only be available inside \cmd{iupac} in the default setting.

\paragraph{ortho/meta/para}\index{ortho/meta/para}\secidx[ortho/meta/para]{IUPAC Names}
\begin{description}
 \item \cmd{ortho} \ortho
 \item \cmd{meta} \meta
 \item \cmd{para} \para
\end{description}

\paragraph{absolute configuration}\index{absolute configuration} (uses \TikZ)
\begin{description}
 \item \cmd{Rconf}[<letter>] \cmd{Rconf}: \Rconf \quad\cmd{Rconf}[]: \Rconf[]
 \item \cmd{Sconf}[<letter>] \cmd{Sconf}: \Sconf \quad\cmd{Sconf}[]: \Sconf[]
\end{description}

Examples:
\begin{beispiel}
 \iupac{\D\-Wein\|s\"aure} = \\
 \iupac{\cip{2S,3S}\-Wein\|s\"aure} \\
 \iupac{\D\-($-$)\-Threose} = \\
 \iupac{\cip{2S,3R}\-($-$)\-2,3,4\-Tri\|hydroxy\|butanal} \\
 \iupac{\cis\-2\-Butene} = \\
 \iupac{\Z\-2\-Butene}, \\
 \iupac{\cip{2E,4Z}\-Hexa\|diene} \\
 \iupac{\meta\-Xylol} = \\
 \iupac{1,3\-Di\|methyl\|benzene}
\end{beispiel}
\secidx*{Stereo Descriptors and Nomenclature}

\subsubsection{Own Naming Commands}\secidx[own]{IUPAC Names}
If you find any commands missing you can define them using
\begin{description}
 \item \cmd{DeclareChemIUPAC}{<cmd>}\ma{<declaration>}
 \item \cmd{RenewChemIUPAC}{<cmd>}\ma{<declaration>}
\end{description}
A command defined in this way will obey the setting of the option \key[option]{iupac}. This means any existing command is only overwritten with \key{iupac}{strict}. However, \cmd{DeclareChemIUPAC} will \emph{not} change the definition of an existing \IUPAC naming command but issue a warning/an error (depending on the package option \key{strict}) if the \IUPAC naming command already exists.
\begin{beispiel}
 % uses the `upgreek' package
 \DeclareChemIUPAC\hapto{$\upeta$}
 Ferrocene = \iupac{bis(\hapto\^5\-cyclo\|penta\|dienyl)iron}
\end{beispiel}

\cmd{RenewChemIUPAC} allows you to redefine the existing iupac naming commands.
\begin{beispiel}
 \iupac{\meta\-Xylol} \\
 \RenewChemIUPAC\meta{\textit{m}}
 \iupac{\meta\-Xylol}
\end{beispiel}

\secidx*{IUPAC Names}

\subsection{Latin Phrases}\secidx{Latin Phrases}
The package \paket{chemstyle} provides the command \cmd{latin} to typeset common latin phrases in a consistent way. \chemmacros defines a similar \cmd{latin} only if \paket{chemstyle} has \emph{not} been loaded and additionally provides these commands:
\begin{description}
 \item \cmd{insitu} \insitu
 \item \cmd{abinitio} \abinitio
 \item \cmd{invacuo} \invacuo
\end{description}

If the package \paket{chemstyle} has been loaded they are defined using \paket{chemstyle}'s \lstinline+\latin+ command. This means that then the appearance depends on \paket{chemstyle}'s option \texttt{abbremph}:
\begin{beispiel}
 \insitu, \abinitio\\
 \cstsetup{abbremph=false}
 \insitu, \abinitio
\end{beispiel}
The commands are defined through
\begin{description}
 \item \cmd{DeclareChemLatin}{<cmd>}\ma{<phrase>}
 \item \cmd{RenewChemLatin}{<cmd>}\ma{<phrase>}
\end{description}
\begin{beispiel}
 \DeclareChemLatin\ltn{latin text}
 \ltn \cstsetup{abbremph=false} \ltn
\end{beispiel}
If you have \emph{not} loaded \paket{chemstyle} you can change the appearance with this option:
\begin{description}
 \item \key[latin]{format}{<definition>} Default = \lstinline+\itshape+
\end{description}
\secidx*{Latin Phrases}

\section{Units for the Usage With \textsf{siunitx}}\label{sec:einheiten}\secidx{Units}
In chemistry some non-SI units are very common. \paket{siunitx} provides the command \lstinline+\DeclareSIUnit{<command>}{<unit>}+ to add arbitrary units. \chemmacros uses that command to provide some units. Like all \paket{siunitx} units they're only valid inside \lstinline+\SI{<num>}{<unit>}+ and \lstinline+\si{<unit>}+.
\begin{description}
 \item \cmd{atmosphere} \si{\atmosphere}
 \item \cmd{atm} \si{\atm}
 \item \cmd{calory} \si{\calory}
 \item \cmd{cal} \si{\cal}
 \item \cmd{cmc} \si{\cmc} The units \cmd{cmc}, \cmd{molar}, and \cmd{Molar} are defined by the package \paket{chemstyle} as well. \chemmacros only defines them, if \paket{chemstyle} is not loaded.
 \item \cmd{molar} \si{\molar}
 \item \cmd{moLar} \si{\moLar}
 \item \cmd{Molar} \si{\Molar}
 \item \cmd{MolMass} \si{\MolMass}
 \item \cmd{normal} \si{\normal}
 \item \cmd{torr} \si{\torr}
\end{description}

By the way: \lstinline+\mmHg+ \si{\mmHg} already is defined by \paket{siunitx} and \paket{chemstyle}
\secidx*{Units}

\section{Acid/Base}\label{sec:saeure_base}\secidx{Acid/Base}
Easy representation of \pH, \pKa \ldots (the command \cmd{pKa} depends on the package option \key[option]{german}, see section \ref{sec:optionen}.)
\begin{description}
 \item \cmd{pH} \pH
 \item \cmd{pOH} \pOH
 \item \cmd{Ka} \Ka
 \item \cmd{Kb} \Kb
 \item \cmd{Kw} \Kw
 \item \cmd{pKa}[<num>] \cmd{pKa}: \pKa, \cmd{pKa}[1]: \pKa[1]
 \item \cmd{pKb}[<num>] \cmd{pKb}: \pKb, \cmd{pKb}[1]: \pKb[1]
 \item \cmd{p}{<anything>} \eg \cmd{p}{\cmd{Kw}} \p{\Kw}
\end{description}

\begin{beispiel}
 \Ka \Kb \pKa \pKa[1] \pKb \pKb[1]\\
 \chemsetup[option]{german=true}
 \Ka \Kb \pKa \pKa[1] \pKb \pKb[1]
\end{beispiel}

\achtung{The default appearance of the \p{}-commands has changed to follow \IUPAC recommendations.}
\begin{myquote}[\IUPAC Green Book \cite[][p.\,103]{iupac:greenbook}]
 The operator \p{} […] shall be printed in Roman type.
\end{myquote}

There is one option which changes the style the \p{} is typeset:
\begin{description}
 \item \key[acid-base]{p-style}{italics/slanted/upright} Default = \texttt{upright}
\end{description}
\begin{beispiel}
 \pH, \pKa

 \chemsetup[acid-base]{p-style=slanted} \pH, \pKa
 
 \chemsetup[acid-base]{p-style=italics} \pH, \pKa
\end{beispiel}
\secidx*{Acid/Base}

\section{Oxidation Numbers, Real and Formal Charges}\label{sec:ladungen}
\chemmacros distinguishes between real ($+$/$-$) and formal (\fplus/\fminus) charge symbols, also see section \ref{sec:optionen}. All commands using formal charge symbols start with a \texttt{f}.
\subsection{Ion Charges}\label{ssec:ionen}\secidx{Ion Charges}
Simple displaying of (real) charges:
\begin{description}
 \item \cmd{pch}[<number>] positive charge (\textbf{p}lus + \textbf{ch}arge)
 \item \cmd{mch}[<number>] negative charge (\textbf{m}inus + \textbf{ch}arge)
\end{description}

\begin{beispiel}
 \pch, Na\pch, Ca\pch[2]\\
 \mch, F\mch, S\mch[2]
\end{beispiel}

The same for formal charges:
\begin{description}
 \item \cmd{fpch}[<number>] positive charge
 \item \cmd{fmch}[<number>] negative charge
\end{description}

\begin{beispiel}
 \fpch\ \fmch\ \fpch[3] \fmch[3]
\end{beispiel}

There is a key which influences the behaviour of the charges.
\begin{description}
 \item \key[charges]{append}{\uline{true}/false} if set \texttt{true}, the charge is appended together with an empty group. 
\end{description}
This is how the key influences the behaviour:
\begin{beispiel}
 % uses package `mhchem'
 \chemsetup{charges/append=false,phases/pos=sub}
 \ce{H\pch\aq} \ce{H\aq\pch}

 \chemsetup[charges]{append=true}
 \ce{H\pch\aq} \ce{H\aq\pch}
\end{beispiel}
In most cases this behaviour will be unwanted. However, in some cases it might be useful, for example together with the \cmd{ox} command (see next section):
\begin{beispiel}
 \chemsetup{charges/append=false,phases/pos=sub}
 \ce{\ox{1,H}\pch\aq}

 \chemsetup[charges]{append=true}
 \ce{\ox{1,H}\pch\aq}
\end{beispiel}
\secidx*{Ion Charges}

\subsection{Oxidation Numbers}\label{ssec:oxidationszahlen}\secidx{Oxidation Numbers}
Typesetting oxidation numbers:
\begin{description}
 \item \cmd{ox}[<keyval>]{<number>,<atom>} places \texttt{<number>} above \texttt{<atom>}; \texttt{<number>} has to be a (rational) number!
\end{description}

\begin{beispiel}
 \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ox{-1,F}
\end{beispiel}

There are a number of keys, that can be used to modify the \cmd{ox} command.
\begin{description}
 \item \key[ox]{parse}{\uline{true}/false} when \texttt{false} an arbitrary entry can be used for \texttt{<number>}. Default = \texttt{true}
 \item \key[ox]{roman}{\uline{true}/false} switches from roman to arabic numbers. Default = \texttt{true}
 \item \key[ox]{pos}{top/super/side}; \texttt{top} places \texttt{<number>} above \texttt{<atom>}, \texttt{super} to the upper right as superscript and \texttt{side} to the right and inside brackets. Default = \texttt{top}
 \item \key[ox]{explicit-sign}{\uline{true}/false} shows the $+$ for positiv numbers and the $\pm$ for $0$. Default = \texttt{false}
 \item \key[ox]{decimal-marker}{comma/point} choice for the decimal marker for formal oxidation numbers like \ox{1.2,X}. Default = \texttt{point}
\end{description}

\begin{beispiel}
 \ox[roman=false]{2,Ca} \ox{2,Ca} \\
 \ox[pos=super]{3,Fe}-Oxide \\
 \ox[pos=side]{3,Fe}-Oxide \\
 \ox[parse=false]{?,Mn}
\end{beispiel}

The \key[ox]{pos}{super} variant also can be set with the shortcut \cmd[oxa]{ox*}:
\begin{beispiel}
 \ox{3,Fe} \ox*{3,Fe}
\end{beispiel}

Using the \key[ox]{explicit-sign} key will always show the sign of the oxidation number:
\begin{beispiel}
 \chemsetup[ox]{explicit-sign = true}
 \ox{+1,Na}, \ox{2,Ca}, \ox{-2,S}, \ch{"\ox{0,F}" {}2}
\end{beispiel}

\begin{beispiel}
 Compare \ox{-1,\ch{O2^2-}} to \ch{"\ox{-1,O}" {}2^2-}
\end{beispiel}

Sometimes one might want to use formal oxidation numbers like \num{.5} or $\frac{1}{3}$:
\begin{beispiel}
 \ox{.5,\ch{Br2}} \ch{"\ox{1/3,I}" {}3+}
\end{beispiel}

The fraction uses the \lstinline+\sfrac+ command of the \paket{xfrac} package. For this purpose the instance \lstinline+chemmacros-ox-frac+ is defined.
\begin{beispiel}[code only]
\DeclareInstance{xfrac}{chemmacros-ox-frac}{text}
  {
    scale-factor        = 1.2 ,
    denominator-bot-sep = -.5ex ,
    numerator-top-sep   = -.3ex ,
    slash-left-kern     = -.2em ,
    slash-right-kern    = -.2em ,
    slash-symbol-font   = lmr
  }
\end{beispiel}
Of course you can redefine it so that it suits your needs as the output often strongly depends on the used font.
\secidx*{Oxidation Numbers}

\subsection{Partial Charges and Similar Stuff}\label{ssec:partialladungen}\secidx{Partial Charges}
The next ones probably are seldomly needed but nevertheless useful:
\begin{description}
 \item \cmd{delp} \delp\ (\textbf{del}ta + \textbf{p}lus)
 \item \cmd{delm} \delm\ (\textbf{del}ta + \textbf{m}inus)
 \item \cmd{fdelp} \fdelp
 \item \cmd{fdelm} \fdelm
\end{description}

These macros for example can be used with the \cmd{ox} command or with the \paket{chemfig} package:
\begin{beispiel}
 \chemsetup{
   option/circled = all,
   ox/parse       = false
 }
 \ce{\ox{\delp,H}-\ox{\delm,Cl}} \hspace*{1cm}
 \chemfig{\chemabove[3pt]{\lewis{246,Br}}{\delm}-\chemabove[3pt]{H}{\delp}}
\end{beispiel}

The following macros are useful together with \paket{chemfig}, too.
\begin{description}
 \item \cmd{scrp} \scrp\ (\textbf{scr}iptstyle + \textbf{p}lus)
 \item \cmd{scrm} \scrm\ (\textbf{scr}iptstyle + \textbf{m}inus)
 \item \cmd{fscrp} \fscrp
 \item \cmd{fscrm} \fscrm
 \item \cmd{fsscrp} \fsscrp\ (using \lstinline+\scriptscriptstyle+)
 \item \cmd{fsscrm} \fsscrm
\end{description}

\begin{beispiel}
 \setatomsep{1.8em}\chemfig{CH_3-\chemabove{C}{\scrp}(-[6]C|H_3)-\vphantom{H_3}CH_3}
 
 \chemfig{\fmch{}|O-\chemabove{N}{\fscrp}(-[1]O|\fmch)-[7]O|\fmch}
\end{beispiel}
\secidx*{Partial Charges}

\section{Reaction Mechanisms}\label{sec:mechanismen}\secidx{Reaction Mechanisms}
With the command
\begin{description}
 \item\cmd{mech}[<type>]
\end{description}
one can specify the most common reaction mechanisms. \texttt{<type>} can have one of the following values:
\begin{itemize}
 \item\cmd{mech} (empty, no opt. argument) nucleophilic substitution \mech
 \item\cmd{mech}[1] unimolecular nucleophilic substitution \mech[1]
 \item\cmd{mech}[2] bimolecular nucleophilic substitution \mech[2]
 \item\cmd{mech}[se] electrophilic substitution \mech[se]
 \item\cmd{mech}[1e] unimolecular electrophilic substitution \mech[1e]
 \item\cmd{mech}[2e] bimolecular electrophilic substitution \mech[2e]
 \item\cmd{mech}[ar] electrophilic aromatic substitution \mech[ar]
 \item\cmd{mech}[e] elimination \mech[e]
 \item\cmd{mech}[e1] unimolecular elimination \mech[e1]
 \item\cmd{mech}[e2] bimolecular elimination \mech[e2]
 \item\cmd{mech}[cb] unimolecular elimination \enquote{conjugated base}, \ie via carbanion \mech[cb]
\end{itemize}
\secidx*{Reaction Mechanisms}

\section{Redox Reactions}\label{sec:redoxreaktionen}\secidx{Redox Reactions}
\chemmacros provides two commands to visualize the transfer of electrons in redox reactions. Both commands are using \TikZ.
\begin{description}
 \item \cmd{OX}{<name>,<atom>}
 \item \cmd{redox}(<name1>,<name2>)[<tikz>][<num>]{<text>} Only the first argument \da{<name1>,<name2>} is required, the others are all optional.
\end{description}

\cmd{OX} places \texttt{<atom>} into a node, which is named with \texttt{<name>}. If you have set two \cmd{OX}, they can be connected with a line using \cmd{redox}. To do so the names of the two nodes that are to be connected are written in the round braces. Since \cmd{redox} draws a tikzpicture with options \texttt{remember picture,overlay}, the document needs to be \emph{compiled at least two times}.
\begin{beispiel}[ox]
 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation}
\end{beispiel}
This line can be customized using \TikZ keys in \oa{<tikz>}:
\begin{beispiel}[ox]
 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
\end{beispiel}

With the argument \oa{<num>} the length of the vertical parts of the line can be adjusted. The default length is \texttt{.6em}. This length is multiplied with \texttt{<num>}. If you use a negative value the line is placed  \emph{below} the text.
\begin{beispiel}[ox]
 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch
 \redox(a,b)[->,red]{ox}
 \redox(a,b)[<-,blue][-1]{red}
\end{beispiel}
The default length of the vertical lines can be customized with the option
\begin{description}
 \item \key[redox]{dist}{<dim>} A \TeX\ dimension. Default = \texttt{.6em}
\end{description}
\begin{beispiel}[ox]
 \chemsetup{redox/dist=1em}
 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
\end{beispiel}

Additionally the option
\begin{description}
 \item\key[redox]{sep}{<dim>} Default = \texttt{.2em}
\end{description}
can be used to change the distance between the atom and the beginning of the line.
\begin{beispiel}[ox]
 \chemsetup{redox/sep=.5em}
 \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
\end{beispiel}

Examples:
\begin{beispiel}[ox]
 \ch{ 2 "\OX{o1,Na}" + "\OX{r1,Cl}" {}2 -> 2 "\OX{o2,Na}" \pch{} + 2
"\OX{r2,Cl}" \mch }
 \redox(o1,o2){\small OX: $- 2\el$}
 \redox(r1,r2)[][-1]{\small RED: $+ 2\el$}
\end{beispiel}
\begin{beispiel}[ox]
 \ch{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}"
\pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
 \redox(o1,o2){\small OX: $- 2\el$}
 \redox(r1,r2)[][-1]{\small RED: $+ 2\el$}
\end{beispiel}
\bspmidlength{ox}{15mm}
\begin{beispiel}[ox]
 \ch{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}"
\pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
 \redox(o1,o2)[draw=red,->][3.33]{\small OX: $- 2\el$}
 \redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$}
 \end{beispiel}
\bspmidlength{ox}{7mm}
 \begin{beispiel}[ox]
 \ch{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}"
\pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
 \redox(o1,o2)[green,-stealth]{\small OX}
 \redox(r1,r2)[purple,-stealth][-1]{\small RED}
\end{beispiel}
\secidx*{Redox Reactions}

\section{(Standard) State, Thermodynamics}\label{sec:standardstate}\secidx{Thermodynamics}
\subsection{Thermodynamic Variables}\label{ssec:siunitx}
The following commands use \paket{siunitx}:
\begin{description}
 \item \cmd{Enthalpy}[<keyval>](<subscript>){<value>}
 \item \cmd{Entropy}[<keyval>](<subscript>){<value>}
 \item \cmd{Gibbs}[<keyval>](<subscript>){<value>}
\end{description}

Their usage is pretty much self-explaining:
\begin{beispiel}
  \Enthalpy{123} \\
  \Entropy{123} \\
  \Gibbs{123}
\end{beispiel}
The argument \da{<subscript>} adds a subscript for specification: \cmd{Enthalpy}(r){123} \Enthalpy(r){123}.

There are several keys to customize the commands.
\begin{description}
 \item \key*{exponent}{<anything>}
 \item \key*{delta}{<anything>/false}
 \item \key*{subscript}{left/right}
 \item \key*{unit}{<unit>}
\end{description}

The default values depend on the command.
\begin{beispiel}
 \Enthalpy[unit=\kilo\joule]{-285} \\
 \Gibbs[delta=false]{0} \\
 \Entropy[delta=\Delta,exponent=]{56.7}
\end{beispiel}
The unit is set corresponding to the rules of \paket{siunitx} and depends on its settings:
\begin{beispiel}
 \Enthalpy{-1234.56e3} \\
 \sisetup{per-mode=symbol,exponent-product=\cdot,output-decimal-marker={,},group-four-digits=true}
 \Enthalpy{-1234.56e3}
\end{beispiel}

\subsubsection{Create New Variables}
You can use the command
\begin{description}
 \item \cmd{DeclareChemState}[<keyval>]{<name>}\ma{<symbol>}\ma{<unit>}
\end{description}

to create new corresponding commands:
\begin{beispiel}
 \DeclareChemState{Helmholtz}{A}{\kilo\joule\per\mole}
 \DeclareChemState[subscript-left=false,exponent=]{ElPot}{E}{\volt}
 \Helmholtz{123.4} \\
 \ElPot{-1.1} \\
 \ElPot[exponent=0]($\ch{Sn}|\ch{Sn^2+}||\ch{Pb^2+}|\ch{Pb}$){0.01}
\end{beispiel}

The command has some keys with which the default behaviour of the new command can be set.
\begin{description}
 \item \key*{exponent}{<anything>}
 \item \key*{delta}{<anything>/false}
 \item \key*{subscript-left}{true/false}
 \item \key*{subscript}{<anything>}
\end{description}

\subsubsection{Redefine Variables}
With
\begin{description}
 \item \cmd{RenewChemState}[<keyval>]{<name>}\ma{<symbol>}\ma{<unit>}
\end{description}

you can redefine the already existing commands:
\begin{beispiel}
 \RenewChemState{Enthalpy}{h}{\joule}
 \Enthalpy(f){12.5}
\end{beispiel}
The command is analogous to \cmd{DeclareChemState}, \ie it has the same keys.

So \textendash\ for following thermodynamic conventions \textendash\ one could define a molar and an absolute variable:
\begin{beispiel}
 \DeclareChemState[exponent=]{enthalpy}{h}{\kilo\joule\per\mole}% molar
 \RenewChemState[exponent=]{Enthalpy}{H}{\kilo\joule}% absolute
 \enthalpy{-12.3} \Enthalpy{-12.3}
\end{beispiel}

\subsection{State}\label{ssec:state}
The commands presented in section \ref{ssec:siunitx} internally all use the command\footnote{Please note that \ma{<subscript>} is an \emph{optional} argument.}
\begin{description}
 \item \cmd{State}[<keyval>]{<symbol>}\ma{<subscript>}
\end{description}

It can be used to write the thermodynamic variables without value and unit.

Examples:
\begin{beispiel}
 \State{A}, \State{G}{f}, \State[subscript-left=false]{E}{\ch{Na}}, \State[exponent=\SI{1000}{\celsius}]{H}
\end{beispiel}

Again there are some keys to customize the command:
\begin{description}
 \item \key[state]{exponent}{<anything>}
 \item \key[state]{subscript-left}{true/false}
 \item \key[state]{delta}{<anything>/false}
\end{description}
\secidx*{Thermodynamics}

\section{Spectroscopy}\label{sec:spektroskopie}\secidx{Spectroscopy}
If substances are examined wether they are what they're supposed to, one often needs NMR spectroscopy. Measured results then are written in a way like: \NMR(400)[CDCl3] = \num{1.59}\ldots\ \chemmacros provides a command which simplifies writing this down (uses \paket{siunitx}).
\begin{description}
 \item \cmd{NMR}{<num>,<elem>}\da{<num>,<unit>}\oa{<solvent>}
 \item \cmd{NMR*}{<num>,<elem>}\da{<num>,<unit>}\oa{<solvent>}
\end{description}

\emph{All} arguments are optional! Without arguments we get\footnote{All arguments can be combined freely, the command can also be used in math mode.}:
\begin{beispiel}
 \NMR \\
 \NMR*
\end{beispiel}
With the first argument you can specify the kind of NMR:
\begin{beispiel}
 \NMR{13,C}
\end{beispiel}
With the second argument the frequency (in \si{\mega\hertz}) can be specified:
\begin{beispiel}
 \NMR(400)
\end{beispiel}
You also can change the unit:
\begin{beispiel}
 \NMR(4e8,\hertz)
\end{beispiel}
Please note that the setup of \paket{siunitx} also has an impact on this command:
\begin{beispiel}
 \sisetup{exponent-product=\cdot}\NMR(4e8,\hertz)
\end{beispiel}
And finally with the third argument the solvent can be specified:
\begin{beispiel}
 \NMR[CDCl3]
\end{beispiel}

With the keys
\begin{description}
 \item\key[nmr]{unit}{<unit>} Default = \lstinline=\mega\hertz=
 \item\key[nmr]{nucleus}{\ma{<num>,<elem>}} Default = \ma{1,H}
\end{description}
the default unit and the default nucleus can be changed.

Examples:
\begin{beispiel}
 {\chemsetup[nmr]{nucleus={13,C}}\NMR(100) \NMR*(100) } \\
 \NMR*{19,F}[CFCl3] \NMR*{19,F}(285)[CFCl3] \\
 \NMR(400)[CDCl3] = \num{1.59} (q, 1\ch{H}, \textit{J} = \SI{11.6}{\hertz}, H-4)
\end{beispiel}
\secidx*{Spectroscopy}

\section{Commands for \textsf{mhchem}}\label{sec:mhchem}\secidx{Commands for mhchem}
\paket{mhchem} isn't loaded automatically any more but only if you've specified \key[option]{method}{mhchem} in the preamble. In the default settings \chemmacros uses \chemformula instead.

\chemmacros provides only one command specifically for \paket{mhchem}\footnote{\chemformula provides its own possibility.}. It is meant to place text below of compounds.
\begin{description}
 \item \cmd{mhName}[<keyval>]{<formula>}\ma{<text>}
\end{description}

For example:
\begin{beispiel}
 \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{former antiknock additive} + NaCl}
\end{beispiel}

There are several keys to customize \cmd{mhName}.
\begin{description}
 \item \key[mhName]{align}{<alignment command>} the alignment of the text in the box it is placed in, default = \lstinline+\centering+
 \item \key[mhName]{format}{<anything>} the format of the text
 \item \key[mhName]{fontsize}{<font size command>} the fontsize of the text, default = \lstinline+\tiny+
 \item \key[mhName]{width}{<dim>/auto} the width of the box the text is placed in, default = \texttt{auto}
\end{description}
\begin{beispiel}
 \ce{4 C2H5Cl + Pb / Na -> \mhName[fontsize=\footnotesize]{Pb(C2H5)4}{former antiknock additive} + NaCl}\\
 \chemsetup[mhName]{align=\raggedright,fontsize=\small,format=\bfseries\color{red},width=3cm}
 \ce{4 C2H5Cl + Pb / Na -> \mhName{Pb(C2H5)4}{former antiknock additive} + NaCl}
\end{beispiel}
\secidx*{Commands for mhchem}

\section{Reaction Environments}\label{ssec:mhchem_reaktionen}\secidx{Reaction Environments}
\subsection{Defined by \chemmacros}
You can use these environments for numbered\ldots
\begin{description}
 \item \env{reaction}{<formula or mhchem code>}
 \item \env{reactions}{<formula or mhchem code>}
\end{description}

\ldots and their starred versions for unnumbered reactions.
\begin{description}
 \item \env{reaction*}{<formula or mhchem code>}
 \item \env{reactions*}{<formula or mhchem code>}
\end{description}

With them you can create (un)numbered reaction equations similar to mathematical equations.

The environments \texttt{reaction}/\texttt{reaction*} use the \texttt{equation}/\texttt{equation*} environments and the environments \texttt{reactions}/\texttt{reactions*} use the \texttt{align}/\texttt{align*} environments to display the reactions.

\begin{beispiel}
 Reaction with counter:
 \begin{reaction}
  A -> B
 \end{reaction}
\end{beispiel}

\begin{beispiel}
 Reaction without counter:
 \begin{reaction*}
  C -> D
 \end{reaction*}
\end{beispiel}

\begin{beispiel}
 Several aligned reactions with counter:
 \begin{reactions}
  A     &-> B + C \\
  D + E &-> F
 \end{reactions}
\end{beispiel}

\begin{beispiel}
 Several aligned reactions without counter:
 \begin{reactions*}
  G     &-> H + I \\
  J + K &-> L
 \end{reactions*}
\end{beispiel}

If you want to change the layout of the counter tags, you can use

\cmd{renewtagform}{<tagname>}\oa{<format>}\ma{<right delim>}\ma{<left delim>}\footnote{Provided by the \paket*{mathtools} package}.

\begin{beispiel}
 \renewtagform{reaction}[R \textbf]{[}{]}
 \begin{reaction}
  H2O + CO2 <<=> H2CO3
 \end{reaction}
\end{beispiel}

\subsection{Own Reactions}
You can create new types of reactions with the command:
\begin{description}
 \item \cmd{DeclareChemReaction}[<keyval>]{<name>}\ma{<math name>}
\end{description}

\texttt{<name>} will be the name of the new environment. \texttt{<math name>} is the used math environment.

The command has two keys.
\begin{description}
 \item\key*{star}{\uline{true}/false}
 \item\key*{arg}{\uline{true}/false}
\end{description}
There is \key*{star}, which will also define a starred version of the new environment, if the starred math environment exists. If it doesn't exist, this will cause an error.

Then there is \key*{arg}, which is used to define an environment with a mandatory argument. Of course this only works, if the used math environment has a mandatory argument.

The predefined environments are defined via
\begin{description}
 \item \cmd{DeclareChemReaction}[star]{reaction}\ma{equation} and
 \item \cmd{DeclareChemReaction}[star]{reactions}\ma{align}.
\end{description}

Let's suppose, you'd like to have the alignment behaviour of the \texttt{alignat} environment for \chemformula/\paket{mhchem} reactions. You could do the following:

\cmd{DeclareChemReaction}[star,arg]{reactionsat}\ma{alignat}

With this the \texttt{reactionsat} environment is defined.
\begin{beispiel}
 \DeclareChemReaction[star,arg]{reactionsat}{alignat}
 \begin{reactionsat}{3}
  A     &-> B     &&-> C     &&-> D \\
  aaaaa &-> bbbbb &&-> ccccc &&-> ddddd
 \end{reactionsat}
 \begin{reactionsat*}{2}
  A     &-> B     & C            &-> D  \\
  aaaaa &-> bbbbb &\quad{} ccccc &-> ddddd
 \end{reactionsat*}
\end{beispiel}

\subsection{List of Reactions}
\chemmacros also provides a command to display a list of the reactions created with the \lstinline+reaction+ environment.
\begin{description}
 \item\cmd{listofreactions}
\end{description}
\begin{beispiel}[below]
 \listofreactions
\end{beispiel}

The Output of this list can be modified by two options:
\begin{description}
 \item\key[reaction]{list-name}{<name of the list>} Let's you set the name of the list manually. Default = \texttt{List of reactions}
 \item\key[reaction]{list-entry}{<prefix to each entry>} Let's you set a prefix to each list entry. Default = \texttt{Reaction}
\end{description}
Both default option values recognize the package option \key[option]{german}.

Instead of using the option \key{list-name} you also could redefine \cmd{reactionlistname}.

The list lists all reactions with a number and disregards reactions without number. All reaction environments without star have an optional argument which let's you add a description (or caption) for the entry in the list.
\begin{beispiel}
 \begin{reaction}[Autoprotolyse]
  2 H2O <<=> H3O+ + OH-
 \end{reaction}
\end{beispiel}
If you use the \texttt{reactions} environment this will not work, though. In this case you can use
\begin{description}
 \item\cmd{AddRxnDesc}{<description>}
\end{description}
\begin{beispiel}
 \begin{reactions}
  Cl "\Lewis{0.,\vphantom{Cl}}" + CH4    &-> HCl + "\Lewis{4.,\vphantom{CH}}" CH3 \AddRxnDesc{first~step~of~chain} \\
  "\Lewis{4.,\vphantom{CH}}" CH3 + Cl2 &-> CH3Cl + Cl "\Lewis{0.,\vphantom{Cl}}" \AddRxnDesc{second~step~of~chain}
 \end{reactions}
\end{beispiel}
Note: you don't have to use the phantom commands if you haven't changed the format of the atoms, see section \ref{sec:format} on page \pageref{sec:format}.
\secidx*{Reaction Environments}

\section{Phases}\label{sec:phasen}\secidx{Phases}
\subsection{Basics}\secidx[basics]{Phases}
These commands are intended to indicate the phase of a compound.
\begin{description}
 \item \cmd{sld} \sld
 \item \cmd{lqd} \lqd
 \item \cmd{gas} \gas
 \item \cmd{aq} \aq
\end{description}

\achtung{The default behaviour of the phases commands has changed to be consistent with \IUPAC recommendations. Both \cmd{sld} and \cmd{lqd} have lost their optional argument.}

\begin{beispiel}
 \ch{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}\\
 To make it complete: NaCl\aq.
\end{beispiel}

With the package option \key{german} (see section \ref{sec:optionen}) you get the german versions:
\begin{beispiel}
 \chemsetup[option]{german=true}
 \ch{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}
\end{beispiel}

The \IUPAC recommendation to indicate the state of aggregation is to put it in parentheses after the compound \cite{iupac:greenbook}. However, you might want to put it as a subscript which is also very common.

\begin{myquote}[{\IUPAC Green Book \cite[][p.\,54]{iupac:greenbook}}]
 The [\ldots] symbols are used to represent the states of aggregation of chemical species. The letters are appended to the formula in parentheses and should be printed in Roman (upright) type without a full stop (period).
\end{myquote}

There are two options to customize the output:
\begin{description}
 \item \key[phases]{pos}{side/sub} Switch the position of the phase indicator. Default = \texttt{side}
 \item \key[phases]{space}{<dim>} Change the default spacing between compound a phase indicator if \key{pos}{side}. A \TeX\ dimension. Default = \texttt{.1333em}
\end{description}
\begin{beispiel}
 \chemsetup[phases]{pos=sub}
 \ch{C\sld{} + 2 H2O\lqd{} -> CO2\gas{} + 2 H2\gas}\\
 To make it complete: NaCl\aq.
\end{beispiel}

\subsection{Define Own Phases}\secidx[own]{Phases}
Depending on the subject of your document you might need to indicate other states of aggregation. You can easily define them.
\begin{description}
 \item \cmd{DeclareChemPhase}{<cmd>}\oa{<german>}\ma{<english>}
 \item \cmd{RenewChemPhase}{<cmd>}\oa{<german>}\ma{<english>}
 \item \cmd{phase}{<phase>} If you need a phase indicator just once or twice.
\end{description}
\cmd{DeclareChemPhase} only defines a phase if \texttt{<cmd>} is not already used by any other command. If it \emph{is} already used \chemmacros will either give a warning or an error, depending on the option \key{strict}. \cmd{RenewChemPhase} \emph{only} defines a phase if \texttt{<cmd>} \emph{is} already used and issues a warning/error otherwise.
\begin{beispiel}
 \DeclareChemPhase{\aqi}{aq,$\infty$}% aqueous solution at infinite dilution
 \DeclareChemPhase{\cd}{cd}% condensed phase
 \RenewChemPhase{\lqd}{lc}% liquid crystal
 NaOH\aqi\ \ch{H2O\cd} U\phase{cr} A\lqd \\
 \chemsetup[phases]{pos=sub}
 NaOH\aqi\ \ch{H2O\cd} U\phase{cr} A\lqd
\end{beispiel}
\secidx*{Phases}

\section{Newman Projections}\label{sec:newman}\secidx{Newman Projections}
\chemmacros provides the command
\begin{description}
 \item \cmd{newman}[<keyval>]\da{<angle>}\ma{<1>,<2>,<3>,<4>,<5>,<6>}
\end{description}
which allows you to create newman projections (uses \TikZ). With \texttt{<angle>} the back atoms are rotated counter clockwise with respect to the front atoms.
\begin{beispiel}
 \newman{} \newman(170){}
 \newman{1,2,3,4,5,6} \newman{1,2,3} \newman{,,,4,5,6}
\end{beispiel}

Several keys allow customization:
\begin{description}
 \item \key[newman]{angle}{<angle>} default angle
 \item \key[newman]{scale}{<factor>} scale the whole projection
 \item \key[newman]{ring}{<tikz>} customize the ring with \TikZ keys
 \item \key[newman]{atoms}{<tikz>} customize the nodes within which the atoms are set
 \item \key[newman]{back-atoms}{<tikz>} explicitly customize the back atoms
\end{description}

\begin{beispiel}
 \chemsetup[newman]{angle=45} \newman{}
 \newman[scale=.75,ring={draw=blue,fill=blue!20}]{}
\end{beispiel}
\begin{beispiel}
 \chemsetup[newman]{atoms={draw=red,fill=red!20,inner sep=2pt,rounded corners}}
 \newman{1,2,3,4,5,6}
\end{beispiel}
\begin{beispiel}
 \chemsetup[newman]{
   atoms = {draw=red,fill=red!20,inner sep=2pt,rounded corners},
   back-atoms = {draw=blue,fill=blue!20,inner sep=2pt,rounded corners}
 }
 \newman{1,2,3,4,5,6} \newman(170){1,2,3,4,5,6}
\end{beispiel}
\secidx*{Newman Projections}

\section{s, p, and Hybrid Orbitals}\label{sec:orbitale}\secidx{Orbitals}
\chemmacros provides the following command to create orbitals:
\begin{description}
 \item \cmd{orbital}[<keyval>]{<type}
\end{description}

There are the following types available for \texttt{<type>}:
\begin{description}
 \item \texttt{s}
 \item \texttt{p}
 \item \texttt{sp}
 \item \texttt{sp2}
 \item \texttt{sp3}
\end{description}

\begin{beispiel}
 \orbital{s} \orbital{p} \orbital{sp} \orbital{sp2} \orbital{sp3}
\end{beispiel}

Depending on the type you have different keys to modify the orbitals:
\begin{description}
 \item \key[orbital]{phase}{\uline{+}/-} changes the phase of the orbital (all types)
 \item \key[orbital]{scale}{<factor>} changes the size of the orbital (all types)
 \item \key[orbital]{color}{<color>} changes the color of the orbital (all types)
 \item \key[orbital]{angle}{<angle>} rotates the orbitals with a p contribution counter clockwise (all types except \texttt{s})
 \item \key[orbital]{half}{\uline{true}/false} displays only half an orbital (only \texttt{p})
\end{description}

\begin{beispiel}
 \orbital{s} \orbital[phase=-]{s} 
 \orbital{p} \orbital[phase=-]{p}
 \orbital{sp3} \orbital[phase=-]{sp3}
 
 \orbital[angle=0]{p} \orbital[color=red!50]{p} \orbital[angle=135,scale=1.5]{p} \orbital[half]{p}
\end{beispiel}

Additionally there are two keys, with which the \TikZ behaviour can be changed.
\begin{description}
 \item \key[orbital]{overlay}{\uline{true}/false} the orbital \enquote{doesn't need space}; it is displayed with the \TikZ option \texttt{overlay}.
 \item \key[orbital]{opacity}{<num>} the orbital becomes transparent; \texttt{<value>} can have values between \texttt{1} (fully opaque) to \texttt{0} (invisible).
\end{description}

\begin{beispiel}
 \vspace{1cm}\hspace{1cm}
 \chemsetup[orbital]{
   overlay,
   p/color = black!70
 }
 \setbondoffset{0pt}
 \chemfig{?\orbital{p}-[,1.3]{\orbital[phase=-]{p}}-[:30,1.1]\orbital{p}-[:150,.9]{\orbital[phase=-]{p}}-[4,1.3]\orbital{p}-[:-150,1.1]{\orbital[phase=-]{p}}?}
 \vspace{1cm}
\end{beispiel}
\begin{beispiel}
 \vspace{2cm}\hspace{2cm}
 \setbondoffset{0pt}
 \chemsetup[orbital]{
   overlay ,
   opacity = .75 ,
   p/scale = 1.6 ,
   s/color = blue!50 ,
   s/scale = 1.6
 }
 \chemfig{\orbital{s}-[:-20]{\orbital[scale=2]{p}}{\orbital[half,angle=0]{p}}{\orbital[angle=170,half]{p}}{\orbital[angle=-150,half]{p}}(-[:-150]\orbital{s})-\orbital{s}}
 \vspace{2cm}
\end{beispiel}
\secidx*{Orbitals}

\section{Key Overview}\label{sec:overview}\secidx{Option Overview (chemmacros)}
In the table below all keys provided by \chemmacros for customization are listed. All keys that belong to a module can be set with 
\begin{description}
 \item \cmd{chemsetup}[<module>]{<keyval>} or
 \item \cmd{chemsetup}{<module>/<keyval>}.
\end{description}
Some keys can be set without value. Then the \uline{underlined} value is used.
\small
\begin{longtable}{>{\ttfamily\color{key}\hspace{5mm}}l>{\ttfamily\color{module}}l>{\ttfamily}l>{\ttfamily}ll}
 \toprule
 \normalfont\normalcolor\bfseries key & \normalfont\normalcolor\bfseries module & \normalfont\bfseries values & \normalfont\bfseries default & \\
 \midrule
 \endhead
 \bottomrule
 \endfoot
 \multicolumn{5}{l}{package options:} \\
 bpchem              & option   & \uline{true}/false       & false                 & page \pageref{key:option_bpchem} \\
 circled             & option   & formal/\uline{all}/none  & formal                & page \pageref{key:option_circled} \\
 circletype          & option   & chem/math                & chem                  & page \pageref{key:option_circletype} \\
 cmversion           & option   & 1/2/bundle               & bundle                & page \pageref{key:option_cmversion} \\
 german              & option   & \uline{true}/false       & false                 & page \pageref{key:option_german} \\
 ghsystem            & option   & \uline{true}/false       & true                  & page \pageref{key:option_ghsystem} \\
 iupac               & option   & auto/restricted/strict   & auto                  & page \pageref{key:option_iupac} \\
 method              & option   & chemformula/formula      & formula               & page \pageref{key:option_method} \\
 Nu                  & option   & chemmacros/mathspec      & chemmacros            & page \pageref{key:option_Nu} \\
 strict              & option   & \uline{true}/false       & false                 & page \pageref{key:option_strict} \\
 synchronize         & option   & \uline{true}/false       & false                 & page \pageref{key:option_synchronize} \\
 upgreek             & option   & none/textgreek/\uline{upgreek} & upgreek         & page \pageref{key:option_upgreek} \\
 version             & option   &                          &                       & page \pageref{key:option_version} \\
 xspace              & option   & \uline{true}/false       & true                  & page \pageref{key:option_xspace} \\
 \multicolumn{5}{l}{\cmd{ba}, \cmd{Nu}:} \\
 elpair              & particle & \uline{dots}/dash/false  & false                 & page \pageref{key:particle_elpair} \\
 \multicolumn{5}{l}{\cmd{DeclareChemLatin}:} \\
 format              & latin    & <anything>               & \lstinline=\itshape=  & page \pageref{key:latin_format} \\
 \multicolumn{5}{l}{\cmd{pch}, \cmd{mch}, \cmd{fpch}, \cmd{fmch}:} \\
 append              & charges  & \uline{true}/false       & false                 & page \pageref{key:charges_append} \\
 \multicolumn{5}{l}{acid/base:} \\
 p-style             & acid-base & slanted/italics/upright & upright               & page \pageref{key:acid-base_p-style} \\
 \multicolumn{5}{l}{\cmd{ox}:} \\
 parse               & ox       & \uline{true}/false       & true                  & page \pageref{key:ox_parse} \\
 roman               & ox       & \uline{true}/false       & true                  & page \pageref{key:ox_roman} \\
 pos                 & ox       & top/super/side           & top                   & page \pageref{key:ox_pos} \\
 explicit-sign       & ox       & \uline{true}/false       & false                 & page \pageref{key:ox_explicit-sign} \\
 decimal-marker      & ox       & comma/point              & point                 & page \pageref{key:ox_decimal-marker} \\
 \multicolumn{5}{l}{\cmd{OX}, \cmd{redox}:} \\
 dist                & redox    & <dim>                    & .6em                  & page \pageref{key:redox_dist} \\
 sep                 & redox    & <dim>                    & .2em                  & page \pageref{key:redox_sep} \\
 \multicolumn{5}{l}{\cmd{Enthalpy}, \cmd{Entropy}, \cmd{Gibbs}:} \\
 exponent            &          & <anything>               & \cmd{standardstate}   & page \pageref{key:none_exponent} \\
 delta               &          & <anything>/false         &                       & page \pageref{key:none_delta} \\
 subscript           &          & left/right               &                       & page \pageref{key:none_subscript} \\
 unit                &          & <unit>                   &                       & page \pageref{key:none_unit} \\
 \multicolumn{5}{l}{\cmd{DeclareChemState}, \cmd{RenewChemState}:} \\
 exponent            &          & <anything>               & \cmd{standardstate}   & page \pageref{key:none_exponent} \\
 delta               &          & <anything>/false         &                       & page \pageref{key:none_delta} \\
 subscript           &          & <anything>               &                       & page \pageref{key:none_subscript} \\
 subscript-left      &          & \uline{true}/false       &                       & page \pageref{key:none_subscript-left} \\
 \multicolumn{5}{l}{\cmd{State}:} \\
 exponent            & state    & <anything>               & \cmd{standardstate}   & page \pageref{key:state_exponent} \\
 delta               & state    & <anything>/false         &                       & page \pageref{key:state_delta} \\
 subscript-left      & state    & \uline{true}/false       &                       & page \pageref{key:state_subscript-left} \\
 \multicolumn{5}{l}{\cmd{NMR}:} \\
 unit                & nmr      & <unit>                   & \cmd{mega}\cmd{hertz} & page \pageref{key:nmr_unit} \\
 nucleus             & nmr      & \{<num>,<atom symbol>\}  & \{1,H\}               & page \pageref{key:nmr_nucleus}  \\
 \multicolumn{5}{l}{\cmd{DeclareChemReaction}:} \\
 star                &          & \uline{true}/false       & false                 & page \pageref{key:none_star} \\
 arg                 &          & \uline{true}/false       & false                 & page \pageref{key:none_arg} \\
 list-name           & reaction & <anything>               & List of reactions     & page \pageref{key:reaction_list-name} \\
 list-entry          & reaction & <anything>               & Reaction              & page \pageref{key:reaction_list-entry} \\
 \multicolumn{5}{l}{\cmd{mhName}:} \\
 align               & mhName   & <alignment>              & \cmd{centering}       & page \pageref{key:mhName_align} \\
 format              & mhName   & <commands>               &                       & page \pageref{key:mhName_format} \\
 fontsize            & mhName   & <fontsize>               & \cmd{tiny}            & page \pageref{key:mhName_fontsize} \\
 width               & mhName   & <dim>                    &                       & page \pageref{key:mhName_width} \\
 \multicolumn{5}{l}{phases:} \\
 pos                 & phases   & side/sub                 & side                  & page \pageref{key:phases_pos} \\
 space               & phases   & <dim>                    & .1333em               & page \pageref{key:phases_space} \\
 \multicolumn{5}{l}{\cmd{newman}:} \\
 angle               & newman   & <angle>                  & 0                     & page \pageref{key:newman_angle} \\
 scale               & newman   & <factor>                 & 1                     & page \pageref{key:newman_scale} \\
 ring                & newman   & <tikz>                   &                       & page \pageref{key:newman_ring} \\
 atoms               & newman   & <tikz>                   &                       & page \pageref{key:newman_atoms} \\
 back-atoms          & newman   & <tikz>                   &                       & page \pageref{key:newman_back-atoms} \\
 \multicolumn{5}{l}{\cmd{orbital} \ttfamily <type> = s/p/sp/sp2/sp3:} \\
 phase               & orbital/<type>  & +/-               & +                     & page \pageref{key:orbital_phase} \\
 scale               & orbital/<type>  & <factor>          & 1                     & page \pageref{key:orbital_scale} \\
 color               & orbital/<type>  & <color>           & black                 & page \pageref{key:orbital_color} \\
 angle               & orbital/<type>  & <angle>           & 90                    & page \pageref{key:orbital_angle} \\
 half                & orbital/p       & \uline{true}/false & false                & page \pageref{key:orbital_half} \\
 overlay             & orbital  & \uline{true}/false       & false                 & page \pageref{key:orbital_overlay} \\
 opacity             & ornital  & <num>                    & 1                     & page \pageref{key:orbital_opacity}
\end{longtable}
\normalsize\secidx*{Option Overview (chemmacros)}
\secidx*{CHEMMACROS}

\part{\texorpdfstring{\Chemformula}{chemformula}}\chemsetup[chemformula]{format=}\secidx{CHEMFORMULA}
\section{Setup}
All of \chemformula's options belong to the module \textcolor{module}{\texttt{chemformula}}. This means they can be setup with
\begin{beispiel}[code only]
 \chemsetup[chemformula]{<options>} or
 \chemsetup{chemformula/<option1>,chemformula/<option2>}
\end{beispiel}

\section{The Basic Principle}
\chemformula offers one main command.
\begin{description}
 \item\cmd{ch}[<options>]{<input>}
\end{description}
The usage will seem very familiar to you if you're familiar with \paket{mhchem}:
\begin{beispiel}
 \ch{H2O} \\
 \ch{Sb2O3} \\
 \ch{H+} \\
 \ch{CrO4^2-} \\
 \ch{AgCl2-} \\
 \ch{[AgCl2]-} \\
 \ch{Y^{99}+} \\
 \ch{Y^{99+}} \\
 \ch{H2_{(aq)}} \\
 \ch{NO3-} \\
 \ch{(NH4)2S} \\
 \ch{^{227}_{90}Th+} \\
 $V_{\ch{H2O}}$ \\
 \ch{Ce^{IV}} \\
 \ch{KCr(SO4)2 * 12 H2O}
\end{beispiel}

However, there are differences. The most notable one: \chemformula distinguishes between different types of input. These different parts \emph{have} to be seperated with blanks:
\begin{description}
 \item\cmd{ch}{part1 part2 part3 part4}
\end{description}
A blank in the input \emph{never} is a blank in the output. This role of the blank strictly holds and disregarding it can have unexpected results and even lead to errors.

Another notable difference: \chemformula tries to avoid math mode whenever possible:
\begin{beispiel}
 \ch{A + B ->[a] C} \\
 \ce{A + B ->[a] C}
\end{beispiel}

This means that \cmd{ch}{2H2O} is recognized as a \emph{single} part, which in this case is recognized as a compound.
\begin{beispiel}
 \ch{2H2O} \\
 \ch{2 H2O}
\end{beispiel}
This also means, that a part cannot contain a blank since this will automatically divide it into two parts. If you need an extra blank in the output you need to use \lstinline+~+. However, since commands in most cases gobble a space after them a input like \cmd{ch}{\textbackslash command ABC} will be treated as a single part. If you want or need to divide them you need to add an empty group: \cmd{ch}{\textbackslash command\{\} ABC}. The different input types are described in the following sections.

There are some options to customize the output of the \cmd{ch} command. They can either be applied locally using the optional argument or can be set globally using the setup command. All options of \chemformula belong to the module \textcolor{module}{\texttt{chemformula}}.
\begin{description}
 \item\cmd{chemsetup}[chemformula]{<options>}
\end{description}

\section{Stoichiometric Factors}\secidx{Stoichiometric Factors}
A stoichiometric factor may only contain of numbers and the signs \lstinline+.,_/()+
\begin{beispiel}
 \ch{2} \\
 \ch{12}

 % decimals:
 \ch{3.5} \\
 \ch{5,75}

 % fractions:
 \ch{3/2} \\
 \ch{1_1/2}
\end{beispiel}

You have to be a little bit careful with the right syntax but I believe it is rather intuitive.
\begin{beispiel}[code only]
 this won't work but will result in an error: \ch{1/1_1}
\end{beispiel}

If stoichiometric factors are enclosed with parentheses the fractions are not recognized. What's inside the parenthesis is typeset as is. \begin{beispiel}
 \ch{(1/2) H2O} \ch{1/2 H2O} \ch{0.5 H2O}
\end{beispiel}
You can find many examples like the following for stoichiometric factors in parentheses in the \IUPAC Green Book \cite{iupac:greenbook}:
\begin{reaction*}
 (1/5) K "\ox*{7,Mn}" O4 + (8/5) HCl == (1/5) "\ox*{2,Mn}" Cl2 + (1/2) Cl2 + (1/5) KCl + (4/5) H2O
\end{reaction*}

There are a few possibilities to customize the output.
\begin{description}
 \item \key{decimal-marker}{<marker>} the symbol to indicate the decimal. Default = \texttt{.}
 \item \key{frac-style}{math/xfrac/nicefrac} determines how fractions are displayed. Default = \texttt{math}
 \item \key{stoich-space}{<dim>} The space that is placed after the stoichiometric factor. Default = \lstinline=.1667em=
\end{description}
\begin{beispiel}
 \ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5} 
\end{beispiel}

The option \key{frac-style}{xfrac} uses the \lstinline+\sfrac+ command of the \paket{xfrac} package. The output strongly depends on the font you use.\secidx[xfrac]{Stoichiometric Factors}
\begin{beispiel}
 \ch[frac-style=xfrac]{3/2} \ch[frac-style=xfrac]{1_1/2}
\end{beispiel}
\chemformula defines the instance \lstinline=formula-text-frac= which you can redefine to your needs. See the \paket{xfrac} documentation for further information. The default definition is this:
\begin{beispiel}[code only]
 \DeclareInstance{xfrac}{chemformula-text-frac}{text}
  {
    slash-left-kern  = -.15em ,
    slash-right-kern = -.15em
  }
\end{beispiel}
This document uses the font Linux Libertine and the following definition:
\begin{beispiel}[code only]
 \DeclareInstance{xfrac}{chemformula-text-frac}{text}
  {
    scale-factor        = 1 ,
    denominator-bot-sep = -.2ex ,
    denominator-format  = \scriptsize #1 ,
    numerator-top-sep   = -.2ex ,
    numerator-format    = \scriptsize #1
  }
\end{beispiel}

The option \key{frac-style}{nicefrac} uses the \lstinline+\nicefrac+ command of the \paket{nicefrac} package.\secidx[nicefrac]{Stoichiometric Factors}
\begin{beispiel}
 \ch[frac-style=nicefrac]{3/2} \ch[frac-style=nicefrac]{1_1/2}
\end{beispiel}

The option \key{stoich-space} allows you to customize the space between stoichiometric factor and the group following after it.\secidx[space]{Stoichiometric Factors}
\begin{beispiel}
 \ch{2 H2O} \\
 \ch[stoich-space=.3em]{2 H2O}
\end{beispiel}
\secidx*{Stoichiometric Factors}

\section{Compounds}\label{ssec:compounds}\secidx{Compounds}
\chemformula determines compounds as the type that \enquote{doesn't fit in anywhere else}. This point will become more clear when you know what the other types are.
\begin{beispiel}
 \ch{H2SO4} \\
 \ch{[Cu(NH3)4]^2+}
\end{beispiel}

\subsection{Adducts}\secidx[adducts]{Compounds}
\chemformula has two identifiers which will create adducts.
\begin{description}
 \item \cmd{ch}{A.B}
 \item \cmd{ch}{A*B}
\end{description}
\begin{beispiel}
 \ch{CaSO4.H2O} \\
 \ch{CaSO4*H2O}
\end{beispiel}
Since numbers in a compound always are treated as subscripts (see section \ref{ssec:subscripts}) you sometimes need to introduce stoichiometric factors for the right output:
\begin{beispiel}
 \ch{Na3PO4*12H2O} \\
 \ch{Na3PO4* 12 H2O} \\
 \ch{Na3PO4 * 12 H2O}
\end{beispiel}

\subsection{Subscripts}\label{ssec:subscripts}\secidx[subscripts]{Compounds}
\emph{All} numbers in a compound are treated as subscripts.
\begin{beispiel}
 \ch{H2SO4}
\end{beispiel}
If you want a letter to be a subscript you can use the math syntax:
\begin{beispiel}
 \ch{A_nB_m}
\end{beispiel}
The subscript recognizes groups. You can also use math inside it.
\begin{beispiel}
 \ch{A_{$n$}B_{$m$}} \\
 \ch{NaCl_{(aq)}}
\end{beispiel}

\subsection{Commands}\secidx[commands]{Compounds}
Commands are allowed in a compound:
\begin{beispiel}
 \ch{\textbf{A2}B3} \ch{A2\color{red}B3}
\end{beispiel}
However, if the commands demand numbers as argument, \eg space commands or \chemmacros' \lstinline+\ox+ command the direct use will fail. This is because the numbers are treated as subscripts \emph{before} the command expands.
\begin{beispiel}[code only]
 \ch{A\hspace{2mm}B} will raise an error because \hspace sees something like this: \hspace{$_2$mm}.
\end{beispiel}
See section \ref{ssec:text} for a way around this.

\subsection{Charges and Other Superscripts}\secidx[charges]{Compounds}\secidx[superscripts]{Compounds}
\paragraph{Basics}
If a compound \emph{ends} with a plus or minus sign it will be treated as charge sign and typeset as superscript. In other places a plus is treated as a triple bond and a dash will be used as a single bond, see section \ref{ssec:bonds}.
\begin{beispiel}
 \ch{A+B} \ch{AB+} \\
 \ch{A-B} \ch{AB-}
\end{beispiel}

For longer charge groups or other superscripts you can use the math syntax. It recognizes groups and you can use math inside them. Inside these groups neither \texttt{+} nor \texttt{-} are treated as bonds. If a dot \texttt{.} is inside a superscript it is treated as indicator for a radical. A \texttt{*} gives the excited state.
\begin{beispiel}
 \ch{A^{x-}} \\
 \ch{A^x-} \\
 \ch{A^{x}-} \\
 \ch{A^{$x-$}} \\
 \ch{RNO2^{-.}} \\
 \ch{^31H} \\
 \ch{^{14}6C} \\
 \ch{^{58}_{26}Fe} \\
 \ch{NO^*}
\end{beispiel}

Ions and ion composites with more than one charge can be typeset quite as easy:
\begin{beispiel}
 \ch{SO4^2-} \ch{Ca^2+ SO4^2-}
\end{beispiel}

\paragraph{Charge Commands}\secidx[superscripts!charge commands]{Compounds}
You don't need to use \cmd{mch} and related commands inside \cmd{ch}. Indeed, you \emph{shouldn't} use them as they might mess with the subscript and superscript alignment. The \chemmacros option \texttt{circled} is obeyed by \cmd{ch}.
\begin{beispiel}
 \chemsetup[option]{circled=all}
 \ch{H+ + OH- <=> H2O}
\end{beispiel}

\paragraph{Behaviour}\secidx[superscripts!behaviour]{Compounds}
The supercripts behave differently depending on their position in a compound, if there are super- and subscripts following each other directly.
\begin{beispiel}
 \ch{^33B} \ch{{}^33B} \ch{3^3B} \ch{B^3} \ch{B3^3} \\
 \ch{^{23}_{123}B} \ch{{}^{23}_{123}B}  \ch{_{123}^{23}B} \ch{B^{23}} \ch{B_{123}^{23}} \\
 \ch{^{123}_{23}B} \ch{{}^{123}_{23}B}  \ch{_{23}^{123}B} \ch{B^{123}} \ch{B23^{123}}
\end{beispiel}
\begin{itemize}
 \item If a compound \emph{starts} with a sub- or superscript both sub- and superscript are aligned to the \emph{right} else to the \emph{left}.
 \item If a \emph{does not start} with a sub- or superscript and there is both a sub- and a superscript, the superscript is shifted additionally by a length determined from the option \key{charge-hshift}{<dim>}, also see page \pageref{key:charge-hshift}f.
\end{itemize}
The second point follows \IUPAC's recommendations:
\begin{myquote}[{\IUPAC Green Book \cite[][p.\,51]{iupac:greenbook}}]
 In writing the formula for a complex ion, spacing for charge number can be added (staggered arrangement), as well as parentheses: \ch[charge-hshift=full]{SO4^2-}, \ch{(SO4)^2-} The staggered arrangement is now recommended.
\end{myquote}

\subsection{Bonds}\label{ssec:bonds}\secidx[bonds]{Compounds}
There are three kinds of bonds:
\begin{beispiel}
 single: \ch{CH3-CH3} \\
 double: \ch{CH2=CH2} \\
 triple: \ch{CH+CH}
\end{beispiel}

\subsection{Customization}\secidx[customization]{Compounds}
These options allow you to customize the ouptut of the compounds:
\begin{description}
 \item \key{subscript-vshift}{<dim>} Extra vertical shift of the subscripts. Default = \texttt{0pt}
 \item \key{subscript-style}{text/math} Style that is used to typeset the subscripts. Default = \texttt{text}
 \item \key{charge-hshift}{<dim>} Shift of superscripts when following a subscript. Default = \texttt{.5ex}\label{key:charge-hshift}
 \item \key{charge-vshift}{<dim>} Extra vertical shift of the superscripts. Default = \texttt{0pt}
 \item \key{charge-style}{text/math} Style that is used to typeset the superscripts. Default = \texttt{text}
 \item \key{adduct-space}{<dim>} Space to the left and the right of the adduct point. Default = \lstinline+.1333em+
 \item \key{bond-length}{<dim>} The length of the bonds. Default is the length of an endash as measured by \lstinline+\settowidth{<len>}{\textendash}+.
\end{description}
Maybe you have noticed that charges of certain ions are shifted to the right.\secidx[charges!shift]{Compounds} They are shifted if they \emph{follow} a subscript which follows \IUPAC recommendations \cite[][p.\,51]{iupac:greenbook}. The amount of the shift can be set with the option \key{charge-hshift}.
\begin{beispiel}
 \ch{SO4^2-} \ch{NH4+} \ch{Na+} \\
 \chemsetup[chemformula]{charge-hshift=.5ex}
 \ch{SO4^2-} \ch{NH4+} \ch{Na+} \\
 \chemsetup[chemformula]{charge-hshift=.5pt}
 \ch{SO4^2-} \ch{NH4+} \ch{Na+}
\end{beispiel}

Despite \IUPAC's recommendation \chemformula does not make a fully staggered arrangements in the default setting as I find it hard to read in some cases and ugly in others. Since this is a subjective decision \chemformula not only let's you define the absolute amount of the shift but also provides a possibility for full staggered arrangements. For this you have to use \key{charge-hshift}{full}.
\begin{beispiel}
 \ch[charge-hshift=0pt]{C5H11+} \ch[charge-hshift=0pt]{SO4^2-} \\
 \ch{C5H11+} \ch{SO4^2-} \\
 \ch[charge-hshift=1ex]{C5H11+} \ch[charge-hshift=1ex]{SO4^2-} \\
 \ch[charge-hshift=full]{C5H11+} \ch[charge-hshift=full]{SO4^2-}
\end{beispiel}

If you don't want the charges to be typeset in text mode you can switch to math mode:
\begin{beispiel}
 \ch{M^x+} \ch{SO4^2-} \\
 \chemsetup[chemformula]{charge-style = math}
 \ch{M^x+} \ch{SO4^2-}
\end{beispiel}

The option \key{subscript-vshift} can be used to adjust the vertical shift of the subscripts:\secidx[subscripts!shift]{Compounds}
\begin{beispiel}
 \ch{H2SO4} \ch{Na3PO4} \\
 \chemsetup[chemformula]{subscript-vshift=.5ex}
 \ch{H2SO4} \ch{Na3PO4} \\
 \chemsetup[chemformula]{subscript-vshift=-.2ex}
 \ch{H2SO4} \ch{Na3PO4}
\end{beispiel}

You can choose the mode subscripts are typeset in the same way as it is possible for the charges:
\begin{beispiel}
 \ch{A_nB_m} \ch{H2SO4} \\
 \chemsetup[chemformula]{subscript-style = math}
 \ch{A_nB_m} \ch{H2SO4}
\end{beispiel}

The option \key{adduct-space} sets the space left and right to the adduct symbol $\cdot$.
\begin{beispiel}
 \ch{Na3PO3*H2O} \\
 \chemsetup[chemformula]{adduct-space=.2em}
 \ch{Na3PO3*H2O}
\end{beispiel}

Changing the length of the bonds:\secidx[bonds!length]{Compounds}
\begin{beispiel}
 \chemsetup[chemformula]{bond-length=4mm}%
 single: \ch{CH3-CH3} \\
 double: \ch{CH2=CH2} \\
 triple: \ch{CH+CH}
\end{beispiel}
\secidx*{Compounds}

\section{Special Input Types}\secidx{Special Types}
There are some \enquote{special type} input groups.

\subsection{Single Token Groups}\secidx[single token groups]{Special Types}
The first kind are groups which consist of only one token, namely of the following ones:
\begin{description}
 \item \cmd{ch}{ + } \ch{+} creates the plus sign between compounds with space around it:\\
 \cmd{ch}{2 Na + Cl2} \ch{2 Na + Cl2}
 \item \cmd{ch}{ v } \ch{v} sign for precipitate: \cmd{ch}{BaSO4 v} \ch{BaSO4 v}
 \item \cmd{ch}{ \lstinline+^+ } \ch{^} sign for escaping gas\footnotemark: \cmd{ch}{\lstinline=H2 ^=} \ch{H2 ^}
\end{description}
\footnotetext{Is this the correct English term? Please correct me if it isn't.}

The space left and right of the plus sign can be set with this option:
\begin{description}
 \item \key{plus-space}{<dim>} Default = \lstinline+.3em+
\end{description}
\begin{beispiel}
 \ch{A + B}\\
 \ch[plus-space=4pt]{A + B}
\end{beispiel}

\subsection{Option Input}\secidx[option input]{Special Types}
\achtung{This is an experimental feature and may well be dropped in future versions.}
Sometimes you might want to apply an option only to a part of a, say, reaction. Of course you have the possibility to use \cmd{ch} several times.
\begin{beispiel}
 \ch{H2O +}\textcolor{red}{\ch{H2SO4}}\ch{-> H3O+ + HSO4-} \\
 \ch{H2O +}\ch[subscript-vshift=2pt]{H2SO4}\ch{-> H3O+ + HSO4-}
\end{beispiel}
This, however, interrupts the input in your source and \emph{may} mess with the spacing. That's why there is an alternative:
\begin{description}
 \item \ttfamily\cmd{ch}\{\lstinline+@{<options>}+\}\normalfont\ The options specified this way will be valid \emph{only} until the next compound is set.
\end{description}
\begin{beispiel}
 \ch{H2O +}\textcolor{red}{\ch{H2SO4}}\ch{-> H3O+ + HSO4-} \\
 \ch{H2O + @{format=\color{red}} H2SO4 -> H3O+ + HSO4-} \\
 or of course:\\
 \ch{H2O + \textcolor{red}{H2SO4} -> H3O+ + HSO4-}\\[1em]
 \ch{H2O +}\ch[subscript-vshift=2pt]{H2SO4}\ch{-> H3O+ + HSO4-} \\
 \ch{H2O + @{subscript-vshift=2pt} H2SO4 -> H3O+ + HSO4-}
\end{beispiel}
\secidx*{Special Types}

\section{Escaped Input}\secidx{Escaped Input}
In some cases it may be desirable to prevent \chemformula from parsing the input. This can be done in two ways.
\subsection{Text}\label{ssec:text}\secidx[text]{Escaped Input}
If you put something between \lstinline+" "+ or \lstinline+' '+ then the input will be treated as normal text, except that spaces are not allowed and have to be input with \lstinline+~+.
\begin{description}
 \item \cmd{ch}{ "<escaped text>" }
 \item \cmd{ch}{ '<escaped text>' }
\end{description}
\begin{beispiel}
 \ch{"\ox{2,Ca}" O} \\
 \ch{"\ldots\," Na + "\ldots\," Cl2 -> "\ldots\," NaCl} \\
 \ch{'A~->~B'}
\end{beispiel}
In many cases you won't need to escape the input. But when you get into trouble when using a command inside \cmd{ch} try hiding it.

\subsection{Math}\secidx[math]{Escaped Input}
If you especially want to input math you just enclose it with \lstinline+$ $+. This output is different from the escaped text as it is followed by a space.
\begin{description}
 \item \cmd{ch}{ \lstinline"$<escaped math>$" }
\end{description}
\begin{beispiel}
 escaped text: \ch{"$x$" H2O} \\
 escaped math: \ch{$x$ H2O} \\
 \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl}
\end{beispiel}

The space that is inserted after a math group can be edited:
\begin{description}
 \item \key{math-space}{<dim>} Default = \lstinline=.1667em=
\end{description}
\begin{beispiel}
 \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \\
 \chemsetup[chemformula]{math-space=.2em}
 \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \\
 \ch{$A->B$}
\end{beispiel}
\secidx*{Escaped Input}

\section{Arrows}\label{sec:arrows}\secidx{Arrows}
\subsection{Arrow types}\secidx[types]{Arrows}
Arrows are input in the same intuitive way they are with \paket{mhchem}. There are various different types:
\begin{description}
 \item \cmd{ch}{ -> } \ch{->} standard right arrow
 \item \cmd{ch}{ <- } \ch{<-} standard left arrow
 \item \cmd{ch}{ -/> } \ch{-/>} does not react (right)
 \item \cmd{ch}{ </- } \ch{</-} does not react (left)
 \item \cmd{ch}{ <-> } \ch{<->} resonance arrow
 \item \cmd{ch}{ <> } \ch{<>} reaction in both directions
 \item \cmd{ch}{ == } \ch{==} stoichiometric equation
 \item \cmd{ch}{ <=> } \ch{<=>} equilibrium arrow
 \item \cmd{ch}{ \lstinline+<=>>+ } \ch{<=>>} unbalanced equilibrium arrow to the right
 \item \cmd{ch}{ \lstinline+<<=>+ } \ch{<<=>} unbalanced equilibrium arrow to the left
 \item \cmd{ch}{ <o> } \ch{<o>} isolobal arrow
\end{description}
All these arrows are drawn with \TikZ.
\begin{beispiel}
 \ch{H2 + Cl2 -> 2 HCl} \\
 \ch{H2O + CO3^2- <=> OH- + HCO3-} \\
 \ch{A <- B} \\
 \ch{\{[CH2=CH-CH2]- <-> [CH2-CH=CH2]- \}} \\
 \ch{A <> B} \\
 \ch{H+ + OH- <=>> H2O} \\
 \ch{2 NO2 <<=> N2O4}
\end{beispiel}

\subsection{Labels}\secidx[labels]{Arrows}
The arrows take two optional arguments to label them.
\begin{description}
 \item\cmd{ch}{ ->[<above>][<below>] }
\end{description}
\begin{beispiel}
 \ch{A ->[a] B} \\
 \ch{A ->[a][b] B} \\
 \ch{A ->[\SI{100}{\celsius}] B}
\end{beispiel}
The label text can be parsed seperately from the arrow. The recipe is easy: leave blanks.
\begin{beispiel}
 \ch{A ->[H2O] B} \\
 \ch{A ->[ H2O ] B} \\
 \ch{A ->[ "\ox{2,Ca}" F2 ] B} \\
 \ch{A ->[$\Delta$,~ \[H+ \]] B}
\end{beispiel}
If you leave the blanks \chemformula treats the groups inside the square brackets as seperated input types. The arrow reads its arguments \emph{afterwards}. As you can see the arrows \enquote{grow} with the length of the labels. What stays constant is the part that protrudes the labels. As you also can see in the last example square brackets inside the arrow arguments should be produced using \cmd{[} and \cmd{]}. They keep their usual meaning outside \cmd{ch}. These commands are necessary since the usual grouping (\ie hiding the brackets inside curly brackets) doesn't work due to the way \cmd{ch} reads its argument.
\begin{beispiel}
 \ch{A ->[a] B} \\
 \ch{A ->[ab] B} \\
 \ch{A ->[abc] B} \\
 \ch{A ->[abc~abc] B} \\
 % needs the `chemfig' package:
 \setatomsep{15pt}
 \ch{A ->[ "\chemfig{-[:30]-[:-30]OH}" ] B} \\
 \ch{A ->[[]] B} vs. \ch{A ->[\[\]] B}
\end{beispiel}

\subsection{Customization}\secidx[customization]{Arrows}
These are the options which enable you to customize the arrows:
\begin{description}
 \item \key{arrow-offset}{<dim>} This is the length that an arrow protrudes a label on both sides. This means an empty arrow's length is two times \texttt{arrow-offset}. Default = \texttt{1.5ex}
 \item \key{arrow-yshift}{<dim>} Shifts an arrow up (positive value) or down (negative value). Default = \texttt{0pt}
 \item \key{arrow-ratio}{<factor>} The ratio of the arrow lengths of the unbalanced equilibrium. \texttt{.4} would mean that the length of the shorter arrow is $0.4\times$ the length of the longer arrow. Default = \texttt{.6}
 \item \key{compound-sep}{<dim>} The space between compounds and the arrows. Default = \texttt{1ex}
 \item \key{label-offset}{<dim>} The space between the labels and the arrows. Default = \texttt{2pt}
 \item \key{label-style}{<font command>} The relative font size of the labels. Default = \lstinline+\footnotesize+
\end{description}

The following code shows the effect of the different options on the \lstinline+<=>>+ arrow:
\begin{beispiel}
 standard: \ch{A <=>>[x][y] B} \\
 longer: \ch[arrow-offset=12pt]{A <=>>[x][y] B} \\
 higher: \ch[arrow-yshift=2pt]{A <=>>[x][y] B} \\
 more balanced: \ch[arrow-ratio=.8]{A <=>>[x][y] B} \\
 labels further away: \ch[label-offset=4pt]{A <=>>[x][y] B} \\
 larger distance to compounds: \ch[compound-sep=2ex]{A <=>>[x][y] B} \\
 smaller labels: \ch[label-style=\tiny]{A <=>[x][y] B}
\end{beispiel}
% 
% The tips of the arrows are designed to match the appearance of \paket{chemfig}'s arrows. If you like other arrow tips better and want to change them without redefining all the arrows (see section \ref{sec:arrows_modify}) you can use the command
% \begin{description}
%  \item \cmd{pgfarrowsrenewalias}{<new start>}\ma{<new end>}\ma{<old start>}\ma{<old end>}
% \end{description}
% This command is the same as \lstinline=\pgfarrowsdeclarealias= but without the check if the new tips exist. This means it lets you overwrite old definitions.
% \begin{beispiel}
%  % overwrite the chemformula arrow heads `cf' and `left cf'
%  \pgfarrowsrenewalias{left cf}{left cf}{left to}{left to}
%  \pgfarrowsrenewalias{cf}{cf}{to}{to}
% 
%  \ch{CO + H2O <=> CO2 + H2} \\
%  \ch{C + H2O -> CO + H2}
% \end{beispiel}

\subsection{Modify Arrow Types}\label{sec:arrows_modify}\secidx[types!modify]{Arrows}
The arrows are defined with the command
\begin{description}
 \item \cmd{DeclareChemArrow}{<tokens>}\ma{<tikz>}
\end{description}
\ma{<tokens>} is the sequence of tokens that is replaced with the actual arrow code. For example the basic arrow is defined via
\begin{beispiel}[code only]
 \DeclareChemArrow{->}{\draw[-cf] (cf_arrow_start) -- (cf_arrow_end) ;}
\end{beispiel}
In order to define arrows yourself you need to know the basics of \TikZ\footnote{Please see the \textsf{pgfmanual} for details.}. There are some predefined coordinates you can and should use:
\begin{description}
 \item[\texttt{(cf\_arrow\_start)}] The beginning of the arrow.
 \item[\texttt{(cf\_arrow\_end)}] The end of the arrow.
 \item[\texttt{(cf\_arrow\_mid)}] The mid of the arrow.
 \item[\texttt{(cf\_arrow\_mid\_start)}] The beginning of the shorter arrow in types like \lstinline+<=>>+.
 \item[\texttt{(cf\_arrow\_mid\_end)}] The end of the shorter arrow in types like \lstinline+<=>>+.
 \item[\texttt{cf}, \texttt{left cf}, \texttt{right cf}] \chemformula's own arrow heads.
\end{description}
\begin{beispiel}
 \DeclareChemArrow{.>}{\draw[-cf,dotted,red] (cf_arrow_start) -- (cf_arrow_end);}
 \DeclareChemArrow{n>}{\draw[-cf] (cf_arrow_start) .. controls ([yshift=3ex]cf_arrow_mid) .. (cf_arrow_end);}
 \ch{A .> B} \ch{A .>[a][b] B} \ch{A n> B}
\end{beispiel}
If you want to redefine an existing arrow there are two commands you can use:
\begin{description}
 \item \cmd{RenewChemArrow}{<tokens>}\ma{<tikz>}
 \item \cmd{ShowChemArrow}{<tokens>}
\end{description}
The second one gives the current definition, the first one redefines an existing arrow.
\begin{beispiel}
 \texttt{\ShowChemArrow{->}} \\
 \RenewChemArrow{->}{\draw[->,red] (cf_arrow_start) -- (cf_arrow_end) ;}
 \texttt{\ShowChemArrow{->}} \\
 \ch{A -> B}
\end{beispiel}
\secidx*{Arrows}

\section{Names}\secidx{Names}
\subsection{Syntax}\secidx[syntax]{Names}
\chemformula has a built-in syntax to write text under a compound. In a way it works very similar to the arrows.
\begin{description}
 \item\cmd{ch}{ !(<name>)( <formula> ) }
\end{description}
If an exclamation mark is followed by a pair of parentheses \chemformula will parse it this way:
\begin{beispiel}
 \ch{!(ethanol)( CH2CH2OH )}
\end{beispiel}
The same what's true for the arrows arguments holds for these arguments: if you leave blanks the different parts will be treated according to their input type before the text is set below the formula.
\begin{beispiel}
 \ch{!(water)(H2O)} \quad
 \ch{!( "\textcolor{blue}{water}" )( H2O )} \quad
 \ch{!( $2n-1$ )( H2O )} \quad
 \ch{!( H2O )( H2O )} \quad
 \ch{!(oxonium)( H3O+ )}
\end{beispiel}
If for some reason you want to insert an exclamation mark \emph{without} it creating a name you only have to make sure it isn't followed by parentheses.
\begin{beispiel}
 \ch{H2O~(!)} \\
 \ch{A!{}()}
\end{beispiel}

\subsection{Customization}\secidx[customization]{Names}
\chemformula provides two options to customize the output of the names:
\begin{description}
 \item \key{name-format}{<commands>} The format of the name. This can be arbitrary input. Default = \lstinline+\scriptsize\centering+
 \item \key{name-width}{<dim>/auto} The width of the box where the label is put into. \texttt{auto} will detect the width of the name and set the box to this width. Default = \texttt{auto}
\end{description}
\begin{beispiel}
 \ch{!(acid)( H2SO4 ) -> B} \\
 \ch[name-format=\sffamily\small]{!(acid)( H2SO4 ) -> B} \\
 \ch[name-format=\scriptsize N:~]{!(acid)( H2SO4 ) -> B} \\
 \ch[name-width=3em,name-format=\scriptsize\raggedright]{!(acid)( H2SO4 ) -> B}
\end{beispiel}
\secidx*{Names}

\section{Format and Font}\secidx{Format and Font}\label{sec:format}
In the standard setting \chemformula doesn't make any default changes to the font of the formula output. Let's take a look at a nonsense input which shows all features:
\begin{beispiel}
 \newcommand*\sample{\ch{H2C-C+C-CH=CH+ + CrO4^2- <=>[x][y] 2.5 Cl^{-.} + 3_1/2 Na*OH_{(aq)} + !(name)( A^n ) "\LaTeXe"}}
 \sample
\end{beispiel}
\newcommand*\sample{\ch{H2C-C+C-CH=CH+ + CrO4^2- <=>[x][y] 2.5 Cl^{-.} + 3_1/2 Na*OH_{(aq)} + !(name)( A^n ) "\LaTeXe"}}
Now we're going to change different aspects of the font a look what happens:
\begin{beispiel}[below]
 \sffamily Hallo \sample \\
 \ttfamily Hallo \sample \normalfont \\
 \bfseries Hallo \sample \normalfont \\
 \itshape Hallo \sample
\end{beispiel}
As you can see most features adapt to the surrounding font.

If you want to change the default format you need to use this option:
\begin{description}
 \item \key{format}{<anything>} Adds arbitrary code before the output of \cmd{ch}.
\end{description}
\begin{beispiel}
 \definecolor{newblue}{rgb}{.1,.1,.5}\chemsetup[chemformula]{format=\color{newblue}\sffamily}
 \sffamily Hallo \sample \\
 \ttfamily Hallo \sample \normalfont \\
 \bfseries Hallo \sample \normalfont \\
 \itshape Hallo \sample
\end{beispiel}

You can also specifically change the fontfamily, fontseries and fontshape of the output.
\begin{description}
 \item \key{font-family}{<family>} Changes the fontfamily of the output with \lstinline+\fontfamily{<family>}\selectfont+.
 \item \key{font-series}{<series>} Changes the fontseries of the output with \lstinline+\fontseries{<series>}\selectfont+.
 \item \key{font-shape}{<shape>} Changes the fontshape of the output with \lstinline+\fontshape{<shape>}\selectfont+.
\end{description}
\begin{beispiel}
 \chemsetup[chemformula]{font-series=bx}
 Hallo \sample \\
 \sffamily Hallo \sample \normalfont \\
 \chemsetup[chemformula]{font-family=lmr,font-series=m} Hallo \sample \normalfont \\
 \itshape Hallo \sample
\end{beispiel}

If you're using \XeLaTeX\ or \LuaLaTeX\ and have loaded \paket{fontspec} you have the possibilty to set the font with it:
\begin{description}
 \item \key{font-spec}{\{<font>\}} or with options
 \item \key{font-spec}{\{[<options>]<font>\}}
\end{description}
\begin{beispiel}
 \chemsetup[chemformula]{font-spec={Linux Biolinum O}} \sample \\
 \chemsetup[chemformula]{font-spec={[Color=darkgray]Augie}} \sample \\
 \chemsetup[chemformula]{font-spec={Tipbrush Script}} \sample \\
 \chemsetup[chemformula]{font-spec={Latin Modern Sans}} \sample \\
 \bfseries \sample \normalfont \\
 \chemsetup[chemformula]{font-spec={Feathergraphy Decoration}} \sample
\end{beispiel}
\secidx*{Format and Font}

\section{Usage In Math Equations}\secidx{Math Environments}
The \cmd{ch} command can be used inside math equations. It recognizes \lstinline+\\+ and \lstinline+&+ and passes them on. However, you can't use the optional arguments of \lstinline+\\+ inside \cmd{ch}.
\begin{beispiel}
 \begin{align}
  \ch{
    H2O & ->[a] H2SO4 \\
    Cl2 & ->[x][y] CH4
  }
 \end{align}
 \begin{align*}
 \ch{
   RNO2      &<=>[ + e- ] RNO2^{-.} \\
   RNO2^{-.} &<=>[ + e- ] RNO2^2-
 }
 \end{align*}
\end{beispiel}
\secidx*{Math Environments}

\section{Further Examples}
This section presents some examples of a possible usage.

\begin{beispiel}
 \begin{reaction}[Synthese von Alkanen]
  !(Synthesegas)( $n$ CO + $(2n+1)$ H2 ) ->[\SI{200}{\celsius}][\[CoNi\]] C_{$n$}H_{$2n+2$} + $n$ H2O
 \end{reaction}
\end{beispiel}

\begin{beispiel}
 \begin{reactions*}
  "a)" && CH4    + Cl2 &-> CH3Cl  + HCl && "{\small Chlormethan/Methylchlorid}" \\
  "b)" && CH3Cl  + Cl2 &-> CH2Cl2 + HCl && "{\small Dichlormethan/Methylenchlorid}" \\
  "c)" && CH2Cl2 + Cl2 &-> CHCl3  + HCl && "{\small Trichlormethan/Chloroform}" \\
  "d)" && CHCl3  + Cl2 &-> CCl4   + HCl && "{\small Tetrachlormethan/Tetrachlorkohlenstoff}"
 \end{reactions*}
\end{beispiel}

\begin{beispiel}
 \chemsetup[ox]{parse=false}\ch{"\ox{\delm,C}" -{} "\ox{\delp,M}" \qquad ( <-> "\ox{\delp,C}" -{} "\ox{\delm,Br}" )} \\
 \ch[adduct-space=0pt]{X. + .Y <=> X-Y + Bindungsenergie} \\
 \ch[name-format=\normalsize]{!(\State{H}{f}\qquad)() !(\textcolor{red}{??})( CH4\gas{} ) + !(\num{0})( 2 O2\gas{} ) -> !(\num{-94.3})( CO2\gas{} ) + !(\num{-57.9})( H2O\lqd{} ) + !(\num{-192.1})( "\State{H}" )}
\end{beispiel}

\begin{beispiel}
 \begin{reactions*}
  CH3MgBr + "\ox*{1,Cu}" X &-> "\glqq" CH3 "\ox*{1,Cu}\grqq" + MgBrX "\qquad X~$=$~Br,I,CN" \\
  2 MeLi + CuI             &-> !(Dimethylcuprat~(Gilmann-Cuprat))( Me2CuLi ) + Li
 \end{reactions*}
\end{beispiel}

\begin{beispiel}
 % needs `chemfig'
 \begin{reactions*}
  H3C-CH3 + Cl2                           &->[$\Delta$][$h\nu$] H3CCH2Cl + HCl       & &"\Enthalpy{-27.1}" \\
  H3C-CH3 + "\Lewis{0.,Cl}"               &-> H3CCH2 "\Lewis{0.,\vphantom{H}}" + HCl & &"\Enthalpy{-5.0}" \\
  H3C-CH2 "\Lewis{0.,\vphantom{H}}" + Cl2 &-> H3CCH2Cl + "\Lewis{0.,Cl}"             & &"\Enthalpy{-23.0}"
 \end{reactions*}
\end{beispiel}

The following example shows how the cancelling of compounds could be done\footnote{Inspired by a question on TeX.SE: \url{http://tex.stackexchange.com/q/30118/5049}}.
\begin{beispiel}
 % needs `cancel'
 \begin{align*}
  \ch{\cancel{HCOOH\aq} + H2O\lqd{}  &<=> H3O^+\aq{} + \cancel{HCOO^-\aq}} \\
  \ch{\cancel{HCOO^-\aq} + H2O\lqd{} &<=> \cancel{HCOOH\aq} + OH^-\aq}\\[-1ex]
  \cline{1-2}
  \ch{H2O\lqd{} + H2O\lqd{} &<=> H3O^+\aq{} + OH^-\aq}    
 \end{align*}
\end{beispiel}
\secidx*{CHEMFORMULA}

\part{\texorpdfstring{\Ghsystem}{ghsystem}}\secidx{GHSYSTEM}
\section{Setup}
All of \ghsystem's options belong to the module \textcolor{module}{\texttt{ghsystem}}. This means they can be setup with
\begin{beispiel}[code only]
 \chemsetup[ghsystem]{<options>} or
 \chemsetup{ghsystem/<option1>,ghsystem/<option2>}
\end{beispiel}

\section{Get Hazard and Precautionary Statements}\secidx{Hazard and Precautionary Statements}
\subsection{Simple Statements}\secidx[get statements]{GHSYSTEM}
The general usage is simple: you use the command
\begin{description}
 \item\cmd{ghs}[<options>]{<type>}\ma{<number>}
 \item\cmd[ghsa]{ghs*}[<options>]{<type>}\ma{<number>}
\end{description}
There are three types available: \texttt{h}, \texttt{euh} and \texttt{p}. The \ma{<type>} argument is case insensitive, so just type them in as you like.
\begin{beispiel}
 \ghs{h}{200} \\
 \ghs{H}{224} \\
 \ghs{euh}{001} \\
 \ghs{Euh}{202} \\
 \ghs{p}{201}
\end{beispiel}

The starred version hides the identifier and only gives the statement. If you want to hide the statement itself instead you can use the option:
\begin{description}
 \item\key{hide}{\uline{true}/false}
\end{description}

There is an option to customize the output, too.
\begin{description}
 \item\key{space}{<space command>} Space between \texttt{<type>} and \texttt{<number>}.
\end{description}
\begin{beispiel}
 \ghs{h}{200} \\
 \ghs[space=\,]{h}{200} \\
 \ghs*{h}{200} \\
 \ghs[hide]{h}{200}
\end{beispiel}

\subsection{Statements with Placeholders}\secidx[statements with placeholders]{GHSYSTEM}
Some of the statements contain placeholders. They can be one of the following:
\begin{itemize}
 \item \textit{\textless state route of exposure if it is conclusively proven that no other routes of exposure cause the hazard\textgreater}
 \item \textit{\textless state specific effect if known\textgreater}
 \item \textit{\textless or state all organs affected, if known\textgreater}
 \item \textit{\textless name of sensitising substance\textgreater}
\end{itemize}

Except the last one which needs to be filled in, they are hidden per default. They can be made visible with the option
\begin{description}
 \item\key{fill-in}{\uline{true}/false} Show placeholders. Default = \texttt{false}
\end{description}
\begin{beispiel}[below]
 \ghs{h}{340} \\
 \ghs[fill-in]{h}{340} \\
 \ghs{h}{360} \\
 \ghs[fill-in]{h}{360} \\
 \ghs{h}{370} \\
 \ghs[fill-in]{h}{370} \\
 \ghs{euh}{208} \\
 \ghs[fill-in]{euh}{208}
\end{beispiel}

These placeholders can be replaced with one of these options:
\begin{description}
 \item\key{exposure}{<text>} exposure placeholder
 \item\key{effect}{<text>} effect placeholder
 \item\key{organs}{<text>} organ placeholder
 \item\key{substance}{<text>} substance placeholder
\end{description}
\begin{beispiel}
 \ghs[exposure=This is how you get exposed.]{h}{340} \\
 \ghs[effect=These are the effects.]{h}{360} \\
 \ghs[organs=to this organ]{h}{370} \\
 \ghs[substance=substance]{euh}{208}
\end{beispiel}

\subsection{Statements with Gaps}\secidx[statements with gaps]{GHSYSTEM}
Some of the statements have gaps that can be filled.
\begin{beispiel}
 \ghs{p}{301} \\
 \ghs{p}{401} \\
 \ghs{p}{411} \\
 \ghs{p}{413}
\end{beispiel}

These gaps can be filled using these options:
\begin{description}
 \item\key{text}{<text>}
 \item\key{dots}{<text>}
 \item\key{C-temperature}{<num>}
 \item\key{F-temperature}{<num>}
 \item\key{kg-mass}{<num>}
 \item\key{lbs-mass}{<num>}
\end{description}
\begin{beispiel}
 \ghs[dots=contact physician!]{p}{301} \\
 \ghs[text=here]{p}{401} \\
 \ghs[C-temperature=50, F-temperature=122]{p}{411} \\
 \ghs[kg-mass=5.0, lbs-mass=11, C-temperature=50, F-temperature=122]{p}{413}
\end{beispiel}

\subsection{Combined Statements}\secidx[combined statements]{GHSYSTEM}
There are some combinations of statements. They are input with a \texttt{+} between the numbers:
\begin{beispiel}[below]
 \ghs{p}{235+410} \\
 \ghs{p}{301+330+331}
\end{beispiel}

Note that you can only get combinations that officially exist. \emph{You can't combine freely}.
\secidx*{Hazard and Precautionary Statements}

\section{Pictograms}\secidx{Pictograms}
\subsection{The Pictures}
The GHS defines a number of pictograms:

\ghspic{explos} \ghspic{flame} \ghspic{flame-O} \ghspic{bottle} \ghspic{acid} \ghspic{skull} \ghspic{exclam} \ghspic{health} \ghspic{aqpol}

The command
\begin{description}
 \item\cmd{ghspic}[<options>]{<name>}
\end{description}
loads them. \ref{tab:ghs_pictograms} shows all available pictograms and their names. To be more precise: it shows the names to use with the \cmd{ghspic} command. The file names are \lstinline=ghsystem_<name>.<filetype>= where \texttt{<filetype>} is \texttt{eps}, \texttt{jpg} or \texttt{png}, see also section \ref{ssec:picture_type}.
\begin{beispiel}
 \ghspic{skull}
\end{beispiel}

If you don't like the default size you can change it using this option:
\begin{description}
 \item\key{scale}{<factor>} Scales the pictogram. Default = \texttt{1}
\end{description}
The pictures are actually quite large. The default setting scales them by a factor of $\frac{1}{20}$.
\begin{beispiel}
 \ghspic[scale=2]{skull}
\end{beispiel}

If you want to use some specific \lstinline=\includegraphics= options, \eg if you want to rotate the pictogram for soma reason, use this option:
\begin{description}
 \item\key{includegraphics}{\{<includegraphics keyvals>\}}
\end{description}
\begin{beispiel}
 \ghspic[includegraphics={angle=90}]{skull}
\end{beispiel}

\begin{longtable}{>{\ttfamily}ll>{\ttfamily}ll}
    \caption{All available GHS pictograms.\label{tab:ghs_pictograms}} \\
  \toprule
    \normalfont\bfseries name & \bfseries pictogram & \normalfont\bfseries name & \bfseries pictogram \\
  \midrule\endfirsthead
  \toprule
    \normalfont\bfseries name & \bfseries pictogram & \normalfont\bfseries name & \bfseries pictogram \\
  \midrule\endhead
  \bottomrule\endfoot
  explos              & \ghspic{explos}          & explos-1            & \ghspic{explos-1} \\
  explos-2            & \ghspic{explos-2}        & explos-3            & \ghspic{explos-3} \\
  explos-4            & \ghspic{explos-4}        & explos-5            & \ghspic{explos-5} \\
  explos-6            & \ghspic{explos-6}        & & \\
  flame               & \ghspic{flame}           & flame-2-white       & \ghspic{flame-2-white} \\
  flame-2-black       & \ghspic{flame-2-black}   & flame-3-white       & \ghspic{flame-3-white} \\
  flame-3-black       & \ghspic{flame-3-black}   & flame-4-1           & \ghspic{flame-4-1} \\
  flame-4-2           & \ghspic{flame-4-2}       & flame-4-3-white     & \ghspic{flame-4-3-white} \\
  flame-4-3-black     & \ghspic{flame-4-3-black} & flame-5-2-white     & \ghspic{flame-5-2-white} \\
  flame-5-2-black     & \ghspic{flame-5-2-black} & & \\
  flame-O             & \ghspic{flame-O}         & flame-O-5-1         & \ghspic{flame-O-5-1} \\
  bottle              & \ghspic{bottle}          & bottle-2-black      & \ghspic{bottle-2-white} \\
  bottle-2-white      & \ghspic{bottle-2-black}  & & \\
  acid                & \ghspic{acid}            & acid-8              & \ghspic{acid-8} \\
  skull               & \ghspic{skull}           & skull-2             & \ghspic{skull-2} \\
  skull-6             & \ghspic{skull-6}         & & \\
  exclam              & \ghspic{exclam}          & & \\
  health              & \ghspic{health}          & & \\
  aqpol               & \ghspic{aqpol}           & & \\
\end{longtable}

\subsection{Picture Type Depending on Engine}\label{ssec:picture_type}
As you probably know you can't use every picture type with every compiler engine. \pdfTeX\ in \textsc{dvi} mode \emph{needs} \texttt{eps} pictures while \pdfTeX\ in \textsc{pdf} mode, \XeTeX\ and \LuaTeX\ convert \texttt{eps} pictures into \texttt{pdf} files, given they have the rights to write in the directory the pictures are saved in.

However, the latter can include \texttt{jpg} and \texttt{png} without any problems, while \pdfTeX\ in \textsc{dvi} mode can't.

To resolve this \ghsystem tests which engine is used and if \pdfTeX\ which mode is used and then chooses either \texttt{eps} or \texttt{png} for the pictograms. You are free to choose the picture type yourself with the option
\begin{description}
 \item\key{pic-type}{eps/jpg/png}
\end{description}
\secidx*{Pictograms}

\section{Available Languages}
Right now the H and P statements are only available in English or German. The package adapts the package option \key[option]{german} but does not (yet) recognize language settings by \paket{babel} or \paket{polyglossia}.

You can also choose the language explicitly.
\begin{description}
 \item\key{language}{english/german}
\end{description}
\begin{beispiel}
 \ghs{h}{201}

 \chemsetup[ghsystem]{language=german}
 \ghs{h}{201}
\end{beispiel}

I will add other languages some time in future. This may take a while, though. If you would be willing to contribute and write the statements of another language please feel free to contact me\footnote{\href{mailto:contac@mychemistry.eu}{contact@mychemistry.eu}}. I would provide you with a template file, a \texttt{pdf} containing the official translations, and help to all your questions.

\section{List of All Statements}\secidx{List of All Statements}
If for some reason you want to list all sentences you can use
\begin{description}
 \item\cmd{ghslistall}[<options>]
\end{description}

This command has a number of options to customize the table, which is created with the \lstinline=longtable= environment of the \paket{longtable} package.
\begin{description}
 \item\key{table-head-number}{<text>} Default = \texttt{Identifier}
 \item\key{table-head-text}{<text>} Default = \texttt{Statement}
 \item\key{table-next-page}{<text>} Default = \texttt{continues on next page}
 \item\key{table-caption}{<text>} As \texttt{<text>} in \lstinline=\caption{<text>}=. Default = \texttt{All H, EUH, and P Statements.}
 \item\key{table-caption-short}{<text>} As \texttt{<short>} in \lstinline=\caption[<short>]{<text>}=.
 \item\key{table-label}{<text>} The label to refer to the table with \lstinline=\ref= and similar commands. Default = \texttt{tab:ghs-hp-statements}
 \item\key{table-row-sep}{<dim>} The separation of the table rows. A \TeX\ dimension. Default = \texttt{3pt}
 \item\key{table-rules}{\uline{default}/booktabs/none} The style of the horizontal rules in the table. \texttt{default} uses \lstinline=\hline=, \texttt{booktabs} uses \lstinline=\toprule=, \lstinline=\midrule= or \lstinline=\bottomrule=, resp. This option needs the \paket{booktabs} package which you have to load yourself then. Default = \texttt{default}
 \item\key{table-top-head-rule}{\uline{default}/booktabs/none} Change top rule explicitly. Default = \texttt{default}
 \item\key{table-head-rule}{\uline{default}/booktabs/none} Change rule below head explicitly. Default = \texttt{default}
 \item\key{table-foot-rule}{\uline{default}/booktabs/none} Change foot rule explicitly. Default = \texttt{default}
 \item\key{table-last-foot-rule}{\uline{default}/booktabs/none} Change last foot rule explicitly. Default = \texttt{default}
\end{description}

The code below shows how \ref{tab:ghs-hp-statements} was created: 
\begin{beispiel}[code only]
 \ghslistall[fill-in,table-rules=booktabs]
\end{beispiel}

\ghslistall[fill-in,table-rules=booktabs]
\secidx*{List of All Statements}\secidx*{GHSYSTEM}

\appendix
\part{Appendix}\index{APPENDIX@\textbf{APPENDIX}}
\section*{Suggestions and Bug Reports}\addcontentsline{toc}{section}{Suggestions and Bug Reports}
Feedback on \chemmacros, \chemformula and \ghsystem is highly appreciated and welcome! Especially \chemformula and \ghsystem are still in beta testing phase so even if I repeat myself: feedback is highly welcome.

If you have suggestions for macros, missing features \etc, please don't hesitate to contact me. If you recognize any errors, be it chemical ones, wrong documentation and the like, I'd be grateful about a short email\footnote{\href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu}}.

If you find any bugs, it would be best, if you'd send me a minimal example, with which I can reproduce the bug. You can also submit an issue on \url{https://bitbucket.org/cgnieder/chemmacros/} instead.

Many thanks to all the people who already provided me with feedback, especially (in alphabetical order):
\begin{itemize}
 \item \href{http://www.mathannotated.com/}{Peter Cao}
 \item Dr.\ Paul King
 \item Christoph Schäfer
\end{itemize}

\printbibliography

\printindex

% \listoftodos
\end{document}