%% mhchem.tex
%% Copyright 2004-2017 Martin Hensel
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c
% which is included as lppl-1-3c.txt.
%
% This work has the LPPL maintenance status "maintained".
% The Current Maintainer of this work is Martin Hensel.
%
% ( In order to fight spam, the maintainer's contact      )
% ( information is "encrypted" with ROT13.                )
% ( If you do not know ROT13 yet and have no tool for     )
% ( decryption, simply do an Internet search for "ROT13". )
%
% ,---[ ROT 13 ]---
% | Gur Pheerag Znvagnvare bs guvf jbex vf Znegva Urafry
% |   jub pna or pbagnpgrq ivn
% |     zupurz@ZnegvaUrafry.qr
% |   be ivn znvy
% |     Znegva Urafry
% |     Cbfgfge. 20
% |     09232 Unegznaafqbes
% |     Treznal
% `----------
%
% This work consists of all files listed in manifest.txt.
%
%
\documentclass[a4paper,notitlepage,parskip=half]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[danish,french,ngerman,spanish,italian,UKenglish]{babel}
\usepackage{tgpagella}% URW Palladio
\usepackage{upgreek}
\addtokomafont{disposition}{\rmfamily}
\linespread{1.1}
\usepackage{mathpazo}% math font
\usepackage[scale=0.9]{sourcecodepro}
\usepackage{AlegreyaSans}
\usepackage[bookmarks,bookmarksopen,pdfstartview=FitH]{hyperref}
\usepackage[alwaysadjust]{paralist}
\usepackage{ragged2e}
\usepackage{fvrb-ex}% example environments
\usepackage{xcolor}
\usepackage{nameref}

\usepackage[version=4]{mhchem}
\usepackage{hpstatement}
\usepackage{rsphrase}
\usepackage{tikz}
\usepgflibrary{arrows.meta}

\setcounter{secnumdepth}{-1}
\newcommand\macro[1]{{\ttfamily\textbackslash#1}}
\newcommand\fromversion[1]{\marginpar{{\scriptsize version$\geq$#1}}}
\newenvironment{annotation}{\bgroup\footnotesize}{\par\egroup}

\definecolor{mhchem}{HTML}{A33E00}
\makeatletter
\def\mhchem@hook@beforeCe{\color{mhchem}}
\makeatother

\begin{document}

\title{%
  The mhchem Bundle\\[0.3em]
  \Large\textmd{%
    Documentation for the \LaTeX{} Packages\\
    mhchem v4.06,\\% check
    hpstatement v1.02 and\\
    rsphrase v3.11}%
}
\author{%
  Martin Hensel\\
  mhchem\makebox[0pt][l]{\textcolor{white}{NOSPAM}}@MartinHensel\makebox[1pt][l]{\textcolor{white}{.}}.de%
}
\date{%
  2017-01-16% check
}
\maketitle

\vfill

\begin{abstract}
  \noindent
  The \textbf{mhchem} package provides commands for typesetting chemical molecular formulae and equations.

  \medskip
  \noindent The \textbf{hpstatement} package provides commands for the official hazard statements and precautionary statements (H and P statements) that are used to label chemicals.

  \medskip
  \noindent
  The \textbf{rsphrase} package provides commands for the official Risk and Safety (R and S) Phrases that are used to label chemicals.
\end{abstract}



\clearpage
\tableofcontents



\clearpage
\chapter{The mhchem Package}


\section{Work in Progress}

Even after years, the mhchem package is still work in progress. I try to never invalidate valid, old syntaxes (via the \verb|version| option). However, slight changes in spacing (and therefore changed line breaks and page breaks) can occur from release to release.

\textbf{The version 4 syntax is subject to change if I find a serious flaw, for a couple of months after first release.} After that, it will be stable and  syntax incompatible changes would only occur in a future version 5.

\section{Preamble}

In order to use all of mhchem's features, request it in your document's preamble with the command

{\color{mhchem}\Large\verb|\usepackage|{\ttfamily\bfseries [version=4]}\verb|{mhchem}|}
\marginpar{\Large !}

\begin{annotation}
What about the \verb|version=4|? During development, I became aware that additional functionality could not be added without changing the user-interface slightly. But what about backward compatibility? I could, of course freeze mhchem and publish an mhchem2 package. However, I decided to use a parameter in order to switch to the new interface. One can use \verb|version=4| for the most-recent version of mhchem, but \verb|version=2| to \verb|version=1| are still there for existing documents that use an old user-interface of mhchem. Those old documents should still produce the same results. However, spacing might differ slightly.
\end{annotation}

mhchem needs a couple of other packages. For instance, expl3, amsmath and calc.


\section{Chemical Equations}

\begin{SideBySideExample}[xrightmargin=6cm]
  \ce{CO2 + C -> 2 CO}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=6cm]
  \ce{Hg^2+ ->[I-] HgI2
            ->[I-] [Hg^{II}I4]^2-}
\end{SideBySideExample}



\section{Chemical Formulae}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{Sb2O3}
\end{SideBySideExample}


This works in text mode (even in headings) and in math mode. (For PDF bookmarks you might have to specify a text-only version.)

{
\let\sffamilyorig\sffamily
\def\sffamily{\color{mhchem}\sffamilyorig}
\begin{SideBySideExample}[xrightmargin=5cm]
  \sffamily\itshape
  This is text with \ce{H2O} and $\ce{H2O}$.
\end{SideBySideExample}
}

For how to fine-tune the font usage, see \nameref{sec:FineTuning}.


\section{Charges}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{H+}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{CrO4^2-}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{[AgCl2]-}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{Y^99+}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{Y^{99+}}
\end{SideBySideExample}

This will work in text mode and math mode. For text, the en-dash will be used as a minus sign.


\section{Oxidation States}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{Fe^{II}Fe^{III}2O4}
\end{SideBySideExample}

\section{Stoichiometric Numbers}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{2H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{2 H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{0.5H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{1/2H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{(1/2)H2O} % IUPAC Green Book
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{$n$H2O}
\end{SideBySideExample}

This works in text mode and math mode. (The fraction line always comes from math mode and might appear too small when using bold text fonts.)


\section{Isotopes}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{^{227}_{90}Th+}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{^227_90Th+}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{^{0}_{-1}n^{-}}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{^0_-1n-}
\end{SideBySideExample}

It might be ambiguous whether a superscript belongs to the left or right letter. You can make sure by hand (using \verb|{}|) or leave it to the automatic detection (digits only~= mass number~= belongs to right side).

\begin{SideBySideExample}[xrightmargin=2.5cm]
  \ce{H{}^3HO}\\
  \ce{H^3HO}
\end{SideBySideExample}

Of course, all of this works in text mode and math mode.


\section{Parenthesis, Brackets, Braces}

Use parenthesis \verb|( )| and brackets \verb|[ ]| normally. Write braces as \verb|\{ \}|.

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{(NH4)2S}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{[\{(X2)3\}2]^3+}
\end{SideBySideExample}

Small parenthesis etc. work in both, text mode and math mode. Large parenthesis etc. are a math-mode only feature.

Both, \macro{left} and \macro{right} macros, need to be in the same math environment, so you might have to put \macro{ce} into \verb|$| into \macro{ce}, but that's fine.

$\displaystyle\ce{CH4 + 2 $\left( \ce{O2 + 79/21 N2} \right)$}$\par
{\raggedleft\verb|\ce{CH4 + 2 $\left( \ce{O2 + 79/21 N2} \right)$}|\par}


\section{States of Aggregation}

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{H2(aq)} % IUPAC recommendation
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{CO3^2-{}_{(aq)}} % not according to IUPAC
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{NaOH(aq,$\infty$)}
\end{SideBySideExample}

This works in text mode and math mode.


\section{Unpaired Electrons, Radical Dots}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{OCO^{.-}}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{NO^{(2.)-}}
\end{SideBySideExample}

This superscript-only feature works in text mode and math mode. A math bullet is used.


\section {Variables like x, n, 2n+1}

Typographical conventions say that variables are typeset in italic font, while other entities (like chemical elements) are typeset in an upright font.

mhchem tries to recognize common patterns and use the correct (italic) font, like the $x$ and $2n$ in the following examples.

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{NO_x}$ \sffamily\bfseries \ce{NO_x}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{Fe^n+}$ \sffamily\bfseries \ce{Fe^n+}
\end{SideBySideExample}

$\ce{x Na(NH4)HPO4 ->[\Delta] (NaPO3)_x + x NH3 ^ + x H2O}$\par
{\raggedleft\verb|$\ce{x Na(NH4)HPO4 ->[\Delta] (NaPO3)_x + x NH3 ^ + x H2O}$|\par}

If a more complex term is not properly recognized, you can switch to math mode (= italics) explicitly.


\section{Greek Characters}

Just write \macro{alpha} etc. This works in text mode and math mode.

Typographical conventions say that variables are typeset in italic font, while other entities (like chemical elements) are typeset in an upright font.

Here, the Greek character is \emph{not} a variable that stands for a number, therefore an upright font is used.

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{\mu-Cl}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{[Pt(\eta^2-C2H4)Cl3]-}
\end{SideBySideExample}

\textbf{By defaut, \LaTeX{} does not come with upright Greek characters.} Therefore, it is recommended to load a package for that, that visually fits to your font. For more details, see the section \nameref{sec:GreekFont}.

If you need an italic Greek character (i.\,e. a variable that stands for a number), use math mode like \verb|$\alpha$|.


\section{(Italic) Math}

By using \verb|$...$|, you can esacpe to `font-corrected math mode'.

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{NaOH(aq,$\infty$)}$\\
  \sffamily\bfseries
  \ce{NaOH(aq,$\infty$)}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{Fe(CN)_{$\frac{6}{2}$}}$\\
  \sffamily\bfseries
  \ce{Fe(CN)_{$\frac{6}{2}$}}
\end{SideBySideExample}

In font-corrected math mode, mhchem regonizes some common patterns and prints them font-corrected (e.\,g. for use in headings). Otherwise, it will fall back to `full math mode'.

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{NO_$x$}$ \sffamily\bfseries \ce{NO_$x$}
\end{SideBySideExample}

You can force `full math mode' with \verb|${...}$|.

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{NO_${x}$}$ \sffamily\bfseries \ce{NO_${x}$}
\end{SideBySideExample}


\section{Italic Text}

With the same mechanism, you can switch to italic font.

\begin{SideBySideExample}[xrightmargin=4cm]
  $\ce{$cis${-}[PtCl2(NH3)2]}$\\
  \sffamily\bfseries
  \ce{$cis${-}[PtCl2(NH3)2]}
\end{SideBySideExample}

Spaces will be ignored. Use a \verb|~| when you need to typeset a space.

This works for the text mode as long as you use latin characters. It also works for the math font.


\section{Escape Parsing, Upright Text}

If you want to escape parsing, for instance for a simple hyphen (that should not become a bond), use \verb|{...}|.

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{{(+)}_589{-}[Co(en)3]Cl3}\\
  \sffamily\bfseries
  \ce{{(+)}_589{-}[Co(en)3]Cl3}
\end{SideBySideExample}


\section{Addition Compounds}

\begin{SideBySideExample}[xrightmargin=5cm]
  \ce{KCr(SO4)2*12H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=5cm]
  \ce{KCr(SO4)2.12H2O}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=5cm]
  \ce{KCr(SO4)2 * 12 H2O}
