From 491687da836539cd84a4754b1b7cb5e1f8398a63 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 15 Dec 2013 23:01:51 +0000
Subject: chemmacros (15dec13)

git-svn-id: svn://tug.org/texlive/trunk@32422 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/chemmacros/chemmacros.sty | 98 ++++++++++++----------
 1 file changed, 55 insertions(+), 43 deletions(-)

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

diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index 1a218208277..b5af1fa8903 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
@@ -26,8 +26,8 @@
 % - The Current Maintainer of this work is Clemens Niederberger.
 % --------------------------------------------------------------------------
 \RequirePackage{ expl3 , xparse , l3keys2e }
-\def\chemmacros@version{4.2c}
-\def\chemmacros@date{2013/11/20}
+\def\chemmacros@version{4.2d}
+\def\chemmacros@date{2013/12/15}
 
 \ProvidesExplPackage
   {chemmacros}
@@ -382,14 +382,12 @@
 \tl_set:Nn       \l_chemmacros_language_tl { english }
 \tl_new:N        \l__chemmacros_current_language_tl
 
-% translate the key #1 or insert #2
-\cs_new:Npn \chemmacros_translate:nn #1#2
+% translate the key #1
+\cs_new:Npn \chemmacros_translate:n #1
   {
-    \@trnslt@if@translation
-      { #1 }
-      { \l_chemmacros_language_tl }
+    \bool_if:NTF \l__chemmacros_language_auto_bool
       { \GetTranslation{#1} }
-      { #2 }    
+      { \GetTranslationFor{\l_chemmacros_language_tl}{#1} }
   }
 
 \AtBeginDocument{
@@ -494,8 +492,12 @@
       \bool_set_false:N \l__chemmacros_iupac_restricted_bool
       \bool_set_true:N \l__chemmacros_iupac_strict_bool ,
     language           .code:n     =
-      \bool_set_false:N \l__chemmacros_language_auto_bool
-      \tl_set:Nn \l__chemmacros_current_language_tl { #1 } ,
+      \tl_if_eq:nnTF { #1 } { auto }
+        { \bool_set_true:N \l__chemmacros_language_auto_bool }
+        {
+          \bool_set_false:N \l__chemmacros_language_auto_bool
+          \tl_set:Nn \l__chemmacros_current_language_tl { #1 }
+        } ,
     method             .choice: ,
     method / chemformula   .code:n     =
       \chemmacros_option_deprecated:n { method } ,
@@ -1309,12 +1311,22 @@
 
 % --------------------------------------------------------------------------- %
 % acid / base
+\tl_new:N  \l__chemmacros_k_acid_tl
+\tl_set:Nn \l__chemmacros_k_acid_tl  { \chemmacros_translate:n { K-acid } }
+\tl_new:N  \l__chemmacros_k_base_tl
+\tl_set:Nn \l__chemmacros_k_base_tl  { \chemmacros_translate:n { K-base } }
+\tl_new:N  \l__chemmacros_k_water_tl
+\tl_set:Nn \l__chemmacros_k_water_tl { \chemmacros_translate:n { K-water } }
+
 \keys_define:nn { chemmacros / acid-base }
   {
-    p-style .choice: ,
-    p-style / slanted .code:n = \cs_set_eq:NN \chemmacros_p_style:n \textsl ,
-    p-style / italics .code:n = \cs_set_eq:NN \chemmacros_p_style:n \textit ,
-    p-style / upright .code:n = \cs_set_eq:NN \chemmacros_p_style:n \textup
+    p-style           .choice: ,
+    p-style / slanted .code:n   = \cs_set_eq:NN \chemmacros_p_style:n \textsl ,
+    p-style / italics .code:n   = \cs_set_eq:NN \chemmacros_p_style:n \textit ,
+    p-style / upright .code:n   = \cs_set_eq:NN \chemmacros_p_style:n \textup ,
+    K-acid            .tl_set:N = \l__chemmacros_k_acid_tl ,
+    K-base            .tl_set:N = \l__chemmacros_k_base_tl ,
+    K-water           .tl_set:N = \l__chemmacros_k_water_tl
   }
 
 \cs_new_eq:NN \chemmacros_p_style:n \textup
@@ -1327,7 +1339,7 @@
           {
             K
             \c_math_subscript_token
-              { \chemmacros_translate:nn { K-acid } { A } }
+              { \l__chemmacros_k_acid_tl }
           }
       }
     \chemmacros_xspace:
@@ -1341,7 +1353,7 @@
           {
             K
             \c_math_subscript_token
-              { \chemmacros_translate:nn { K-base } { B } }
+              { \l__chemmacros_k_base_tl }
           }
       }
     \chemmacros_xspace:
@@ -1355,7 +1367,7 @@
           {
             K
             \c_math_subscript_token
-              { \chemmacros_translate:nn { K-water } { W } }
+              { \l__chemmacros_k_water_tl }
           }
       }
     \chemmacros_xspace:
@@ -1553,7 +1565,7 @@
     \bool_if:NTF \l__chemmacros_ox_parse_bool
       {
         \tl_if_in:nnTF { #1 } { / }
-          { \__chemmacros_ox_fraction:n #1 }
+          { \__chemmacros_ox_fraction:w #1 \q_stop }
           {
             \__chemmacros_ox_sign:n { #1 }
             \__chemmacros_ox_value:n { #1 }
@@ -1572,7 +1584,7 @@
     slash-symbol-font   = lmr
   }
 
-\cs_new_protected:Npn \__chemmacros_ox_fraction:n #1/#2
+\cs_new_protected:Npn \__chemmacros_ox_fraction:w #1/#2 \q_stop
   {
     \bool_set_false:N \l__chemmacros_ox_format_roman_bool
     \__chemmacros_ox_sign:n { #1 }
@@ -1597,8 +1609,7 @@
 
 \cs_new_protected:Npn \__chemmacros_ox_value:n #1
   {
-    \fp_set:Nn \l__chemmacros_ox_number_fp { #1 }
-    \fp_abs:N \l__chemmacros_ox_number_fp
+    \fp_set:Nn \l__chemmacros_ox_number_fp { abs(#1) }
     \__chemmacros_ox_is_integer:V \l__chemmacros_ox_number_fp
     \bool_if:NTF \l__chemmacros_ox_format_roman_bool
       { \__chemmacros_fp_to_Roman:V \l__chemmacros_ox_number_fp }
@@ -2350,9 +2361,8 @@
     \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 }
     \__chemmacros_define_phase:Nx #1
       {
-        \exp_not:N \chemmacros_translate:nn
+        \exp_not:N \chemmacros_translate:n
           { phase-\l__chemmacros_tmpa_tl }
-          { \exp_not:n { #2 } }
       }
   }
 
@@ -2365,9 +2375,8 @@
     \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 }
     \__chemmacros_define_phase:Nx #1
       {
-        \exp_not:N \chemmacros_translate:nn
+        \exp_not:N \chemmacros_translate:n
           { phase-\l__chemmacros_tmpa_tl }
-          { \exp_not:n { #2 } }
       }
   }
 
@@ -2439,6 +2448,7 @@
           \addcontentsline { lor } { reaction }
             {
               \tl_use:N \l__chemmacros_reaction_lorname_tl
+              \tl_use:N \c_space_tl
               #2 #3 #4 #5
               \tl_use:N \g__chemmacros_reaction_description_tl
             }
@@ -2539,7 +2549,7 @@
     arg          .default:n  = true ,
     list-name    .tl_set:N   = \reactionlistname ,
     list-entry   .code:n     =
-      \tl_set:Nn \l__chemmacros_reaction_lorname_tl { #1 ~ } ,
+      \tl_set:Nn \l__chemmacros_reaction_lorname_tl { #1 } ,
     list-heading .code:n     =
       \cs_set:Npn \__chemmacros_reaction_heading:n ##1 { #1 { ##1 } }
   }
@@ -3824,28 +3834,22 @@
 \DeclareTranslation{German}{phase-sld}{ f }
 \DeclareTranslation{German}{phase-lqd}{ f{}l }
 % list of reactions:
-\DeclareTranslationFallback  {list-of-reactions} { List ~ of ~ reactions }
-\DeclareTranslation{English} {list-of-reactions} { List ~ of ~ reactions }
+\DeclareTranslationFallback  {list-of-reactions} { List~ of~ reactions }
+\DeclareTranslation{English} {list-of-reactions} { List~ of~ reactions }
 \DeclareTranslation{German}  {list-of-reactions} { Reaktionsverzeichnis }
-\DeclareTranslation{Italian} {list-of-reactions} { Elenco ~ delle ~ reazioni }
-\DeclareTranslation{French}  {list-of-reactions} { Table ~ des ~ r\'eactions }
+\DeclareTranslation{Italian} {list-of-reactions} { Elenco~ delle~ reazioni }
+\DeclareTranslation{French}  {list-of-reactions} { Table~ des~ r\'eactions }
 %
-\DeclareTranslationFallback  {lor-reaction} { Reaction ~ }
-\DeclareTranslation{English} {lor-reaction} { Reaction ~ }
-\DeclareTranslation{German}  {lor-reaction} { Reaktion ~ }
-\DeclareTranslation{Italian} {lor-reaction} { Reazione ~ }
-\DeclareTranslation{French}  {lor-reaction} { R\'eaction ~ }
+\DeclareTranslationFallback  {reaction} { Reaction }
+\DeclareTranslation{English} {reaction} { Reaction }
+\DeclareTranslation{German}  {reaction} { Reaktion }
+\DeclareTranslation{Italian} {reaction} { Reazione }
+\DeclareTranslation{French}  {reaction} { R\'eaction }
 
 \tl_set:Nn \l__chemmacros_reaction_lorname_tl
-  {
-    \chemmacros_translate:nn
-      {lor-reaction} { Reaction ~ }
-  }
+  { \chemmacros_translate:n {reaction} }
 \tl_set:Nn \reactionlistname
-  {
-    \chemmacros_translate:nn
-      {list-of-reactions} { List ~ of ~ reactions }
-  }
+  { \chemmacros_translate:n {list-of-reactions} }
 
 \tex_endinput:D
 
@@ -4056,6 +4060,14 @@ Version history
 2013/10/31 - version 4.2a - bug bix in \hapto and \bridge
 2013/11/04 - version 4.2b - new IUPAC commands: \fac/\mer
 2013/11/20 - version 4.2c - step bundle version due to changes in `chemgreek'
+2013/12/15 - version 4.2d - small changes to the translating mechansim which
+                            now seems to be more logical: `language=auto'
+                            detects the current `babel' language and
+                            `language=<lang>' overwrites to the chosen
+                            language
+                          - new options `acid-base/K-acid', `acid-base/K-base'
+                            and `acid-base/K-water'
+                          - adapt \ox to updates in `l3fp'
 
 % --------------------------------------------------------------------------- %
 % TODO:
-- 
cgit v1.2.3

