From 8abada29009890b3f73568d9bcefffbdacaaf0a0 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 25 Jun 2018 20:56:15 +0000
Subject: mhchem (25jun18)

git-svn-id: svn://tug.org/texlive/trunk@48088 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/mhchem/mhchem.sty | 45 +++++++++++++--------------
 1 file changed, 21 insertions(+), 24 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/mhchem/mhchem.sty')

diff --git a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
index 227372cdca1..594b5e6d0e6 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-2017 Martin Hensel
+%% Copyright 2004-2018 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}[2017/07/24 v4.07 for typesetting chemical formulae]
+\ProvidesPackage{mhchem}[2018/06/22 v4.08 for typesetting chemical formulae]
 \RequirePackage{expl3}
 \RequirePackage{l3keys2e}
 \RequirePackage{calc}[1998/07/07]
@@ -2335,7 +2335,7 @@
           \l__mhchem_regex_bracedGroup_fregex
           {#1}
           {
-            \__mhchem_output_escapeFromMathToItalicMath:n {#1}
+            \__mhchem_output_escapeToItalicMath:n {#1}
           }
         % else
           {
@@ -2346,10 +2346,11 @@
                 \group_begin:
                   \bool_if:NTF \l__mhchem_output_isMathMode_bool
                     {
-                      \thinmuskip=0mu
-                      \medmuskip=0mu
-                      \thickmuskip=0mu
-                      \__mhchem_output_escapeFromMathToItalicMath:n {#1}
+                      \text { \ensuremath
+                        {
+                          \thinmuskip=0mu \medmuskip=0mu \thickmuskip=0mu
+                          \__mhchem_output_escapeFromMathToItalicMath:n {#1}
+                        } }
                     }
                     {
                       \tl_set:Nn \l__mhchem_cg_withinMathTokens_tmpa_tl { #1 }
@@ -2370,9 +2371,7 @@
                 \group_end:
               }
               {
-                \bool_if:NTF \l__mhchem_output_isMathMode_bool
-                  { \__mhchem_output_escapeFromMathToItalicMath:n {#1} }
-                  { \__mhchem_output_escapeFromTextToItalicMath:n {#1} }
+                \__mhchem_output_escapeToItalicMath:n {#1}
               }
           }
       }
@@ -2486,7 +2485,7 @@
               {
                 \regex_replace_all:NnN
                   \l__mhchem_regex_oneLowercaseLetter_regex
-                  { \c{__mhchem_output_withFont:n}\cB[ \c{__mhchem_cg_itshape:n}\cB[ \0 \cE]\cE] }
+                  { \c{__mhchem_cg_itshape:n}\cB[ \0 \cE] }
                   #1
                 \regex_replace_all:NnN
                   \l__mhchem_regex_hyphen_regex
@@ -2938,19 +2937,13 @@
   {
     \bool_if:NTF \l__mhchem_output_isMathMode_bool
       { \__mhchem_output_escapeFromMathToItalicMath:n {#1} }
-      { \__mhchem_output_escapeFromTextToItalicMath:n {#1} }
+      { \ensuremath { \mhchem@hook@beforeItalicMath #1 } }
   }
 \cs_new_protected:Npn \__mhchem_output_escapeFromMathToItalicMath:n #1
   {
-    \text { \__mhchem_output_escapeFromTextToItalicMath:n {#1} }
-  }
-\cs_new_protected:Npn \__mhchem_output_escapeFromTextToItalicMath:n #1
-  {
-    \ensuremath
-      {
-        \mhchem@hook@beforeItalicMath
-        #1
-      }
+    \bool_if:NTF \l__mhchem_option_unicodemath_bool
+      { \text { \ensuremath { \symit { \mhchem@hook@beforeItalicMath #1 } } } }
+      { \text { \ensuremath {          \mhchem@hook@beforeItalicMath #1 } } }
   }
 
 \cs_new_protected:Npn \__mhchem_output_skipAfterAmount:
@@ -3022,9 +3015,9 @@
       { \smash{\raisebox{-0.4em}{\scalebox{1.3}{*}}} }
   }
 \cs_new_protected:Npn \__mhchem_output_commaDecimal:
-  { \__mhchem_output_withFont:n { , } }
+  { \__mhchem_output_withFont:n { {,} } }
 \cs_new_protected:Npn \__mhchem_output_commaEnumeration:
-  { \__mhchem_output_withFont:n { , } \ensuremath { \mkern3mu } }
+  { \__mhchem_output_withFont:n { {,} } \ensuremath { \mkern3mu } }
 \cs_new_protected:Npn \__mhchem_output_commaAuto:
   {
     \__mhchem_regex_peek:NTF \l__mhchem_regex_digit_pregex
@@ -3032,7 +3025,7 @@
       { \__mhchem_output_commaEnumeration: }
   }
 \cs_new_protected:Npn \__mhchem_output_commaEnumerationSmall:
-  { \__mhchem_output_withFont:n { , } \ensuremath { \mkern1mu } }
+  { \__mhchem_output_withFont:n { {,} } \ensuremath { \mkern1mu } }
 \cs_new_protected:Npn \__mhchem_output_commaAutoSmall:
   {
     \__mhchem_regex_peek:NTF \l__mhchem_regex_digit_pregex
@@ -3402,6 +3395,7 @@
       { \mhchemoptions{layout=staggered-flat} }
   }
 
+\bool_new:N \l__mhchem_option_unicodemath_bool
 \AtBeginDocument
   {
     \bool_if:nF \l__mhchem_option_textgreekSelectedByUser_bool
@@ -3412,6 +3406,9 @@
       {
         \chemgreek_declare_mapping_alias:nn { mhchem-math } { \l_chemgreek_active_mapping_tl }
       }
+    \@ifpackageloaded {unicode-math}
+      { \bool_set_true:N \l__mhchem_option_unicodemath_bool }
+      { \bool_set_false:N \l__mhchem_option_unicodemath_bool }
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-- 
cgit v1.2.3