\end{SideBySideExample}

The centered dot is taken from math font.


\section{Bonds}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{C6H5-CHO}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A-B=C#D}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \sffamily\bfseries
  \ce{A-B=C#D}
\end{SideBySideExample}

mhchem tries to differentiate whether \verb|\ce{-}| should be a bond, a charge or a hyphen.

The \verb|#| bond might not work if you pass it through other commands. In this case, use \verb|\bond{3}| instead.

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A\bond{-}B\bond{=}C\bond{#}D}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A\bond{1}B\bond{2}C\bond{3}D}
\end{SideBySideExample}

\mhchemoptions{minus-text-sidebearing-left=0.1em,minus-text-sidebearing-right=0.18em}
\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A\bond{~}B\bond{~-}C}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A\bond{~--}B\bond{~=}C\bond{-~-}D}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A\bond{...}B\bond{....}C}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A\bond{->}B\bond{<-}C}
\end{SideBySideExample}

Text mode: Line-based bonds are based on the text-font's en-dash. For all the others, math glyphs are used.

Math mode: Bonds are based on the math-font minus sign.  All bonds are vertically aligned on the math axis. For most math fonts, this  is slightly lower than half the height of a capital letter.

If you switch to another font, the sidebearing of the minus sign may vary, which would cause the dashed bonds to align badly. In that  case, adjust the alignment by using the following command with slightly changed values. Use \verb|\mhchemoptions{minus-text-sidebearing-left=0.10em,| \verb|minus-text-sidebearing-right=0.16em}| for text font adjustment and \verb|\mhchemoptions{minus-math-sidebearing-left=0.06em,| \verb|minus-math-sidebearing-right=0.11em}| for math font.


\section{Reaction Arrows}

\makebox[3cm][l]{\ce{A -> B}}\verb|\ce{A -> B}|\\
\makebox[3cm][l]{\ce{A <- B}}\verb|\ce{A <- B}|\\
\makebox[3cm][l]{\ce{A <-> B}}\verb|\ce{A <-> B}% not to be used according to IUPAC|\\ % Green Book p.52
\makebox[3cm][l]{\ce{A <--> B}}\verb|\ce{A <--> B}|\\
\makebox[3cm][l]{\ce{A <=> B}}\verb|\ce{A <=> B}|\\
\makebox[3cm][l]{\ce{A <=>> B}}\verb|\ce{A <=>> B}|\\
\makebox[3cm][l]{\ce{A <<=> B}}\verb|\ce{A <<=> B}|

The arrow arguments use the same syntax as the \macro{ce} command.

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A ->[H2O] B}\\% chemistry
  \sffamily\bfseries
  \ce{A ->[H2O] B}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A ->[{text above}][{text below}] B}\\% text
  \sffamily\bfseries
  \ce{A ->[{text above}][{text below}] B}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A ->[$x$][$x_i$] B}\\% font-corrected math
  \sffamily\bfseries
  \ce{A ->[$x$][$x_i$] B}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A ->[${x}$] B}\\% full math
  \sffamily\bfseries
  \ce{A ->[${x}$] B}
\end{SideBySideExample}

For how you can change the layout of the arrows, see \nameref{sec:FineTuning}.


\section{Equation Operators}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A + B}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A - B} % not to be confused with bonds
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A = B} % not to be confused with bonds
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \ce{A \pm B}
\end{SideBySideExample}

This works in text mode and math mode. The respective font is used, except for \macro{pm}, which always come from math font.


\section{Precipitate and Gas}

\begin{SideBySideExample}[xrightmargin=6cm]
  \ce{SO4^2- + Ba^2+ -> BaSO4 v}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=6cm]
  \ce{A v B (v) -> B ^ B (^)}
\end{SideBySideExample}


\section{Further Examples}

\begin{Example}[xrightmargin=15cm]
  \ce{Zn^2+
    <=>[+ 2OH-][+ 2H+]
    $\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2 v}}$
    <=>[+ 2OH-][+ 2H+]
    $\underset{\text{Hydroxozikat}}{\ce{[Zn(OH)4]^2-}}$
  }
\end{Example}

\begin{Example}[xrightmargin=5cm]
  $K = \frac{[\ce{Hg^2+}][\ce{Hg}]}{[\ce{Hg2^2+}]}$
\end{Example}

\begin{Example}[xrightmargin=5cm]
  $K = \ce{\frac{[Hg^2+][Hg]}{[Hg2^2+]}}$
\end{Example}

\begin{Example}[xrightmargin=5cm]
  \ce{Hg^2+ ->[I-]
    $\underset{\mathrm{red}}{\ce{HgI2}}$
    ->[I-]
    $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}}$
  }
\end{Example}



\section{Equation Environments}

\subsection{Aligning Equations}

