From 38bf042280d81ae16f304a6beaf48995745f31c6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 28 Apr 2011 22:41:30 +0000 Subject: mhchem (28apr11) git-svn-id: svn://tug.org/texlive/trunk@22241 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/mhchem/mhchem.sty | 1853 ++++++++++++++++------- Master/texmf-dist/tex/latex/mhchem/rsphrase.sty | 2 +- 2 files changed, 1310 insertions(+), 545 deletions(-) (limited to 'Master/texmf-dist/tex/latex/mhchem') diff --git a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty index 7cc49e99028..13caf95ec8b 100644 --- a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty +++ b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty @@ -1,5 +1,5 @@ %% mhchem.sty -%% Copyright 2004-2010 M.a-r.t-i.n H.e-n.s-e.l +%% Copyright 2004-2011 M.a-r.t-i.n H.e-n.s-e.l % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License version 1.3c @@ -29,7 +29,7 @@ % mhchem.pdf and legal.txt. % % -\ProvidesPackage{mhchem}[2010/06/16 v3.08 for typesetting chemical formulae] +\ProvidesPackage{mhchem}[2011/04/26 v3.09 for typesetting chemical formulae] \RequirePackage{ifthen} \RequirePackage{calc}[1998/07/07] \RequirePackage{twoopt} @@ -37,12 +37,10 @@ \RequirePackage{keyval} \RequirePackage{graphics} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%% misc %%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% misc %%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand*\mhchem@cmath[1]{\ensuremath{\text{\ensuremath{#1}}}}% -\newcommand*\cmath[1]{\mhchem@cmath{#1}}% \DeclareMathSymbol{\mhchem@hyphen}{0}{operators}{45} %%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -50,17 +48,17 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*{\cee}[1]{% - \ifnum1<\mhchem@option@version% + \ifnum 1<\mhchem@option@version% \def\mhchem@ce@out{}% {\mhchem@ce@v#1\mhchem@empty\\\mhchem@END\mhchem@ENDEND}% \ensuremath{% - \mhchem@ce@out% - }% - \else% - \PackageWarningNoLine{mhchem}{% + \mhchem@ce@out% + }% + \else% + \PackageWarningNoLine{mhchem}{% The \string\cee{} command of mhchem is only available\MessageBreak when you secify [version=2] or greater}% - \fi% + \fi% }% \def\mhchem@ce@v#1\\#2#3\mhchem@ENDEND{% @@ -105,24 +103,6 @@ \space\mhchem@ce@viii#2\mhchem@ENDEND% \fi } -%\def\mhchem@ce@ix#1#2 #3\mhchem@ENDEND{% -% \ifx\mhchem@END#3% -% \ifx\mhchem@empty#2\mhchem@empty% -% \mhchem@ce@x{#1}#2\mhchem@END\mhchem@ENDEND% -% \else% -% \mhchem@ce@x#1#2\mhchem@END\mhchem@ENDEND% -% \fi% -% \else% -% \ifx\mhchem@empty#2\mhchem@empty% -% \mhchem@ce@x{#1}#2\mhchem@END\mhchem@ENDEND% -% \else% -% \mhchem@ce@x#1#2\mhchem@END\mhchem@ENDEND% -% \fi% -% \ifx\mhchem@END#1\else% -% \space\mhchem@ce@ix#3\mhchem@ENDEND% -% \fi% -% \fi% -%} \def\mhchem@ce@x#1#2\mhchem@ENDEND{% \ifx\@empty#1\@empty% \mhchem@ce@xi{}\mhchem@END\mhchem@ENDEND% @@ -152,6 +132,7 @@ \bgroup% \def\mhchem@protect{\noexpand}% \edef\mhchem@tmp{#1}% + % \expandafter\ce@main\expandafter{\mhchem@tmp}% \egroup } @@ -160,17 +141,18 @@ %%% \DeclareRobustCommand*{\ce@main}[1]{% - \bgroup% - \ifnum1<\mhchem@option@version% + \bgroup% + \ifnum 1<\mhchem@option@version% \ifmmode\else\def\mhchem@option@alwaystextmode{1}\fi% - \fi% - \ifx\@empty#1\@empty\else% - \ifmmode\else\mhchem@option@textfont\fi% - \ensuremath{% - \mhchem@ce@xx#1 \mhchem@END\mhchem@ENDEND% - }% - \fi% - \egroup% + \fi% + \def\bond{}\def\sbond{}\def\dbond{}\def\tbond{}% + \ifx\@empty#1\@empty\else% + \ifmmode\else\mhchem@option@textFont\fi% + \ensuremath{% + \mhchem@ce@xx#1 \mhchem@END\mhchem@ENDEND% + }% + \fi% + \egroup% }% \def\mhchem@ce@xx#1 #2\mhchem@ENDEND{% @@ -205,11 +187,17 @@ \else\ifx \protect#1{\mhchem@ce@ii{#1#2}}% % \else\ifx\ce#1 \mhchem@ce@i #2 \mhchem@END% - \else\ifx\cf#1 \cf{#2}% + \else\ifx\cf#1 \mhchem@cf{#2}% \else\ifx\cmath#1 \mhchem@ce@cmath#2\mhchem@END% + \else\ifx\bond#1{\mhchem@ce@ii{#1#2}}% + \else\ifx\sbond#1{\mhchem@ce@ii{#1#2}}% + \else\ifx\dbond#1{\mhchem@ce@ii{#1#2}}% + \else\ifx\tond#1{\mhchem@ce@ii{#1#2}}% + \else\ifx\label#1 \mhchem@ce@label#2\mhchem@END% + \else\ifx\tag#1 \mhchem@ce@tag#2\mhchem@END% % \else #1#2% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% } % @@ -302,11 +290,13 @@ \ifx\mhchem@ce@iii@tmp@i\mhchem@ce@iii@tmp@ii% {}\mathop{\downarrow}{}% \else% - \cf{#1}% + \mhchem@cf{#1}% \fi\fi\fi\fi% }% -\def\mhchem@ce@cmath#1#2\mhchem@END{\mhchem@cmath{#1}\cf{#2}} +\def\mhchem@ce@cmath#1#2\mhchem@END{\mhchem@cmath{#1}\mhchem@cf{#2}} +\def\mhchem@ce@label#1#2\mhchem@END{\label{#1}\mhchem@cf{#2}} +\def\mhchem@ce@tag#1#2\mhchem@END{\tag{#1}\mhchem@cf{#2}} %%%%%%%%%%%%% %%% arrows @@ -507,7 +497,7 @@ \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi% #7\if0#2\else\mkern#2mu\fi}}% \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi% - #6\if0#2\else\mkern#2mu\fi}}% + #6\if0#2\else\mkern#2mu\fi}}% \mkern#4mu% }}}% % @@ -522,7 +512,7 @@ #7\if0#2\else\mkern#2mu\fi}}% \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi% \hspace{1em}% %% - #6\if0#2\else\mkern#2mu\fi}}% + #6\if0#2\else\mkern#2mu\fi}}% \mkern#4mu% }}}% }{}% @@ -536,7 +526,7 @@ \hspace{1em}% %% #7\if0#2\else\mkern#2mu\fi}}% \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi% - #6\if0#2\else\mkern#2mu\fi}}% + #6\if0#2\else\mkern#2mu\fi}}% \mkern#4mu% }}}% }{}% @@ -550,7 +540,7 @@ #7\if0#2\else\mkern#2mu\fi}}% \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi% \hspace{1em}% %% - #6\if0#2\else\mkern#2mu\fi}}% + #6\if0#2\else\mkern#2mu\fi}}% \mkern#4mu% }}}% }{}% @@ -564,11 +554,11 @@ \hspace{1em}% %% #7\if0#2\else\mkern#2mu\fi}}% \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi% - #6\if0#2\else\mkern#2mu\fi}}% + #6\if0#2\else\mkern#2mu\fi}}% \mkern#4mu% }}}% }{}% - % + % \ifdim\mhchem@arrowlength@pgf<\mhchem@arrowminlength@pgf% \setlength\mhchem@arrowlength@pgf{\mhchem@arrowminlength@pgf}% \fi% @@ -582,7 +572,7 @@ \mkern#4mu% }%} }% - + \newcommandtwoopt*\mhchem@gives[2][][]{} \newcommandtwoopt*\mhchem@givesleft[2][][]{} \newcommandtwoopt*\mhchem@mesomeric[2][][]{} @@ -593,61 +583,61 @@ \newcommand\mhchem@definearrows[1]{% %%% font \ifthenelse{\equal{#1}{font}}{% - \renewcommandtwoopt*\mhchem@gives[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% - \xrightarrow% - [{##2}]% - {##1}}}% - \renewcommandtwoopt*\mhchem@givesleft[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% - \xleftarrow% - [{##2}]% - {##1}}}% - \renewcommandtwoopt*\mhchem@mesomeric[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% - \ext@arrow 3399\leftrightarrowfill@% - {##2}% - {##1}}}% - \renewcommandtwoopt*{\mhchem@equilibrium}[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% - \mhchem@xrightleftharpoons% - [{##2}]% - {##1}}}% - \renewcommandtwoopt*{\mhchem@equilibriumRight}[2][\hphantom{\makebox[\mhchem@arrowminlength]{}}][]{\ensuremath{% - \mhchem@xlongrightshortleftharpoons% - [{##2}]% - {##1}}}% + \renewcommandtwoopt*\mhchem@gives[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% + \xrightarrow% + [{##2}]% + {##1}}}% + \renewcommandtwoopt*\mhchem@givesleft[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% + \xleftarrow% + [{##2}]% + {##1}}}% + \renewcommandtwoopt*\mhchem@mesomeric[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% + \ext@arrow 3399\leftrightarrowfill@% + {##2}% + {##1}}}% + \renewcommandtwoopt*{\mhchem@equilibrium}[2][\hspace{\mhchem@arrowminlength}][]{\ensuremath{% + \mhchem@xrightleftharpoons% + [{##2}]% + {##1}}}% + \renewcommandtwoopt*{\mhchem@equilibriumRight}[2][\hphantom{\makebox[\mhchem@arrowminlength]{}}][]{\ensuremath{% + \mhchem@xlongrightshortleftharpoons% + [{##2}]% + {##1}}}% \renewcommandtwoopt*{\mhchem@equilibriumLeft}[2][][\hspace{\mhchem@arrowminlength}]{\ensuremath{% - \mhchem@xshortrightlongleftharpoons% - [{##2}]% - {##1}}}% + \mhchem@xshortrightlongleftharpoons% + [{##2}]% + {##1}}}% }{%%% pgf \ifthenelse{\equal{#1}{pgf}}{% - \renewcommandtwoopt*\mhchem@gives[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{1.5}{5}{1.5}{1}{mhchem@rightarrow@pgf}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@givesleft[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{5}{1.5}{1}{1.5}{mhchem@leftarrow@pgf}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@mesomeric[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{5}{5}{1}{1}{mhchem@leftrightarrow@pgf}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@equilibrium[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{6}{6}{1}{1}{mhchem@leftrightharpoon@pgf}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@equilibriumRight[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{6}{6}{1}{1}{mhchem@longrightshortleftharpoons@pgf}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@equilibriumLeft[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{6}{6}{1}{1}{mhchem@shortrightlongleftharpoons@pgf}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@gives[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{1.5}{5}{1.5}{1}{mhchem@rightarrow@pgf}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@givesleft[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{5}{1.5}{1}{1.5}{mhchem@leftarrow@pgf}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@mesomeric[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{5}{5}{1}{1}{mhchem@leftrightarrow@pgf}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@equilibrium[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{6}{6}{1}{1}{mhchem@leftrightharpoon@pgf}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@equilibriumRight[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{6}{6}{1}{1}{mhchem@longrightshortleftharpoons@pgf}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@equilibriumLeft[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{6}{6}{1}{1}{mhchem@shortrightlongleftharpoons@pgf}{##2}{##1}}}% }{%%% pgf-filled \ifthenelse{\equal{#1}{pgf-filled}}{% - \renewcommandtwoopt*\mhchem@gives[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{1.5}{7}{1.5}{1}{mhchem@rightarrow@pgffilled}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@givesleft[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{7}{1.5}{1}{1.5}{mhchem@leftarrow@pgffilled}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@mesomeric[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@leftrightarrow@pgffilled}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@equilibrium[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@leftrightharpoon@pgffilled}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@equilibriumRight[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@longrightshortleftharpoons@pgffilled}{##2}{##1}}}% - \renewcommandtwoopt*\mhchem@equilibriumLeft[2][][]% - {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@shortrightlongleftharpoons@pgffilled}{##2}{##1}}}% - }{% - \PackageError{mhchem}{The option font=#1 is not supported}% - }% + \renewcommandtwoopt*\mhchem@gives[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{1.5}{7}{1.5}{1}{mhchem@rightarrow@pgffilled}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@givesleft[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{7}{1.5}{1}{1.5}{mhchem@leftarrow@pgffilled}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@mesomeric[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@leftrightarrow@pgffilled}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@equilibrium[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@leftrightharpoon@pgffilled}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@equilibriumRight[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@longrightshortleftharpoons@pgffilled}{##2}{##1}}}% + \renewcommandtwoopt*\mhchem@equilibriumLeft[2][][]% + {\ensuremath{\mhchem@labeledarrow@pgf{7}{7}{1}{1}{mhchem@shortrightlongleftharpoons@pgffilled}{##2}{##1}}}% + }{% + \PackageError{mhchem}{The option font=#1 is not supported}% + }% }}% } @@ -677,8 +667,9 @@ {\mhchem@equilibriumLeft[\ce@main{#1}][\ce@main{#2}]} -%%%%%%%%%% -% bonds - basic definition see in \cf +%%%%%%%%%%%%% +%%% bonds %%% +% \newlength\mhchem@bondwidth% \newlength\mhchem@bondheight% \newlength\mhchem@smallbondwidth@tmpA% @@ -702,9 +693,17 @@ \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}}% \phantom{\sbond}} \def\mhchem@bond#1{% - \mhchem@cf@length{#1}% - {}% - \ifnum\value{mhchem@cf@length}>1\relax% + % + \if ##\noexpand#1% + \tbond% + \else\ifx \tbond#1% + \tbond% + \else% + \ifthenelse{\equal{#1}{-}}{\sbond}{% + \ifthenelse{\equal{#1}{=}}{\dbond}{% + \ifthenelse{\equal{#1}{~}}{% + \mhchem@setbondwidth% + \mhchem@halfbond}{% \ifthenelse{\equal{#1}{~-}}{% \mhchem@setbondwidth% \rlap{\protect\raisebox{.2ex}{\mhchem@halfbond}}% @@ -712,454 +711,1176 @@ \ifthenelse{\equal{#1}{~--}}{% \mhchem@setbondwidth% \rlap{\protect\raisebox{.4ex}{\mhchem@halfbond}}% - \rlap{\sbond}% - \protect\raisebox{-.4ex}{\sbond}}{% + \rlap{\sbond}% + \protect\raisebox{-.4ex}{\sbond}}{% \ifthenelse{\equal{#1}{~=}}{% \mhchem@setbondwidth% \rlap{\protect\raisebox{.4ex}{\mhchem@halfbond}}% - \rlap{\sbond}% - \protect\raisebox{-.4ex}{\sbond}}{% + \rlap{\sbond}% + \protect\raisebox{-.4ex}{\sbond}}{% \ifthenelse{\equal{#1}{-~-}}{% \mhchem@setbondwidth% \rlap{\protect\raisebox{.4ex}{\sbond}}% - \rlap{\mhchem@halfbond}% - \protect\raisebox{-.4ex}{\sbond}}{% + \rlap{\mhchem@halfbond}% + \protect\raisebox{-.4ex}{\sbond}}{% \ifthenelse{\equal{#1}{...}}{{\cdot}{\cdot}{\cdot}}{% \ifthenelse{\equal{#1}{....}}{{\cdot}{\cdot}{\cdot}{\cdot}}{% \ifthenelse{\equal{#1}{->}}{{\rightarrow}}{% \ifthenelse{\equal{#1}{<-}}{{\leftarrow}}{% % - \PackageError{mhchem}{unknown bond type in \string\bond}% - }}}}}}}}% - \else% - \if\noexpand#1##% - \tbond% - \else% - \ifthenelse{\equal{#1}{-}}{\sbond}{% - \ifthenelse{\equal{#1}{=}}{\dbond}{% - \ifthenelse{\equal{#1}{\tbond}}{\tbond}{% - \ifthenelse{\equal{#1}{~}}{% - \mhchem@setbondwidth% - \mhchem@halfbond}{% - % - \PackageError{mhchem}{unknown bond type in \string\bond}% - }}}}% - \fi% - \fi% + \PackageError{mhchem}{unknown bond type in \string\bond (#1)}% + }}}}}}}}}}}% + \fi\fi% } - %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% \cf %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newtoks\mhchem@cf@element% -\newtoks\mhchem@cf@number% -\newtoks\mhchem@cf@sup% -\newtoks\tok@mhchem@cf@i% - -\newcommand*{\cf}[2][]{% - \bgroup% - \def\sbond{{\ensuremath{-}}}% - \DeclareRobustCommand\dbond{\rlap{\protect\raisebox{.2ex}{\sbond}}\protect\raisebox{-.2ex}{\sbond}}% - \def\tbond{\rlap{\protect\raisebox{.4ex}{\sbond}}% +\newtoks\mhchem@cf@result% +\newcommand*\mhchem@cf[2][]{% + \bgroup% + %%% + \def\sbond{{\ensuremath{-}}}% + \ifnum 2=\mhchem@option@version% + \let\bond\sbond% + \else\ifnum 2<\mhchem@option@version% + \DeclareRobustCommand*\bond{\mhchem@bond}% + \fi\fi% + \DeclareRobustCommand\dbond{\rlap{\protect\raisebox{.2ex}{\sbond}}\protect\raisebox{-.2ex}{\sbond}}% + \DeclareRobustCommand\tbond{\rlap{\protect\raisebox{.4ex}{\sbond}}% \rlap{\sbond}\protect\raisebox{-.4ex}{\sbond}}% - \def\hyphen{\mhchem@hyphen}% - \ifmmode\else\def\mhchem@option@alwaystextmode{1}\fi% - \if 1\mhchem@option@alwaystextmode% - \edef\mhchem@mathortext##1{\noexpand\text{##1}}% - \edef\mhchem@mathortext@ii##1##2{##2}% - \else% - \ifnum1<\mhchem@option@version% - \edef\mhchem@mathortext##1{\ifmmode\noexpand\mhchem@option@mathfont{##1}\else\noexpand\text{##1}\fi}% - \edef\mhchem@mathortext@ii##1##2{\ifmmode\noexpand\mhchem@option@mathfont{##1}\else ##2\fi}% - \else - \edef\mhchem@mathortext##1{\ifmmode ##1\else\noexpand\text{##1}\fi}% - \edef\mhchem@mathortext@ii##1##2{\ifmmode ##1\else ##2\fi}% - \fi% - \fi% - \ifmmode\else\mhchem@option@textfont\fi% - \ensuremath{% - % - % - % - \def\mhchem@cf@presub{}% - \def\mhchem@cf@presup{}% - \def\mhchem@cf@others{}% - \def\mhchem@cf@state{s}% -% -% -% -% + \def\hyphen{\mhchem@hyphen}% + %%% + \ifmmode\else\def\mhchem@option@alwaystextmode{1}\fi% + \if 1\mhchem@option@alwaystextmode% + \edef\mhchem@mathOrText##1{\noexpand\text{##1}}% + \edef\mhchem@mathOrText@ii##1##2{##2}% + \else% + \ifnum 1<\mhchem@option@version% + \edef\mhchem@mathOrText##1{\ifmmode\mhchem@option@mathFont{##1}\else\noexpand\text{##1}\fi}% + \edef\mhchem@mathOrText@ii##1##2{\ifmmode\mhchem@option@mathFont{##1}\else ##2\fi}% + \else% + \edef\mhchem@mathOrText##1{\ifmmode ##1\else\noexpand\text{##1}\fi}% + \edef\mhchem@mathOrText@ii##1##2{\ifmmode ##1\else ##2\fi}% + \fi% + \fi% + \ifmmode\else\mhchem@option@textFont\fi% + %%% + \def\mhchem@cf@state{s}% + % + % + % + % + % + % + % + % + % + % + \def\mhchem@cf@startedWithBond{0}% + %%% + \mhchem@cf@outputReset% + \mhchem@cf@result={}% + %%% + \mhchem@cf@continue#2\mhchem@END% + %%% + % + % + \ifthenelse{\equal{#1}{}}% + {% + \ensuremath{\the\mhchem@cf@result}% + }{% + \ensuremath{\overset{#1}{\the\mhchem@cf@result}}% + }% + %TODO: insert kerning if full stop (or similar) follows superscript + %\@ifnextchar,{\kern-0.2em}{} ??% + \egroup% +}% +\def\mhchem@cf@i{% + % + % + %%% + \ifx\mhchem@END\mhchem@cf@lookahead% + \if -\mhchem@cf@state% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup -}% + \else% + \if 0\mhchem@cf@startedWithBond% + \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup -}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\sbond}% + \fi% + \fi% + \fi% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \let\mhchem@cf@action\mhchem@gobble% + \else\ifx\relax\mhchem@cf@lookahead% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifx\protect\mhchem@cf@lookahead% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + %%% + \else% % % % % - \ifthenelse{\equal{#1}{}}% - {\mhchem@cf@i #2\mhchem@END\mhchem@ENDEND}% - {\ensuremath{\overset{#1}{\mhchem@cf@i #2\mhchem@END\mhchem@ENDEND}}}% - %TODO: insert kerning if full stop (or similar) follows superscript - %\@ifnextchar,{\kern-0.2em}{} ??% - }\egroup% + \if -\mhchem@cf@state% + % + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\sbond}% + \def\mhchem@cf@state{+}% + \fi% + \if s\mhchem@cf@state% + \ifx \{\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx \}\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx\bond\mhchem@cf@lookahead% + \ifnum 2=\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{C}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \else\if =\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\dbond}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if ##\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\tbond}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifcat\noexpand\mhchem@macro\noexpand\mhchem@cf@lookahead% + \def\mhchem@cf@state{c}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ^\mhchem@cf@lookahead% + \def\mhchem@cf@state{p}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if _\mhchem@cf@lookahead% + \def\mhchem@cf@state{q}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if `\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{P}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if ,\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{Q}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{1}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@amount}{{,}}}% + \fi% + \else\if .\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else% + \def\mhchem@cf@state{1}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \fi% + \else\if +\mhchem@cf@lookahead% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@sup}}% + \else\if -\mhchem@cf@lookahead% + \ifnum 1<\mhchem@option@version% + \def\mhchem@cf@state{-}% + \def\mhchem@cf@startedWithBond{1}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@sup}{-}}% + \fi% + \else\if |\mhchem@cf@lookahead% + \let\mhchem@cf@action\mhchem@cf@switchState% + \else\if (\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if )\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if [\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if ]\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if *\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else\ifcat a\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifcat 1\mhchem@cf@lookahead% + \def\mhchem@cf@state{1}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \else\if\mhchem@lbracechar\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{1}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@amount}}% + \fi% + \else\if $\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@element}}% + \else% + \def\mhchem@cf@state{1}% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@amount}}% + \fi% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \else\if C\mhchem@cf@state% + \if\mhchem@lbracechar\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \def\mhchem@cf@state{c}% + \else\if c\mhchem@cf@state% + \if\mhchem@lbracechar\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@continue}% + \fi% + \else\if 1\mhchem@cf@state% + \ifx \{\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx \}\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx\bond\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \ifnum 2=\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{C}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \else\if =\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\dbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if ##\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\tbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifcat\noexpand\mhchem@macro\noexpand\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{c}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ^\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{p}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if _\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{q}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if `\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{E}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \fi% + \else\if ,\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{F}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@amount}{{,}}}% + \fi% + \else\if .\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \fi% + \else\if |\mhchem@cf@lookahead% + \PackageWarning{mhchem}{The symbol | is not allowed here}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if (\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if )\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if [\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if ]\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if *\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else\ifcat a\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifcat 1\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \else\if\mhchem@lbracechar\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@amount}}% + \fi% + \else\if $\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@amount}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \else\if a\mhchem@cf@state% + \ifx \{\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx \}\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx\bond\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \ifnum 2=\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{C}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \else\if =\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\dbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if ##\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\tbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifcat\noexpand\mhchem@macro\noexpand\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{c}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ^\mhchem@cf@lookahead% + \def\mhchem@cf@state{e}% + \expandafter\ifx\expandafter\@empty\the\mhchem@cf@sup\@empty\else% + \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup ,}% + \fi% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if _\mhchem@cf@lookahead% + \def\mhchem@cf@state{f}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if `\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{E}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if ,\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@element}{,}}% + \fi% + \else\if .\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if +\mhchem@cf@lookahead% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@sup}}% + \else\if -\mhchem@cf@lookahead% + \ifnum 1<\mhchem@option@version% + \def\mhchem@cf@state{-}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@sup}{-}}% + \fi% + \else\if |\mhchem@cf@lookahead% + \PackageWarning{mhchem}{The symbol | is not allowed here}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if (\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if )\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if [\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if ]\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if *\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else\ifcat a\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifcat 1\mhchem@cf@lookahead% + \def\mhchem@cf@state{2}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \else\if\mhchem@lbracechar\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroupAsMath{% + \mhchem@cf@element}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@element}}% + \fi% + \else\if $\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@element}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \else\if 2\mhchem@cf@state% + \ifx \{\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx \}\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx\bond\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \ifnum 2=\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{C}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \else\if =\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\dbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if ##\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\tbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifcat\noexpand\mhchem@macro\noexpand\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{c}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ^\mhchem@cf@lookahead% + \def\mhchem@cf@state{e}% + \expandafter\ifx\expandafter\@empty\the\mhchem@cf@sup\@empty\else% + \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup ,}% + \fi% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if _\mhchem@cf@lookahead% + \def\mhchem@cf@state{f}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if `\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{E}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \fi% + \else\if ,\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{F}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@amount}{,}}% + \fi% + \else\if .\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \fi% + \else\if +\mhchem@cf@lookahead% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@sup}}% + \else\if -\mhchem@cf@lookahead% + \ifnum 1<\mhchem@option@version% + \def\mhchem@cf@state{-}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@sup}{-}}% + \fi% + \else\if |\mhchem@cf@lookahead% + \PackageWarning{mhchem}{The symbol | is not allowed here}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if (\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if )\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if [\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if ]\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if *\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else\ifcat a\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifcat 1\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \else\if\mhchem@lbracechar\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@result}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@element}}% + \fi% + \else\if $\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@element}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \else\if e\mhchem@cf@state% + \def\mhchem@cf@state{+}% + \if $\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendMathAsGroup{\mhchem@cf@sup}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@sup}}% + \fi% + \else\if f\mhchem@cf@state% + \def\mhchem@cf@state{+}% + \if $\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendMathAsGroup{\mhchem@cf@amount}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \fi% + \else\if p\mhchem@cf@state% + \def\mhchem@cf@state{*}% + \if $\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendMathAsGroup{\mhchem@cf@presup}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@presup}}% + \fi% + \else\if q\mhchem@cf@state% + \def\mhchem@cf@state{*}% + \if $\mhchem@cf@lookahead% + \def\mhchem@cf@action{\mhchem@cf@appendMathAsGroup{\mhchem@cf@presub}}% + \else% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@presub}}% + \fi% + \else\if E\mhchem@cf@state% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{% + \mhchem@cf@appendNextTokenAsMathrm{\mhchem@cf@sup}}% + \else\if F\mhchem@cf@state% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{% + \mhchem@cf@appendNextTokenAsMathrm{\mhchem@cf@amount}}% + \else\if P\mhchem@cf@state% + \def\mhchem@cf@state{*}% + \def\mhchem@cf@action{% + \mhchem@cf@appendNextTokenAsMathrm{\mhchem@cf@presup}}% + \else\if Q\mhchem@cf@state% + \def\mhchem@cf@state{*}% + \def\mhchem@cf@action{% + \mhchem@cf@appendNextTokenAsMathrm{\mhchem@cf@presub}}% + \else\if +\mhchem@cf@state% + \ifx \{\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx \}\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifx\bond\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \ifnum 2=\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{C}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \else\if =\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\dbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if ##\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\tbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifcat\noexpand\mhchem@macro\noexpand\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{c}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ^\mhchem@cf@lookahead% + \def\mhchem@cf@state{e}% + \expandafter\ifx\expandafter\@empty\the\mhchem@cf@sup\@empty\else% + \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup ,}% + \fi% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if _\mhchem@cf@lookahead% + \def\mhchem@cf@state{f}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if `\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{E}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if ,\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{F}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@element}{,}}% + \fi% + \else\if .\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if +\mhchem@cf@lookahead% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@sup}}% + \else\if -\mhchem@cf@lookahead% + \ifnum 1<\mhchem@option@version% + \def\mhchem@cf@state{-}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{+}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@sup}{-}}% + \fi% + \else\if |\mhchem@cf@lookahead% + \PackageWarning{mhchem}{The symbol | is not allowed here}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if (\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if )\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if [\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if ]\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if *\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else\ifcat a\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifcat 1\mhchem@cf@lookahead% + % + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\if\mhchem@lbracechar\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@result}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@element}}% + \fi% + \else\if $\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@element}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% . + \else\if *\mhchem@cf@state% + \ifx \{\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\ifx \}\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\ifx\bond\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \ifnum 2=\mhchem@option@version% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else% + \def\mhchem@cf@state{C}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi% + \else\if =\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\dbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if ##\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \mhchem@cf@result=\expandafter{\the\mhchem@cf@result\tbond}% + \def\mhchem@cf@state{+}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\ifcat\noexpand\mhchem@macro\noexpand\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{c}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ^\mhchem@cf@lookahead% + \def\mhchem@cf@state{p}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if _\mhchem@cf@lookahead% + \def\mhchem@cf@state{q}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if `\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{P}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if ,\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \def\mhchem@cf@state{Q}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@element}{,}}% + \fi% + \else\if .\mhchem@cf@lookahead% + \ifnum 4>\mhchem@option@version% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \fi% + \else\if |\mhchem@cf@lookahead% + \PackageWarning{mhchem}{The symbol | is not allowed here}% + \let\mhchem@cf@action\mhchem@cf@gobbleNextToken% + \else\if (\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if )\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if [\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if ]\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \else\if *\mhchem@cf@lookahead% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@append{\mhchem@cf@result}% + {\mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot}}}% + \else\ifcat a\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@element}}% + \else\ifcat 1\mhchem@cf@lookahead% + % + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{1}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@amount}}% + \else\if\mhchem@lbracechar\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendNextGroup{\mhchem@cf@element}}% + \else\if $\mhchem@cf@lookahead% + \def\mhchem@cf@state{a}% + \def\mhchem@cf@action{\mhchem@cf@appendMath{\mhchem@cf@element}}% + \else% + \mhchem@cf@outputAndReset{\mhchem@cf@result}% + \def\mhchem@cf@state{s}% + \def\mhchem@cf@action{\mhchem@cf@appendNextToken{\mhchem@cf@result}}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% . + \else% + \PackageWarning{mhchem}{Assertion failed: unknown internal state \mhchem@cf@state}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% + \fi\fi\fi% + \mhchem@cf@action% +}% +%%% +\def\mhchem@cf@continue{% + \futurelet\mhchem@cf@lookahead\mhchem@cf@i% +}% +\def\mhchem@cf@gobbleNextToken#1{% + \mhchem@cf@continue% +}% +\def\mhchem@cf@append#1#2#3{% + %\showthe#1% + #1=\expandafter{\the#1#2}% + %\showthe#1% + \mhchem@cf@continue% +}% +\def\mhchem@cf@appendExpand#1#2#3{% + \edef\mhchem@cf@appendExpand@i{\noexpand\mhchem@cf@append\noexpand{#1}{#2}}% + \mhchem@cf@appendExpand@i% +}% +\def\mhchem@cf@appendAndExecute#1#2#3#4{% + #1=\expandafter{\the#1#2}% + #3% + \mhchem@cf@continue% +}% +\def\mhchem@cf@appendAndExecuteExpand#1#2#3#4{% + \edef\mhchem@cf@appendExpand@i{\noexpand\mhchem@cf@appendAndExecute\noexpand{#1}{#2}{#3}}% + \mhchem@cf@appendExpand@i% +}% +\def\mhchem@cf@appendNextGroup#1#2{% + #1=\expandafter{\the#1{#2}}% + \mhchem@cf@continue% +} +\def\mhchem@cf@appendNextGroupAsMath#1#2{% + #1=\expandafter{\the#1{\text{\ensuremath{#2}}}}% + \mhchem@cf@continue% +} +\def\mhchem@cf@appendNextToken#1#2{% + %\showthe#1% + #1=\expandafter{\the#1#2}% + %\showthe#1% + \mhchem@cf@continue% +} +\def\mhchem@cf@appendNextTokenAsMathrm#1#2{% + #1=\expandafter{\the#1{\ensuremath{\mathrm{#2}}}}% + \mhchem@cf@continue% } +\def\mhchem@cf@appendMath#1#2#3${% + #1=\expandafter{\the#1\text{\ensuremath{#3}}}% + \mhchem@cf@continue% +}% +\def\mhchem@cf@appendMathAsGroup#1#2#3${% + #1=\expandafter{\the#1{\text{\ensuremath{#3}}}}% + \mhchem@cf@continue% +}% +\def\mhchem@cf@switchState#1#2|{% + \ifthenelse{\equal{1}{#2}}{% if 1 + \def\mhchem@cf@state{a}% switch to [a]element + }{% + \PackageWarning{mhchem}{Command |#2| unknown}% + }% + \mhchem@cf@continue% +}% + +%%%%% +\newtoks\mhchem@cf@element% +\newtoks\mhchem@cf@amount% +%\newtoks\mhchem@cf@sub% +\newtoks\mhchem@cf@sup% +\newtoks\mhchem@cf@presub% +\newtoks\mhchem@cf@presup% \def\mhchem@cf@output{% + %\showthe\mhchem@cf@result% \if\mhchem@cf@state s% - % \else\if\mhchem@cf@state 1% - {\mhchem@mathortext{\expandafter\mhchem@cf@frac\the\mhchem@cf@number/\mhchem@END}}% - \else\if\mhchem@cf@state n% - {\mhchem@mathortext{\expandafter\mhchem@cf@frac\the\mhchem@cf@number/\mhchem@END}}% - \else\if\mhchem@cf@state M% - \mhchem@cmath{\the\mhchem@cf@element} + \noexpand\mhchem@mathOrText{\noexpand\mhchem@cf@frac\the\mhchem@cf@amount/\noexpand\mhchem@END}% \else% - \if\mhchem@option@usenonsimultaneoussubsuperscripts 0% - \mhchem@chemfive{\mhchem@cf@presup}{\mhchem@cf@presub}% - {\the\mhchem@cf@element}{\the\mhchem@cf@number}{\the\mhchem@cf@sup}{}% + \if\mhchem@option@usenonsimultaneoussubsuperscripts 0\relax% + \noexpand\mhchem@chemfive% + {\noexpand\mhchem@cf@replaceMath{\the\mhchem@cf@presup}}% + {\noexpand\mhchem@cf@replaceMath{\the\mhchem@cf@presub}}% + {\the\mhchem@cf@element}% + {\noexpand\mhchem@cf@replaceMath{\the\mhchem@cf@amount}}% + {\noexpand\mhchem@cf@replaceMathMinusDot{\the\mhchem@cf@sup}}% + {}% \else% - \mhchem@chemfive{\mhchem@cf@presup}{\mhchem@cf@presub}% - {\the\mhchem@cf@element}{\the\mhchem@cf@number}{}{\the\mhchem@cf@sup}% + \noexpand\mhchem@chemfive% + {\noexpand\mhchem@cf@replaceMath{\the\mhchem@cf@presup}}% + {\noexpand\mhchem@cf@replaceMath{\the\mhchem@cf@presub}}% + {\the\mhchem@cf@element}% + {\noexpand\mhchem@cf@replaceMath{\the\mhchem@cf@amount}}% + {}% + {\noexpand\mhchem@cf@replaceMathMinusDot{\the\mhchem@cf@sup}}% \fi% - \fi\fi\fi\fi% - \mhchem@cf@element{} - \mhchem@cf@number{}% - \mhchem@cf@sup{}% - \def\mhchem@cf@presub{}% - \def\mhchem@cf@presup{}% - \def\mhchem@cf@others{}% -} -\def\mhchem@cf@output@o#1{% - \mhchem@cf@output% - \if\mhchem@cf@state s\else\nolinebreak\fi% - {#1}% + \fi\fi%\fi% } - -\newcounter{mhchem@cf@length}% -\def\mhchem@cf@length#1{% - \setcounter{mhchem@cf@length}{0}% - \ifx\@empty#1\@empty% - \else% - \setcounter{mhchem@cf@length}{1}% - \mhchem@cf@length@i#1\mhchem@END% - \fi% +\def\mhchem@cf@outputReset{% + %\showthe\mhchem@cf@element% + %\showthe\mhchem@cf@sup% + % + \mhchem@cf@element={}% + \mhchem@cf@amount={}% + \mhchem@cf@sup={}% + \mhchem@cf@presub={}% + \mhchem@cf@presup={}% } -\def\mhchem@cf@length@i#1#2\mhchem@END{% - \ifx\@empty#2\@empty% - \else% - \setcounter{mhchem@cf@length}{2}% - \fi% +\def\mhchem@cf@outputAndReset#1{% + \edef\mhchem@cf@outputAndReset@i{#1={\the#1\mhchem@cf@output}}% + \mhchem@cf@outputAndReset@i% + %\showthe#1% + \mhchem@cf@outputReset% } -\def\mhchem@cf@frac#1/#2\mhchem@END{\ifthenelse{\equal{#2}{}}{#1\,}{% - \ensuremath{\mathchoice% - {\textstyle% - \frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}% - {\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}% - {\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}% - {\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}}}} + + +%%% frac +\def\mhchem@cf@frac#1/#2\mhchem@END{% + \ifthenelse{\equal{#2}{}}{% + #1\mhchem@option@skipAfterAmount% + }{% + \ensuremath{\mathchoice% + {\textstyle% + \frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mhchem@option@skipAfterFracAmount}% + {\frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mhchem@option@skipAfterFracAmount}% + {\frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mhchem@option@skipAfterFracAmount}% + {\frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mhchem@option@skipAfterFracAmount}% + }% + }% +}% \def\mhchem@getfirstchar#1#2\mhchem@ENDgetfirstchar{#1} \def\mhchem@getlastchars#1#2\mhchem@ENDgetlastchars{#2} -\newtoks\mhchem@cf@replaceminus@tok -\def\mhchem@cf@replaceminus#1{% - \mhchem@cf@replaceminus@tok{}% - \mhchem@cf@replaceminus@i#1-\mhchem@END\mhchem@ENDEND% - \the\mhchem@cf@replaceminus@tok} -\def\mhchem@cf@replaceminus@i#1-#2\mhchem@ENDEND{% - \ifx\mhchem@END#2% - \mhchem@cf@replaceminus@tok=\expandafter{\the\mhchem@cf@replaceminus@tok#1}% - \else% - \mhchem@cf@replaceminus@tok=\expandafter{#1\mhchem@mathortext@ii{-}{$\,$--$\,$}}%\ensuremath{-}% - \mhchem@cf@replaceminus@i#2\mhchem@ENDEND% - \fi% +%%% replaceMath + % + % + % +\newtoks\mhchem@cf@replaceMath@result +\newcommand\mhchem@cf@replaceMath[1]{% + \mhchem@cf@replaceMath@result={}% + \mhchem@cf@replaceMath@continue#1\mhchem@END% + % + \the\mhchem@cf@replaceMath@result% } - -\def\mhchem@cf@replacedot#1{\mhchem@cf@replacedot@i#1.\mhchem@END\mhchem@ENDEND} -\def\mhchem@cf@replacedot@i#1.#2\mhchem@ENDEND{% - \ifx\mhchem@END#2% - #1% +\def\mhchem@cf@replaceMath@i{% + \ifx\mhchem@END\mhchem@cf@replaceMath@lookahead% + \let\mhchem@cf@replaceMath@action\mhchem@gobble% + \else\if\mhchem@lbracechar\mhchem@cf@replaceMath@lookahead% + \let\mhchem@cf@replaceMath@action\mhchem@cf@replaceMath@appendNextGroup% + \else\if $\mhchem@cf@replaceMath@lookahead% + \let\mhchem@cf@replaceMath@action\mhchem@cf@replaceMath@appendMath% \else% - #1%{\noexpand\textbf{\noexpand\fontfamily{cmr}\noexpand\selectfont\noexpand\textperiodcentered}}% - {\textbf{\fontfamily{cmr}\selectfont\textperiodcentered}}% - \mhchem@cf@replacedot@i#2\mhchem@ENDEND% - \fi% + \let\mhchem@cf@replaceMath@action\mhchem@cf@replaceMath@appendNextToken% + \fi\fi\fi% + \mhchem@cf@replaceMath@action% } - -\def\mhchem@cf@i#1#2\mhchem@ENDEND{% - \ifx\mhchem@END#1% - \mhchem@cf@output% +%%% +\def\mhchem@cf@replaceMath@continue{% + \futurelet\mhchem@cf@replaceMath@lookahead\mhchem@cf@replaceMath@i% +} +\def\mhchem@cf@replaceMath@appendNextGroup#1{% + \mhchem@cf@replaceMath@result=\expandafter{\the\mhchem@cf@replaceMath@result{#1}}% + \mhchem@cf@replaceMath@continue% +} +\def\mhchem@cf@replaceMath@appendNextToken#1{% + \mhchem@cf@replaceMath@result=\expandafter{\the\mhchem@cf@replaceMath@result#1}% + \mhchem@cf@replaceMath@continue% +} +\def\mhchem@cf@replaceMath@appendMath#1#2${% + \mhchem@cf@replaceMath@result=\expandafter{\the\mhchem@cf@replaceMath@result\text{\ensuremath{#2}}}% + \mhchem@cf@replaceMath@continue% +}% +%%% replaceMathMinusDot +%%% +%%% +%%% +%%% +%%% +\newtoks\mhchem@cf@replaceMathMinusDot@result +\newcommand\mhchem@cf@replaceMathMinusDot[1]{% + \mhchem@cf@replaceMathMinusDot@result={}% + \mhchem@cf@replaceMathMinusDot@continue#1\mhchem@END% + % + \the\mhchem@cf@replaceMathMinusDot@result% +} +\def\mhchem@cf@replaceMathMinusDot@i{% + \ifx\mhchem@END\mhchem@cf@replaceMathMinusDot@lookahead% + \let\mhchem@cf@replaceMathMinusDot@action\mhchem@gobble% + \else\if -\mhchem@cf@replaceMathMinusDot@lookahead\relax% + \def\mhchem@cf@replaceMathMinusDot@action{\mhchem@cf@replaceMathMinusDot@append{\mhchem@mathOrText@ii{-}{\mhchem@option@textminus}}}% + \else\if .\mhchem@cf@replaceMathMinusDot@lookahead\relax% + \def\mhchem@cf@replaceMathMinusDot@action{\mhchem@cf@replaceMathMinusDot@append{\ensuremath{\textbf{\fontfamily{cmr}\selectfont\textperiodcentered}}}}% + \else\if\mhchem@lbracechar\mhchem@cf@replaceMathMinusDot@lookahead% + \let\mhchem@cf@replaceMathMinusDot@action\mhchem@cf@replaceMathMinusDot@appendNextGroup% + \else\if $\mhchem@cf@replaceMathMinusDot@lookahead% + \let\mhchem@cf@replaceMathMinusDot@action\mhchem@cf@replaceMathMinusDot@appendMath% \else% - \ifx\@empty#1\@empty% leer - \if\mhchem@cf@state e\def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state E\def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state p\def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state P\def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state f\def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state F\def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state q\def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state Q\def\mhchem@cf@state{*}% - \else% - \mhchem@cf@output% - \def\mhchem@cf@state{s}% - \fi\fi\fi\fi\fi\fi\fi\fi% - \else\ifx\protect#1% - \else\if\mhchem@cf@state e% - \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup% - \expandafter\mhchem@cf@replacedot\expandafter{\mhchem@cf@replaceminus{#1}}}% - \def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state E% - \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup% - \mhchem@mathortext@ii{\mhchem@option@mathfont{#1}}{#1}}% - \def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state p% - \g@addto@macro\mhchem@cf@presup{#1}% - \def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state P% - \edef\mhchem@cf@presup{\mhchem@cf@presup% - \mhchem@mathortext@ii{\mhchem@option@mathfont{#1}}{#1}}% - \def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state f% - \mhchem@cf@number=\expandafter{\the\mhchem@cf@number#1}% - \def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state F% - \ifx\@empty\the\mhchem@cf@number\@empty%*** - \else\mhchem@cf@number=\expandafter{\the\mhchem@cf@number\,}\fi% - \mhchem@cf@number=\expandafter{\the\mhchem@cf@number% - \mhchem@mathortext@ii{\mhchem@option@mathfont{#1}}{#1}}% - \def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state q% - \g@addto@macro\mhchem@cf@presub{#1}% - \def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state Q% - \edef\mhchem@cf@presub{\mhchem@cf@presub% - \mhchem@mathortext@ii{\mhchem@option@mathfont{#1}}{#1}}% - \def\mhchem@cf@state{*}% - \else\if\mhchem@cf@state m% - \mhchem@cmath{#1}% - \def\mhchem@cf@state{+}% - \else\if\mhchem@cf@state b% - \mhchem@bond{#1}% - \def\mhchem@cf@state{+}% - \else% - \mhchem@cf@length{#1}% - \ifnum\value{mhchem@cf@length}>1% - \if\mhchem@cf@state M% - \mhchem@cf@element=\expandafter{\the\mhchem@cf@element{#1}}% - \else% - \mhchem@cf@output@o{#1}% - \fi% - \else% - \if\mhchem@cf@state M% - \ifcat$\noexpand#1% - \mhchem@cf@output% - \def\mhchem@cf@state{+}% - \else% - \mhchem@cf@element=\expandafter{\the\mhchem@cf@element#1}% - \fi% - \else\ifx\ #1\mhchem@cf@output% - \else\ifx\protect#1% - \else\ifx#1\cmath% - \mhchem@cf@output% - \def\mhchem@cf@state{m}% - \else\ifx#1\bond% - \ifnum2<\mhchem@option@version% - \mhchem@cf@output% - \def\mhchem@cf@state{b}% - \else% - \mhchem@cf@output% - \sbond% - \fi% - \else\if\noexpand#1`% - \if\mhchem@cf@state s\def\mhchem@cf@state{P}% - \else\if\mhchem@cf@state 1\mhchem@cf@output\def\mhchem@cf@state{P}% - \else\if\mhchem@cf@state *\def\mhchem@cf@state{P}% - \else\def\mhchem@cf@state{E}% - \fi\fi\fi% - \else\if\noexpand#1,% - \if\mhchem@cf@state s\def\mhchem@cf@state{Q}% - \else\if\mhchem@cf@state 1\mhchem@cf@output\def\mhchem@cf@state{Q}% - \else\if\mhchem@cf@state *\def\mhchem@cf@state{Q}% - \else\def\mhchem@cf@state{F}% - \fi\fi\fi% - \else\ifx#1(% - \mhchem@cf@output@o{\mhchem@mathortext{#1}}% - \else\ifx#1)% - \mhchem@cf@output@o{\mhchem@mathortext{#1}}% - \else\ifx#1[% - \mhchem@cf@output@o{\mhchem@mathortext{#1}}% - \else\ifx#1]% - \mhchem@cf@output@o{\mhchem@mathortext{#1}}% - \else\ifx#1\{% - \mhchem@cf@output@o{\mhchem@mathortext{#1}}% - \else\ifx#1\}% - \mhchem@cf@output@o{\mhchem@mathortext{#1}}% - \else\ifx#1+% - \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup #1}% - \def\mhchem@cf@state{+}% - \else\ifx#1-% - \ifnum1<\mhchem@option@version% - \ifx\mhchem@END#2% - \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup \mhchem@cf@replaceminus{#1}}% - \def\mhchem@cf@state{+}% - \else% - \mhchem@cf@output% - \sbond% - \fi% - \else% - \mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup \mhchem@cf@replaceminus{#1}}% - \def\mhchem@cf@state{+}% - \fi% - \else\ifx#1=% - \ifnum1<\mhchem@option@version% - \mhchem@cf@output% - \dbond% - \else% - \mhchem@cf@output@o{#1}% - \fi% - \else\if\noexpand#1##% - \ifnum1<\mhchem@option@version% - \mhchem@cf@output% - \tbond% - \else% - \mhchem@cf@output@o{\#}% - \fi% - \else\ifx#1.% - \mhchem@cf@output% - \mhchem@mathortext@ii{\cdot}{\,\ensuremath{{\cdot}}\,}% - \def\mhchem@cf@state{s}% - \else\ifx#1*% - \mhchem@cf@output% - \mhchem@mathortext@ii{\cdot}{\,\ensuremath{{\cdot}}\,}% - \def\mhchem@cf@state{s}% - \else\ifcat 1\noexpand#1% - \if\mhchem@cf@state 2% - \else% - \if\mhchem@cf@state s% - \def\mhchem@cf@state{1}% - \else\if\mhchem@cf@state 1% - \else% - \def\mhchem@cf@state{2}% - \fi\fi% - \fi% - \mhchem@cf@number=\expandafter{\the\mhchem@cf@number #1}% - \else\ifcat a\noexpand#1% - \if\mhchem@cf@state a% - \else% - \if\mhchem@cf@state *\else\mhchem@cf@output% - \if\mhchem@cf@state s\else% - \nolinebreak% - \fi% - \fi% - \def\mhchem@cf@state{a}% - \fi% - \mhchem@cf@element=\expandafter{\the\mhchem@cf@element#1}% - \else% - \ifcat ^\noexpand#1% - \if\mhchem@cf@state s\def\mhchem@cf@state{p}% - \else\if\mhchem@cf@state 1\mhchem@cf@output\def\mhchem@cf@state{p}% - \else\if\mhchem@cf@state *\def\mhchem@cf@state{p}% - \else% - \ifx\@empty\the\mhchem@cf@sup\@empty%*** - \else\mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup\,}\fi% - \def\mhchem@cf@state{e}% - \fi\fi\fi% - \else\if^\noexpand#1% - \if\mhchem@cf@state s\def\mhchem@cf@state{p}% - \else\if\mhchem@cf@state 1\mhchem@cf@output\def\mhchem@cf@state{p}% - \else\if\mhchem@cf@state *\def\mhchem@cf@state{p}% - \else% - \ifx\@empty\the\mhchem@cf@sup\@empty%*** - \else\mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup\,}\fi% - \def\mhchem@cf@state{e}% - \fi\fi\fi% - \else\ifcat _\noexpand#1% - \if\mhchem@cf@state s\def\mhchem@cf@state{q}% - \else\if\mhchem@cf@state 1\mhchem@cf@output\def\mhchem@cf@state{q}% - \else\if\mhchem@cf@state *\def\mhchem@cf@state{q}% - \else\if\mhchem@cf@state 2\mhchem@cf@number=\expandafter{\the\mhchem@cf@number\,}\def\mhchem@cf@state{f}% - \else\def\mhchem@cf@state{f}% - \fi\fi\fi\fi% - \else\ifcat$\noexpand#1% - \mhchem@cf@output% - \def\mhchem@cf@state{M}% - \else% - \mhchem@cf@output@o{#1}% - \fi\fi\fi\fi% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% - \fi% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% - \mhchem@cf@length{#2}% - \mhchem@cf@i #2\mhchem@ENDEND% - \fi% + \let\mhchem@cf@replaceMathMinusDot@action\mhchem@cf@replaceMathMinusDot@appendNextToken% + \fi\fi\fi\fi\fi% + \mhchem@cf@replaceMathMinusDot@action% +} +%%% +\def\mhchem@cf@replaceMathMinusDot@continue{% + \futurelet\mhchem@cf@replaceMathMinusDot@lookahead\mhchem@cf@replaceMathMinusDot@i% +} +\def\mhchem@cf@replaceMathMinusDot@append#1#2{% + \mhchem@cf@replaceMathMinusDot@result=\expandafter{\the\mhchem@cf@replaceMathMinusDot@result#1}% + \mhchem@cf@replaceMathMinusDot@continue% +} +\def\mhchem@cf@replaceMathMinusDot@appendNextGroup#1{% + \mhchem@cf@replaceMathMinusDot@result=\expandafter{\the\mhchem@cf@replaceMathMinusDot@result{#1}}% + \mhchem@cf@replaceMathMinusDot@continue% } +\def\mhchem@cf@replaceMathMinusDot@appendNextToken#1{% + \mhchem@cf@replaceMathMinusDot@result=\expandafter{\the\mhchem@cf@replaceMathMinusDot@result#1}% + \mhchem@cf@replaceMathMinusDot@continue% +} +\def\mhchem@cf@replaceMathMinusDot@appendMath#1#2${% + \mhchem@cf@replaceMathMinusDot@result=\expandafter{\the\mhchem@cf@replaceMathMinusDot@result\text{\ensuremath{#2}}}% + \mhchem@cf@replaceMathMinusDot@continue% +}% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%% \mhchem@chemfive %%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand*{\mhchem@chemfive}[6]{% -% - \def\mhchem@largest@superscript{\smash[t]{2+}}% [4] - \def\mhchem@vphantommathortext##1{\vphantom{\mhchem@mathortext{##1}}}% [2][5] +%%%%%%%%%%%%%%%%%%%%% +%%% @chemfive %%% +%%%%%%%%%%%%%%%%%%%%% +%%% +%%% +%%% +%%% +%%% +%%% +%%% +\newcommand*\mhchem@chemfive[6]{% + {% + \mhchem@prepostscript% + [\mhchem@mathOrText{\smash[t]{2+}}]% + {\mhchem@mathOrText{#1}}% + {\mhchem@mathOrText{#2}}% + {\mhchem@mathOrText@ii{\mhchem@option@mathFont{#3}}{\text{#3}}}% + {\mhchem@mathOrText{#4}}% + {\mhchem@mathOrText{#5}}% + {\mhchem@mathOrText{#6}}% + }% +} + +%%% @prepostscript +%%% +%%% +%%% +%%% +%%% +%%% +%%% +\newlength\mhchem@prepostscript@tmp@i% +\newlength\mhchem@prepostscript@tmp@ii% +\newcommand*\mhchem@prepostscript[7][]{% \m@th% \ensuremath{% - \ifthenelse{\equal{#1#2}{}}{}{% - \setlength{\dimen0}{\widthof{${}^{% - \mhchem@mathortext{% [5] - #1% [1] - }% [5] - }$}}% [1] - \setlength{\dimen1}{\widthof{${}_{#2}$}}% [1] - \ifdim\dimen0<\dimen1\setlength{\dimen0}{\dimen1}\fi% [1] - \makebox{\vphantom{\text{#3}}}% [2] + \setlength{\mhchem@prepostscript@tmp@i}{\widthof{$#2#3$}}% + \ifdim\mhchem@prepostscript@tmp@i>0pt% + \setlength{\mhchem@prepostscript@tmp@i}{\widthof{${}^{#2}$}}% [1] + \setlength{\mhchem@prepostscript@tmp@ii}{\widthof{${}_{#3}$}}% [1] + \ifdim\mhchem@prepostscript@tmp@i<\mhchem@prepostscript@tmp@ii% + \setlength{\mhchem@prepostscript@tmp@i}{\mhchem@prepostscript@tmp@ii}\fi% [1] + \vphantom{#4}% [2] {}% ^{% - \mhchem@mathboxright{\dimen0}{% [1] - \mhchem@vphantommathortext{#5#6}% [2][5] - \mhchem@vphantommathortext{\mhchem@largest@superscript}% [4][5] - \mhchem@mathortext{% [5] - #1% - }% [5] + \mhchem@mathboxright{\mhchem@prepostscript@tmp@i}{% [1] + \vphantom{#6#7}% [2] + \vphantom{#1}% [4] + #2% }% [1] }% _{% - \mhchem@mathboxright{\dimen0}{% [1] - \mhchem@vphantommathortext{#4}% [2][5] - \mhchem@mathortext{% [5] - #2% - }% [5] + \mhchem@mathboxright{\mhchem@prepostscript@tmp@i}{% [1] + \vphantom{#5}% [2] + #3% }% [1] }% \mhchem@minispace% [3] - }% - \mhchem@mathortext@ii{% [5] - \mhchem@option@mathfont {#3}% - }{\text{#3}}% [5] - \ifthenelse{\equal{#4#5}{}}{}{% + \fi% + #4% + \setlength{\mhchem@prepostscript@tmp@i}{\widthof{$#5#6$}}% + \ifdim\mhchem@prepostscript@tmp@i>0pt% _{% - \mhchem@vphantommathortext{#2}% [2][5] - \mhchem@mathortext{% [5] - #4% - }% [5] + \vphantom{#3}% [2] + #5% }% ^{% - \mhchem@vphantommathortext{#1#6}% [2][5] - \mhchem@vphantommathortext{\mhchem@largest@superscript}% [4][5] - \mhchem@mathortext{% [5] - #5% - }% [5] + \vphantom{#2#7}% [2] + \vphantom{#1}% [4] + #6 }% - }% - \ifthenelse{\equal{#6}{}}{}{% + \fi% + \setlength{\mhchem@prepostscript@tmp@i}{\widthof{$#7$}}% + \ifdim\mhchem@prepostscript@tmp@i>0pt% \mhchem@minispace% [3] {}% - _{\mhchem@vphantommathortext{#2#4}}% [2][5] + _{\vphantom{#3#5}}% [2] ^{% - \mhchem@vphantommathortext{#1#5}% [2][5] - \mhchem@vphantommathortext{\mhchem@largest@superscript}% [4][5] - \mhchem@mathortext{% [5] - #6% - }% [5] + \vphantom{#2#6}% [2] + \vphantom{#1}% [4] + #7% }% - }% + \fi% }% % % @@ -1168,67 +1889,77 @@ % % % -% } +%%% @mathbox +%%% +%%% \newcommand*\mhchem@mathbox[2][]{% \mathchoice% {\mhchem@mathbox@ii{\displaystyle}{#1}{#2}}% {\mhchem@mathbox@ii{\textstyle}{#1}{#2}}% {\mhchem@mathbox@ii{\scriptstyle}{#1}{#2}}% {\mhchem@mathbox@ii{\scriptscriptstyle}{#1}{#2}}}% +\newlength\mhchem@mathbox@tmp@i +\newlength\mhchem@mathbox@tmp@ii \newcommand*\mhchem@mathbox@ii[3]{% - \setlength{\dimen1}{\widthof{\ensuremath{#1#2}}}% - \setlength{\dimen2}{\widthof{\ensuremath{#1#3}}}% - \ifdim\dimen1<\dimen2% + \setlength{\mhchem@mathbox@tmp@i}{\widthof{\ensuremath{#1#2}}}% + \setlength{\mhchem@mathbox@tmp@ii}{\widthof{\ensuremath{#1#3}}}% + \ifdim\mhchem@mathbox@tmp@i<\mhchem@mathbox@tmp@ii% \mhchem@mathbox@i{#3}% \else% - \makebox[\dimen1]{\ensuremath{#1#3}}% + \makebox[\mhchem@mathbox@tmp@i]{\ensuremath{#1#3}}% \fi} \newcommand*\mhchem@mathbox@i[1]{\mathchoice% {\mbox{\ensuremath{\displaystyle#1}}}% {\mbox{\ensuremath{\textstyle#1}}}% {\mbox{\ensuremath{\scriptstyle#1}}}% {\mbox{\ensuremath{\scriptscriptstyle#1}}}} - + +%%% @mathboxright \newcommand*\mhchem@mathboxright[2]{\mathchoice% {\makebox[#1][r]{\ensuremath{\displaystyle#2}}}% {\makebox[#1][r]{\ensuremath{\textstyle#2}}}% {\makebox[#1][r]{\ensuremath{\scriptstyle#2}}}% {\makebox[#1][r]{\ensuremath{\scriptscriptstyle#2}}}} +%%% @minispace +%%% +%%% +\newlength\mhchem@minispace@tmp \newcommand*\mhchem@minispace{% - \setlength{\dimen2}{0pt-\widthof{${}^8_8$}+% - \widthof{$\text{C}^8_8$}-\widthof{$\text{C}^{}_{}$}}% [3] - \kern\dimen2% - % - % + \setlength{\mhchem@minispace@tmp}{0pt-\widthof{${}^8_8$}+% + \widthof{$\text{C}^8_8$}-\widthof{$\text{C}^{}_{}$}}% [3] + \kern\mhchem@minispace@tmp% } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%% Options %%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% Package Options %%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mhchem@option@version{0} \define@key{mhchem}{version}{\def\mhchem@option@version{#1}} -\def\mhchem@option@mathfont{\mathrm} -\def\mhchem@option@textfont{} -\define@key{mhchem}{textfontcommand}{\def\mhchem@option@textfont{#1}} -\define@key{mhchem}{textfontname}{\def\mhchem@option@textfont{\csname#1\endcsname}} -\define@key{mhchem}{mathfontcommand}{\def\mhchem@option@mathfont{#1}} -\define@key{mhchem}{mathfontname}{\def\mhchem@option@mathfont{\csname#1\endcsname}} +\def\mhchem@option@mathFont{\mathrm} +\def\mhchem@option@textFont{} +\define@key{mhchem}{textfontcommand}{\def\mhchem@option@textFont{#1}} +\define@key{mhchem}{textfontname}{\def\mhchem@option@textFont{\csname#1\endcsname}} +\define@key{mhchem}{mathfontcommand}{\def\mhchem@option@mathFont{#1}} +\define@key{mhchem}{mathfontname}{\def\mhchem@option@mathFont{\csname#1\endcsname}} \define@key{mhchem}{font}{% \ifthenelse{\equal{sf}{#1}}{% - \def\mhchem@option@textfont{\sffamily}% - \def\mhchem@option@mathfont{\mathsf}% + \def\mhchem@option@textFont{\sffamily}% + \def\mhchem@option@mathFont{\mathsf}% }{\ifthenelse{\equal{}{#1}}{% - \def\mhchem@option@textfont{}% - \def\mhchem@option@mathfont{\mathrm}% + \def\mhchem@option@textFont{}% + \def\mhchem@option@mathFont{\mathrm}% }{\PackageError{mhchem}{Font option `#1' unknown}}}% } +% +\def\mhchem@option@alwaystextmode{0}% + \newlength\mhchem@option@minussidebearingleft \newlength\mhchem@option@minussidebearingright \setlength\mhchem@option@minussidebearingleft{0.06em} @@ -1251,9 +1982,11 @@ % % % +% +% Replicate layout of MS Word (superscript after subscript, not over) \def\mhchem@option@usenonsimultaneoussubsuperscripts{0}% -\def\mhchem@option@alwaystextmode{0}% +% There is no key defined for this option, as to promote good typographic conventions. \mhchem@definearrows{font} \define@key{mhchem}{arrows}{% @@ -1264,6 +1997,20 @@ \mhchem@definearrows{#1}% } +\def\mhchem@option@skipAfterAmount{\,} +\define@key{mhchem}{skip-after-amount}{\def\mhchem@option@skipAfterAmount{#1}\def\mhchem@option@skipAfterFracAmount{#1}} +\def\mhchem@option@skipAfterFracAmount{\,} +\define@key{mhchem}{skip-after-frac-amount}{\def\mhchem@option@skipAfterFracAmount{#1}} +% + +\def\mhchem@option@textminus{--} +\define@key{mhchem}{textminus}{\def\mhchem@option@textminus{#1}} +% + +\def\mhchem@option@textcdot{\cdot} +\define@key{mhchem}{textcdot}{\def\mhchem@option@textcdot{#1}} +% + %%% begin: standard keyval handling as in many other packages \def\ProcessOptionsWithKV#1{% \let\@tempc\relax% @@ -1289,23 +2036,35 @@ \ProcessOptionsWithKV{mhchem}\relax %%% end: -\define@key{mhchem}{arrows}{\mhchem@definearrows{#1}} +\define@key{mhchem}{arrows}{\mhchem@definearrows{#1}}% \newcommand*\mhchemoptions[1]{\setkeys{mhchem}{#1}} -\ifnum0=\mhchem@option@version% +\ifnum 0=\mhchem@option@version% \PackageWarningNoLine{mhchem}{% You did not specify a 'version' option for the mhchem\MessageBreak - package. This means you EITHER have an existing\MessageBreak - document and mhchem was updated to a newer version.\MessageBreak - Please check the mhchem manual in that case! OR, you\MessageBreak - are about to create a new document; in this case,\MessageBreak + package. If you are about to create a new document,\MessageBreak please write \string\usepackage[version=3]{mhchem} in your preamble in\MessageBreak order to use the most recent version of mhchem}% - \def\mhchem@option@version{1}% -\else% -\fi% + \def\mhchem@option@version{3}% +\else\ifnum 4=\mhchem@option@version% + \PackageWarningNoLine{mhchem}{% + You are using version 3.09 of mhchem. You entered\MessageBreak + the parameter version=4. This means, you are using\MessageBreak + some beta features of mhchem that are subject\MessageBreak + to change without notice}% +\fi\fi% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%% misc %%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\ifnum 4>\mhchem@option@version + \newcommand*\mhchem@cmath[1]{\ensuremath{\text{\ensuremath{#1}}}}% + \newcommand*\cmath[1]{\mhchem@cmath{#1}} + \newcommand*\cf[2][]{\mhchem@cf[#1]{#2}} + \newcommand*\hyphen{\mhchem@hyphen} +\fi @@ -1315,23 +2074,29 @@ -%TODO: option for CrO_4{}^{2-} instead of CrO_4^{2-} - proper switch option [wordstyle] and documentation -%TODO: option to use nicefrac -%TODO: option for automatically using nicefrac im text mode -%TODO: kerning if superscript is followed by arrow (inside ce), comma (outside) etc. -%TODO: make sure a \cf in a (uppercase) heading retains its mixed case -% from fancyhdr.sty version 3.0: -% \def\nouppercase##1{{\let\uppercase\relax\let\MakeUppercase\relax -% \expandafter\let\csname MakeUppercase \endcsname\relax##1}}% -%TODO: bold Parts of formulae? -%TODO: Option for longer arrows -%TODO: spacing? X2 Y ^2- before ^ -%TODO: always minimum length of arrows? override? -%TODO: count0 und dimen@ eliminieren +% +% +% +% +% +% +% +% +% +% +% +% +% % % % +% \def\mhchem@END{} -%\def\mhchem@ENDEND{} -\def\mhchem@empty{} \ No newline at end of file +\def\mhchem@macro{} +\def\mhchem@empty{} +% +\edef\mhchem@lbracechar{\string{} %} +\def\mhchem@gobble#1{}% +% +%- todo: \sbond etc. aus Anleitung für v4 entfernen \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty b/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty index 3bb3531f009..59137891f63 100644 --- a/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty +++ b/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty @@ -52,7 +52,7 @@ % mhchem.pdf and legal.txt. % % -\ProvidesPackage{rsphrase}[2010/06/16 v3.08 Risk and Safety Phrases (mhchem bundle)] +\ProvidesPackage{rsphrase}[2011/04/26 v3.09 Risk and Safety Phrases (mhchem bundle)] \RequirePackage{ifthen} \RequirePackage{textcomp} -- cgit v1.2.3