%% mhchem.sty %% Copyright 2004-2015 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. % % \ProvidesPackage{mhchem}[2015/02/09 v3.19 for typesetting chemical formulae] \RequirePackage{ifthen} \RequirePackage{calc}[1998/07/07] \RequirePackage{amsmath} \RequirePackage{keyval} \RequirePackage{graphics} \RequirePackage{expl3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% misc %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclareMathSymbol{\mhchem@hyphen}{0}{operators}{45} \def\mhchem@END{\mhchem@END} \def\mhchem@macro{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% \cee %%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*{\cee}[1]{% \def\mhchem@ce@out{}% {\mhchem@cee@i#1\\\mhchem@END\mhchem@ENDEND}% \ensuremath{% \mhchem@ce@out% }% }% \def\mhchem@cee@i#1\\#2#3\mhchem@ENDEND{% \ifx\mhchem@END#2% \mhchem@cee@ii#1&\mhchem@END\mhchem@ENDEND% \else% \mhchem@cee@ii#1&\mhchem@END\mhchem@ENDEND% \g@addto@macro\mhchem@ce@out{\\}% \@ifnextchar[% \mhchem@cee@optArg% \mhchem@cee@i#2#3\mhchem@ENDEND% \fi% } \def\mhchem@cee@optArg[#1]{% \g@addto@macro\mhchem@ce@out{[#1]}\mhchem@cee@i% } \long\def\mhchem@cee@ii#1#3\mhchem@ENDEND{% \ifx\mhchem@END#2% \g@addto@macro\mhchem@ce@out{\ce{#1}}% \else% \g@addto@macro\mhchem@ce@out{\ce{#1}}% \g@addto@macro\mhchem@ce@out{&}% \mhchem@cee@ii#2#3\mhchem@ENDEND% \fi% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% global helpers %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mhchem@appendToks#1#2{% #1=\expandafter{\the#1#2}% } \ExplSyntaxOn \int_new:N \__mhchem_option_version_int \cs_generate_variant:Nn \str_if_eq:nnTF { Vn } \cs_generate_variant:Nn \peek_catcode_remove:NTF { oTF } \cs_generate_variant:Nn \peek_catcode:NTF { oTF } \cs_generate_variant:Nn \str_case:nnn { Vnn } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% loop helpers %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \cs_new_protected:Npn \__mhchem_loopHelper_appendNextToken:NNn #1#2#3 { \tl_put_right:Nn #1 {#3} #2 } \cs_new_protected:Npn \__mhchem_loopHelper_appendNextGroup:NNn #1#2#3 { \tl_put_right:Nn #1 { { #3 } } #2 } \cs_new_protected:Npn \__mhchem_loopHelper_appendMathA:NNw #1#2#3$ { \tl_put_right:Nn #1 { $ #3 $ } #2 } \cs_new_protected:Npn \__mhchem_loopHelper_appendMathB:NNw #1#2#3$ { \tl_put_right:Nn #1 { \text { \ensuremath { #3 } } } #2 } \cs_new_protected:Npn \__mhchem_loopHelper_appendMathAsGroup:NNw #1#2#3$ { \tl_put_right:Nn #1 { \text { \ensuremath { #3 } } } #2 } \cs_new_protected:Npn \__mhchem_loopHelper_appendNextTokenAsMathrm:NNn #1#2#3 { \tl_put_right:Nn #1 { \ensuremath { \mathrm { #3 } } } #2 } \cs_new_protected:Npn \__mhchem_loopHelper_ignoreNextToken:Nn #1#2 { #1 } \ExplSyntaxOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% \ce %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% \/ %%% Prevent argument from expanding when written to .aux %%%%%%%%%% Solution by Heiko Oberdiek %%%%%%%%%% http://tex.stackexchange.com/questions/160306/prevent-caption-from-expanding-argument-too-early \newcommand*{\ce}{% \ifx\protect\@typeset@protect \csname ce \expandafter\endcsname \else \ifx\protect\@unexpandable@protect \protect@unexpand@cmd@arg\ce \else \ifx\protect\string \protect@string@cmd@arg\ce \else \expandafter\protect@unknown@cmd@arg \csname ce \endcsname \fi \fi \fi } \expandafter\newcommand\csname ce \endcsname[1]{% \mhchem@ce{#1}% } % unexpanded protect \def\protect@unexpand@cmd@arg#1\else#2\fi\fi\fi#3{% \fi\fi \ifx\thepage\relax \detokenize \else \unexpanded \fi {#1{#3}}% } % display protect \def\protect@string@cmd@arg#1\else#2\fi\fi\fi#3{% \fi\fi\fi \detokenize{#1{#3}}% } % unknown protect \def\protect@unknown@cmd@arg#1\fi\fi\fi{% \fi\fi\fi \protect#1% } %%%%%%%%%% %%% /\ %%% \ExplSyntaxOn \msg_new:nnn { mhchem } { ce/unexpected-state } { Assertion~failed:~Unexpected~internal~state~'#1' (ce).~You~found~a~bug.~ Please~contact~the~package~author. } \tl_new:N \__mhchem_ce_state_tl \tl_new:N \__mhchem_ce_arrowName_tl \tl_new:N \__mhchem_ce_arrowTypeOne_tl \tl_new:N \__mhchem_ce_arrowTextOne_tl \tl_new:N \__mhchem_ce_arrowTypeTwo_tl \tl_new:N \__mhchem_ce_arrowTextTwo_tl \newcommand*\mhchem@ce[1]{ \__mhchem_ce:n {#1} } \cs_new_protected:Npn \__mhchem_ce:n #1 { \group_begin: \def\hyphen{\mhchem@hyphen}% \tl_clear_new:N \__mhchem_ce_result_tl \tl_clear_new:N \__mhchem_ce_part_tl \tl_set:Nn \__mhchem_ce_state_tl { c } \__mhchem_ce_loop: #1 \q_recursion_stop \int_set:Nn \__mhchem_option_version_int { \mhchem@option@version } \int_compare:nTF { 1 < \__mhchem_option_version_int } { \tl_use:N \__mhchem_ce_result_tl } { \ensuremath{\tl_use:N \__mhchem_ce_result_tl} } \group_end: } \cs_new_protected:Npn \__mhchem_ce_loop: { \str_case:Vnn \__mhchem_ce_state_tl { { c } { \str_case:Vnn \__mhchem_ce_part_tl { { + } { \tl_put_right:Nn \__mhchem_ce_result_tl { \ensuremath{{}+{}} } \tl_clear:N \__mhchem_ce_part_tl } { -> } { \tl_set:Nn \__mhchem_ce_arrowName_tl { yields } \__mhchem_ce_loop_startArrow: } { <- } { \tl_set:Nn \__mhchem_ce_arrowName_tl { yieldsLeft } \__mhchem_ce_loop_startArrow: } { <--> } { \tl_set:Nn \__mhchem_ce_arrowName_tl { yieldsLeftRight } \__mhchem_ce_loop_startArrow: } { <-> } { \tl_set:Nn \__mhchem_ce_arrowName_tl { mesomerism } \__mhchem_ce_loop_startArrow: } { <=> } { \tl_set:Nn \__mhchem_ce_arrowName_tl { equilibrium } \__mhchem_ce_loop_startArrow: } { <<=> } { \tl_set:Nn \__mhchem_ce_arrowName_tl { equilibriumLeft } \__mhchem_ce_loop_startArrow: } { <=>> } { \tl_set:Nn \__mhchem_ce_arrowName_tl { equilibriumRight } \__mhchem_ce_loop_startArrow: } } {} } } {} \peek_meaning_remove:NTF \q_recursion_stop { \__mhchem_ce_output: }{ \str_case:Vnn \__mhchem_ce_state_tl { { c } { \peek_charcode_remove:NTF \c_space_token { \__mhchem_ce_output: \__mhchem_ce_loop: }{ \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathA:NNw \__mhchem_ce_part_tl \__mhchem_ce_loop: }{ \peek_catcode:NTF \c_group_begin_token { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_ce_part_tl \__mhchem_ce_loop: } % else { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_part_tl \__mhchem_ce_loop: } }} } { a-t1 } { \peek_charcode_remove:NTF \c_space_token { \__mhchem_ce_output: \__mhchem_ce_loop: }{ \peek_charcode:NTF T { \tl_set:Nn \__mhchem_ce_state_tl { a-[1 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTypeOne_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF M { \tl_set:Nn \__mhchem_ce_state_tl { a-[1 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTypeOne_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF C { \tl_set:Nn \__mhchem_ce_state_tl { a-[1 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTypeOne_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF [ { \tl_set:Nn \__mhchem_ce_state_tl { a-]1 } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_ce_loop: } % else { \str_case:Vnn \__mhchem_ce_arrowName_tl { { yieldsLeft } { \peek_charcode:NTF - { \tl_set:Nn \__mhchem_ce_state_tl { c } \tl_set:Nn \__mhchem_ce_part_tl { <- } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_part_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF > { \tl_set:Nn \__mhchem_ce_state_tl { c } \tl_set:Nn \__mhchem_ce_part_tl { <- } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_part_tl \__mhchem_ce_loop: } % else { \__mhchem_ce_output: \__mhchem_ce_loop: } } } { equilibrium } { \peek_charcode:NTF > { \tl_set:Nn \__mhchem_ce_state_tl { c } \tl_set:Nn \__mhchem_ce_part_tl { <=> } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_part_tl \__mhchem_ce_loop: } % else { \__mhchem_ce_output: \__mhchem_ce_loop: } } } % else { \__mhchem_ce_output: \__mhchem_ce_loop: } } }}}} } { a-[1 } { \peek_charcode:NTF [ { \tl_set:Nn \__mhchem_ce_state_tl { a-]1 } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_ce_loop: } % else { \__mhchem_ce_output: \__mhchem_ce_loop: } } { a-]1 } { \peek_charcode_remove:NTF \c_space_token { \tl_put_right:Nn \__mhchem_ce_arrowTextOne_tl { ~ } \__mhchem_ce_loop: }{ \peek_charcode:NTF ] { \tl_set:Nn \__mhchem_ce_state_tl { a-t2 } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_ce_loop: }{ \peek_catcode:NTF \c_group_begin_token { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_ce_arrowTextOne_tl \__mhchem_ce_loop: }{ \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathB:NNw \__mhchem_ce_arrowTextOne_tl \__mhchem_ce_loop: } % else { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTextOne_tl \__mhchem_ce_loop: } }}} } { a-t2 } { \peek_charcode_remove:NTF \c_space_token { \__mhchem_ce_output: \__mhchem_ce_loop: }{ \peek_charcode:NTF T { \tl_set:Nn \__mhchem_ce_state_tl { a-[2 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTypeTwo_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF M { \tl_set:Nn \__mhchem_ce_state_tl { a-[2 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTypeTwo_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF C { \tl_set:Nn \__mhchem_ce_state_tl { a-[2 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTypeTwo_tl \__mhchem_ce_loop: }{ \peek_charcode:NTF [ { \tl_set:Nn \__mhchem_ce_state_tl { a-]2 } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_ce_loop: } % else { \__mhchem_ce_output: \__mhchem_ce_loop: } }}}} } { a-[2 } { \peek_charcode:NTF [ { \tl_set:Nn \__mhchem_ce_state_tl { a-]2 } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_ce_loop: } % else { \__mhchem_ce_output: \__mhchem_ce_loop: } } { a-]2 } { \peek_charcode_remove:NTF \c_space_token { \tl_put_right:Nn \__mhchem_ce_arrowTextTwo_tl { ~ } \__mhchem_ce_loop: }{ \peek_charcode:NTF ] { \__mhchem_ce_output: \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_ce_loop: }{ \peek_catcode:NTF \c_group_begin_token { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_ce_arrowTextTwo_tl \__mhchem_ce_loop: }{ \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathB:NNw \__mhchem_ce_arrowTextTwo_tl \__mhchem_ce_loop: } % else { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_arrowTextTwo_tl \__mhchem_ce_loop: } }}} } } { \msg_error:nnx { mhchem } { ce/unexpected-state } { \__mhchem_ce_state_tl } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_ce_result_tl \__mhchem_ce_loop: } } } \cs_new_protected:Npn \__mhchem_ce_output: { \str_case:Vnn \__mhchem_ce_state_tl { { c } { \str_if_eq:VnTF \__mhchem_ce_part_tl { - } { \tl_put_right:Nn \__mhchem_ce_result_tl { \ensuremath{{}-{}} } }{ \str_if_eq:VnTF \__mhchem_ce_part_tl { (v) } { \tl_put_right:Nn \__mhchem_ce_result_tl { \ensuremath{{}\mathop{\downarrow}{}} } }{ \str_if_eq:VnTF \__mhchem_ce_part_tl { v } { \tl_put_right:Nn \__mhchem_ce_result_tl { \ensuremath{{}\mathop{\downarrow}{}} } }{ \str_if_eq:VnTF \__mhchem_ce_part_tl { (^) } { \tl_put_right:Nn \__mhchem_ce_result_tl { \ensuremath{{}\mathop{\uparrow}{}} } }{ \str_if_eq:VnTF \__mhchem_ce_part_tl { ^ } { \tl_put_right:Nn \__mhchem_ce_result_tl { \ensuremath{{}\mathop{\uparrow}{}} } } % else { \tl_if_empty:NTF \__mhchem_ce_part_tl {} { \tl_put_right:Nx \__mhchem_ce_result_tl { \exp_not:N \__mhchem_cf:nn {} { \exp_not:V \__mhchem_ce_part_tl } } } } }}}} } { a-t1 } { \__mhchem_ce_outputArrow:ooooo { \__mhchem_ce_arrowName_tl } {} {} {} {} } { a-[1 } { \__mhchem_ce_outputArrow:ooooo { \__mhchem_ce_arrowName_tl } {} {} {} {} \tl_set:NV \__mhchem_ce_part_tl \__mhchem_ce_arrowTypeOne_tl \tl_set:Nn \__mhchem_ce_state_tl { c } \__mhchem_ce_output: } { a-]1 } { \__mhchem_ce_outputArrow:ooooo { \__mhchem_ce_arrowName_tl } { \__mhchem_ce_arrowTypeOne_tl } { \__mhchem_ce_arrowTextOne_tl } {} {} } { a-t2 } { \__mhchem_ce_outputArrow:ooooo { \__mhchem_ce_arrowName_tl } { \__mhchem_ce_arrowTypeOne_tl } { \__mhchem_ce_arrowTextOne_tl } {} {} } { a-[2 } { \__mhchem_ce_outputArrow:ooooo { \__mhchem_ce_arrowName_tl } { \__mhchem_ce_arrowTypeOne_tl } { \__mhchem_ce_arrowTextOne_tl } {} {} \tl_set:NV \__mhchem_ce_part_tl \__mhchem_ce_arrowTypeTwo_tl \tl_set:Nn \__mhchem_ce_state_tl { c } \__mhchem_ce_output: } { a-]2 } { \__mhchem_ce_outputArrow:ooooo { \__mhchem_ce_arrowName_tl } { \__mhchem_ce_arrowTypeOne_tl } { \__mhchem_ce_arrowTextOne_tl } { \__mhchem_ce_arrowTypeTwo_tl } { \__mhchem_ce_arrowTextTwo_tl } } } {} \tl_clear:N \__mhchem_ce_part_tl \tl_set:Nn \__mhchem_ce_state_tl { c } } \cs_new_protected:Npn \__mhchem_ce_outputArrow:nnnnn #1#2#3#4#5 { \tl_put_right:Nn \__mhchem_ce_result_tl { \__mhchem_arrow_deploy:nnnnn {#1} {#2} {#3} {#4} {#5} } \tl_clear:N \__mhchem_ce_part_tl \tl_set:Nn \__mhchem_ce_state_tl { c } } \cs_generate_variant:Nn \__mhchem_ce_outputArrow:nnnnn {ooooo} \cs_new_protected:Npn \__mhchem_ce_loop_startArrow: { \tl_set:Nn \__mhchem_ce_state_tl { a-t1 } \tl_clear:N \__mhchem_ce_arrowTypeOne_tl \tl_clear:N \__mhchem_ce_arrowTextOne_tl \tl_clear:N \__mhchem_ce_arrowTypeTwo_tl \tl_clear:N \__mhchem_ce_arrowTextTwo_tl \tl_clear:N \__mhchem_ce_part_tl } \cs_new_protected:Npn \__mhchem_ce_loop_abortArrow: { \tl_put_right:Nx \__mhchem_ce_part_tl { \tl_set:Nn \__mhchem_ce_state_tl { a-t1 } \exp_not:V \__mhchem_ce_arrowTypeOne_tl \exp_not:V \__mhchem_ce_arrowTextOne_tl \exp_not:V \__mhchem_ce_arrowTypeTwo_tl \exp_not:V \__mhchem_ce_arrowTextTwo_tl } \tl_set:Nn \__mhchem_ce_state_tl { c } } \ExplSyntaxOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% arrows %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\mhchem@arrow@minlength{{2em}}% %%% Deployment of arrow macros \ExplSyntaxOn \msg_new:nnn { mhchem } { unexpected-arrow-type } { Assertion~failed:~Unexpected~arrow~type~'#1'.~You~found~a~bug.~ Please~contact~the~package~author. } \cs_new_protected:Npn \__mhchem_arrow_deploy:nnnnn #1#2#3#4#5 { \str_case:nnn {#2} { { } { \int_compare:nTF { 3 < \__mhchem_option_version_int } { \cs:w mhchem@arrow@#1T \cs_end: {#3}{#5} } { \cs:w mhchem@arrow@#1M \cs_end: {#3}{#5} } } { M } { \cs:w mhchem@arrow@#1M \cs_end: {#3}{#5} } { T } { \cs:w mhchem@arrow@#1T \cs_end: {#3}{#5} } { C } { \cs:w mhchem@arrow@#1C \cs_end: {#3}{#5} } } { \msg_error:nnn { mhchem } { unexpected-arrow-type } {#2} } } \ExplSyntaxOff %%% Definition of arrows (with math text) for font/pgf/pgf-filled \newcommand*\mhchem@arrow@yieldsM[2]{} \newcommand*\mhchem@arrow@yieldsLeftM[2]{} \newcommand*\mhchem@arrow@yieldsLeftRightM[2]{} \newcommand*\mhchem@arrow@mesomerismM[2]{} \newcommand*\mhchem@arrow@equilibriumM[2]{} \newcommand*\mhchem@arrow@equilibriumRightM[2]{} \newcommand*\mhchem@arrow@equilibriumLeftM[2]{} \newcommand\mhchem@definearrows[1]{% %%% font \ifthenelse{\equal{#1}{font}}{% \renewcommand*\mhchem@arrow@yieldsM[2]{% \ensuremath{{}\mhchem@ext@arrow{5}{9}{##1}{5}{9}{##2}{\mhchem@arrow@minlength}{\rightarrowfill@}{}}}% \renewcommand*\mhchem@arrow@yieldsLeftM[2]{% \ensuremath{{}\mhchem@ext@arrow{9}{5}{##1}{9}{5}{##2}{\mhchem@arrow@minlength}{\leftarrowfill@}{}}}% \renewcommand*\mhchem@arrow@yieldsLeftRightM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##2}% {\rlap{\raisebox{.44ex}{$\mhchem@ext@arrow{9}{9}{##1}{9}{9}{}{\mhchem@arrow@minlength}{\rightarrowfill@}$}}}% {\rlap{\raisebox{.44ex}{$\mhchem@ext@arrow{9}{9}{##1}{9}{9}{\hphantom{##2}}{\mhchem@arrow@minlength}{\rightarrowfill@}$}}}% \@ifempty{##1}% {\raisebox{-.44ex}{$\mhchem@ext@arrow{9}{9}{}{9}{9}{##2}{\mhchem@arrow@minlength}{\leftarrowfill@}$}}% {\raisebox{-.44ex}{$\mhchem@ext@arrow{9}{9}{\hphantom{##1}}{9}{9}{##2}{\mhchem@arrow@minlength}{\leftarrowfill@}$}}% }{}}}% \renewcommand*\mhchem@arrow@mesomerismM[2]{% \ensuremath{{}\mhchem@ext@arrow{9}{9}{##1}{9}{9}{##2}{\mhchem@arrow@minlength}{\leftrightarrowfill@}{}}}% \renewcommand*\mhchem@arrow@equilibriumM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##2}% {\rlap{\raisebox{.22ex}{$\mhchem@ext@arrow{5}{9}{##1}{9}{9}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}}% {\rlap{\raisebox{.22ex}{$\mhchem@ext@arrow{9}{9}{##1}{9}{5}{\hphantom{##2}}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}}% \@ifempty{##1}% {\raisebox{-.22ex}{$\mhchem@ext@arrow{9}{9}{}{9}{5}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondownfill@}$}}% {\raisebox{-.22ex}{$\mhchem@ext@arrow{5}{9}{\hphantom{##1}}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondownfill@}$}}% }{}}}% \renewcommand*\mhchem@arrow@equilibriumRightM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##1}{% \rlap{\raisebox{-.22ex}{$\kern0.5em\mhchem@ext@arrow{0}{0}{}{9}{5}{##2}{\mhchem@arrow@minlength-1em}{\mhchem@leftharpoondownfill@}$}}% \@ifempty{##2}% {\raisebox{.22ex}{$\mhchem@ext@arrow{0}{0}{}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}% {\raisebox{.22ex}{$\mhchem@ext@arrow{0}{0}{}{9}{5}{\hphantom{##2}\kern1em}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}% }{% \rlap{\raisebox{-.22ex}{$\kern0.5em\mhchem@ext@arrow{5}{9}{\hphantom{##1}\kern-1em}{9}{9}{##2}{\mhchem@arrow@minlength-1em}{\mhchem@leftharpoondownfill@}$}}% \@ifempty{##2}% {\raisebox{.22ex}{$\mhchem@ext@arrow{5}{9}{##1}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}% {\raisebox{.22ex}{$\mhchem@ext@arrow{9}{9}{##1}{9}{9}{\hphantom{##2}\kern1em}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}% }% }{}}}% \renewcommand*\mhchem@arrow@equilibriumLeftM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##2}{% \rlap{\raisebox{.22ex}{$\kern0.5em\mhchem@ext@arrow{5}{9}{##1}{0}{0}{}{\mhchem@arrow@minlength-1em}{\mhchem@rightharpoonupfill@}$}}% \@ifempty{##1}% {\raisebox{-.22ex}{$\mhchem@ext@arrow{0}{0}{}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@leftharpoondownfill@}$}}% {\raisebox{-.22ex}{$\mhchem@ext@arrow{5}{9}{\hphantom{##1}\kern1em}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@leftharpoondownfill@}$}}% }{% \rlap{\raisebox{.22ex}{$\kern0.5em\mhchem@ext@arrow{9}{9}{##1}{5}{9}{\hphantom{##2}\kern-1em}{\mhchem@arrow@minlength-1em}{\mhchem@rightharpoonupfill@}$}}% \@ifempty{##1}% {\raisebox{-.22ex}{$\mhchem@ext@arrow{0}{0}{}{9}{5}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondownfill@}$}}% {\raisebox{-.22ex}{$\mhchem@ext@arrow{9}{9}{\hphantom{##1}\kern1em}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondownfill@}$}}% }% }{}}}% %%% pgf }{\ifthenelse{\equal{#1}{pgf} \or \equal{#1}{pgf-filled}}{% \renewcommand*\mhchem@arrow@yieldsM[2]{% \ensuremath{{}\mhchem@ext@arrow@pgf{5}{9}{##1}{5}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@rightarrow@pgf}{}}}% \renewcommand*\mhchem@arrow@yieldsLeftM[2]{% \ensuremath{{}\mhchem@ext@arrow@pgf{9}{5}{##1}{9}{5}{##2}{\mhchem@arrow@minlength}{\mhchem@leftarrow@pgf}{}}}% \renewcommand*\mhchem@arrow@yieldsLeftRightM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##2}% {\rlap{\raisebox{.44ex}{$\mhchem@ext@arrow@pgf{9}{9}{##1}{9}{9}{}{\mhchem@arrow@minlength}{\mhchem@rightarrow@pgf}$}}}% {\rlap{\raisebox{.44ex}{$\mhchem@ext@arrow@pgf{9}{9}{##1}{9}{9}{\hphantom{##2}}{\mhchem@arrow@minlength}{\mhchem@rightarrow@pgf}$}}}% \@ifempty{##1}% {\raisebox{-.44ex}{$\mhchem@ext@arrow@pgf{9}{9}{}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftarrow@pgf}$}}% {\raisebox{-.44ex}{$\mhchem@ext@arrow@pgf{9}{9}{\hphantom{##1}}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftarrow@pgf}$}}% }{}}}% \renewcommand*\mhchem@arrow@mesomerismM[2]{% \ensuremath{{}\mhchem@ext@arrow@pgf{9}{9}{##1}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftrightarrow@pgf}{}}}% \renewcommand*\mhchem@arrow@equilibriumM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##2}% {\rlap{\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{5}{9}{##1}{9}{9}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}}% {\rlap{\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{9}{9}{##1}{9}{5}{\hphantom{##2}}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}}% \@ifempty{##1}% {\raisebox{-.22ex}{$\mhchem@ext@arrow@pgf{9}{9}{}{9}{5}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondown@pgf}$}}% {\raisebox{-.22ex}{$\mhchem@ext@arrow@pgf{5}{9}{\hphantom{##1}}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondown@pgf}$}}% }{}}}% \renewcommand*\mhchem@arrow@equilibriumRightM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##1}{% \rlap{\raisebox{-.22ex}{$\kern0.5em\mhchem@ext@arrow@pgf{0}{0}{}{9}{5}{##2}{\mhchem@arrow@minlength-1em}{\mhchem@leftharpoondown@pgf}$}}% \@ifempty{##2}% {\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{0}{0}{}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}% {\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{0}{0}{}{9}{5}{\hphantom{##2}\kern1em}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}% }{% \rlap{\raisebox{-.22ex}{$\kern0.5em\mhchem@ext@arrow@pgf{5}{9}{\hphantom{##1}\kern-1em}{9}{9}{##2}{\mhchem@arrow@minlength-1em}{\mhchem@leftharpoondown@pgf}$}}% \@ifempty{##2}% {\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{5}{9}{##1}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}% {\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{9}{9}{##1}{9}{9}{\hphantom{##2}\kern1em}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}% }% }{}}}% \renewcommand*\mhchem@arrow@equilibriumLeftM[2]{% \ensuremath{{}\mathrel{% \@ifempty{##2}{% \rlap{\raisebox{.22ex}{$\kern0.5em\mhchem@ext@arrow@pgf{5}{9}{##1}{0}{0}{}{\mhchem@arrow@minlength-1em}{\mhchem@rightharpoonup@pgf}$}}% \@ifempty{##1}% {\raisebox{-.22ex}{$\mhchem@ext@arrow@pgf{0}{0}{}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@leftharpoondown@pgf}$}}% {\raisebox{-.22ex}{$\mhchem@ext@arrow@pgf{5}{9}{\hphantom{##1}\kern1em}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@leftharpoondown@pgf}$}}% }{% \rlap{\raisebox{.22ex}{$\kern0.5em\mhchem@ext@arrow@pgf{9}{9}{##1}{5}{9}{\hphantom{##2}\kern-1em}{\mhchem@arrow@minlength-1em}{\mhchem@rightharpoonup@pgf}$}}% \@ifempty{##1}% {\raisebox{-.22ex}{$\mhchem@ext@arrow@pgf{0}{0}{}{9}{5}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondown@pgf}$}}% {\raisebox{-.22ex}{$\mhchem@ext@arrow@pgf{9}{9}{\hphantom{##1}\kern1em}{9}{9}{##2}{\mhchem@arrow@minlength}{\mhchem@leftharpoondown@pgf}$}}% }% }{}}}% \ifthenelse{\equal{#1}{pgf}}{% \let\mhchem@rightarrow@pgf\mhchem@rightarrow@pgfopen% \let\mhchem@leftarrow@pgf\mhchem@leftarrow@pgfopen% \let\mhchem@leftrightarrow@pgf\mhchem@leftrightarrow@pgfopen% \let\mhchem@rightharpoonup@pgf\mhchem@rightharpoonup@pgfopen% \let\mhchem@leftharpoondown@pgf\mhchem@leftharpoondown@pgfopen% }{% \let\mhchem@rightarrow@pgf\mhchem@rightarrow@pgffilled% \let\mhchem@leftarrow@pgf\mhchem@leftarrow@pgffilled% \let\mhchem@leftrightarrow@pgf\mhchem@leftrightarrow@pgffilled% \let\mhchem@rightharpoonup@pgf\mhchem@rightharpoonup@pgffilled% \let\mhchem@leftharpoondown@pgf\mhchem@leftharpoondown@pgffilled% }% }{% \PackageError{mhchem}{The option font=#1 is not supported}% }}% } %%% Arrow compositions with text or chemistry \newtoks\mhchem@arrow@params% \def\mhchem@arrow@setParamsT#1#2{% \mhchem@arrow@params={}% \@ifempty{#1}% {\mhchem@appendToks{\mhchem@arrow@params}{{}}}% {\mhchem@appendToks{\mhchem@arrow@params}{{\text{#1}}}}% \@ifempty{#2}% {\mhchem@appendToks{\mhchem@arrow@params}{{}}}% {\mhchem@appendToks{\mhchem@arrow@params}{{\text{#2}}}}% }% \def\mhchem@arrow@setParamsC#1#2{% \mhchem@arrow@params={}% \@ifempty{#1}% {\mhchem@appendToks{\mhchem@arrow@params}{{}}}% {\mhchem@appendToks{\mhchem@arrow@params}{{\ce{#1}}}}% \@ifempty{#2}% {\mhchem@appendToks{\mhchem@arrow@params}{{}}}% {\mhchem@appendToks{\mhchem@arrow@params}{{\ce{#2}}}}% }% \newcommand*\mhchem@arrow@yieldsT[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@yieldsM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@yieldsC[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@yieldsM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@yieldsLeftT[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@yieldsLeftM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@yieldsLeftC[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@yieldsLeftM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@yieldsLeftRightT[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@yieldsLeftRightM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@yieldsLeftRightC[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@yieldsLeftRightM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@mesomerismT[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@mesomerismM\the\mhchem@arrow@params}% \newcommand*\mhchem@arrow@mesomerismC[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@mesomerismM\the\mhchem@arrow@params}% \newcommand*{\mhchem@arrow@equilibriumT}[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@equilibriumM\the\mhchem@arrow@params}% \newcommand*{\mhchem@arrow@equilibriumC}[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@equilibriumM\the\mhchem@arrow@params}% \newcommand*{\mhchem@arrow@equilibriumRightT}[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@equilibriumRightM\the\mhchem@arrow@params}% \newcommand*{\mhchem@arrow@equilibriumRightC}[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@equilibriumRightM\the\mhchem@arrow@params}% \newcommand*{\mhchem@arrow@equilibriumLeftT}[2]{% \mhchem@arrow@setParamsT{#1}{#2}% \expandafter\mhchem@arrow@equilibriumLeftM\the\mhchem@arrow@params}% \newcommand*{\mhchem@arrow@equilibriumLeftC}[2]{% \mhchem@arrow@setParamsC{#1}{#2}% \expandafter\mhchem@arrow@equilibriumLeftM\the\mhchem@arrow@params}% %%% Font arrows \def\mhchem@ext@arrow#1#2#3#4#5#6#7#8{% adaption of amsmath's ext@arrow \mathrel{% \mathop{\makebox[#7]{#8\displaystyle}}% \limits% \@ifnotempty{#3}{^{\mkern#1mu#3\mkern#2mu}}% \@ifnotempty{#6}{_{\mkern#4mu#6\mkern#5mu}}% }% } \def\mhchem@rightharpoonupfill@{\arrowfill@\relbar\relbar\rightharpoonup} \def\mhchem@leftharpoondownfill@{\arrowfill@\leftharpoondown\relbar\relbar} %%% pgf arrows \newlength{\mhchem@arrowlength@pgf} \def\mhchem@ext@arrow@pgf#1#2#3#4#5#6#7#8{% \setlength\mhchem@arrowlength@pgf{\widthof{\ensuremath{% \mhchem@ext@arrow{#1}{#2}{#3}{#4}{#5}{#6}{#7}{\rightarrowfill@}% }}}% \mathrel{% \mathop{\kern0.7pt#8{\mhchem@arrowlength@pgf-1.8pt}\kern0.7pt}% \limits% \@ifnotempty{#3}{^{\mkern#1mu#3\mkern#2mu}}% \@ifnotempty{#6}{_{\mkern#4mu#6\mkern#5mu}}% }% }% \newcommand*\mhchem@rightarrow@pgfopen[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) -- ++(#1,0cm) arc (250:198:0.6ex) arc (198:250:0.6ex) arc (110:162:0.6ex); \end{tikzpicture}% }% \newcommand*\mhchem@leftarrow@pgfopen[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex] (#1,0.575ex) -- (0cm,0.575ex) arc (70:18:0.6ex) arc (18:70:0.6ex) arc (-70:-18:0.6ex); \end{tikzpicture}% }% \newcommand*\mhchem@leftrightarrow@pgfopen[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) arc (70:18:0.6ex) arc (18:70:0.6ex) arc (-70:-18:0.6ex) arc (-18:-70:0.6ex) -- ++(#1,0cm) arc (250:198:0.6ex) arc (198:250:0.6ex) arc (110:162:0.6ex); \end{tikzpicture}% }% \newcommand*\mhchem@rightharpoonup@pgfopen[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) -- ++(#1,0cm) arc (250:198:0.6ex); \end{tikzpicture}% }% \newcommand*\mhchem@leftharpoondown@pgfopen[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) arc (70:18:0.6ex) arc (18:70:0.6ex) -- ++(#1,0cm); \end{tikzpicture}% }% \newcommand*\mhchem@rightarrow@pgffilled[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex, shorten >=0.01ex] (0cm,0.575ex) -- ++(#1,0cm); \filldraw[cap=round, join=round, line width=0.09ex] (#1,0.575ex) -- ++(-0.6ex,0.2ex) -- ++(0.15ex,-0.2ex) -- ++(-0.15ex,-0.2ex) -- cycle; \end{tikzpicture}% }% \newcommand*\mhchem@leftarrow@pgffilled[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex, shorten >=0.01ex] (0cm,0.575ex) -- ++(#1,0cm); \filldraw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) -- ++(0.6ex,0.2ex) -- ++(-0.15ex,-0.2ex) -- ++(+0.15ex,-0.2ex) -- cycle; \end{tikzpicture}% }% \newcommand*\mhchem@leftrightarrow@pgffilled[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex, shorten >=0.01ex] (0cm,0.575ex) -- ++(#1,0cm); \filldraw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) -- ++(0.6ex,0.2ex) -- ++(-0.15ex,-0.2ex) -- ++(+0.15ex,-0.2ex) -- cycle; \filldraw[cap=round, join=round, line width=0.09ex] (#1,0.575ex) -- ++(-0.6ex,0.2ex) -- ++(0.15ex,-0.2ex) -- ++(-0.15ex,-0.2ex) -- cycle; \end{tikzpicture}% }% \newcommand*\mhchem@rightharpoonup@pgffilled[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex, shorten >=0.01ex] (0cm,0.575ex) -- ++(#1,0cm); \filldraw[cap=round, join=round, line width=0.09ex] (#1,0.575ex) -- ++(-0.6ex,0.25ex) -- ++(0.15ex,-0.25ex) -- cycle; \end{tikzpicture}% }% \newcommand*\mhchem@leftharpoondown@pgffilled[1]{% \begin{tikzpicture}[baseline]% \draw[use as bounding box] (0,0) (#1,0.85ex); \draw[cap=round, join=round, line width=0.09ex, shorten >=0.01ex] (0cm,0.575ex) -- ++(#1,0cm); \filldraw[cap=round, join=round, line width=0.09ex] (0cm,0.575ex) -- ++(0.6ex,-0.25ex) -- ++(-0.15ex,0.25ex) -- cycle; \end{tikzpicture}% }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% bonds %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newlength\mhchem@bondwidth% \newlength\mhchem@bondheight% \newlength\mhchem@smallbondwidth@tmpA% \newlength\mhchem@smallbondwidth@tmpB% \newlength\mhchem@smallbondwidth% \def\mhchem@setbondwidth{% \setlength\mhchem@bondwidth{\widthof{\sbond}}% \setlength\mhchem@bondheight{\heightof{\sbond}}% \setlength\mhchem@smallbondwidth@tmpA{% \mhchem@bondwidth-\mhchem@option@minussidebearingleft-\mhchem@option@minussidebearingright}% \setlength\mhchem@smallbondwidth@tmpB{% \widthof{\sbond\sbond\sbond}-\mhchem@option@minussidebearingleft-% \mhchem@option@minussidebearingright}% \setlength\mhchem@smallbondwidth{\mhchem@bondwidth*% \ratio{\mhchem@smallbondwidth@tmpA}{\mhchem@smallbondwidth@tmpB}}% } \def\mhchem@halfbond{\rlap{\hspace{\mhchem@option@minussidebearingleft}% \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}\unskip% \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}% \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}}% \phantom{\sbond}}% \ExplSyntaxOn \char_set_catcode_letter:n { 126 } % tilde \cs_new_protected:Npn \mhchem@bond #1 { \str_case:nnn {#1} { { - } { \sbond } { 1 } { \sbond } { = } { \dbond } { 2 } { \dbond } { ## } { \tbond } { 3 } { \tbond } { ~ } { \mhchem@setbondwidth \mhchem@halfbond } { ~- } { \mhchem@setbondwidth \rlap{\protect\raisebox{.2ex}{\mhchem@halfbond}} \protect\raisebox{-.2ex}{\sbond} } { ~-- } { \mhchem@setbondwidth \rlap{\protect\raisebox{.4ex}{\mhchem@halfbond}} \rlap{\sbond} \protect\raisebox{-.4ex}{\sbond} } { ~= } { \mhchem@setbondwidth \rlap{\protect\raisebox{.4ex}{\mhchem@halfbond}} \rlap{\sbond} \protect\raisebox{-.4ex}{\sbond} } { -~- } { \mhchem@setbondwidth \rlap{\protect\raisebox{.4ex}{\sbond}} \rlap{\mhchem@halfbond} \protect\raisebox{-.4ex}{\sbond} } { ... } { {\cdot}{\cdot}{\cdot} } { .... } { {\cdot}{\cdot}{\cdot}{\cdot} } { -> } { {\rightarrow} } { <- } { {\leftarrow} } } { %todo Tilde is not a space anymore, here \PackageError{mhchem}{Unknown~bond~type~in~\string\bond~(#1)}% } } \ExplSyntaxOff % end of Expl with tilde %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% loop helpers %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ExplSyntaxOn \msg_new:nnn { mhchem } { cf/unexpected-input } { Assertion~failed:~Unexpected~input~character.~You~found~a~bug.~ Please~contact~the~package~author. } \msg_new:nnn { mhchem } { cf/unexpected-state } { Assertion~failed:~Unexpected~internal~state~'#1' (cf).~You~found~a~bug.~ Please~contact~the~package~author. } \msg_new:nnn { mhchem } { cf/unexpected-two-superscripts } { Assertion~failed:~Two~superscripts.~You~entered~an~invalid~formula.~ Or~you~found~a~bug,~in~which~case~you~should~contact~the~package~author. } \cs_new_protected:Npn \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn #1#2#3 { \__mhchem_cf_outputAndReset: \tl_put_right:Nn \__mhchem_cf_result_tl { \mhchem@mathOrText{#3} } \tl_set:Nn \__mhchem_cf_state_tl {#1} #2 } \cs_new_protected:Npn \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn #1#2#3#4 { \__mhchem_cf_outputAndReset: \tl_put_right:Nn \__mhchem_cf_result_tl {#1} \tl_set:Nn \__mhchem_cf_state_tl {#2} #3 } %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% \cf %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*\mhchem@cf[2][]{ \__mhchem_cf:nn {#1} {#2} } \tl_new:N \__mhchem_cf_state_tl \bool_new:N \__mhchem_cf_startedWithBond_bool \bool_new:N \__mhchem_cf_cfActive_bool \bool_set_false:N \__mhchem_cf_cfActive_bool \cs_new_protected:Npn \__mhchem_cf:nn #1#2 { \group_begin: \int_set:Nn \__mhchem_option_version_int { \mhchem@option@version } \def\sbond{{\ensuremath{-}}} \ifnum 2=\mhchem@option@version \let\bond\sbond \else\ifnum 2<\mhchem@option@version \def\bond{\mhchem@bond} \fi\fi \def\dbond{\rlap{\protect\raisebox{.2ex}{\sbond}}\protect\raisebox{-.2ex}{\sbond}} \def\tbond{\rlap{\protect\raisebox{.4ex}{\sbond}} \rlap{\sbond}\protect\raisebox{-.4ex}{\sbond}} \def\hyphen{\mhchem@hyphen} \bool_if:NF \__mhchem_cf_cfActive_bool { \bool_set_true:N \__mhchem_cf_cfActive_bool \mode_if_math:F { \def\mhchem@option@alwaystextmode{1} \mhchem@option@textFont } \str_if_eq:nnTF { 1 } { \mhchem@option@alwaystextmode } { \cs_set:Npx \mhchem@mathOrText ##1 { \exp_not:N \text{##1} } \cs_set:Npx \mhchem@mathOrText@ii ##1##2 { ##2 } } { \int_compare:nTF { 1 < \__mhchem_option_version_int } { \cs_set:Npx \mhchem@mathOrText ##1 { \mode_if_math:TF { \exp_not:N \mhchem@option@mathFont{##1} } { \exp_not:N \text{##1} } } \cs_set:Npx \mhchem@mathOrText@ii ##1##2 { \mode_if_math:TF { \exp_not:N \mhchem@option@mathFont{##1} } { ##2 } } } { \cs_set:Npx \mhchem@mathOrText ##1 { \mode_if_math:TF { ##1 } { \exp_not:N \text{##1} } } \cs_set:Npx \mhchem@mathOrText@ii ##1##2 { \mode_if_math:TF { ##1 } { ##2 } } } } } \tl_set:Nn \__mhchem_cf_state_tl { s } \bool_set_false:N \__mhchem_cf_startedWithBond_bool \__mhchem_cf_resetOutput: \tl_clear_new:N \__mhchem_cf_result_tl \__mhchem_cf_loop: #2 \q_recursion_stop \str_if_eq:nnTF {#1} {} { \ensuremath{\tl_use:N \__mhchem_cf_result_tl} } { \ensuremath{\overset{#1}{\tl_use:N \__mhchem_cf_result_tl}} } \bool_set_false:N \__mhchem_cf_cfActive_bool \group_end: } \cs_new_protected:Npn \__mhchem_cf_loop: { \peek_meaning_remove:NTF \q_recursion_stop { \str_case:Vnn \__mhchem_cf_state_tl { { - } { \bool_if:NTF \__mhchem_cf_startedWithBond_bool { \__mhchem_cf_outputAndReset: \tl_put_right:Nn \__mhchem_cf_result_tl {\sbond} } { \tl_put_right:Nn \__mhchem_cf_sup_tl {-} } } { 1 } { \tl_set:Nn \__mhchem_cf_state_tl {9} } } {} \__mhchem_cf_outputAndReset: }{ \peek_meaning:NTF \relax { \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_meaning:NTF \protect { \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \str_case:Vnn \__mhchem_cf_state_tl { { - } { \__mhchem_cf_outputAndReset: \tl_put_right:Nn \__mhchem_cf_result_tl {\sbond} \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_cf_loop: } { s } { \peek_charcode:NTF - { \int_compare:nTF { 1 < \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { - } \bool_set_true:N \__mhchem_cf_startedWithBond_bool \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { + } \tl_put_right:Nn \__mhchem_cf_sup_tl { - } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } }{ \peek_charcode:NTF = { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \dbond } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ## { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \tbond } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ^ { \tl_set:Nn \__mhchem_cf_state_tl { p } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF _ { \tl_set:Nn \__mhchem_cf_state_tl { q } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ` { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { P } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF , { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { Q } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { 1 } \tl_put_right:Nn \__mhchem_cf_sub_tl { {,} } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } }{ \peek_charcode:NTF . { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF * { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF + { \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sup_tl \__mhchem_cf_loop: }{ \peek_charcode:NTF | { \let\mhchem@cf@action\mhchem@cf@switchState }{ \peek_charcode:NTF ( { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ) { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_charcode:NTF [ { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ] { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_catcode:NTF \mhchem@macro { \tl_set:Nn \__mhchem_cf_state_tl { c } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF a { \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF 1 { \tl_set:Nn \__mhchem_cf_state_tl { 1 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF \c_group_begin_token { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { 1 } \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: } }{ \peek_catcode_remove:NTF \c_math_toggle_token { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { 1 } \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_element_tl \__mhchem_cf_loop: } } % else { \msg_error:nnn { mhchem } { cf/unexpected-input } } }}}}}}}}}}}}}}}}}}} } { c } { \peek_catcode:NTF \c_group_begin_token { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_cf_loop: } } { 1 } { \peek_charcode:NTF 1 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 2 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 3 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 4 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 5 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 6 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 7 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 8 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 9 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF 0 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF . { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } { \peek_charcode:NTF , { \tl_put_right:Nn \__mhchem_cf_element_tl { {,} } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \peek_charcode:NTF / { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } % else { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_cf_loop: } }}}}}}}}}}}} } { a } { \peek_charcode:NTF - { \tl_set:Nn \__mhchem_cf_state_tl { - } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF = { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \dbond } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ## { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \tbond } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ^ { \tl_set:Nn \__mhchem_cf_state_tl { k } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF _ { \tl_set:Nn \__mhchem_cf_state_tl { f } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ` { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { E } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF , { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { F } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { 1 } \tl_put_right:Nn \__mhchem_cf_sub_tl { , } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } }{ \peek_charcode:NTF . { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF * { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF + { \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sup_tl \__mhchem_cf_loop: }{ \peek_charcode:NTF | { \PackageWarning{mhchem}{The symbol | is not allowed here} \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ( { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ) { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_charcode:NTF [ { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ] { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_catcode:NTF \mhchem@macro { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { c } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF a { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF 1 { \tl_set:Nn \__mhchem_cf_state_tl { 2 } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF \c_group_begin_token { \__mhchem_cf_outputAndReset: \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: }{ \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_element_tl \__mhchem_cf_loop: } % else { \msg_error:nnn { mhchem } { cf/unexpected-input } } }}}}}}}}}}}}}}}}}}} } { 2 } { \peek_charcode:NTF - { \tl_set:Nn \__mhchem_cf_state_tl { - } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF = { \__mhchem_cf_outputAndReset: \tl_put_right:Nn \__mhchem_cf_result_tl {\dbond} \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ## { \__mhchem_cf_outputAndReset: \tl_put_right:Nn \__mhchem_cf_result_tl {\tbond} \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ^ { \tl_set:Nn \__mhchem_cf_state_tl { e } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF _ { \tl_set:Nn \__mhchem_cf_state_tl { f } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ` { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { E } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF , { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { F } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_put_right:Nn \__mhchem_cf_sub_tl { , } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } }{ \peek_charcode:NTF . { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF * { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF + { \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sup_tl \__mhchem_cf_loop: }{ \peek_charcode:NTF | { \PackageWarning{mhchem}{The symbol | is not allowed here} \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ( { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ) { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_charcode:NTF [ { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ] { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_catcode:NTF \mhchem@macro { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { c } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF a { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF 1 { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF \c_group_begin_token { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_element_tl \__mhchem_cf_loop: } % else { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } }}}}}}}}}}}}}}}}}}} } { e } { \tl_set:Nn \__mhchem_cf_state_tl { + } \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathAsGroup:NNw \__mhchem_cf_sup_tl \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sup_tl \__mhchem_cf_loop: } } { k } { \tl_set:Nn \__mhchem_cf_state_tl { + } \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathAsGroup:NNw \__mhchem_cf_supA_tl \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_supA_tl \__mhchem_cf_loop: } } { f } { \tl_set:Nn \__mhchem_cf_state_tl { + } \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathAsGroup:NNw \__mhchem_cf_sub_tl \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: } } { p } { \tl_set:Nn \__mhchem_cf_state_tl { * } \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathAsGroup:NNw \__mhchem_cf_presup_tl \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_presup_tl \__mhchem_cf_loop: } } { q } { \tl_set:Nn \__mhchem_cf_state_tl { * } \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_loopHelper_appendMathAsGroup:NNw \__mhchem_cf_presub_tl \__mhchem_cf_loop: } { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_presub_tl \__mhchem_cf_loop: } } { E } { \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_loopHelper_appendNextTokenAsMathrm:NNn \__mhchem_cf_sup_tl \__mhchem_cf_loop: } { F } { \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_loopHelper_appendNextTokenAsMathrm:NNn \__mhchem_cf_sub_tl \__mhchem_cf_loop: } { P } { \tl_set:Nn \__mhchem_cf_state_tl { * } \__mhchem_loopHelper_appendNextTokenAsMathrm:NNn \__mhchem_cf_presup_tl \__mhchem_cf_loop: } { Q } { \tl_set:Nn \__mhchem_cf_state_tl { * } \__mhchem_loopHelper_appendNextTokenAsMathrm:NNn \__mhchem_cf_presub_tl \__mhchem_cf_loop: } { + } { \peek_charcode:NTF - { \tl_set:Nn \__mhchem_cf_state_tl { - } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF = { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \dbond } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ## { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \tbond } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ^ { \tl_set:Nn \__mhchem_cf_state_tl { e } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF _ { \tl_set:Nn \__mhchem_cf_state_tl { f } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ` { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { E } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF , { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { F } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \tl_put_right:Nn \__mhchem_cf_element_tl { , } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } }{ \peek_charcode:NTF . { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF * { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:NNn { \mhchem@mathOrText@ii{{}\cdot{}}{\mhchem@option@textcdot} } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF + { \tl_set:Nn \__mhchem_cf_state_tl { + } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_sup_tl \__mhchem_cf_loop: }{ \peek_charcode:NTF | { \PackageWarning{mhchem}{The symbol | is not allowed here} \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ( { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ) { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_charcode:NTF [ { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ] { \__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:NNn { a } \__mhchem_cf_loop: }{ \peek_catcode:NTF \mhchem@macro { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { c } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF a { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF 1 { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: }{ \peek_catcode:NTF \c_group_begin_token { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_catcode_remove:NTF \c_math_toggle_token { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_element_tl \__mhchem_cf_loop: } % else { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } }}}}}}}}}}}}}}}}}}} } { * } { \peek_charcode:NTF ^ { \tl_set:Nn \__mhchem_cf_state_tl { p } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF _ { \tl_set:Nn \__mhchem_cf_state_tl { q } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_charcode:NTF ` { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { P } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { a } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_element_tl \__mhchem_cf_loop: } }{ \peek_charcode:NTF , { \int_compare:nTF { 4 > \__mhchem_option_version_int } { \tl_set:Nn \__mhchem_cf_state_tl { Q } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } { \tl_set:Nn \__mhchem_cf_state_tl { a } \tl_put_right:Nn \__mhchem_cf_element_tl { , } \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: } } % else { \__mhchem_cf_outputAndReset: \tl_set:Nn \__mhchem_cf_state_tl { s } \__mhchem_cf_loop: } }}} } } { \msg_error:nnx { mhchem } { cf/unexpected-state } { \__mhchem_cf_state_tl } \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_result_tl \__mhchem_cf_loop: } }}} } \def\mhchem@cf@switchState#1#2|{% \ifthenelse{\equal{1}{#2}}{% \tl_set:Nn \__mhchem_cf_state_tl { a }% }{% \PackageWarning{mhchem}{Command |#2| unknown}% }% \mhchem@cf@continue% }% \tl_new:N \__mhchem_cf_presup_tl \tl_new:N \__mhchem_cf_presub_tl \tl_new:N \__mhchem_cf_element_tl \tl_new:N \__mhchem_cf_supA_tl \tl_new:N \__mhchem_cf_sub_tl \tl_new:N \__mhchem_cf_sup_tl \cs_new_protected:Npn \__mhchem_cf_output: { \str_case:Vnn \__mhchem_cf_state_tl { { s } { } { 1 } { \tl_put_right:Nx \__mhchem_cf_result_tl { \exp_not:N \mhchem@mathOrText { \exp_not:N \mhchem@cf@frac \exp_not:V \__mhchem_cf_element_tl / \exp_not:N \mhchem@END { \mhchem@option@skipAfterFracAmount } } } } { 9 } { \tl_put_right:Nx \__mhchem_cf_result_tl { \exp_not:N \mhchem@mathOrText { \exp_not:N \mhchem@cf@frac \exp_not:V \__mhchem_cf_element_tl / \exp_not:N \mhchem@END {} } } } } { \tl_if_empty:NTF \__mhchem_cf_sub_tl { \tl_put_right:NV \__mhchem_cf_supA_tl \__mhchem_cf_sup_tl \tl_clear:N \__mhchem_cf_sup_tl } { \tl_if_empty:NTF \__mhchem_cf_sup_tl { } { \tl_if_empty:NTF \__mhchem_cf_supA_tl { } { \msg_error:nnn { mhchem } { cf/unexpected-two-superscripts } } } } \tl_put_right:Nx \__mhchem_cf_result_tl { \exp_not:N \__mhchem_chemfive:nnnnnn { \exp_not:N \__mhchem_cf_replaceMath:n { \exp_not:V \__mhchem_cf_presup_tl } } { \exp_not:N \__mhchem_cf_replaceMath:n { \exp_not:V \__mhchem_cf_presub_tl } } { \exp_not:V \__mhchem_cf_element_tl } { \exp_not:N \__mhchem_cf_replaceMathMinusDot:n { \exp_not:V \__mhchem_cf_supA_tl } } { \exp_not:N \__mhchem_cf_replaceMath:n { \exp_not:V \__mhchem_cf_sub_tl } } { \exp_not:N \__mhchem_cf_replaceMathMinusDot:n { \exp_not:V \__mhchem_cf_sup_tl } } } } } \cs_new_protected:Npn \__mhchem_cf_resetOutput: { \tl_clear:N \__mhchem_cf_presup_tl \tl_clear:N \__mhchem_cf_presub_tl \tl_clear:N \__mhchem_cf_element_tl \tl_clear:N \__mhchem_cf_supA_tl \tl_clear:N \__mhchem_cf_sub_tl \tl_clear:N \__mhchem_cf_sup_tl } \cs_new_protected:Npn \__mhchem_cf_outputAndReset: { \__mhchem_cf_output: \__mhchem_cf_resetOutput: } %%% frac \def\mhchem@cf@frac#1/#2\mhchem@END#3{% \ifthenelse{\equal{#2}{}}{% #1#3% }{% \ensuremath{\mathchoice% {\textstyle% \frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}#3}% {\frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}#3}% {\frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}#3}% {\frac{\mhchem@mathOrText{#1}}{\mhchem@mathOrText{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}#3}% }% }% }% \def\mhchem@getfirstchar#1#2\mhchem@ENDgetfirstchar{#1} \def\mhchem@getlastchars#1#2\mhchem@ENDgetlastchars{#2} %%% replaceMath \tl_new:N \__mhchem_cf_replaceMath_result_tl \cs_new_protected:Npn \__mhchem_cf_replaceMath:n #1 { \tl_clear:N \__mhchem_cf_replaceMath_result_tl \__mhchem_cf_replaceMath_loop: #1 \q_recursion_stop \__mhchem_cf_replaceMath_result_tl } \cs_new_protected:Npn \__mhchem_cf_replaceMath_loop: { \peek_meaning:NTF \q_recursion_stop { \use_none:n } { \peek_catcode_remove:NTF \c_math_toggle_token % math $ { \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_replaceMath_result_tl \__mhchem_cf_replaceMath_loop: } { \peek_catcode:NTF \c_group_begin_token { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_replaceMath_result_tl \__mhchem_cf_replaceMath_loop: } % else { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_replaceMath_result_tl \__mhchem_cf_replaceMath_loop: } }} } %%% replaceMathMinusDot \tl_new:N \__mhchem_cf_replaceMathMinusDot_result_tl \cs_new_protected:Npn \__mhchem_cf_replaceMathMinusDot:n #1 { \tl_clear:N \__mhchem_cf_replaceMathMinusDot_result_tl \__mhchem_cf_replaceMathMinusDot_loop: #1 \q_recursion_stop \__mhchem_cf_replaceMathMinusDot_result_tl } \cs_new_protected:Npn \__mhchem_cf_replaceMathMinusDot_loop: { \peek_meaning:NTF \q_recursion_stop { \use_none:n } { \peek_charcode_remove:NTF - { \tl_put_right:Nn \__mhchem_cf_replaceMathMinusDot_result_tl { \mhchem@mathOrText@ii{-}{\mhchem@option@textminus} } \__mhchem_cf_replaceMathMinusDot_loop: }{ \peek_charcode_remove:NTF . { \tl_put_right:Nn \__mhchem_cf_replaceMathMinusDot_result_tl { \ensuremath{\textbf{\fontfamily{cmr}\selectfont\textperiodcentered}} } \__mhchem_cf_replaceMathMinusDot_loop: }{ \peek_catcode_remove:NTF \c_math_toggle_token % math $ { \__mhchem_loopHelper_appendMathB:NNw \__mhchem_cf_replaceMathMinusDot_result_tl \__mhchem_cf_replaceMathMinusDot_loop: } { \peek_catcode:NTF \c_group_begin_token { \__mhchem_loopHelper_appendNextGroup:NNn \__mhchem_cf_replaceMathMinusDot_result_tl \__mhchem_cf_replaceMathMinusDot_loop: } % else { \__mhchem_loopHelper_appendNextToken:NNn \__mhchem_cf_replaceMathMinusDot_result_tl \__mhchem_cf_replaceMathMinusDot_loop: } }}}} } %%%%%%%%%%%%%%%%%%%%% %%% @chemfive %%% %%%%%%%%%%%%%%%%%%%%% \cs_new_protected:Npn \__mhchem_chemfive:nnnnnn #1#2#3#4#5#6 { \str_if_eq:VnTF \mhchem@option@superscriptstacked { true } { \mhchem@prepostscript% {\mhchem@mathOrText{\smash[t]{2+}}}% {\mhchem@mathOrText{\smash[t]{2}}}% {\mhchem@mathOrText{#1}}% {\mhchem@mathOrText{#2}}% {\mhchem@mathOrText@ii{\mhchem@option@mathFont{#3}}{\text{#3}}}% {\mhchem@mathOrText{#4#6}}% {\mhchem@mathOrText{#5}}% {}% } { \mhchem@prepostscript% {\mhchem@mathOrText{\smash[t]{2+}}}% {\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}}% } } \ExplSyntaxOff %%% @prepostscript \newlength\mhchem@prepostscript@tmp@i% \newlength\mhchem@prepostscript@tmp@ii% \newcommand*\mhchem@prepostscript[8]{% \m@th% \ensuremath{% \setlength{\mhchem@prepostscript@tmp@i}{\widthof{$#3#4$}}% \ifdim\mhchem@prepostscript@tmp@i>0pt% \setlength{\mhchem@prepostscript@tmp@i}{\widthof{${}^{#3}$}}% \setlength{\mhchem@prepostscript@tmp@ii}{\widthof{${}_{#4}$}}% \ifdim\mhchem@prepostscript@tmp@i<\mhchem@prepostscript@tmp@ii% \setlength{\mhchem@prepostscript@tmp@i}{\mhchem@prepostscript@tmp@ii}\fi% \vphantom{#5}% {}% ^{% \mhchem@mathboxright{\mhchem@prepostscript@tmp@i}{% \vphantom{#6#8}% \vphantom{#1}% #3% }% }% _{% \mhchem@mathboxright{\mhchem@prepostscript@tmp@i}{% \vphantom{#7}% \vphantom{#2}% #4% }% }% \mhchem@minispace% \fi% #5% \setlength{\mhchem@prepostscript@tmp@i}{\widthof{$#7#6$}}% \ifdim\mhchem@prepostscript@tmp@i>0pt% _{% \vphantom{#4}% \vphantom{#2}% #7% }% ^{% \vphantom{#3#8}% \vphantom{#1}% #6% }% \fi% \setlength{\mhchem@prepostscript@tmp@i}{\widthof{$#8$}}% \ifdim\mhchem@prepostscript@tmp@i>0pt% \mhchem@minispace% {}% _{% \vphantom{#4#7}% \vphantom{#2}% }% ^{% \vphantom{#3#6}% \vphantom{#1}% #8% }% \fi% }% } %%% @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{\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[\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{\mhchem@minispace@tmp}{0pt-\widthof{${}^8_8$}+% \widthof{$\text{C}^8_8$}-\widthof{$\text{C}^{}_{}$}}% \kern\mhchem@minispace@tmp% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% 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}} \define@key{mhchem}{font}{% \ifthenelse{\equal{sf}{#1}}{% \def\mhchem@option@textFont{\sffamily}% \def\mhchem@option@mathFont{\mathsf}% }{\ifthenelse{\equal{}{#1}}{% \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} \setlength\mhchem@option@minussidebearingright{0.11em} \define@key{mhchem}{minus-sidebearing-left}{\setlength\mhchem@option@minussidebearingleft{#1}} \define@key{mhchem}{minus-sidebearing-right}{\setlength\mhchem@option@minussidebearingright{#1}} \mhchem@definearrows{font} \define@key{mhchem}{arrows}{% \ifthenelse{\equal{pgf}{#1} \or \equal{pgf-filled}{#1}}{% \RequirePackage{pgf}% for finding the tikz package more easily \RequirePackage{tikz}% }{}% \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}} \def\mhchem@option@superscriptstacked{0} \define@key{mhchem}{superscriptstacked}[true]{\def\mhchem@option@superscriptstacked{#1}}% %%% begin: standard keyval handling as in many other packages \def\ProcessOptionsWithKV#1{% \let\@tempc\relax% \let\mhchem@tempa\@empty% \@for\CurrentOption:=\@classoptionslist\do{% \@ifundefined{KV@#1@\CurrentOption}% {}% {% \edef\mhchem@tempa{\mhchem@tempa,\CurrentOption,}% \@expandtwoargs\@removeelement\CurrentOption% \@unusedoptionlist\@unusedoptionlist% }% }% \edef\mhchem@tempa{% \noexpand\setkeys{#1}{% \mhchem@tempa\@ptionlist{\@currname.\@currext}% }% }% \mhchem@tempa% \let\CurrentOption\@empty% \AtEndOfPackage{\let\@unprocessedoptions\relax}% } \ProcessOptionsWithKV{mhchem}\relax %%% end: \define@key{mhchem}{arrows}{\mhchem@definearrows{#1}}% \newcommand*\mhchemoptions[1]{\setkeys{mhchem}{#1}} \ifnum 0=\mhchem@option@version% \PackageWarningNoLine{mhchem}{% You did not specify a 'version' option for the mhchem\MessageBreak package. If you are about to create a new document,\MessageBreak please write \string\usepackage[version=3]{mhchem} in your\MessageBreak preamble in order to use the most recent version of\MessageBreak mhchem}% \def\mhchem@option@version{3}% \else\ifnum 4=\mhchem@option@version% \PackageWarningNoLine{mhchem}{% You are using version 3.xx 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% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% legacy %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifnum 4>\mhchem@option@version \newcommand*\mhchem@cmath[1]{\ensuremath{\text{\ensuremath{#1}}}}% \newcommand*\cmath[1]{\mhchem@cmath{#1}} \DeclareRobustCommand\cf[2][]{\mhchem@cf[#1]{#2}} \fi