You can use \verb|&| and \verb|\\| inside \macro{ce} to align equations.

\begin{SideBySideExample}[xrightmargin=5cm]
  \begin{align*}
    \ce{RNO2 &<=>[+e] RNO2^{-.} \\
         RNO2^{-.} &<=>[+e] RNO2^2-}
  \end{align*}
\end{SideBySideExample}


\subsection{Own Equation Command}

When you use equation environments containing a \macro{ce} very often, you might want to create your own command. You could---preferably in your preamble---define the following two commands

\begin{Verbatim}
  \newcommand\reaction[1]{\begin{equation}\ce{#1}\end{equation}}
  \newcommand\reactionnonumber[1]%
    {\begin{equation*}\ce{#1}\end{equation*}}
\end{Verbatim}

and then use them as follows.

\newcommand\reaction[1]{\begin{equation}\ce{#1}\end{equation}}
\newcommand\reactionnonumber[1]%
  {\begin{equation*}\ce{#1}\end{equation*}}
\begin{SideBySideExample}[xrightmargin=5cm]
  \reaction{CO2 + C}
  \reactionnonumber{CO2 + C}
\end{SideBySideExample}

The advanced \LaTeX\ user could replace the two definitions by one
\begin{Verbatim}
  \makeatletter
    \newcommand\reaction@[1]{\begin{equation}\ce{#1}\end{equation}}
    \newcommand\reaction@nonumber[1]%
      {\begin{equation*}\ce{#1}\end{equation*}}
    \newcommand\reaction{\@ifstar{\reaction@nonumber}{\reaction@}}
  \makeatother
\end{Verbatim}

and then write

\makeatletter
  \newcommand\reaction@[1]{\begin{equation}\ce{#1}\end{equation}}
  \newcommand\reaction@nonumber[1]%
    {\begin{equation*}\ce{#1}\end{equation*}}
  \renewcommand\reaction{\@ifstar{\reaction@nonumber}{\reaction@}}
\makeatother
\begin{SideBySideExample}[xrightmargin=5cm]
  \reaction{CO2 + C}
  \reaction*{CO2 + C}
\end{SideBySideExample}

for the same result.

\minisec{}

So far, so good. All reactions will be labelled exactly as all the equations. A few people asked for a \emph{different} set of numbers for equations and reactions. One could use this code:

\begin{Verbatim}
  \makeatletter
  \newcounter{reaction}
  %%% >> for article <<
  %\renewcommand\thereaction{C\,\arabic{reaction}}
  %%% << for article <<
  %%% >> for report and book >>
  \renewcommand\thereaction{C\,\thechapter.\arabic{reaction}}
  \@addtoreset{reaction}{chapter}
  %%% << for report and book <<
  \newcommand\reactiontag%
    {\refstepcounter{reaction}\tag{\thereaction}}
  \newcommand\reaction@[2][]%
    {\begin{equation}\ce{#2}%
    \ifx\@empty#1\@empty\else\label{#1}\fi%
    \reactiontag\end{equation}}
  \newcommand\reaction@nonumber[1]%
    {\begin{equation*}\ce{#1}\end{equation*}}
  \newcommand\reaction%
    {\@ifstar{\reaction@nonumber}{\reaction@}}
  \makeatother
\end{Verbatim}

With that, all reactions will be labelled independently of the equations.

\makeatletter
\newcounter{reaction}
%%% >> for article <<
%\renewcommand\thereaction{C\,\arabic{reaction}}
%%% << for article <<
%%% >> for report and book >>
\renewcommand\thereaction{C\,\thechapter.\arabic{reaction}}
\@addtoreset{reaction}{chapter}
%%% << for report and book <<
\newcommand\reactiontag%
  {\refstepcounter{reaction}\tag{\thereaction}}
\renewcommand\reaction@[2][]%
  {\begin{equation}\ce{#2}%
  \ifx\@empty#1\@empty\else\label{#1}\fi%
  \reactiontag\end{equation}}
\renewcommand\reaction@nonumber[1]%
  {\begin{equation*}\ce{#1}\end{equation*}}
\renewcommand\reaction%
  {\@ifstar{\reaction@nonumber}{\reaction@}}
\makeatother
\begin{SideBySideExample}[xrightmargin=6.5cm]
  \begin{equation}a+b\end{equation}
  \reaction{CO2 + C}
  \reaction*{CO2 + C}
  \reaction[react:co]{CO2 + C}
  \begin{equation}a+b\end{equation}
\end{SideBySideExample}



\section{Splitting the \macro{ce} command}

As mentioned before, you can use  \verb|$| to switch to math mode inside \macro{ce}. But maybe, you want to `escape' to outside of \macro{ce}.


\subsection{Comma Example}

Assume, you are getting tired of typing

\begin{SideBySideExample}[xrightmargin=4cm]
  \ce{N2}, \ce{O2}, \ce{CO2}
\end{SideBySideExample}

Then you could define your own command that splits at commas (plus space).

\begin{SideBySideExample}[xrightmargin=4cm]
  \newcommand*\cec[1]{\cesplit{{\,\ }{\0}}{#1}}
  \cec{N2, O2, CO2}
\end{SideBySideExample}

You could re-define \macro{ce} with \verb|\newcommand*\ce{\cesplit{...}{#1}}|, if you do not like to create a new name.


\subsection{Layer Stacks}

Another example shows how physicists can use mhchem to write layer stacks.

\medskip
\begin{SideBySideExample}[xrightmargin=4cm]
  \newcommand*\stackslash{\text{/}\allowbreak}
  \newcommand*\stackhyphen{\text{-}\allowbreak}
  \newcommand\stack[1]{%
    \cesplit{%
      {\/}{\c{stackslash}}%
      {-}{\c{stackhyphen}}%
    }{#1}%
  }
  \ldots\ structure of
  \stack{Co-Fe-B/HfO2/Co-Fe-B} is resp\ldots
\end{SideBySideExample}


\subsection{The Details}

\macro{cesplit} takes two parameters. The first one is a list of search-and-replace pairs, the second parameter is the chemistry string as you would put into \macro{ce}. The search-and-replace list uses the syntax of \verb|l3regex|. As a rule of thumb, precede every non-letter with a backslash. You can replace it with some other text, or use \verb|\0| to retain the match. If you want to replace with a macro, write \verb|\c{macroname}|. For further details, refer to the \verb|l3regex| manual.

Do not nest \macro{cesplit} commands.

The result of \macro{cesplit} does \emph{not} have the feature to use \verb|&| and \verb|\\| as you might to want to deal with them differently. \macro{ce} is itself defined by \macro{cesplit} (which, technically speaking, does not split \macro{ce}, but an internal command). As \macro{ce} is defined by

\begin{Verbatim}
    \cesplit % spaced added for readability
      {
        { \c{\\}(\[.*?\])? } { \0 }
        { \& } { \0 }
      }
      {#1}
\end{Verbatim}

you could add these rules to you own \macro{cesplit} definition.



\section{Fine Tuning}\label{sec:FineTuning}

All options explained here, can either be set using the \macro{mhchemoptions} command

\begin{Verbatim}[commandchars=+()]
  +textbf(\mhchemoptions{)arrows=pgf+textbf(})
\end{Verbatim}

or as options to the package

\begin{Verbatim}[commandchars=+()]
  +textbf(\usepackage[version=4,)arrows=pgf+textbf(]{mhchem})
\end{Verbatim}


\subsection{Text Font and Math Font} \label{sec:Fonts}

mhchem uses the current text font (if you use \macro{ce} in text mode) or the  current math font (if you use \macro{ce} in math mode). If you want, however, you can set a font that will be used for all your formulae and equations.

Inside your document, you can use

\begin{Verbatim}[commandchars=+()]
  \mhchemoptions{+textbf(textfontcommand=\sffamily)}
  \mhchemoptions{+textbf(mathfontcommand=\mathsf)}
\end{Verbatim}

in order to get sanf-serif fonts in both, text mode and math mode.

You can use any font command there, not only the mentioned ones. Please be aware that the text-font command is a font switching command (taking no arguments) while the math-font command takes one argument and typesets it.

You can specify the commands by name only, i.\,e. without the \verb|\|.

\begin{Verbatim}[commandchars=+()]
  \mhchemoptions{+textbf(textfontname=sffamily)}
  \mhchemoptions{+textbf(mathfontname=mathsf)}
\end{Verbatim}

\noindent
Only the latter options can be used with the \macro{usepackage} command, because the font commands are not properly defined in the preamble, yet. The shortcut

\begin{Verbatim}[commandchars=+()]
  \mhchemoptions{+textbf(font=sf)}
\end{Verbatim}

sets the two fonts to sans-serif, as mentioned above, and

\begin{Verbatim}[commandchars=+()]
  \mhchemoptions{+textbf(font=)}
\end{Verbatim}

switches back to the default, which is equivalent to

\begin{Verbatim}[commandchars=+()]
  \mhchemoptions{+textbf(textfontcommand=,mathfontcommand=\mathrm)}
\end{Verbatim}


\subsection{Greek Font} \label{sec:GreekFont}

If you load a package for upright Greek characters, this will automatically be used. You can load any of the following packages (e.g. \verb|\usepackage{textgreek}| in the preamble). Choose the one that visually fits your font.
\begin{compactitem}[--]
  \item textgreek,
  \item upgreek,
  \item newtx,
  \item kpfonts,
  \item mathdesign,
  \item fourier,
  \item textalpha,
  \item fontspec.
\end{compactitem}
This functionality was possible by the very neat chemgreek package of Clemens Niederberger. If you want to have different Greek fonts for text mode and math mode, you can specify these `mappings' by (for instance) \verb|\mhchemoptions{text-greek=upgreek,| \verb|math-greek=default}|. You can use any of the package names from above, or \verb|default| or \verb|var-default|. Refer to the	 \href{http://mirrors.ctan.org/macros/latex/contrib/chemgreek/chemgreek_en.pdf}{chemgreek manual} for details (in particular its Appendix `Overviews Over the Mappings').


\subsection{Arrows}

By default, mhchem uses arrows that are composed of different math-font characters, because it uses some features of the amsmath package.

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{arrows=font}% default
  \ce{A <--> B}
\end{SideBySideExample}

But you may switch to arrows drawn with PGF (using TikZ). These are activated by

\begin{Verbatim}[commandchars=+()]
  \usepackage[version=3,+textbf(arrows=pgf)]{mhchem}
  % or
  \usepackage[version=3,+textbf(arrows=pgf-filled)]{mhchem}
\end{Verbatim}

The \verb|tikz| package is loaded automatically if you switch to PGF arrows in the preamble (as you do when using \verb|\usepackage|). If you switch inside your document (with \macro{mhchemoptions}), don't forget to load the required packages manually in your preamble: \verb|\RequirePackage{tikz}\usetikzlibrary{arrows.meta}|.

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{arrows=pgf}
  \ce{A <--> B}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{arrows=pgf-filled}
  \ce{A <--> B}
\end{SideBySideExample}

You can select other pre-defined PGF arrows (see PGF manual) or even define your own. Activate them with the option \verb|pgf={arrow-name}{line-width}|. The dimensions of your custom arrows are expected to be close to those of the built-in mhchem arrows. By the way, they have line width of 0.09ex.

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{arrows=%
    pgf{Kite[length=0pt 4,width'=0pt 1]}{0.15ex}}
  \ce{A <--> B}
\end{SideBySideExample}


\subsection{Stacked Superscripts and Subscripts}

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{layout=staggered-flat}% default
  \ce{CrO4^2-}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{layout=staggered-deep}
  \ce{CrO4^2-}
\end{SideBySideExample}

\begin{SideBySideExample}[xrightmargin=3cm]
  \mhchemoptions{layout=stacked}
  \ce{CrO4^2-}% not IUPAC-conform
\end{SideBySideExample}



\section{Rudimentary \TeX 4HT (htlatex) support}

mhchem has basic support for \TeX 4HT (htlatex). Summary formulae should work fine. Special bonds and reaction arrows are recognizable, but ugly. Complex math with mhchem inside might fail completely.

\clearpage
\section{Major Changes}
\label{sec:WhatSNew}

\subsection{Migrating from version 1}

Inner \verb|-| characters are considered to be bonds. Use \verb|$...$| for math mode inside \macro{ce} (no braces any more).

\subsection{Migrating from version 2}

Meaning and usage of \macro{bond} changed.

\subsection{Migrating from version 3}

\verb|{...}| does escape to text now, not math. \verb|$...$| does only escape to `font-corrected math mode'---check the results. Additional spaces will be inserted: A \verb|$x\,$H2O| should be changed to \verb|$x$ H2O|. Appearance of bonds, radical dot, $x$, single-letter variables, \verb|-| in subscripts etc. slightly changed---check if this fits with your font, in particular your text font. Check all complex subscripts and superscripts (more than just number or a charge). The arrow arguments are set with the same syntax as the \macro{ce} command---use \verb|$...$| or \verb|${...}$| for math. Deprecated commands like \macro{cf}, \verb|,| and \verb|`| and \macro{hyphen} and \macro{cmath} were removed completely. \macro{cee} was removed---just use \macro{ce}.


\section{Most Recent Changes}% check

\minisec{2017-01-16 mhchem v4.06}
\begin{compactitem}
\item Adapt to upcoming \LaTeX3 change
\end{compactitem}

\minisec{2016-08-07 mhchem v4.05}
\begin{compactitem}
\item extended variable recognition -- single lower-case letters in superscripts/subscripts are typeset in an italic font
\item improved bond/charge/hyphen distinction 
\item fixed error handling for nonstopmode
\end{compactitem}

\minisec{2016-02-07 mhchem v4.04}
\begin{compactitem}
\item support for negative subscripts, \verb|\ce{^0_-1n-}|
\item \verb|\frac{}{}| added
\item \verb|$\alpha$| fixed (math Greek)
\end{compactitem}

\minisec{2015-11-29 mhchem v4.03}
\begin{compactitem}
\item reworked arrows and provided option for custom pgf arrows
\item improved speed
\end{compactitem}

\minisec{2015-07-23 mhchem v4.02}
\begin{compactitem}
\item added rudimentary TeX4ht support
\item fixed the \verb|\str_case:nnn| bug---expl3 removed that function
\end{compactitem}

\minisec{2015-04-23 mhchem v4.01}
\begin{compactitem}
\item support upright greek characters (chemgreek)
\item syntax improvements% $n$H2O, D2-3[T4O10], Fe^{III}2
\item recognition of states of aggregation% HCl(g), OH-(aq)
\item text-font operators \verb|+|, \verb|-|, \verb|=|
\end{compactitem}

\minisec{2015-04-07 mhchem v4.00}
\begin{compactitem}
\item many syntax improvements
\item many layout improvements
\item stricter distinction between text font and math font, many math features are translated into their text equivalent, e.g. italic variables
\item new options
\item removed deprecated commands
\end{compactitem}

\minisec{2015-03-13 mhchem v3.21}
\begin{compactitem}
\item rewrote further large parts using \LaTeX3
\item introduced \macro{cesplit}
\item simplified creation two-digit superscripts and subscripts (less braces needed)
\end{compactitem}

% 3.20 revoked

\minisec{2015-02-09 mhchem v3.19}
\begin{compactitem}
\item fixed an incompatibility when running without (implicit) pdftexcmds
\end{compactitem}

\minisec{2015-01-05 mhchem v3.18}
\begin{compactitem}
\item rewrote further large parts using \LaTeX3, preparing for new features
\item \verb|\left| and \verb|\right| possible because of rewrite
\item several fixes for text above and below arrows
\end{compactitem}



\chapter{The hpstatement Package and the rsphrase Package}\label{sec:rsphrase}

The \textbf{hpstatement} package contains all official
hazard statements and precautionary statements (H and P) of the
Globally Harmonized System of Classification and Labelling of Chemicals (GHS)
and of the CLP Regulation of the European Union.

The statements are available in
  English,
  French,
  and
  German.
If you are a native speaker of either
Bulgarian,
Czech,
Danish,
Dutch,
Estonian,
Finnish,
Greek,
Hungarian,
Irish,
Italian,
Latvian,
Lithuanian,
Maltese,
Polish,
Portuguese,
Romanian,
Slovak,
Slovenian,
Spanish or
Swedish,
and would like to help offering the statements in those languages, please
contact the author.

\bigskip

The \textbf{rsphrase} package contains the text of all official
Risk and Safety (R and S) Phrases that were used to label chemicals.

These phrases are
available in Danish, Englisch, French, German (current spelling), Spanish, and
Italian.

\bigskip

Please be advised that, as stated in the license, the authors provide no
warranty of correctness.


\section{Usage}

The \textbf{hpstatement} package provides two commands: \verb|\hpstatement| and
\verb|\hpnumber|. \verb|\hpstatement| inserts the statement's text,
\verb|\hpnumber| its formatted number.\bigskip

\begin{addmargin}[1em]{0em}
\begin{SideBySideExample}[xrightmargin=7cm]
  The statement \hpnumber{H200}\\
  is `\hpstatement{H200}'
\end{SideBySideExample}
\end{addmargin}
\bigskip

\noindent The \textbf{rsphrase} package works the same way, but provides two
commands: \verb|\rsnumber| and \verb|\rsphrase|, respectively.

\bigskip

\noindent One can use the two commands with an empty argument. It is then
assumed that the argument is equivalent to the one used previously. \bigskip

\begin{addmargin}[1em]{0em}
\begin{SideBySideExample}[xrightmargin=7cm]
  The statement \hpnumber{H200}\\
  is `\hpstatement{}'
\end{SideBySideExample}
\end{addmargin}
\bigskip

\noindent The commands add text in your currently selected language.
\bigskip

\begin{addmargin}[1em]{0em}
\begin{SideBySideExample}[xrightmargin=7cm]
  \selectlanguage{ngerman}% babel
  \hpnumber{H200}:
  \hpstatement{}
\end{SideBySideExample}
\end{addmargin}
\bigskip

\noindent Some phrases allow you to choose between certain alternatives. In
these cases, special numbers (<number>.1, <number>.2, \textellipsis) are
available for \verb|\hpstatement|. Of course, the official number is typeset if
you call \verb|\hpnumber| with a special number. \bigskip

\begin{addmargin}[1em]{0em}
\begin{SideBySideExample}[xrightmargin=7cm]
  \hpnumber{P210.2}:
  \hpstatement{}
\end{SideBySideExample}
\end{addmargin}
\bigskip

\noindent For phrases with selection, an additional special number is provided
that refers to the original version as stated in the regulations: <number>.0
(e.\,g. P210.0).
\bigskip

\begin{addmargin}[1em]{0em}
\begin{SideBySideExample}[xrightmargin=7cm]
  \hpnumber{P210.0}:
  \hpstatement{}
\end{SideBySideExample}
\end{addmargin}
\bigskip

\noindent Some statements refer to `this label'. If you are creating documents
that are not labels, you might want to rephrase this. You can do so, by using
the <number>.nolabel statement (e.\,g. P321.nolabel). \bigskip

See the appendix for a complete list of all implemented statements, including
all options.

\begin{annotation}\RaggedRight Sources for the H and P statements are:
Regulation (EC) No 1272/2008 of the European Parliament and of the Council of 16
December 2008 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\footnote{\url{http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2008:353:0001:1355:EN:PDF}},
a database with the extracted phrases, kindly provided by the author of
schoolscout24.de\footnote{\url{http://schoolscout24.de/cgi-bin/hpp/hppinput.cgi}},
Commission Regulation (EU) No 286/2011 of 10 March 2011 amending, for the
purposes of its adaptation to technical and scientific progress, Regulation (EC)
No 1272/2008 of the European Parliament and of the Council on classification,
labelling and packaging of substances and
mixtures\footnote{\url{http://new.eur-lex.europa.eu/legal-content/EN/TXT/?qid=1369907325497\&uri=CELEX:32011R0286}},
and the manual creation of placeholder statements and proof-reading.

Sources for the R and S phrases are documents downloaded from
\url{http://europa.eu.int}\footnote{Previously to be found under
\url{http://europa.eu.int/comm/environment/dansub/pdfs/annex3_en.pdf} and
\url{http://europa.eu.int/comm/environment/dansub/pdfs/annex4_en.pdf} which in
turn were linked from
\url{http://europa.eu.int/comm/environment/dansub/main67_548/index_en.htm}}.
\end{annotation}


\clearpage
\section{Most Recent Changes}% check

\minisec{2016-02-09 hpstatement v1.02}
\begin{compactitem}
  \item added French statements
  \item all languages: H360f, H360f, H360fd became H361f, H361d, H361fd
  \item German: updated EUH001, P222, P241, P243, P263, P305+P351+P338, P306, P402+P404, P403+P233, P403+P235, P406, P410, P411, P411+P235, P412, P413 according to new official translations.
\end{compactitem}

\minisec{2013-07-02 hpstatement v1.01}
\begin{compactitem}
\item added German statements
\item removed spaces around arguments of H340[a], H341[a], H350[a], H351[a], 
  H360[a], H361[a], H370[a][b], H371[a][b], H372[a][b], H373[a][b], because 
  arguments might need punctuation, e.g. a commas in several languages
\item fixed H420
\item added variants for P220.x, P411.x, P411+P235.x
\item removed variants for P413.x
\end{compactitem}

\minisec{2013-06-17 hpstatement v1.00}
\begin{compactitem}
\item initial release with English statements
\end{compactitem}

\minisec{2010-06-16 rsphrase v3.08}
\begin{compactitem}
  \item added: Italian phrases
\end{compactitem}



\appendix
\chapter{Appendix}

\section{List of Implemented H and P Statements}

\newcommand\hpmanual[2]{\textbf{#1} (\hpnumber#2): \hpstatement#2}
\newcommand\allhpstatements{%
\bgroup\footnotesize%
\hpmanual{EUH001}{{EUH001}}
\hpmanual{EUH006}{{EUH006}}
\hpmanual{EUH014}{{EUH014}}
\hpmanual{EUH018.0}{{EUH018.0}}
\hpmanual{EUH018.1}{{EUH018.1}}
\hpmanual{EUH018.2}{{EUH018.2}}
\hpmanual{EUH019}{{EUH019}}
\hpmanual{EUH029}{{EUH029}}
\hpmanual{EUH031}{{EUH031}}
\hpmanual{EUH032}{{EUH032}}
\hpmanual{EUH044}{{EUH044}}
\hpmanual{EUH059}{{EUH059}}
\hpmanual{EUH066}{{EUH066}}
\hpmanual{EUH070}{{EUH070}}
\hpmanual{EUH071}{{EUH071}}
\hpmanual{EUH201}{{EUH201}}
\hpmanual{EUH201A}{{EUH201A}}
\hpmanual{EUH202}{{EUH202}}
\hpmanual{EUH203}{{EUH203}}
\hpmanual{EUH204}{{EUH204}}
\hpmanual{EUH205}{{EUH205}}
\hpmanual{EUH206}{{EUH206}}
\hpmanual{EUH207}{{EUH207}}
\hpmanual{EUH208.0}{{EUH208.0}}
\hpmanual{EUH208[a]}{[{[a]}]{EUH208}}
\hpmanual{EUH209}{{EUH209}}
\hpmanual{EUH209A}{{EUH209A}}
\hpmanual{EUH210}{{EUH210}}
\hpmanual{EUH401}{{EUH401}}
\hpmanual{H200}{{H200}}
\hpmanual{H201}{{H201}}
\hpmanual{H202}{{H202}}
\hpmanual{H203}{{H203}}
\hpmanual{H204}{{H204}}
\hpmanual{H205}{{H205}}
\hpmanual{H220}{{H220}}
\hpmanual{H221}{{H221}}
\hpmanual{H222}{{H222}}
\hpmanual{H223}{{H223}}
\hpmanual{H224}{{H224}}
\hpmanual{H225}{{H225}}
\hpmanual{H226}{{H226}}
\hpmanual{H228}{{H228}}
\hpmanual{H240}{{H240}}
\hpmanual{H241}{{H241}}
\hpmanual{H242}{{H242}}
\hpmanual{H250}{{H250}}
\hpmanual{H251}{{H251}}
\hpmanual{H252}{{H252}}
\hpmanual{H260}{{H260}}
\hpmanual{H261}{{H261}}
\hpmanual{H270}{{H270}}
\hpmanual{H271}{{H271}}
\hpmanual{H272}{{H272}}
\hpmanual{H280}{{H280}}
\hpmanual{H281}{{H281}}
\hpmanual{H290}{{H290}}
\hpmanual{H300}{{H300}}
\hpmanual{H301}{{H301}}
\hpmanual{H302}{{H302}}
\hpmanual{H304}{{H304}}
\hpmanual{H310}{{H310}}
\hpmanual{H311}{{H311}}
\hpmanual{H312}{{H312}}
\hpmanual{H314}{{H314}}
\hpmanual{H315}{{H315}}
\hpmanual{H317}{{H317}}
\hpmanual{H318}{{H318}}
\hpmanual{H319}{{H319}}
\hpmanual{H330}{{H330}}
\hpmanual{H331}{{H331}}
\hpmanual{H332}{{H332}}
\hpmanual{H334}{{H334}}
\hpmanual{H335}{{H335}}
\hpmanual{H336}{{H336}}
\hpmanual{H340.0}{{H340.0}}
\hpmanual{H340}{{H340}}
\hpmanual{H340[a]}{[{[a]}]{H340}}
\hpmanual{H341.0}{{H341.0}}
\hpmanual{H341}{{H341}}
\hpmanual{H341[a]}{[{[a]}]{H341}}
\hpmanual{H350.0}{{H350.0}}
\hpmanual{H350}{{H350}}
\hpmanual{H350[a]}{[{[a]}]{H350}}
\hpmanual{H350i}{{H350i}}
\hpmanual{H351.0}{{H351.0}}
\hpmanual{H351}{{H351}}
\hpmanual{H351[a]}{[{[a]}]{H351}}
\hpmanual{H360.0}{{H360.0}}
\hpmanual{H360}{{H360}}
\hpmanual{H360[a]}{[{[a]}]{H360}}
\hpmanual{H360F}{{H360F}}
\hpmanual{H360D}{{H360D}}
\hpmanual{H361f}{{H361f}}
\hpmanual{H361d}{{H361d}}
\hpmanual{H360FD}{{H360FD}}
\hpmanual{H361fd}{{H361fd}}
\hpmanual{H360Fd}{{H360Fd}}
\hpmanual{H360Df}{{H360Df}}
\hpmanual{H361.0}{{H361.0}}
\hpmanual{H361}{{H361}}
\hpmanual{H361[a]}{[{[a]}]{H361}}
\hpmanual{H362}{{H362}}
\hpmanual{H370.0}{{H370.0}}
\hpmanual{H370}{{H370}}
\hpmanual{H370[a]}{[{[a]}]{H370}}
\hpmanual{H370[a][b]}{[{[a]}][{[b]}]{H370}}
\hpmanual{H371.0}{{H371.0}}
\hpmanual{H371}{{H371}}
\hpmanual{H371[a]}{[{[a]}]{H371}}
\hpmanual{H371[a][b]}{[{[a]}][{[b]}]{H371}}
\hpmanual{H372.0}{{H372.0}}
\hpmanual{H372}{{H372}}
\hpmanual{H372[a]}{[{[a]}]{H372}}
\hpmanual{H372[a][b]}{[{[a]}][{[b]}]{H372}}
\hpmanual{H373.0}{{H373.0}}
\hpmanual{H373}{{H373}}
\hpmanual{H373[a]}{[{[a]}]{H373}}
\hpmanual{H373[a][b]}{[{[a]}][{[b]}]{H373}}
\hpmanual{H300+H310}{{H300+H310}}
\hpmanual{H300+H330}{{H300+H330}}
\hpmanual{H310+H330}{{H310+H330}}
\hpmanual{H300+H310+H330}{{H300+H310+H330}}
\hpmanual{H301+H311}{{H301+H311}}
\hpmanual{H301+H331}{{H301+H331}}
\hpmanual{H311+H331}{{H311+H331}}
\hpmanual{H301+H311+H331}{{H301+H311+H331}}
\hpmanual{H302+H312}{{H302+H312}}
\hpmanual{H302+H332}{{H302+H332}}
\hpmanual{H312+H332}{{H312+H332}}
\hpmanual{H301+H312+H332}{{H301+H312+H332}}
\hpmanual{H400}{{H400}}
\hpmanual{H410}{{H410}}
\hpmanual{H411}{{H411}}
\hpmanual{H412}{{H412}}
\hpmanual{H413}{{H413}}
\hpmanual{H420}{{H420}}
\hpmanual{P101}{{P101}}
\hpmanual{P101.nolabel[a]}{[{[a]}]{P101.nolabel}}
\hpmanual{P102}{{P102}}
\hpmanual{P103}{{P103}}
\hpmanual{P103.nolabel[a]}{[{[a]}]{P103.nolabel}}
\hpmanual{P201}{{P201}}
\hpmanual{P202}{{P202}}
\hpmanual{P210.0}{{P210.0}}
\hpmanual{P210[a]}{[{[a]}]{P210}}
\hpmanual{P210.1}{{P210.1}}
\hpmanual{P210.2}{{P210.2}}
\hpmanual{P210.3}{{P210.3}}
\hpmanual{P210.4}{{P210.4}}
\hpmanual{P211}{{P211}}
\hpmanual{P220.0.0}{{P220.0.0}}
\hpmanual{P220.0.1[a]}{[{[a]}]{P220.0.1}}
\hpmanual{P220.0.2}{{P220.0.2}}
\hpmanual{P220.0.3}{{P220.0.3}}
\hpmanual{P220.1.0}{{P220.1.0}}
\hpmanual{P220.1[a]}{[{[a]}]{P220.1}}
\hpmanual{P220.1.1}{{P220.1.1}}
\hpmanual{P220.1.2}{{P220.1.2}}
\hpmanual{P220.2.0}{{P220.2.0}}
\hpmanual{P220.2[a]}{[{[a]}]{P220.2}}
\hpmanual{P220.2.1}{{P220.2.1}}
\hpmanual{P220.2.2}{{P220.2.2}}
\hpmanual{P221.0}{{P221.0}}
\hpmanual{P221[a]}{[{[a]}]{P221}}
\hpmanual{P221.1}{{P221.1}}
\hpmanual{P222}{{P222}}
\hpmanual{P223}{{P223}}
\hpmanual{P230.0}{{P230.0}}
\hpmanual{P230[a]}{[{[a]}]{P230}}
\hpmanual{P231}{{P231}}
\hpmanual{P231+P232}{{P231+P232}}
\hpmanual{P232}{{P232}}
\hpmanual{P233}{{P233}}
\hpmanual{P234}{{P234}}
\hpmanual{P235}{{P235}}
\hpmanual{P235+P410}{{P235+P410}}
\hpmanual{P240}{{P240}}
\hpmanual{P241.0}{{P241.0}}
\hpmanual{P241[a]}{[{[a]}]{P241}}
\hpmanual{P241.1}{{P241.1}}
\hpmanual{P241.2}{{P241.2}}
\hpmanual{P241.3}{{P241.3}}
\hpmanual{P242}{{P242}}
\hpmanual{P243}{{P243}}
\hpmanual{P244}{{P244}}
\hpmanual{P250.0}{{P250.0}}
\hpmanual{P250[a]}{[{[a]}]{P250}}
\hpmanual{P250.1}{{P250.1}}
\hpmanual{P250.2}{{P250.2}}
\hpmanual{P250.3}{{P250.3}}
\hpmanual{P251}{{P251}}
\hpmanual{P260.0}{{P260.0}}
\hpmanual{P260[a]}{[{[a]}]{P260}}
\hpmanual{P260.1}{{P260.1}}
\hpmanual{P260.2}{{P260.2}}
\hpmanual{P260.3}{{P260.3}}
\hpmanual{P260.4}{{P260.4}}
\hpmanual{P260.5}{{P260.5}}
\hpmanual{P260.6}{{P260.6}}
\hpmanual{P261}{{P261}}
\hpmanual{P262}{{P262}}
\hpmanual{P263.0}{{P263.0}}
\hpmanual{P263[a]}{[{[a]}]{P263}}
\hpmanual{P263.1}{{P263.1}}
\hpmanual{P263.2}{{P263.2}}
\hpmanual{P264.0}{{P264.0}}
\hpmanual{P264[a]}{[{[a]}]{P264}}
\hpmanual{P270}{{P270}}
\hpmanual{P271}{{P271}}
\hpmanual{P272}{{P272}}
\hpmanual{P273}{{P273}}
\hpmanual{P280.0}{{P280.0}}
\hpmanual{P280[a]}{[{[a]}]{P280}}
\hpmanual{P280.1}{{P280.1}}
\hpmanual{P280.2}{{P280.2}}
\hpmanual{P280.3}{{P280.3}}
\hpmanual{P280.4}{{P280.4}}
\hpmanual{P281}{{P281}}
\hpmanual{P282.0}{{P282.0}}
\hpmanual{P282[a]}{[{[a]}]{P282}}
\hpmanual{P282.1}{{P282.1}}
\hpmanual{P282.2}{{P282.2}}
\hpmanual{P282.3}{{P282.3}}
\hpmanual{P283.0}{{P283.0}}
\hpmanual{P283[a]}{[{[a]}]{P283}}
\hpmanual{P284}{{P284}}
\hpmanual{P285}{{P285}}
\hpmanual{P301}{{P301}}
\hpmanual{P301+P310}{{P301+P310}}
\hpmanual{P301+P312}{{P301+P312}}
\hpmanual{P301+P330+P331}{{P301+P330+P331}}
\hpmanual{P302}{{P302}}
\hpmanual{P302+P334.0}{{P302+P334.0}}
\hpmanual{P302+P334[a]}{[{[a]}]{P302+P334}}
\hpmanual{P302+P334.1}{{P302+P334.1}}
\hpmanual{P302+P334.2}{{P302+P334.2}}
\hpmanual{P302+P350}{{P302+P350}}
\hpmanual{P302+P352}{{P302+P352}}
\hpmanual{P303}{{P303}}
\hpmanual{P303+P361+P353}{{P303+P361+P353}}
\hpmanual{P304}{{P304}}
\hpmanual{P304+P340}{{P304+P340}}
\hpmanual{P304+P341}{{P304+P341}}
\hpmanual{P305}{{P305}}
\hpmanual{P305+P351+P338}{{P305+P351+P338}}
\hpmanual{P306}{{P306}}
\hpmanual{P306+P360}{{P306+P360}}
\hpmanual{P307}{{P307}}
\hpmanual{P307+P311}{{P307+P311}}
\hpmanual{P308}{{P308}}
\hpmanual{P308+P313}{{P308+P313}}
\hpmanual{P309}{{P309}}
\hpmanual{P309+P311}{{P309+P311}}
\hpmanual{P310}{{P310}}
\hpmanual{P311}{{P311}}
\hpmanual{P312}{{P312}}
\hpmanual{P313}{{P313}}
\hpmanual{P314}{{P314}}
\hpmanual{P315}{{P315}}
\hpmanual{P320.0}{{P320.0}}
\hpmanual{P320[a]}{[{[a]}]{P320}}
\hpmanual{P320.nolabel[a]}{[{[a]}]{P320.nolabel}}
\hpmanual{P321.0}{{P321.0}}
\hpmanual{P321[a]}{[{[a]}]{P321}}
\hpmanual{P321.nolabel[a]}{[{[a]}]{P321.nolabel}}
\hpmanual{P322.0}{{P322.0}}
\hpmanual{P322[a]}{[{[a]}]{P322}}
\hpmanual{P322.nolabel[a]}{[{[a]}]{P322.nolabel}}
\hpmanual{P330}{{P330}}
\hpmanual{P331}{{P331}}
\hpmanual{P332}{{P332}}
\hpmanual{P332+P313}{{P332+P313}}
\hpmanual{P333}{{P333}}
\hpmanual{P333+P313}{{P333+P313}}
\hpmanual{P334.0}{{P334.0}}
\hpmanual{P334.1}{{P334.1}}
\hpmanual{P334.2}{{P334.2}}
\hpmanual{P335}{{P335}}
\hpmanual{P335+P334.0}{{P335+P334.0}}
\hpmanual{P335+P334.1}{{P335+P334.1}}
\hpmanual{P335+P334.2}{{P335+P334.2}}
\hpmanual{P336}{{P336}}
\hpmanual{P337}{{P337}}
\hpmanual{P337+P313}{{P337+P313}}
\hpmanual{P338}{{P338}}
\hpmanual{P340}{{P340}}
\hpmanual{P341}{{P341}}
\hpmanual{P342}{{P342}}
\hpmanual{P342+P311}{{P342+P311}}
\hpmanual{P350}{{P350}}
\hpmanual{P351}{{P351}}
\hpmanual{P352}{{P352}}
\hpmanual{P353}{{P353}}
\hpmanual{P360}{{P360}}
\hpmanual{P361}{{P361}}
\hpmanual{P362}{{P362}}
\hpmanual{P363}{{P363}}
\hpmanual{P370}{{P370}}
\hpmanual{P370+P376}{{P370+P376}}
\hpmanual{P370+P378.0}{{P370+P378.0}}
\hpmanual{P370+P378[a]}{[{[a]}]{P370+P378}}
\hpmanual{P370+P380}{{P370+P380}}
\hpmanual{P370+P380+P375}{{P370+P380+P375}}
\hpmanual{P371}{{P371}}
\hpmanual{P371+P380+P375}{{P371+P380+P375}}
\hpmanual{P372}{{P372}}
\hpmanual{P373}{{P373}}
\hpmanual{P374}{{P374}}
\hpmanual{P375}{{P375}}
\hpmanual{P376}{{P376}}
\hpmanual{P377}{{P377}}
\hpmanual{P378.0}{{P378.0}}
\hpmanual{P378[a]}{[{[a]}]{P378}}
\hpmanual{P380}{{P380}}
\hpmanual{P381}{{P381}}
\hpmanual{P390}{{P390}}
\hpmanual{P391}{{P391}}
\hpmanual{P401.0}{{P401.0}}
\hpmanual{P401[a]}{[{[a]}]{P401}}
\hpmanual{P402}{{P402}}
\hpmanual{P402+P404}{{P402+P404}}
\hpmanual{P403}{{P403}}
\hpmanual{P403+P233}{{P403+P233}}
\hpmanual{P403+P235}{{P403+P235}}
\hpmanual{P404}{{P404}}
\hpmanual{P405}{{P405}}
\hpmanual{P406.0}{{P406.0}}
\hpmanual{P406[a]}{[{[a]}]{P406}}
\hpmanual{P406.1}{{P406.1}}
\hpmanual{P407}{{P407}}
\hpmanual{P410}{{P410}}
\hpmanual{P410+P403}{{P410+P403}}
\hpmanual{P410+P412}{{P410+P412}}
\hpmanual{P411.0}{{P411.0}}
\hpmanual{P411[a]}{[{[a]}]{P411}}
\hpmanual{P411+P235.0}{{P411+P235.0}}
\hpmanual{P411+P235[a]}{[{[a]}]{P411+P235}}
\hpmanual{P412}{{P412}}
\hpmanual{P413.0}{{P413.0}}
\hpmanual{P413[a][b]}{[{[a]}][{[b]}]{P413}}
\hpmanual{P420}{{P420}}
\hpmanual{P422.0}{{P422.0}}
\hpmanual{P422[a]}{[{[a]}]{P422}}
\hpmanual{P501.0.0}{{P501.0.0}}
\hpmanual{P501.0[a]}{[{[a]}]{P501.0}}
\hpmanual{P501.1.0}{{P501.1.0}}
\hpmanual{P501.1[a]}{[{[a]}]{P501.1}}
\hpmanual{P501.2.0}{{P501.2.0}}
\hpmanual{P501.2[a]}{[{[a]}]{P501.2}}
\par\egroup%
}

\subsection{English}
\medskip
\allhpstatements

\subsection{French}
\medskip
\selectlanguage{french}
\allhpstatements

\subsection{German}
\medskip
\selectlanguage{ngerman}
\allhpstatements
\selectlanguage{UKenglish}


\section{List of Implemented R and S Phrases}

\newenvironment{RandS}{\bigskip\bgroup\footnotesize\noindent}{\par\egroup}
\newcommand{\rs}[2][]{\textbf{\rsnumber[#1]{#2}}: \rsphrase{}}
\newcommand{\rsskip}{\par\medskip}
\newcommand{\allrsphrases}[1][]{%
  \par%
  \begin{RandS}\noindent%
    \rs{R1}
    \rs{R2}
    \rs{R3}
    \rs{R4}
    \rs{R5}
    \rs{R6}
    \rs{R7}
    \rs{R8}
    \rs{R9}
    \rs{R10}
    \rs{R11}
    \rs{R12}
    \rs{R14}
    \rs{R15}
    \rs{R16}
    \rs{R17}
    \rs{R18}
    \rs{R19}
    \rs{R20}
    \rs{R21}
    \rs{R22}
    \rs{R23}
    \rs{R24}
    \rs{R25}
    \rs{R26}
    \rs{R27}
    \rs{R28}
    \rs{R29}
    \rs{R30}
    \rs{R31}
    \rs{R32}
    \rs{R33}
    \rs{R34}
    \rs{R35}
    \rs{R36}
    \rs{R37}
    \rs{R38}
    \rs{R39}
    \rs{R40}
    \rs{R41}
    \rs{R42}
    \rs{R43}
    \rs{R44}
    \rs{R45}
    \rs{R46}
    \rs{R48}
    \rs{R49}
    \rs{R50}
    \rs{R51}
    \rs{R52}
    \rs{R53}
    \rs{R54}
    \rs{R55}
    \rs{R56}
    \rs{R57}
    \rs{R58}
    \rs{R59}
    \rs{R60}
    \rs{R61}
    \rs{R62}
    \rs{R63}
    \rs{R64}
    \rs{R65}
    \rs{R66}
    \rs{R67}
    \rs{R68}
    \rs{R14/15}
    \rs{R15/29}
    \rs{R20/21}
    \rs{R20/22}
    \rs{R20/21/22}
    \rs{R21/22}
    \rs{R23/24}
    \rs{R23/25}
    \rs{R23/24/25}
    \rs{R24/25}
    \rs{R26/27}
    \rs{R26/28}
    \rs{R26/27/28}
    \rs{R27/28}
    \rs{R36/37}
    \rs{R36/38}
    \rs{R36/37/38}
    \rs{R37/38}
    \rs{R39/23}
    \rs{R39/24}
    \rs{R39/25}
    \rs{R39/23/24}
    \rs{R39/23/25}
    \rs{R39/24/25}
    \rs{R39/23/24/25}
    \rs{R39/26}
    \rs{R39/27}
    \rs{R39/28}
    \rs{R39/26/27}
    \rs{R39/26/28}
    \rs{R39/27/28}
    \rs{R39/26/27/28}
    \rs{R42/43}
    \rs{R48/20}
    \rs{R48/21}
    \rs{R48/22}
    \rs{R48/20/21}
    \rs{R48/20/22}
    \rs{R48/21/22}
    \rs{R48/20/21/22}
    \rs{R48/23}
    \rs{R48/24}
    \rs{R48/25}
    \rs{R48/23/24}
    \rs{R48/23/25}
    \rs{R48/24/25}
    \rs{R48/23/24/25}
    \rs{R50/53}
    \rs{R51/53}
    \rs{R52/53}
    \rs{R68/20}
    \rs{R68/21}
    \rs{R68/22}
    \rs{R68/20/21}
    \rs{R68/20/22}
    \rs{R68/21/22}
    \rs{R68/20/21/22}
    \rsskip
    \rs{S1}
    \rs{S2}
    \rs{S3}
    \rs{S4}
    \rs[\ldots]{S5}
    \rs[\ldots]{S6}
    \rs{S7}
    \rs{S8}
    \rs{S9}
    \rs{S12}
    \rs{S13}
    \rs[\ldots]{S14}
    \rs{S15}
    \rs{S16}
    \rs{S17}
    \rs{S18}
    \rs{S20}
    \rs{S21}
    \rs{S22}
    \rs[\ldots]{S23}
    \rs{S23.0}
    \rs{S23.1}
    \rs{S23.2}
    \rs{S23.3}
    \rs{S23.4}
    \rs{S24}
    \rs{S25}
    \rs{S26}
    \rs{S27}
    \rs[\ldots]{S28}
    \rs{S29}
    \rs{S30}
    \rs{S33}
    \rs{S35}
    \rs{S36}
    \rs{S37}
    \rs{S38}
    \rs{S39}
    \rs[\ldots]{S40}
    \rs{S41}
    \ifthenelse{\equal{#1}{}}
      {\rs{S42}}
      {\rs{S42.0}\rs{S42.1}\rs{S42.2}}
    \rs[\ldots]{S43.0}
    \rs[\ldots]{S43.1}
    \rs{S45}
    \rs[\ldots]{S46}
    \rs[\ldots]{S47}
    \rs[\ldots]{S48}
    \rs{S49}
    \rs[\ldots]{S50}
    \rs{S51}
    \rs{S52}
    \rs{S53}
    \rs{S56}
    \rs{S57}
    \rs{S59}
    \rs{S60}
    \rs{S61}
    \rs[\ldots]{S62}
    \rs{S63}
    \rs{S64}
    \rs{S1/2}
    \rs{S3/7}
    \rs[\ldots]{S3/9/14}
    \rs[\ldots]{S3/9/14/49}
    \rs[\ldots]{S3/9/49}
    \rs[\ldots]{S3/14}
    \rs{S7/8}
    \rs{S7/9}
    \rs[\ldots]{S7/47}
    \rs{S20/21}
    \rs{S24/25}
    \rs[\ldots]{S27/28}
    \rs{S29/35}
    \rs{S29/56}
    \rs{S36/37}
    \rs[\ldots]{S36/37/39}
    \rs[\ldots]{S36/39}
    \rs{S37/39}
    \rs[\ldots]{S47/49}
  \end{RandS}
}

\subsection{English}
The official phrases are given in American English. These phrases are typeset when the current Babel language is either set to \verb|english|, \verb|USenglish|, \verb|american|, \verb|UKenglish| or \verb|british|.
\allrsphrases
\selectlanguage{UKenglish}

\subsection{Danish}
Thanks to the extensive help of Rasmus Villemoes, the Danish phrases could be included. There were a couple typos in the official documents: We changed `bebølse' to `beboelse', `omgåænde' to `omgående' and `producentesn' to `producenten'.
\selectlanguage{danish}
\allrsphrases
\selectlanguage{UKenglish}

\subsection{French}
Dominique Richard helped with the French phrases. Many thanks to him!
\selectlanguage{french}
\allrsphrases
\selectlanguage{UKenglish}

\subsection{German}
I adapted the German R and S Phrases to the current (`new') spelling. Therefore, when writing a text in \verb|german| and using rsphrase, you will get a warning (`Your current language setting is german, rsphrase only knows the current German spelling (ngerman) which therefore was used.').
\selectlanguage{ngerman}
\allrsphrases
\selectlanguage{UKenglish}

\subsection{Italian}
Italian phrases implemented by Lorenzo Vagnarelli. Copy-and-paste-ready. Thanks a lot.
\selectlanguage{italian}
\allrsphrases[alt42]
\selectlanguage{UKenglish}

\subsection{Spanish}
Ignacio Fernández Galván sent me the Spanish phrases copy-and-paste-ready. What a surprise! I was done in five minutes. Thanks a lot!
\selectlanguage{spanish}
\allrsphrases[alt42]
\selectlanguage{UKenglish}

\end{document}
