summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/mhchem/mhchem.sty')
-rw-r--r--Master/texmf-dist/tex/latex/mhchem/mhchem.sty509
1 files changed, 272 insertions, 237 deletions
diff --git a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
index 2bb6a5041e8..8a1879aafc0 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-2015 Martin Hensel
+%% Copyright 2004-2016 Martin Hensel
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c
@@ -27,7 +27,7 @@
% This work consists of all files listed in manifest.txt.
%
%
-\ProvidesPackage{mhchem}[2015/11/29 v4.03 for typesetting chemical formulae]
+\ProvidesPackage{mhchem}[2016/02/07 v4.04 for typesetting chemical formulae]
\RequirePackage{expl3}
\RequirePackage{l3keys2e}
\RequirePackage{l3regex}
@@ -35,7 +35,6 @@
\RequirePackage{amsmath}
\RequirePackage{chemgreek}[2015/04/09]
\RequirePackage{graphics}
-\RequirePackage{ifthen}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% misc %%%%%%%%%%
@@ -77,41 +76,42 @@
}
\regex_const:Nn \l__mhchem_regex_digitCommaDigit_regex { \d\,\d }
-\regex_const:Nn \l__mhchem_regex_oneLetter_regex { [nmpx] }
+\regex_const:Nn \l__mhchem_regex_oneLetter_regex { [nmptx] }
\regex_const:Nn \l__mhchem_regex_hyphen_regex { - }
\regex_const:Nn \l__mhchem_regex_letters_regex { [a-zA-Z]+ }
\regex_const:Nn \l__mhchem_regex_spaces_regex { [\ ]+ }
\regex_const:Nn \l__mhchem_regex_digits_fregex { \A [0-9]+ \Z}
\regex_const:Nn \l__mhchem_regex_oneToThreeLetters_fregex { \A (.+) (\([a-z]{1,3}\)) \Z }
-\regex_const:Nn \l__mhchem_regex_oneLetter_fregex { \A [nmpx] \Z }
+\regex_const:Nn \l__mhchem_regex_oneLetter_fregex { \A [nmptx] \Z }
\regex_const:Nn \l__mhchem_regex_oneLetterPlus_fregex
- { \A ([nmpx]|\c{eta}|\c{mu}|\c{kappa}|\c{__mhchem_cg_withinMathTokens:n}\cB.[nmpx]\cE.|\d+) \Z }
-\regex_const:Nn \l__mhchem_regex_oneGreekLetter_fregex { \A (\c{eta}|\c{mu}|\c{kappa}) \Z }
+ { \A ([nmptx]|\c{eta|mu|kappa}|\c{__mhchem_cg_withinMathTokens:n}\cB.[nmptx]\cE.|[0-9]+|[0-9]+\/[0-9]+) \Z }
\regex_const:Nn \l__mhchem_regex_romanNumeral_fregex { \A [IVX]+ \Z }
\regex_const:Nn \l__mhchem_regex_bracedGroup_fregex { \A \cB. [^\cE.]* \cE. \Z }
-\regex_const:Nn \l__mhchem_regex_greekLetter_fregex
- { \A [\c{alpha}\c{beta}\c{gamma}\c{delta}\c{epsilon}\c{zeta}\c{eta}\c{theta}\c{iota}\c{kappa}\c{lambda}\c{mu}\c{nu}\c{xi}\c{omicron}\c{pi}\c{rho}\c{sigma}\c{tau}\c{upsilon}\c{phi}\c{chi}\c{psi}\c{omega}\c{Alpha}\c{Beta}\c{Gamma}\c{Delta}\c{Epsilon}\c{Zeta}\c{Eta}\c{Theta}\c{Iota}\c{Kappa}\c{Lambda}\c{Mu}\c{Nu}\c{Xi}\c{Omicron}\c{Pi}\c{Rho}\c{Sigma}\c{Tau}\c{Upsilon}\c{Phi}\c{Chi}\c{Psi}\c{Omega}] \Z }
+\regex_const:Nn \l__mhchem_regex_oneGreekLetter_fregex
+ { \A \c{alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Alpha|Beta|Gamma|Delta|Epsilon|Zeta|Eta|Theta|Iota|Kappa|Lambda|Mu|Nu|Xi|Omicron|Pi|Rho|Sigma|Tau|Upsilon|Phi|Chi|Psi|Omega} \Z }
\regex_const:Nn \l__mhchem_regex_digitOrLetterOrGreek_fregex
- { \A [1-9a-zA-Z\ \~\+\-\,\.\(\)\c{alpha}\c{beta}\c{gamma}\c{delta}\c{epsilon}\c{zeta}\c{eta}\c{theta}\c{iota}\c{kappa}\c{lambda}\c{mu}\c{nu}\c{xi}\c{omicron}\c{pi}\c{rho}\c{sigma}\c{tau}\c{upsilon}\c{phi}\c{chi}\c{psi}\c{omega}\c{Alpha}\c{Beta}\c{Gamma}\c{Delta}\c{Epsilon}\c{Zeta}\c{Eta}\c{Theta}\c{Iota}\c{Kappa}\c{Lambda}\c{Mu}\c{Nu}\c{Xi}\c{Omicron}\c{Pi}\c{Rho}\c{Sigma}\c{Tau}\c{Upsilon}\c{Phi}\c{Chi}\c{Psi}\c{Omega}]+ \Z }
+ { \A [1-9a-zA-Z\ \~\+\-\,\.\(\)\c{alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Alpha|Beta|Gamma|Delta|Epsilon|Zeta|Eta|Theta|Iota|Kappa|Lambda|Mu|Nu|Xi|Omicron|Pi|Rho|Sigma|Tau|Upsilon|Phi|Chi|Psi|Omega}]+ \Z }
\regex_const:Nn \l__mhchem_regex_formula_fregex
- { \A ( [nmpx] | ([0-9\ \+\-\,\.\(\)]+ [nmpx] [0-9\ \+\-\,\.\(\)]*)+ | ([0-9\ \+\-\,\.\(\)]* [nmpx] [0-9\ \+\-\,\.\(\)]+)+ ) \Z }
+ { \A ([0-9\ \+\-\,\.\(\)]* [nmptx] [0-9\ \+\-\,\.\(\)]*)+ \Z }
\regex_const:Nn \l__mhchem_regex_formulaAmount_fregex
- { \A \c{__mhchem_cg_withinMathTokens:n}\cB. (([0-9nmpx]+ [\+\-])? [nmpx] ([\+\-] [0-9nmpx]+)?) \cE. \Z }
+ { \A \c{__mhchem_cg_withinMathTokens:n}\cB. (([0-9nmptx]+ [\+\-])? [nmptx] ([\+\-] [0-9nmptx]+)?) \cE. \Z }
\regex_const:Nn \l__mhchem_regex_fraction_fregex
{ \A ([0-9]+)\/([0-9]+) \Z }
+\regex_const:Nn \l__mhchem_regex_fracMacro_fregex { \A \c{frac} \Z }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_digit_pregex { [ 0-9 ] }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_digitOrPlus_pregex { [ 0-9 \+ ] }
+\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_digitOrMinus_pregex { [ 0-9 \-] }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_digitOrDot_pregex { [ 0-9 . ] }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_digitOrSlash_pregex { [ 0-9 \/ ] }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_digitOrDotPlus_pregex { [ 0-9 \) \. \/ ] }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_dotOrAsterisk_pregex { [ \. \* ] }
\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_letter_pregex { [ a-zA-Z ] }
-\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_uppercaseLetter_pregex { [ A-Z ] }
-\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_openingBrace_pregex { [ \( \[ ] }
-\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_closingBrace_pregex { [ \) \] \/ ] }
-\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_oneLetter_pregex { [ nmpx ] }
+\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_uppercaseLetterOrParenthesis_pregex { [ A-Z( ] }
+\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_openingBracket_pregex { [ \( \[ ] }
+\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_closingBracket_pregex { [ \) \] \/ ] }
+\__mhchem_regex_peek_compile:Nn \l__mhchem_regex_oneLetter_pregex { [ nmptx ] }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% loop helpers %%%%%%%%%%
@@ -127,7 +127,12 @@
\tl_put_right:Nn #1 { { #3 } }
#2
}
-\cs_new_protected:Npn \__mhchem_loopHelper_appendNextGroup_prefix_ifEmpty:NnnNn #1#2#3#4#5
+\cs_new_protected:Npn \__mhchem_loopHelper_appendNextGroupAsCe:NNn #1#2#3
+ {
+ \tl_put_right:Nn #1 { { \ce{#3} } }
+ #2
+ }
+\cs_new_protected:Npn \__mhchem_loopHelper_appendNextGroup_prefix_doIfEmpty:NnnNn #1#2#3#4#5
{
\tl_if_empty:nTF {#5}
{ #3 }
@@ -350,54 +355,54 @@
\cs_set_eq:NN \__mhchem_output_greek_orig_Chi \Chi
\cs_set_eq:NN \__mhchem_output_greek_orig_Psi \Psi
\cs_set_eq:NN \__mhchem_output_greek_orig_Omega \Omega
- \def \alpha { \__mhchem_output_greek:n { alpha } }
- \def \beta { \__mhchem_output_greek:n { beta } }
- \def\gamma { \__mhchem_output_greek:n { gamma } }
- \def\delta { \__mhchem_output_greek:n { delta } }
- \def\epsilon { \__mhchem_output_greek:n { epsilon } }
- \def\zeta { \__mhchem_output_greek:n { zeta } }
- \def\eta { \__mhchem_output_greek:n { eta } }
- \def\theta { \__mhchem_output_greek:n { theta } }
- \def\iota { \__mhchem_output_greek:n { iota } }
- \def\kappa { \__mhchem_output_greek:n { kappa } }
- \def\lambda { \__mhchem_output_greek:n { lambda } }
- \def\mu { \__mhchem_output_greek:n { mu } }
- \def\nu { \__mhchem_output_greek:n { nu } }
- \def\xi { \__mhchem_output_greek:n { xi } }
- \def\omicron { \__mhchem_output_greek:n { omicron } }
- \def\pi { \__mhchem_output_greek:n { pi } }
- \def\rho { \__mhchem_output_greek:n { rho } }
- \def\sigma { \__mhchem_output_greek:n { sigma } }
- \def\tau { \__mhchem_output_greek:n { tau } }
- \def\upsilon { \__mhchem_output_greek:n { upsilon } }
- \def\phi { \__mhchem_output_greek:n { phi } }
- \def\chi { \__mhchem_output_greek:n { chi } }
- \def\psi { \__mhchem_output_greek:n { psi } }
- \def\omega { \__mhchem_output_greek:n { omega } }
- \def\Alpha { \__mhchem_output_greek:n { Alpha } }
- \def\Beta { \__mhchem_output_greek:n { Beta } }
- \def\Gamma { \__mhchem_output_greek:n { Gamma } }
- \def\Delta { \__mhchem_output_greek:n { Delta } }
- \def\Epsilon { \__mhchem_output_greek:n { Epsilon } }
- \def\Zeta { \__mhchem_output_greek:n { Zeta } }
- \def\Eta { \__mhchem_output_greek:n { Eta } }
- \def\Theta { \__mhchem_output_greek:n { Theta } }
- \def\Iota { \__mhchem_output_greek:n { Iota } }
- \def\Kappa { \__mhchem_output_greek:n { Kappa } }
- \def\Lambda { \__mhchem_output_greek:n { Lambda } }
- \def\Mu { \__mhchem_output_greek:n { Mu } }
- \def\Nu { \__mhchem_output_greek:n { Nu } }
- \def\Xi { \__mhchem_output_greek:n { Xi } }
- \def\Omicron { \__mhchem_output_greek:n { Omicron } }
- \def\Pi { \__mhchem_output_greek:n { Pi } }
- \def\Rho { \__mhchem_output_greek:n { Rho } }
- \def\Sigma { \__mhchem_output_greek:n { Sigma } }
- \def\Tau { \__mhchem_output_greek:n { Tau } }
- \def\Upsilon { \__mhchem_output_greek:n { Upsilon } }
- \def\Phi { \__mhchem_output_greek:n { Phi } }
- \def\Chi { \__mhchem_output_greek:n { Chi } }
- \def\Psi { \__mhchem_output_greek:n { Psi } }
- \def\Omega { \__mhchem_output_greek:n { Omega } }
+ \cs_set_protected:Npn \alpha { \__mhchem_output_greek:n { alpha } }
+ \cs_set_protected:Npn \beta { \__mhchem_output_greek:n { beta } }
+ \cs_set_protected:Npn \gamma { \__mhchem_output_greek:n { gamma } }
+ \cs_set_protected:Npn \delta { \__mhchem_output_greek:n { delta } }
+ \cs_set_protected:Npn \epsilon { \__mhchem_output_greek:n { epsilon } }
+ \cs_set_protected:Npn \zeta { \__mhchem_output_greek:n { zeta } }
+ \cs_set_protected:Npn \eta { \__mhchem_output_greek:n { eta } }
+ \cs_set_protected:Npn \theta { \__mhchem_output_greek:n { theta } }
+ \cs_set_protected:Npn \iota { \__mhchem_output_greek:n { iota } }
+ \cs_set_protected:Npn \kappa { \__mhchem_output_greek:n { kappa } }
+ \cs_set_protected:Npn \lambda { \__mhchem_output_greek:n { lambda } }
+ \cs_set_protected:Npn \mu { \__mhchem_output_greek:n { mu } }
+ \cs_set_protected:Npn \nu { \__mhchem_output_greek:n { nu } }
+ \cs_set_protected:Npn \xi { \__mhchem_output_greek:n { xi } }
+ \cs_set_protected:Npn \omicron { \__mhchem_output_greek:n { omicron } }
+ \cs_set_protected:Npn \pi { \__mhchem_output_greek:n { pi } }
+ \cs_set_protected:Npn \rho { \__mhchem_output_greek:n { rho } }
+ \cs_set_protected:Npn \sigma { \__mhchem_output_greek:n { sigma } }
+ \cs_set_protected:Npn \tau { \__mhchem_output_greek:n { tau } }
+ \cs_set_protected:Npn \upsilon { \__mhchem_output_greek:n { upsilon } }
+ \cs_set_protected:Npn \phi { \__mhchem_output_greek:n { phi } }
+ \cs_set_protected:Npn \chi { \__mhchem_output_greek:n { chi } }
+ \cs_set_protected:Npn \psi { \__mhchem_output_greek:n { psi } }
+ \cs_set_protected:Npn \omega { \__mhchem_output_greek:n { omega } }
+ \cs_set_protected:Npn \Alpha { \__mhchem_output_greek:n { Alpha } }
+ \cs_set_protected:Npn \Beta { \__mhchem_output_greek:n { Beta } }
+ \cs_set_protected:Npn \Gamma { \__mhchem_output_greek:n { Gamma } }
+ \cs_set_protected:Npn \Delta { \__mhchem_output_greek:n { Delta } }
+ \cs_set_protected:Npn \Epsilon { \__mhchem_output_greek:n { Epsilon } }
+ \cs_set_protected:Npn \Zeta { \__mhchem_output_greek:n { Zeta } }
+ \cs_set_protected:Npn \Eta { \__mhchem_output_greek:n { Eta } }
+ \cs_set_protected:Npn \Theta { \__mhchem_output_greek:n { Theta } }
+ \cs_set_protected:Npn \Iota { \__mhchem_output_greek:n { Iota } }
+ \cs_set_protected:Npn \Kappa { \__mhchem_output_greek:n { Kappa } }
+ \cs_set_protected:Npn \Lambda { \__mhchem_output_greek:n { Lambda } }
+ \cs_set_protected:Npn \Mu { \__mhchem_output_greek:n { Mu } }
+ \cs_set_protected:Npn \Nu { \__mhchem_output_greek:n { Nu } }
+ \cs_set_protected:Npn \Xi { \__mhchem_output_greek:n { Xi } }
+ \cs_set_protected:Npn \Omicron { \__mhchem_output_greek:n { Omicron } }
+ \cs_set_protected:Npn \Pi { \__mhchem_output_greek:n { Pi } }
+ \cs_set_protected:Npn \Rho { \__mhchem_output_greek:n { Rho } }
+ \cs_set_protected:Npn \Sigma { \__mhchem_output_greek:n { Sigma } }
+ \cs_set_protected:Npn \Tau { \__mhchem_output_greek:n { Tau } }
+ \cs_set_protected:Npn \Upsilon { \__mhchem_output_greek:n { Upsilon } }
+ \cs_set_protected:Npn \Phi { \__mhchem_output_greek:n { Phi } }
+ \cs_set_protected:Npn \Chi { \__mhchem_output_greek:n { Chi } }
+ \cs_set_protected:Npn \Psi { \__mhchem_output_greek:n { Psi } }
+ \cs_set_protected:Npn \Omega { \__mhchem_output_greek:n { Omega } }
}
\tl_clear:N \l__mhchem_ce_result_tl
\tl_clear:N \l__mhchem_ce_part_tl
@@ -406,11 +411,9 @@
\int_set:Nn \l__mhchem_ce_distanceFromLastComma_int { 9 }
\tl_clear:N \l__mhchem_cf_lastElement_tl
\__mhchem_ce_loop: #1 \q_recursion_stop
- \__mhchem_output_begin_ce:
\int_compare:nTF { \l__mhchem_option_version_int > 1 }
{ \tl_use:N \l__mhchem_ce_result_tl }
{ \ensuremath{\tl_use:N \l__mhchem_ce_result_tl} }
- \__mhchem_output_end_ce:
\mhchem@hook@afterCe
\group_end:
}
@@ -996,7 +999,6 @@
\ExplSyntaxOn
\cs_new:Npn \__mhchem_arrow_options_minLength:n { {2em} }
\tl_new:N \mhchem@option@arrow@pgf@tip
-\tl_new:N \mhchem@option@arrow@pgf@halftip
\tl_new:N \mhchem@option@arrow@pgf@linewidth
\msg_new:nnn { mhchem } { error-arrow-type }
@@ -1023,7 +1025,7 @@
{
\bool_if:NTF { \l__mhchem_option_inPreamble_bool }
{
- \RequirePackage{pgf} %. for finding the tikz package more easily
+ \RequirePackage{pgf}
\RequirePackage{tikz}
\AtBeginDocument {
\usetikzlibrary{arrows.meta}
@@ -1051,7 +1053,7 @@
}
{
\regex_extract_once:nnNTF
- { \A pgf \cB. (.+?) \cE. \cB. (.+?) \cE. \Z } %. pgf{arrowname}{linewidth}
+ { \A pgf \cB. (.+?) \cE. \cB. (.+?) \cE. \Z }
{#1}
\l__mhchem_tmp_arrow_seq
{
@@ -1294,7 +1296,7 @@
{
Assertion~failed:~Unexpected~input~character.~
In~case~you~think~this~is~a~bug,~
- lease~contact~the~package~author.
+ please~contact~the~package~author.
}
\msg_new:nnn { mhchem } { cf / unexpected-state }
{
@@ -1407,11 +1409,9 @@
\tl_clear:N \l__mhchem_cf_result_tl
\__mhchem_cf_loop: #2 \q_recursion_stop
}
- \__mhchem_output_begin_cf:
\tl_if_empty:nTF {#1}
{ \ensuremath{\tl_use:N \l__mhchem_cf_result_tl} }
{ \ensuremath{\overset{#1}{\tl_use:N \l__mhchem_cf_result_tl}} }
- \__mhchem_output_end_cf:
\group_end:
}
\tl_new:N \l__mhchem_cf_loop_tmpa_l
@@ -1427,14 +1427,13 @@
{ - }
{
\bool_if:NTF \l__mhchem_cf_startedWithBond_bool
- {
- \__mhchem_cf_outputAndReset:
- \__mhchem_cf_outputRawElementAndReset:n { \__mhchem_output_bond_single: }
- }
+ { \__mhchem_cf_outputRaw:n { \__mhchem_output_bond_single: } }
{ \tl_put_right:Nn \l__mhchem_cf_sup_tl { - } }
}
{ 1 }
{ \tl_set:Nn \l__mhchem_cf_state_tl {9} }
+ { frac2 }
+ { \__mhchem_cf_outputRawElementAndReset: }
}
{}
\__mhchem_cf_outputAndReset:
@@ -1452,12 +1451,11 @@
\l__mhchem_regex_oneLetterPlus_fregex
\l__mhchem_cf_lastElement_tl
{
- \__mhchem_cf_outputRawElementAndReset:n
+ \__mhchem_cf_outputRaw:n
{ \__mhchem_cg_escapeFromMathToTextOrFaketext:n { - } }
}
{
- \__mhchem_cf_outputRawElementAndReset:n
- { \__mhchem_output_bond_single: }
+ \__mhchem_cf_outputRaw:n { \__mhchem_output_bond_single: }
}
\tl_set:Nn \l__mhchem_cf_state_tl { s }
\__mhchem_cf_loop:
@@ -1481,7 +1479,7 @@
{ ps }
{
\__mhchem_cf_outputAndReset:
- \__mhchem_regex_peek:NTF \l__mhchem_regex_uppercaseLetter_pregex
+ \__mhchem_regex_peek:NTF \l__mhchem_regex_uppercaseLetterOrParenthesis_pregex
{
\regex_match:NVTF
\l__mhchem_regex_formulaAmount_fregex
@@ -1522,7 +1520,7 @@
% else
{
\tl_set:Nn \l__mhchem_cf_state_tl { a }
- \__mhchem_loopHelper_appendNextGroup_prefix_ifEmpty:NnnNn
+ \__mhchem_loopHelper_appendNextGroup_prefix_doIfEmpty:NnnNn
\l__mhchem_cf_element_tl
{ \__mhchem_cg_escapeFromMathToTextOrFaketext:n }
{ \tl_set:Nn \l__mhchem_cf_state_tl { s } }
@@ -1650,7 +1648,7 @@
{ s }
\__mhchem_cf_loop:
}{
- \__mhchem_regex_peek:NTF \l__mhchem_regex_closingBrace_pregex
+ \__mhchem_regex_peek:NTF \l__mhchem_regex_closingBracket_pregex
{
\__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:nNn
{ a }
@@ -1668,34 +1666,62 @@
\__mhchem_cf_outputAndReset:
\tl_set:Nn \l__mhchem_cf_state_tl { 1 }
\__mhchem_cf_loop:
+ }{
+ \peek_charcode:NTF |
+ {
+ \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:nnNn
+ { \__mhchem_output_verticalBar: }
+ { s }
+ \__mhchem_cf_loop:
}
% else
{ \msg_error:nnn { mhchem } { cf / unexpected-input } }
- }}}}}}}}}}}}}}}}
+ }}}}}}}}}}}}}}}}}
}
{ c }
{
\regex_match:NVTF
- \l__mhchem_regex_greekLetter_fregex
+ \l__mhchem_regex_oneGreekLetter_fregex
\l__mhchem_cf_element_tl
{
\tl_set:Nn \l__mhchem_cf_state_tl { a }
\__mhchem_cf_loop:
- }
+ }{
+ \regex_match:NVTF
+ \l__mhchem_regex_fracMacro_fregex
+ \l__mhchem_cf_element_tl
{
- \peek_catcode:NTF \c_group_begin_token
- {
- \__mhchem_loopHelper_appendNextGroup:NNn
- \l__mhchem_cf_element_tl
- \__mhchem_cf_loop:
- }
- % else
- {
- \__mhchem_cf_outputAndReset:
- \tl_set:Nn \l__mhchem_cf_state_tl { a }
- \__mhchem_cf_loop:
- }
+ \tl_set:Nn \l__mhchem_cf_state_tl { frac1 }
+ \__mhchem_loopHelper_appendNextGroupAsCe:NNn
+ \l__mhchem_cf_element_tl
+ \__mhchem_cf_loop:
+ }{
+ \peek_catcode:NTF \c_group_begin_token
+ {
+ \__mhchem_loopHelper_appendNextGroup:NNn
+ \l__mhchem_cf_element_tl
+ \__mhchem_cf_loop:
}
+ % else
+ {
+ \__mhchem_cf_outputRawElementAndReset:
+ \tl_set:Nn \l__mhchem_cf_state_tl { a }
+ \__mhchem_cf_loop:
+ }
+ }}
+ }
+ { frac1 }
+ {
+ \tl_set:Nn \l__mhchem_cf_state_tl { frac2 }
+ \__mhchem_loopHelper_appendNextGroupAsCe:NNn
+ \l__mhchem_cf_element_tl
+ \__mhchem_cf_loop:
+ }
+ { frac2 }
+ {
+ \__mhchem_cf_outputRawElementAndReset:
+ \tl_set:Nn \l__mhchem_cf_state_tl { a }
+ \__mhchem_cf_loop:
}
{ 1 }
{
@@ -1712,6 +1738,8 @@
}{
\peek_charcode:NTF -
{
+ \tl_set:Nn \l__mhchem_cf_state_tl { 9 }
+ \__mhchem_cf_outputAndReset:
\tl_set:Nn \l__mhchem_cf_state_tl { - }
\__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop:
}
@@ -1744,7 +1772,7 @@
}
% else
{
- \__mhchem_loopHelper_appendNextGroup_prefix_ifEmpty:NnnNn
+ \__mhchem_loopHelper_appendNextGroup_prefix_doIfEmpty:NnnNn
\l__mhchem_cf_element_tl
{ \__mhchem_cg_escapeFromMathToTextOrFaketext:n }
{}
@@ -1831,8 +1859,7 @@
}
% else
{
- \__mhchem_cf_outputAndReset:
- \__mhchem_cf_outputRawElementAndReset:n
+ \__mhchem_cf_outputRaw:n
{ \__mhchem_output_commaEnumeration: }
\__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop:
}
@@ -1850,13 +1877,13 @@
\tl_set:Nn \l__mhchem_cf_state_tl { e }
\__mhchem_cf_loop:
}{
- \__mhchem_regex_peek:NTF \l__mhchem_regex_openingBrace_pregex
+ \__mhchem_regex_peek:NTF \l__mhchem_regex_openingBracket_pregex
{
\__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:nNn
{ s }
\__mhchem_cf_loop:
}{
- \__mhchem_regex_peek:NTF \l__mhchem_regex_closingBrace_pregex
+ \__mhchem_regex_peek:NTF \l__mhchem_regex_closingBracket_pregex
{
\__mhchem_loopHelper_outputAndReset_appendNextTokenToResult_setState:nNn
{ a }
@@ -1906,9 +1933,7 @@
{
\__mhchem_cf_outputAndReset:
\tl_set:Nn \l__mhchem_cf_state_tl { s }
- \__mhchem_loopHelper_appendNextToken:NNn
- \l__mhchem_cf_result_tl
- \__mhchem_cf_loop:
+ \__mhchem_cf_loop:
}
}}}}}}}}}}}}}}}
}
@@ -1948,7 +1973,7 @@
\peek_charcode:NTF -
{
\regex_match:NVTF
- \l__mhchem_regex_oneGreekLetter_fregex
+ \l__mhchem_regex_oneLetterPlus_fregex
\l__mhchem_cf_element_tl
{
\tl_set:Nn \l__mhchem_cf_state_tl { - }
@@ -2016,7 +2041,7 @@
{ l__mhchem_cf_presup_tl }
{ __mhchem_cf_loop: }
}{
- \__mhchem_regex_peek:NTF \l__mhchem_regex_digit_pregex
+ \__mhchem_regex_peek:NTF \l__mhchem_regex_digitOrMinus_pregex
{
\tl_set:Nn \l__mhchem_cf_state_tl { p+ }
\__mhchem_loopHelper_appendNextToken:NNn
@@ -2055,7 +2080,7 @@
{ l__mhchem_cf_presub_tl }
{ __mhchem_cf_loop: }
}{
- \__mhchem_regex_peek:NTF \l__mhchem_regex_digit_pregex
+ \__mhchem_regex_peek:NTF \l__mhchem_regex_digitOrMinus_pregex
{
\tl_set:Nn \l__mhchem_cf_state_tl { q+ }
\__mhchem_loopHelper_appendNextToken:NNn
@@ -2152,11 +2177,14 @@
\str_if_eq:VnTF \l__mhchem_cf_supState_tl { rm }
{ \tl_set:Nx \l__mhchem_cf_sup_tl { \exp_not:N \__mhchem_output_escapeToRomanMath:n { \exp_not:V \l__mhchem_cf_sup_tl } } }
{ \__mhchem_cg_replaceForSuperscript:N \l__mhchem_cf_sup_tl }
- \regex_match:NVTF
- \l__mhchem_regex_romanNumeral_fregex
- \l__mhchem_cf_sup_tl
- { \tl_set:Nn \l__mhchem_cf_supState_tl { ox } }
- {}
+ \str_if_eq:VnT \l__mhchem_cf_supState_tl { kv }
+ {
+ \regex_match:NVTF
+ \l__mhchem_regex_romanNumeral_fregex
+ \l__mhchem_cf_sup_tl
+ { \tl_set:Nn \l__mhchem_cf_supState_tl { ox } }
+ {}
+ }
\bool_if:nT
{
\str_if_eq_p:Vn \l__mhchem_cf_supState_tl { kv } &&
@@ -2225,8 +2253,9 @@
\__mhchem_cf_outputRawElement:
\__mhchem_cf_resetOutput:
}
-\cs_new_protected:Npn \__mhchem_cf_outputRawElementAndReset:n #1
+\cs_new_protected:Npn \__mhchem_cf_outputRaw:n #1
{
+ \__mhchem_cf_outputAndReset:
\tl_put_right:Nn \l__mhchem_cf_element_tl {#1}
\__mhchem_cf_outputRawElementAndReset:
}
@@ -2236,8 +2265,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tl_new:N \l__mhchem_cg_withinMathTokens_tmpa_tl
+\bool_new:N \l__mhchem_cg_withinMathTokens_bool
+\bool_set_false:N \l__mhchem_cg_withinMathTokens_bool
\cs_new_protected:Npn \__mhchem_cg_withinMathTokens:n #1
{
+ \group_begin:
+ \bool_set_true:N \l__mhchem_cg_withinMathTokens_bool
\int_compare:nTF { \l__mhchem_option_version_int > 3 }
{
\regex_match:NnTF
@@ -2289,12 +2322,7 @@
{
\__mhchem_output_escapeFromMathToItalicMath:n {#1}
}
- }
-\tl_new:N \g__mhchem_cg_potentialSpaceAfterWithinMath_tl
-\cs_new_protected:Npn \__mhchem_cg_potentialSpaceAfterWithinMath:
- {
- \tl_use:N \g__mhchem_cg_potentialSpaceAfterWithinMath_tl
- \tl_gclear:N \g__mhchem_cg_potentialSpaceAfterWithinMath_tl
+ \group_end:
}
\cs_new_protected:Npn \__mhchem_cg_itshape:n #1
{
@@ -2421,7 +2449,7 @@
\peek_meaning:NTF \q_recursion_stop
{ \use_none:n }
{
- \peek_catcode_remove:NTF \c_math_toggle_token
+ \peek_catcode_remove:NTF \c_math_toggle_token
{
\tl_set:Nn \l__mhchem_cg_replaceForSubscript_state_tl { s }
\__mhchem_loopHelper_appendWithinMathTokens:nn
@@ -2647,11 +2675,6 @@
}
}
-\cs_new_protected:Npn \__mhchem_output_begin_ce: {}
-\cs_new_protected:Npn \__mhchem_output_end_ce: {}
-\cs_new_protected:Npn \__mhchem_output_begin_cf: {}
-\cs_new_protected:Npn \__mhchem_output_end_cf: {}
-
\cs_new_protected:Npn \__mhchem_output_amount:n #1
{
\__mhchem_output_withFont:n {#1}
@@ -2671,18 +2694,19 @@
\hphantom { {}^{\__mhchem_output_withFont:n{#1}}\c_math_subscript_token{\__mhchem_output_withFont:n{#2}} }
{ \vphantom { \__mhchem_output_withFont:n { X } } }
^ {
- \mhchem@mathboxrightt
+ \__mhchem_output_coreFive_llap:n
{
- \vphantom { \__mhchem_output_scriptWithFont:n { 2+ } }
+ \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2 } } }
\__mhchem_output_scriptWithFont:n {#1}
}
}
\tl_if_empty:nF {#2}
{
\c_math_subscript_token {
- \mhchem@mathboxrightt
+ \__mhchem_output_coreFive_llap:n
{
- \smash{\__mhchem_output_scriptWithFont:n {#2}}
+ \vphantom { \__mhchem_output_scriptWithFont:n { 2 } }
+ \smash[t] { \__mhchem_output_scriptWithFont:n {#2} }
}
}
}
@@ -2703,7 +2727,7 @@
}
}
^ {
- \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2+ } } }
+ \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2 } } }
\__mhchem_output_scriptWithFont:n {#4#5#7}
}
}
@@ -2715,7 +2739,7 @@
{
{ \vphantom { \__mhchem_output_withFont:n { X } } }
^ {
- \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2+ } } }
+ \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2 } } }
\__mhchem_output_scriptWithFont:n {#4}
}
\c_math_subscript_token
@@ -2735,7 +2759,7 @@
}
}
^ {
- \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2+ } } }
+ \vphantom { \smash[t] { \__mhchem_output_scriptWithFont:n { 2 } } }
\hphantom { \__mhchem_output_scriptWithFont:n {#6} }
\__mhchem_output_scriptWithFont:n {#5#7}
}
@@ -2754,7 +2778,6 @@
{ \vphantom { \__mhchem_output_withFont:n { X } } }
\c_math_subscript_token
{
- \vphantom { \__mhchem_output_scriptWithFont:n { 2 } }
\smash[t] { \__mhchem_output_scriptWithFont:n {#6} }
}
}
@@ -2771,6 +2794,28 @@
}
\group_end:
}
+\cs_new_protected:Npn \__mhchem_output_coreFive_llap:n #1
+ {
+ \mathchoice
+ {\llap{\ensuremath{\displaystyle#1}}}
+ {\llap{\ensuremath{\textstyle#1}}}
+ {\llap{\ensuremath{\scriptstyle#1}}}
+ {\llap{\ensuremath{\scriptscriptstyle#1}}}
+ }
+%%% @minispace
+\newlength\mhchem@minispace@tmp
+\newcommand*\mhchem@minispace{%
+ \setlength{\mhchem@minispace@tmp}{0pt-\widthof{${}^8\c_math_subscript_token8$}+%
+ \widthof{$\text{C}^8\c_math_subscript_token8$}-\widthof{$\text{C}^{}\c_math_subscript_token{}$}}%
+ \kern\mhchem@minispace@tmp%
+}
+%%% @minibackspace
+\newlength\mhchem@minibackspace@tmp
+\newcommand*\mhchem@minibackspace{%
+ \setlength{\mhchem@minibackspace@tmp}{0pt-\widthof{${}\c_math_subscript_token{2}{}\c_math_subscript_token{2}$}+\widthof{${}\c_math_subscript_token{22}$}}%
+ \kern\mhchem@minibackspace@tmp%
+}
+
\cs_new_protected:Npn \__mhchem_output_withFont:n #1
{
\bool_if:NTF \l__mhchem_output_isMathMode_bool
@@ -2811,7 +2856,9 @@
{ \group_begin: \itshape \mhchem@hook@beforeItalicText #1 \group_end: \/ }
\cs_new_protected:Npn \__mhchem_output_escapeToItalicMath:n #1
{
- \ensuremath { \__mhchem_output_escapeFromMathToItalicMath:n {#1} }
+ \bool_if:NTF \l__mhchem_output_isMathMode_bool
+ { \__mhchem_output_escapeFromMathToItalicMath:n {#1} }
+ { \__mhchem_output_escapeFromTextToItalicMath:n {#1} }
}
\cs_new_protected:Npn \__mhchem_output_escapeFromMathToItalicMath:n #1
{
@@ -2822,6 +2869,12 @@
\ensuremath
{
\mhchem@hook@beforeItalicMath
+ \bool_if:NT \l__mhchem_cg_isScript_bool
+ {
+ \medmuskip=0mu
+ \thinmuskip=0mu
+ \thickmuskip=0mu
+ }
#1
}
}
@@ -2882,6 +2935,12 @@
{
\ensuremath { \,{\mhchem@option@cdot}\, }
}
+\cs_new_protected:Npn \__mhchem_output_verticalBar:
+ {
+ \bool_if:NTF \l__mhchem_output_isMathMode_bool
+ { | }
+ { \text{\textbar} }
+ }
\cs_new_protected:Npn \__mhchem_output_excited:
{
\bool_if:NTF \l__mhchem_output_isMathMode_bool
@@ -2907,61 +2966,6 @@
{ \__mhchem_output_commaEnumerationSmall: }
}
-\cs_new_protected:Npn \__mhchem_output_bond_single:
- {
- \int_compare:nTF { \l__mhchem_option_version_int < 4 }
- { {\ensuremath{-}} }
- {
- \bool_if:NTF \l__mhchem_output_isMathMode_bool
- { {\ensuremath{-}} }
- { \text{\mhchem@option@textminus} }
- }
- }
-\cs_new_protected:Npn \__mhchem_output_bond_double:
- {
- \rlap { \protect \raisebox { .2ex }{ \__mhchem_output_bond_single: } }
- \protect \raisebox { -.2ex }{ \__mhchem_output_bond_single: }
- }
-\cs_new_protected:Npn \__mhchem_output_bond_triple:
- {
- \rlap { \protect \raisebox { .4ex } { \__mhchem_output_bond_single: } }
- \rlap{ \__mhchem_output_bond_single: }
- \protect \raisebox { -.4ex } { \__mhchem_output_bond_single: }
- }
-\cs_new_protected:Npn \__mhchem_output_bond_half:
- {
- \mhchem@setbondwidth
- \mhchem@halfbond
- }
-\cs_new_protected:Npn \__mhchem_output_bond_oneAndHalf:
- {
- \mhchem@setbondwidth
- \rlap{\protect\raisebox{.2ex}{\mhchem@halfbond}}
- \protect\raisebox{-.2ex}{\__mhchem_output_bond_single:}
- }
-\cs_new_protected:Npn \__mhchem_output_bond_twoAndHalf:
- {
- \mhchem@setbondwidth
- \rlap{\protect\raisebox{.4ex}{\mhchem@halfbond}}
- \rlap{\__mhchem_output_bond_single:}
- \protect\raisebox{-.4ex}{\__mhchem_output_bond_single:}
- }
-\cs_new_protected:Npn \__mhchem_output_bond_twoAndHalff:
- {
- \mhchem@setbondwidth
- \rlap{\protect\raisebox{.4ex}{\__mhchem_output_bond_single:}}
- \rlap{\mhchem@halfbond}
- \protect\raisebox{-.4ex}{\__mhchem_output_bond_single:}
- }
-\cs_new_protected:Npn \__mhchem_output_bond_dotdotdot:
- { {\cdot}{\cdot}{\cdot} }
-\cs_new_protected:Npn \__mhchem_output_bond_dotdotdotdot:
- { {\cdot}{\cdot}{\cdot}{\cdot} }
-\cs_new_protected:Npn \__mhchem_output_bond_rightArrow:
- { {\rightarrow} }
-\cs_new_protected:Npn \__mhchem_output_bond_leftArrow:
- { {\leftarrow} }
-
\cs_new_protected:Npn \__mhchem_output_greek:n #1
{
\group_begin:
@@ -3013,9 +3017,15 @@
\cs_set_eq:NN \Chi \__mhchem_output_greek_orig_Chi
\cs_set_eq:NN \Psi \__mhchem_output_greek_orig_Psi
\cs_set_eq:NN \Omega \__mhchem_output_greek_orig_Omega
- \mode_if_math:TF
- { \chemgreek_get_from_mapping:nn { mhchem-math } {#1} }
- { \chemgreek_get_from_mapping:nn { mhchem-text } {#1} }
+ \bool_if:NTF \l__mhchem_cg_withinMathTokens_bool
+ {
+ { \chemgreek_get_from_mapping:nn { default } {#1} }
+ }
+ {
+ \mode_if_math:TF
+ { \chemgreek_get_from_mapping:nn { mhchem-math } {#1} }
+ { \chemgreek_get_from_mapping:nn { mhchem-text } {#1} }
+ }
\group_end:
}
@@ -3023,6 +3033,61 @@
%%%%%%%%%% bonds %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\cs_new_protected:Npn \__mhchem_output_bond_single:
+ {
+ \int_compare:nTF { \l__mhchem_option_version_int < 4 }
+ { {\ensuremath{-}} }
+ {
+ \bool_if:NTF \l__mhchem_output_isMathMode_bool
+ { {\ensuremath{-}} }
+ { \text{\mhchem@option@textminus} }
+ }
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_double:
+ {
+ \rlap { \protect \raisebox { .2ex }{ \__mhchem_output_bond_single: } }
+ \protect \raisebox { -.2ex }{ \__mhchem_output_bond_single: }
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_triple:
+ {
+ \rlap { \protect \raisebox { .4ex } { \__mhchem_output_bond_single: } }
+ \rlap{ \__mhchem_output_bond_single: }
+ \protect \raisebox { -.4ex } { \__mhchem_output_bond_single: }
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_half:
+ {
+ \mhchem@setbondwidth
+ \mhchem@halfbond
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_oneAndHalf:
+ {
+ \mhchem@setbondwidth
+ \rlap{\protect\raisebox{.2ex}{\mhchem@halfbond}}
+ \protect\raisebox{-.2ex}{\__mhchem_output_bond_single:}
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_twoAndHalf:
+ {
+ \mhchem@setbondwidth
+ \rlap{\protect\raisebox{.4ex}{\mhchem@halfbond}}
+ \rlap{\__mhchem_output_bond_single:}
+ \protect\raisebox{-.4ex}{\__mhchem_output_bond_single:}
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_twoAndHalff:
+ {
+ \mhchem@setbondwidth
+ \rlap{\protect\raisebox{.4ex}{\__mhchem_output_bond_single:}}
+ \rlap{\mhchem@halfbond}
+ \protect\raisebox{-.4ex}{\__mhchem_output_bond_single:}
+ }
+\cs_new_protected:Npn \__mhchem_output_bond_dotdotdot:
+ { {\cdot}{\cdot}{\cdot} }
+\cs_new_protected:Npn \__mhchem_output_bond_dotdotdotdot:
+ { {\cdot}{\cdot}{\cdot}{\cdot} }
+\cs_new_protected:Npn \__mhchem_output_bond_rightArrow:
+ { {\rightarrow} }
+\cs_new_protected:Npn \__mhchem_output_bond_leftArrow:
+ { {\leftarrow} }
+
\newlength\mhchem@bondwidth%
\newlength\mhchem@bondheight%
\newlength\mhchem@smallbondwidth@tmpA%
@@ -3066,6 +3131,7 @@
\msg_new:nnn { mhchem } { bond / unknown }
{ Unknown~bond~type~in~\string\bond~(#1) }
+
\ExplSyntaxOff
\ExplSyntaxOn % with special tilde
\char_set_catcode_letter:n { 126 } % tilde
@@ -3098,32 +3164,6 @@
}
\ExplSyntaxOff % end of Expl with tilde
-%%% @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}}}}
-\newcommand*\mhchem@mathboxrightt[1]{\mathchoice%
- {\ensuremath{\displaystyle\llap{\ensuremath{\displaystyle#1}}}}%
- {\ensuremath{\textstyle\llap{\ensuremath{\textstyle#1}}}}%
- {\ensuremath{\scriptstyle\llap{\ensuremath{\scriptstyle#1}}}}%
- {\ensuremath{\scriptscriptstyle\llap{\ensuremath{\scriptscriptstyle#1}}}}}%
-
-%%% @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%
-}
-%%% @minibackspace
-\newlength\mhchem@minibackspace@tmp
-\newcommand*\mhchem@minibackspace{%
- \setlength{\mhchem@minibackspace@tmp}{0pt-\widthof{${}_{2}{}_{2}$}+\widthof{${}_{22}$}}%
- \kern\mhchem@minibackspace@tmp%
-}
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Package Options %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -3131,21 +3171,10 @@
\ExplSyntaxOn
\tl_new:N \l__mhchem_option_tmpa_tl
-\msg_new:nnn { mhchem } { options / no-version }
- {
- You~did~not~specify~a~'version'~option~for~the~mhchem~package.~
- Please~write~
- \string\usepackage[version=4]{mhchem}~in~your~preamble~
- (or~any~lower~number~for~compatibility~mode),~
- because~you~might~get~different~output~with~the~same~input~
- in~future~versions.
- }
\msg_new:nnn { mhchem } { options / version-too-high }
{
You~are~using~version~4.xx~of~mhchem,
- but~you~entered~a~higher~version~number.~
- This~means,~you~are~using~some~beta~features~of~mhchem~
- that~are~subject~to~change~without~notice.
+ but~you~entered~a~higher~version~number~that~is~not~supported~yet.
}
\def\mhchem@option@mathFont{\mathrm}
@@ -3167,7 +3196,7 @@
\bool_new:N \l__mhchem_option_mathgreekSelectedByUser_bool
\bool_set_false:N \l__mhchem_option_mathgreekSelectedByUser_bool
-\keys_define:nn {mhchem}
+\keys_define:nn { mhchem }
{
version .int_set:N = \l__mhchem_option_version_int,
version .value_required:,
@@ -3275,14 +3304,21 @@
\int_compare:nT { -1 = \l__mhchem_option_version_int }
{
- \msg_warning:nn { mhchem } { options / no-version }
+ \PackageWarningNoLine { mhchem }
+ {
+ You~did~not~specify~a~'version'~option~for~the~mhchem\MessageBreak
+ package.~Please~write~\string\usepackage[version=4]{mhchem}\MessageBreak
+ in~your~preamble~(or~any~lower~number~for\MessageBreak
+ compatibility~mode),~because~you~might~get~slightly\MessageBreak
+ different~output~with~the~same~input~in~future~versions
+ }
\int_set:Nn \l__mhchem_option_version_int { 4 }
}
% else
{
\int_compare:nT { \l__mhchem_option_version_int > 4 }
{
- \msg_warning:nn { mhchem } { options / version-too-high }
+ \msg_error:nn { mhchem } { options / version-too-high }
}
}
\bool_if:NF \l__mhchem_option_layoutWasSet_bool
@@ -3310,8 +3346,7 @@
\int_compare:nT { \l__mhchem_option_version_int < 4 }
{
- \newcommand*\mhchem@cmath[1]{\__mhchem_output_escapeFromMathToItalicMath:n{#1}}
- \newcommand*\cmath[1]{\mhchem@cmath{#1}}
+ \newcommand*\cmath[1]{\__mhchem_output_escapeFromMathToItalicMath:n{#1}}
\DeclareRobustCommand\cf[2][]{\mhchem@cf[#1]{#2}}
\DeclareRobustCommand\cee[1]{\mhchem@cee{#1}}
}