diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/mhchem/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mhchem/manifest.txt | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mhchem/mhchem.pdf | bin | 385337 -> 386711 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mhchem/mhchem.tex | 23 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/mhchem/mhchem.sty | 286 |
5 files changed, 172 insertions, 142 deletions
diff --git a/Master/texmf-dist/doc/latex/mhchem/README b/Master/texmf-dist/doc/latex/mhchem/README index 4a258578407..c1b53441e32 100644 --- a/Master/texmf-dist/doc/latex/mhchem/README +++ b/Master/texmf-dist/doc/latex/mhchem/README @@ -1,7 +1,7 @@ -The mhchem Bundle 2015-04-23 +The mhchem Bundle 2015-07-23 containing -- mhchem v4.01 +- mhchem v4.02 - hpstatement v1.01 - rsphrase v3.11 diff --git a/Master/texmf-dist/doc/latex/mhchem/manifest.txt b/Master/texmf-dist/doc/latex/mhchem/manifest.txt index f008046fef7..3835c77fe2d 100644 --- a/Master/texmf-dist/doc/latex/mhchem/manifest.txt +++ b/Master/texmf-dist/doc/latex/mhchem/manifest.txt @@ -1,6 +1,7 @@ This work consists of the files mhchem.sty (Copyright Martin Hensel) + mhchem.4ht (Copyright Martin Hensel) hpstatement.sty (Copyright Martin Hensel, except the contained statements) rsphrase.sty (Copyright Martin Hensel, except the contained phrases) diff --git a/Master/texmf-dist/doc/latex/mhchem/mhchem.pdf b/Master/texmf-dist/doc/latex/mhchem/mhchem.pdf Binary files differindex 5d642912e4a..db4fea48dd1 100644 --- a/Master/texmf-dist/doc/latex/mhchem/mhchem.pdf +++ b/Master/texmf-dist/doc/latex/mhchem/mhchem.pdf diff --git a/Master/texmf-dist/doc/latex/mhchem/mhchem.tex b/Master/texmf-dist/doc/latex/mhchem/mhchem.tex index bc1e4c827f4..03fea5234d3 100644 --- a/Master/texmf-dist/doc/latex/mhchem/mhchem.tex +++ b/Master/texmf-dist/doc/latex/mhchem/mhchem.tex @@ -67,7 +67,7 @@ The mhchem Bundle\\[0.3em] \Large\textmd{% Documentation for the Packages\\ - mhchem v4.01,\\% check + mhchem v4.02,\\% check hpstatement v1.01 and\\ rsphrase v3.11}% } @@ -76,7 +76,7 @@ mhchem\makebox[0pt][l]{\textcolor{white}{NOSPAM}}@MartinHensel\makebox[1pt][l]{\textcolor{white}{.}}.de% } \date{% - 2015-04-23% check + 2015-07-23% check } \maketitle @@ -132,7 +132,7 @@ mhchem needs a couple of other packages. For instance, expl3, amsmath and calc. \end{SideBySideExample} \begin{SideBySideExample}[xrightmargin=6cm] - \ce{Hg^2+ ->[I-] HgI2 + \ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-} \end{SideBySideExample} @@ -391,7 +391,7 @@ You can `half-escape' to math by using \verb|$...$|. Remember, that the math fon When `half-escaped', mhchem tries to recognize common patterns and still use the correct font. \begin{SideBySideExample}[xrightmargin=4cm] - $\ce{Fe^$n$+}$ \sffamily\bfseries \ce{Fe^$n$+} + $\ce{Fe^$n$+}$ \sffamily\bfseries \ce{Fe^$n$+} \end{SideBySideExample} You can prevent this recognition by `fully escaping' to math with \verb|${...}$|. @@ -761,7 +761,7 @@ switches back to the default, which is equivalent to \subsection{Greek Font} \label{sec:GreekFont} -If you load a package for upright Greek letters, this will automatically be used. This was possible by the very neat chemgreek package of Clemens Niederberger. If you want to have different Greek fonts for text mode and math mode, you can specify these `mappings', e.\,g. by \verb|\mhchemoptions{text-greek=upgreek,| \verb|math-greek=default}|. You can use any of +If you load a package for upright Greek letters, this will automatically be used. This was possible by the very neat chemgreek package of Clemens Niederberger. If you want to have different Greek fonts for text mode and math mode, you can specify these `mappings', e.\,g. by \verb|\mhchemoptions{text-greek=upgreek,| \verb|math-greek=default}|. You can use any of \begin{compactitem}[--] \item default, \item var-default, @@ -825,6 +825,10 @@ If you use this switch inside your document with \macro{mhchemoptions}, don't fo +\section{Rudimentary \TeX 4HT (htlatex) support} + +mhchem has basic support for \TeX 4HT (htlatex). Summary formulae should work fine. Special bonds and reaction arrows are recognizable, but ugly. Complex math with mhchem inside might fail completely. + \clearpage \section{Major Changes} \label{sec:WhatSNew} @@ -844,9 +848,16 @@ Meaning and usage of \macro{bond} changed. \section{Most Recent Changes}% check +\minisec{2015-07-23 mhchem v4.02} +\begin{compactitem} +\item added rudimentary TeX4ht support +\item fixed the \verb|\str_case:nnn| bug---expl3 removed that function +\end{compactitem} + \minisec{2015-04-23 mhchem v4.01} \begin{compactitem} -\item syntax improvements% $n$H2O, D2-3[T4O10], Fe^{III}2 +\item support upright greek characters (chemgreek) +\item syntax improvements% $n$H2O, D2-3[T4O10], Fe^{III}2 \item recognition of states of aggregation% HCl(g), OH-(aq) \item text-font operators \verb|+|, \verb|-|, \verb|=| \end{compactitem} diff --git a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty index 5d27ecce7ce..f9d1fe25f25 100644 --- a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty +++ b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty @@ -27,7 +27,7 @@ % This work consists of all files listed in manifest.txt. % % -\ProvidesPackage{mhchem}[2015/04/23 v4.01 for typesetting chemical formulae] +\ProvidesPackage{mhchem}[2015/07/23 v4.02 for typesetting chemical formulae] \RequirePackage{expl3} \RequirePackage{l3keys2e} \RequirePackage{l3regex} @@ -55,7 +55,7 @@ \ExplSyntaxOn \cs_generate_variant:Nn \str_if_eq:nnTF { Vn } -\cs_generate_variant:Nn \str_case:nnn { Vnn } +\cs_generate_variant:Nn \str_case:nnF { VnF } \cs_generate_variant:Nn \regex_match:nnTF { nV } \cs_generate_variant:Nn \regex_match:nnTF { no } \cs_new_protected:Npn \__mhchem_regex_peek:nTF #1 #2 #3 @@ -85,7 +85,7 @@ } \cs_new_protected:Npn \__mhchem_loopHelper_appendNextGroup_prefix_ifEmpty:NnnNn #1#2#3#4#5 { - \str_if_eq:nnTF {#5} {} + \tl_if_empty:nTF {#5} { #3 } { \tl_put_right:Nn #1 { #2 { #5 } } } #4 @@ -174,9 +174,9 @@ %%%%%%%%%% %%% /\ %%% -%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%% \cesplit %%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ExplSyntaxOn \cs_generate_variant:Nn \regex_replace_all:nnN { VnN } @@ -362,20 +362,22 @@ \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: } \cs_new_protected:Npn \__mhchem_ce_loop: { \int_incr:N \l__mhchem_ce_distanceFromLastComma_int - \str_case:Vnn \l__mhchem_ce_state_tl + \str_case:VnF \l__mhchem_ce_state_tl { { c } { - \str_case:Vnn \l__mhchem_ce_part_tl + \str_case:VnF \l__mhchem_ce_part_tl { { + } { @@ -435,7 +437,7 @@ { \__mhchem_ce_output: }{ - \str_case:Vnn \l__mhchem_ce_state_tl + \str_case:VnF \l__mhchem_ce_state_tl { { c } { @@ -524,7 +526,7 @@ } % else { - \str_case:Vnn \l__mhchem_ce_arrowName_tl + \str_case:VnF \l__mhchem_ce_arrowName_tl { { yieldsLeft } { @@ -739,11 +741,11 @@ \cs_new_protected:Npn \__mhchem_ce_output: { \bool_set_true:N \l__mhchem_ce_potentialSpacingAllowed_bool - \str_case:Vnn \l__mhchem_ce_state_tl + \str_case:VnF \l__mhchem_ce_state_tl { { c } { - \str_case:Vnn \l__mhchem_ce_part_tl + \str_case:VnF \l__mhchem_ce_part_tl { { - } { @@ -757,12 +759,6 @@ { \__mhchem_output_operatorEquals: } \bool_set_false:N \l__mhchem_ce_potentialSpacingAllowed_bool } - { +- } - { - \tl_put_right:Nn \l__mhchem_ce_result_tl - { \__mhchem_output_operatorPlusMinus: } - \bool_set_false:N \l__mhchem_ce_potentialSpacingAllowed_bool - } { $\pm$ } { \tl_put_right:Nn \l__mhchem_ce_result_tl @@ -965,7 +961,7 @@ } \cs_new_protected:Npn \__mhchem_arrow_deploy:nnnnn #1#2#3#4#5 { - \str_case:nnn {#2} + \str_case:nnF {#2} { { } { @@ -1443,25 +1439,23 @@ \cs_new_protected:Npn \__mhchem_cf:nn #1#2 { \group_begin: - \let\sbond\__mhchem_output_sbond: - \int_compare:nTF { 2 = \l__mhchem_option_version_int } - { \let\bond\sbond } + \bool_if:NF \l__mhchem_cf_cfActive_bool { - \int_compare:nT { \l__mhchem_option_version_int > 2 } + \bool_set_true:N \l__mhchem_cf_cfActive_bool + \bool_if:NF \l__mhchem_ce_ceActive_bool + { \__mhchem_output_defMathOrText: } + \int_compare:nTF { \l__mhchem_option_version_int < 3 } + { \cs_set_eq:NN \bond \__mhchem_output_bond_single: } { - \def\bond{\mhchem@bond} + \cs_set_protected:Npn \bond { \mhchem@bond } } - } - \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 \l__mhchem_ce_ceActive_bool { - \bool_if:NF \l__mhchem_cf_cfActive_bool - { - \bool_set_true:N \l__mhchem_cf_cfActive_bool - \__mhchem_output_defMathOrText: - } + \int_compare:nT { \l__mhchem_option_version_int < 4 } + { + \cs_set_protected:Npn \sbond { \__mhchem_output_bond_single: } + \cs_set_protected:Npn \dbond { \__mhchem_output_bond_double: } + \cs_set_protected:Npn \tbond { \__mhchem_output_bond_triple: } + } + \cs_set_protected:Npn \hyphen {\mhchem@hyphen} } \tl_set:Nn \l__mhchem_cf_state_tl { s } \bool_set_false:N \l__mhchem_cf_startedWithBond_bool @@ -1474,9 +1468,11 @@ \tl_clear:N \l__mhchem_cf_result_tl \__mhchem_cf_loop: #2 \q_recursion_stop } - \str_if_eq:nnTF {#1} {} + \__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 @@ -1487,14 +1483,14 @@ { \peek_meaning_remove:NTF \q_recursion_stop { - \str_case:Vnn \l__mhchem_cf_state_tl + \str_case:VnF \l__mhchem_cf_state_tl { { - } { \bool_if:NTF \l__mhchem_cf_startedWithBond_bool { \__mhchem_cf_outputAndReset: - \__mhchem_cf_outputRawElementAndReset:n { \sbond } + \__mhchem_cf_outputRawElementAndReset:n { \__mhchem_output_bond_single: } } { \tl_put_right:Nn \l__mhchem_cf_sup_tl { - } } } @@ -1508,7 +1504,7 @@ { \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ \peek_meaning:NTF \protect { \__mhchem_loopHelper_ignoreNextToken:Nn \__mhchem_cf_loop: }{ - \str_case:Vnn \l__mhchem_cf_state_tl + \str_case:VnF \l__mhchem_cf_state_tl { { - } { @@ -1521,7 +1517,8 @@ { \__mhchem_cg_escapeFromMathToTextOrFaketext:n { - } } } { - \__mhchem_cf_outputRawElementAndReset:n { \sbond } + \__mhchem_cf_outputRawElementAndReset:n + { \__mhchem_output_bond_single: } } \tl_set:Nn \l__mhchem_cf_state_tl { s } \__mhchem_cf_loop: @@ -1622,7 +1619,7 @@ { \__mhchem_cf_outputAndReset: \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:nnNn - { \dbond } + { \__mhchem_output_bond_double: } { s } \__mhchem_cf_loop: }{ @@ -1630,7 +1627,7 @@ { \__mhchem_cf_outputAndReset: \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:nnNn - { \tbond } + { \__mhchem_output_bond_triple: } { s } \__mhchem_cf_loop: }{ @@ -1833,14 +1830,14 @@ \peek_charcode:NTF = { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:nnNn - { \dbond } + { \__mhchem_output_bond_double: } { s } \__mhchem_cf_loop: }{ \peek_charcode:NTF ## { \__mhchem_loopHelper_outputAndReset_appendToResult_setState_useNone:nnNn - { \tbond } + { \__mhchem_output_bond_triple: } { s } \__mhchem_cf_loop: }{ @@ -2179,17 +2176,16 @@ ! \tl_if_empty_p:N \l__mhchem_cf_sub_tl || ! \tl_if_empty_p:N \l__mhchem_cf_sup_tl } - \str_case:Vnn \l__mhchem_cf_state_tl + \str_case:VnF \l__mhchem_cf_state_tl { { 1 } { \__mhchem_cg_replaceForAmount:N \l__mhchem_cf_element_tl \tl_put_right:Nx \l__mhchem_cf_result_tl { - \exp_not:N \__mhchem_output_withFont:n { + \exp_not:N \__mhchem_output_amount:n { \exp_not:V \l__mhchem_cf_element_tl } - \exp_not:N \__mhchem_output_skipAfterAmount: } } { 9 } @@ -2225,10 +2221,10 @@ \bool_if:nT { \str_if_eq_p:Vn \l__mhchem_cf_supState_tl { kv } && - \str_if_eq_p:Vn \l__mhchem_cf_sub_tl {} + \tl_if_empty_p:V \l__mhchem_cf_sub_tl } { \tl_set:Nn \l__mhchem_cf_supState_tl { d } } - \str_case:Vnn \l__mhchem_cf_supState_tl + \str_case:VnF \l__mhchem_cf_supState_tl { { kv } { @@ -2600,7 +2596,7 @@ }{ \peek_charcode_remove:NTF . { - \str_case:Vnn \l__mhchem_cg_replaceForSuperscript_state_tl + \str_case:VnF \l__mhchem_cg_replaceForSuperscript_state_tl { { 9. } { @@ -2654,7 +2650,7 @@ }{ \peek_charcode_remove:NTF , { - \str_case:Vnn \l__mhchem_cg_replaceForSuperscript_state_tl + \str_case:VnF \l__mhchem_cg_replaceForSuperscript_state_tl { { 9. } { @@ -2708,16 +2704,27 @@ \mhchem@option@textFont } } + +\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} + \__mhchem_output_skipAfterAmount: + } \cs_new_protected:Npn \__mhchem_output_coreFive:nnnnnnn #1#2#3#4#5#6#7 { \group_begin: \bool_if:nT - { \str_if_eq_p:nn {#7} {} && ! \str_if_eq_p:nn {#5} {} } + { \tl_if_empty_p:n {#7} && ! \tl_if_empty_p:n {#5} } { \bool_set_true:N \l__mhchem_option_superscriptsStacked_bool } \m@th \ensuremath { - \str_if_eq:nnF {#1#2} {} + \tl_if_empty:nF {#1#2} { \hphantom { {}^{\__mhchem_output_withFont:n{#1}}\c_math_subscript_token{\__mhchem_output_withFont:n{#2}} } { \vphantom { \__mhchem_output_withFont:n { X } } } @@ -2728,7 +2735,7 @@ \__mhchem_output_scriptWithFont:n {#1} } } - \str_if_eq:nnF {#2} {} + \tl_if_empty:nF {#2} { \c_math_subscript_token { \mhchem@mathboxrightt @@ -2740,12 +2747,12 @@ \mhchem@minispace } \__mhchem_output_withFont:n {#3} - \str_if_eq:nnF {#4#5#6#7} {} + \tl_if_empty:nF {#4#5#6#7} { \bool_if:NTF \l__mhchem_option_superscriptsStacked_bool { { \vphantom { \__mhchem_output_withFont:n { X } } } - \str_if_eq:nnF {#6} {} + \tl_if_empty:nF {#6} { \c_math_subscript_token { @@ -2762,7 +2769,7 @@ { \bool_if:NTF \l__mhchem_option_subscriptsDeep_bool { - \str_if_eq:nnF {#4} {} + \tl_if_empty:nF {#4} { { \vphantom { \__mhchem_output_withFont:n { X } } } ^ { @@ -2774,10 +2781,10 @@ \vphantom { \__mhchem_output_scriptWithFont:n { 2 } } } } - \str_if_eq:nnF {#5#6#7} {} + \tl_if_empty:nF {#5#6#7} { { \vphantom { \__mhchem_output_withFont:n { X } } } - \str_if_eq:nnF {#6} {} + \tl_if_empty:nF {#6} { \c_math_subscript_token { @@ -2793,14 +2800,14 @@ } } { - \str_if_eq:nnF {#4} {} + \tl_if_empty:nF {#4} { { \vphantom { \__mhchem_output_withFont:n { X } } } ^ { \__mhchem_output_scriptWithFont:n {#4} } } - \str_if_eq:nnF {#6} {} + \tl_if_empty:nF {#6} { { \vphantom { \__mhchem_output_withFont:n { X } } } \c_math_subscript_token @@ -2809,7 +2816,7 @@ \smash[t] { \__mhchem_output_scriptWithFont:n {#6} } } } - \str_if_eq:nnF {#5#7} {} + \tl_if_empty:nF {#5#7} { { \vphantom { \__mhchem_output_withFont:n { X } } } ^ { @@ -2887,12 +2894,6 @@ { - } { \mhchem@option@textminus } } -\cs_new_protected:Npn \__mhchem_output_plus: - { - \bool_if:NTF \l__mhchem_output_isMathMode_bool - { {}+{} } - { \hspace{0.5ex minus 0.5ex} + \hspace{0.5ex minus 0.5ex} } - } \cs_new_protected:Npn \__mhchem_output_operatorPlus: { \int_compare:nTF { \l__mhchem_option_version_int < 4 } @@ -2964,6 +2965,61 @@ { \__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: @@ -3050,89 +3106,51 @@ \setlength\mhchem@bondtmp@minussidebearingright{\mhchem@option@minustextsidebearingright} } } - \setlength\mhchem@bondwidth{\widthof{\sbond}}% - \setlength\mhchem@bondheight{\heightof{\sbond}}% + \setlength\mhchem@bondwidth{\widthof{\__mhchem_output_bond_single:}}% + \setlength\mhchem@bondheight{\heightof{\__mhchem_output_bond_single:}}% \setlength\mhchem@smallbondwidth@tmpA{% \mhchem@bondwidth-\mhchem@bondtmp@minussidebearingleft-\mhchem@bondtmp@minussidebearingright}% \setlength\mhchem@smallbondwidth@tmpB{% - \widthof{\sbond\sbond\sbond}-\mhchem@bondtmp@minussidebearingleft-% + \widthof{\__mhchem_output_bond_single:\__mhchem_output_bond_single:\__mhchem_output_bond_single:}-\mhchem@bondtmp@minussidebearingleft-% \mhchem@bondtmp@minussidebearingright}% \setlength\mhchem@smallbondwidth{\mhchem@bondwidth*% \ratio{\mhchem@smallbondwidth@tmpA}{\mhchem@smallbondwidth@tmpB}}% } \def\mhchem@halfbond{\rlap{\hspace{\mhchem@bondtmp@minussidebearingleft}% - \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}\unskip% - \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}% - \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\sbond}}% - \phantom{\sbond}}% - -\cs_new_protected:Npn \__mhchem_output_sbond: - { - \int_compare:nTF { \l__mhchem_option_version_int < 4 } - { {\ensuremath{-}} } - { - \bool_if:NTF \l__mhchem_output_isMathMode_bool - { {\ensuremath{-}} } - { \text{\mhchem@option@textminus} } - } - } + \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\__mhchem_output_bond_single:}\unskip% + \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\__mhchem_output_bond_single:}% + \resizebox{\mhchem@smallbondwidth}{\mhchem@bondheight}{\__mhchem_output_bond_single:}}% + \phantom{\__mhchem_output_bond_single:}}% +\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 - \cs_new_protected:Npn \mhchem@bond #1 { \ensuremath { - \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} } - } - { - \PackageError{mhchem}{Unknown~bond~type~in~\string\bond~(#1)}% + \str_case:nnF {#1} + { + { - } { \__mhchem_output_bond_single: } + { 1 } { \__mhchem_output_bond_single: } + { = } { \__mhchem_output_bond_double: } + { 2 } { \__mhchem_output_bond_double: } + { ## } { \__mhchem_output_bond_triple: } + { 3 } { \__mhchem_output_bond_triple: } + { ~ } { \__mhchem_output_bond_half: } + { ~- } { \__mhchem_output_bond_oneAndHalf: } + { ~-- } { \__mhchem_output_bond_twoAndHalf: } + { ~= } { \__mhchem_output_bond_twoAndHalf: } + { -~- } { \__mhchem_output_bond_twoAndHalff: } + { ... } { \__mhchem_output_bond_dotdotdot: } + { .... } { \__mhchem_output_bond_dotdotdotdot: } + { -> } { \__mhchem_output_bond_rightArrow: } + { <- } { \__mhchem_output_bond_leftArrow: } + } + { + \msg_error:nnx { mhchem } { bond / unknown } {#1} } } } |