From d62dfb02a03e1cd263bfbd6f33fda7006178193d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 7 May 2012 22:50:21 +0000 Subject: chemmacros (7may12) git-svn-id: svn://tug.org/texlive/trunk@26245 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/chemmacros/chemformula.sty | 95 +++- .../texmf-dist/tex/latex/chemmacros/chemmacros.sty | 632 +++++++++++++++++---- .../texmf-dist/tex/latex/chemmacros/ghsystem.sty | 28 +- 3 files changed, 613 insertions(+), 142 deletions(-) (limited to 'Master/texmf-dist/tex/latex/chemmacros') diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty index a509e2772a1..30f254f9039 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty @@ -5,7 +5,7 @@ % - macros and commands for chemists - % % --------------------------------------------------------------------------- % % - Clemens Niederberger - % -% - 2012/03/20 - % +% - 2012/05/07 - % % --------------------------------------------------------------------------- % % - https://bitbucket.org/cgnieder/chemmacros/ - % % - contact@mychemistry.eu - % @@ -30,8 +30,8 @@ \RequirePackage{ expl3 } \ProvidesExplPackage {chemformula} - {2012/03/20} - {3.2} + {2012/05/07} + {3.3} {typeset chemical compounds and reactions} %-----------------------------------------------------------------------------% @@ -488,7 +488,7 @@ %-----------------------------------------------------------------------------% % MAIN COMMAND -\NewDocumentCommand \chemformula_ch_aux_iii:w { > { \SplitList { ~ } } m } +\NewDocumentCommand \chemformula_ch_main:w { > { \SplitList { ~ } } m } { \group_begin: \cs_set_eq:NN \xspace \scan_stop: @@ -504,7 +504,7 @@ \chemformula_generate_arrows:V \l_chemformula_input_tl \chemformula_generate_name:V \l_chemformula_output_tl \tl_set_rescan:Nno \l_chemformula_output_tl - { \ExplSyntaxOn } + { \ExplSyntaxOn \makeatletter } { \l_chemformula_output_tl } \chemformula_write:V \l_chemformula_output_tl \group_end: @@ -523,6 +523,8 @@ \tl_gclear:N \g_chemformula_output_tl } +% Trickery to use \ch inside align environment: +% bypass \\: \cs_new:Npn \chemformula_ch_aux_i:w #1 \\ #2 \q_stop { \chemformula_ch_aux_ii:w #1 & \q_no_value \q_stop @@ -533,10 +535,10 @@ } } +% bypass &: \cs_new:Npn \chemformula_ch_aux_ii:w #1 & #2 \q_stop { - \tl_gput_right:Nn \g_chemformula_output_tl - { \chemformula_ch_aux_iii:w { #1 } } + \chemformula_ch_aux_iii:w #1 \label{} \q_no_value \q_stop \quark_if_no_value:nF { #2 } { \tl_gput_right:Nn \g_chemformula_output_tl { & } @@ -544,6 +546,40 @@ } } +% bypass \label: +\cs_new:Npn \chemformula_ch_aux_iii:w #1 \label#2 #3 \q_stop + { + \chemformula_ch_aux_iv:w #1 \tag{} \q_no_value \q_stop + \quark_if_no_value:nF { #3 } + { + \tl_gput_right:Nn \g_chemformula_output_tl { \label{#2} } + \chemformula_ch_aux_iii:w #3 \q_stop + } + } + +% bypass \tag: +\cs_new:Npn \chemformula_ch_aux_iv:w #1 \tag#2 #3 \q_stop + { + \chemformula_ch_aux_v:w #1 \intertext{} \q_no_value \q_stop + \quark_if_no_value:nF { #3 } + { + \tl_gput_right:Nn \g_chemformula_output_tl { \tag{#2} } + \chemformula_ch_aux_iv:w #3 \q_stop + } + } + +% bypass \intertext: +\cs_new:Npn \chemformula_ch_aux_v:w #1 \intertext#2 #3 \q_stop + { + \tl_gput_right:Nn \g_chemformula_output_tl + { \chemformula_ch_main:w { #1 } } + \quark_if_no_value:nF { #3 } + { + \tl_gput_right:Nn \g_chemformula_output_tl { \intertext{#2} } + \chemformula_ch_aux_v:w #3 \q_stop + } + } + % user command: \NewDocumentCommand \ch { om } { \chemformula_ch:nn { #1 } { #2 } } @@ -807,23 +843,29 @@ %-----------------------------------------------------------------------------% % bonds: +\dim_new:N \l_chemformula_bond_space_dim +\dim_zero:N \l_chemformula_bond_space_dim + \cs_new:Npn \chemformula_single_bond: { \bool_if:NTF \l_chemformula_sup_bool { \chemformula_minus: } { - \chemformula_tikz:nn { inner~sep=0, outer~sep=0 } - { - \draw node[draw=none,minimum~height=1em,minimum~width=0] - (chemformula-single-bond) at (0,0) {} ; - \draw[butt~cap-butt~cap] (chemformula-single-bond) ++ (0,-.1716em) - -- ++( \l_chemformula_bond_dim ,0) ; - } - } + \skip_horizontal:N \l_chemformula_bond_space_dim + \chemformula_tikz:nn { inner~sep=0, outer~sep=0 } + { + \draw node[draw=none,minimum~height=1em,minimum~width=0] + (chemformula-single-bond) at (0,0) {} ; + \draw[butt~cap-butt~cap] (chemformula-single-bond) ++ (0,-.1716em) + -- ++( \l_chemformula_bond_dim ,0) ; + } + \skip_horizontal:N \l_chemformula_bond_space_dim + } } \cs_new:Npn \chemformula_double_bond: { + \skip_horizontal:N \l_chemformula_bond_space_dim \chemformula_tikz:nn { inner~sep=0, outer~sep=0 } { \draw node[draw=none,minimum~height=1em,minimum~width=0] @@ -835,10 +877,12 @@ (chemformula-double-bond) ++ (0,-.2574em) -- ++ (\l_chemformula_bond_dim ,0) ; } + \skip_horizontal:N \l_chemformula_bond_space_dim } \cs_new:Npn \chemformula_triple_bond: { + \skip_horizontal:N \l_chemformula_bond_space_dim \chemformula_tikz:nn { inner~sep=0, outer~sep=0 } { \draw node[draw=none,minimum~height=1em,minimum~width=0] @@ -853,6 +897,7 @@ (chemformula-triple-bond) ++ (0,-.3003em) -- ++ (\l_chemformula_bond_dim ,0) ; } + \skip_horizontal:N \l_chemformula_bond_space_dim } %-----------------------------------------------------------------------------% @@ -1146,8 +1191,6 @@ %-----------------------------------------------------------------------------% % set options for next compound: -% TODO: this is not working: -% - applies to first instead of the next cmpd \cs_new:Npn \chemformula_input_options:n #1 { \makeatother @@ -1345,10 +1388,10 @@ \char_set_catcode_letter:N \{ \char_set_catcode_letter:N \} \char_set_catcode_letter:N \\ + \char_set_catcode_letter:N \# } { #1 } % let's see if the compound starts with a sub- or superscript: -% \exp_args:Nx \tl_show:n { \tl_head:V \l_tmpa_tl } \exp_args:Nx \tl_if_in:nnT { \tl_head:V \l_tmpa_tl } { ^ } { \bool_set_true:N \l_chemformula_is_isotope_bool } \exp_args:Nx \tl_if_in:nnT { \tl_head:V \l_tmpa_tl } { _ } @@ -1356,8 +1399,6 @@ \exp_args:NNx \prop_if_in:NnT \l_chemformula_numbers_prop { \tl_head:V \l_tmpa_tl } { \bool_set_true:N \l_chemformula_is_isotope_bool } -% \bool_if:NT \l_chemformula_is_isotope_bool -% { \exp_args:Nx \tl_show:n { \tl_head:V \l_tmpa_tl } } \tl_if_in:VnT \l_tmpa_tl { ^ } { \tl_replace_all:Nnn \l_tmpa_tl { ^ } @@ -1502,7 +1543,7 @@ { \ExplSyntaxNamesOn \char_set_catcode_other:N \: } { { #1 } } \tl_replace_all:Nnn \l_tmpa_tl { \_ } { chemformulaplaceholder } - \tl_replace_all:Nnn \l_tmpa_tl { _ } { \sb } + \tl_replace_all:Nnn \l_tmpa_tl { _ } { \sb } % TODO use \c_math_subscript_token \tl_replace_all:Nnn \l_tmpa_tl { chemformulaplaceholder } { \_ } \tl_set_rescan:Nno \l_tmpa_tl { \ExplSyntaxOff } { \l_tmpa_tl } \tl_put_right:NV \l_chemformula_input_tl \l_tmpa_tl @@ -1514,7 +1555,7 @@ { \ExplSyntaxNamesOn \char_set_catcode_other:N \: } { { #1 } } \tl_replace_all:Nnn \l_tmpa_tl { \_ } { chemformulaplaceholder } - \tl_replace_all:Nnn \l_tmpa_tl { _ } { \sb } + \tl_replace_all:Nnn \l_tmpa_tl { _ } { \sb } % TODO use \c_math_subscript_token \tl_replace_all:Nnn \l_tmpa_tl { chemformulaplaceholder } { \_ } \tl_set_rescan:Nno \l_tmpa_tl { \ExplSyntaxOff } { \l_tmpa_tl } \tl_put_right:NV \l_chemformula_input_tl \l_tmpa_tl @@ -1580,7 +1621,7 @@ } { \mbox { \( #1 \) } } \tl_replace_all:Nnn \l_tmpa_tl { \_ } { chemformulaplaceholder } - \tl_replace_all:Nnn \l_tmpa_tl { _ } { \sb } + \tl_replace_all:Nnn \l_tmpa_tl { _ } { \sb } % TODO use \c_math_subscript_token \tl_replace_all:Nnn \l_tmpa_tl { chemformulaplaceholder } { \_ } \tl_set_rescan:Nno \l_tmpa_tl { \ExplSyntaxOff } { \l_tmpa_tl } \tl_put_right:NV \l_chemformula_input_tl \l_tmpa_tl @@ -1680,6 +1721,7 @@ } } , bond-length .dim_set:N = \l_chemformula_bond_dim , + bond-offset .dim_set:N = \l_chemformula_bond_space_dim , font-family .code:n = \bool_set_true:N \l_chemformula_fss_bool \bool_set_false:N \l_chemformula_fontspec_bool @@ -1742,9 +1784,16 @@ VERSION HISTORY - improved arrow labels 2012/03/20 - version 3.2 - new: option input via @{} - a few changes in chemmacros.sty +2012/05/07 - version 3.3 - \ch now bypasses \ref{}, \label{}, and \intertext{} + - new features in chemmacros.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO +- Bindungen nach einem Mechanismus ähnlich der Pfeile konstruieren + => Möglichkeit, eigene Bindungen hinzuzufügen, Bindungen leichter um weitere + Typen erweitern + => Problem: bislang nur ein Token pro Bindung möglich + => Makro \bond{}? - Addukte: Zahlen nach * und . automatisch erkennen? - allow fractions in subscripts: _{$\frac{1}{2}$} ? - optionale argumente von \\ nach außen weiterreichen? diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index b06c416bc68..e925819baf0 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -5,7 +5,7 @@ % - macros and commands for chemists - % % --------------------------------------------------------------------------- % % - Clemens Niederberger - % -% - 2012/03/20 - % +% - 2012/05/07 - % % --------------------------------------------------------------------------- % % - https://bitbucket.org/cgnieder/chemmacros/ - % % - contact@mychemistry.eu - % @@ -33,14 +33,13 @@ \ProvidesExplPackage {chemmacros} - {2012/03/20} - {3.2} + {2012/05/07} + {3.3} {macros and commands for chemists} \@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } } \bool_new:N \l_chemmacros_version_one_bool -\bool_new:N \l_chemmacros_german_bool \bool_new:N \l_chemmacros_xspace_bool \bool_set_true:N \l_chemmacros_xspace_bool \bool_new:N \l_chemmacros_bpchem_bool @@ -102,7 +101,13 @@ \bool_set_true:N \l_chemmacros_detect_bold_bool \bool_new:N \l_chemmacros_use_upgreek_bool -\bool_new:N \l_chemmacros_use_textgreek_bool +\bool_new:N \l_chemmacros_use_textgreek_bool +\bool_new:N \l_chemmacros_option_upgreek_set_bool + +\tl_new:N \l_chemmacros_language_tl +\tl_set:Nn \l_chemmacros_language_tl { english } +\tl_new:N \l_chemmacros_current_language_tl +\tl_set:Nn \l_chemmacros_current_language_tl { english } \cs_new:Nn \chemmacros_inner_font: {} @@ -137,8 +142,12 @@ { detect-bold } {} , EZ .code:n = \chemmacros_msg:nnxx { chemmacros } { option-deprecated } { EZ } {} , - german .bool_set:N = \l_chemmacros_german_bool , - german .default:n = true , + german .code:n = + \chemmacros_msg:nnxx { chemmacros } { option-deprecated } + { german } {} , + ngerman .code:n = + \chemmacros_msg:nnxx { chemmacros } { option-deprecated } + { ngerman } {} , ghsystem .bool_set:N = \l_chemmacros_ghsystem_bool , ghsystem .default:n = true , iupac .choice: , @@ -151,13 +160,12 @@ iupac / strict .code:n = \bool_set_false:N \l_chemmacros_iupac_restricted_bool \bool_set_true:N \l_chemmacros_iupac_strict_bool , + language .tl_set:N = \l_chemmacros_language_tl , method .choice: , method / chemformula .code:n = \bool_set_false:N \l_chemmacros_use_mhchem_bool , method / mhchem .code:n = \bool_set_true:N \l_chemmacros_use_mhchem_bool , - ngerman .bool_set:N = \l_chemmacros_german_bool , - ngerman .default:n = true , Nu .choice: , Nu / mathspec .code:n = \bool_set_true:N \l_chemmacros_Nu_mathspec_bool , @@ -170,21 +178,28 @@ \cs_set_eq:NN \chemmacros_inner_font: \chemformula_font_inner: , synchronize / false .code:n = \cs_set:Nn \chemmacros_inner_font: {} , synchronize .default:n = true , - upgreek .choice: , - upgreek / upgreek .code:n = + greek .choice: , + greek / upgreek .code:n = \bool_set_true:N \l_chemmacros_use_upgreek_bool - \bool_set_false:N \l_chemmacros_use_textgreek_bool , - upgreek / textgreek .code:n = + \bool_set_false:N \l_chemmacros_use_textgreek_bool + \bool_set_true:N \l_chemmacros_option_upgreek_set_bool , + greek / textgreek .code:n = \bool_set_false:N \l_chemmacros_use_upgreek_bool - \bool_set_true:N \l_chemmacros_use_textgreek_bool , - upgreek / none .code:n = + \bool_set_true:N \l_chemmacros_use_textgreek_bool + \bool_set_true:N \l_chemmacros_option_upgreek_set_bool , + greek / math .code:n = \bool_set_false:N \l_chemmacros_use_upgreek_bool - \bool_set_false:N \l_chemmacros_use_textgreek_bool , - upgreek .default:n = upgreek , + \bool_set_false:N \l_chemmacros_use_textgreek_bool + \bool_set_true:N \l_chemmacros_option_upgreek_set_bool , + greek .default:n = upgreek , + upgreek .code:n = + \chemmacros_msg:nnxx { chemmacros } { option-deprecated } + { upgreek } {} , % dummy version for compatibility with KOMA's global option and backwards % compatibility of chemmacros - version .code:n = , - % TODO: neuen Namen finden! + version .code:n = + \chemmacros_msg:nnxx { chemmacros } { option-deprecated } + { version } {} , cmversion .choice: , cmversion / 1 .code:n = { \bool_set_true:N \l_chemmacros_version_one_bool } , @@ -198,8 +213,42 @@ \ProcessKeysOptions { chemmacros / option } +% --------------------------------------------------------------------------- % +% language settings: +\prop_new:N \l_chemmacros_language_prop +\prop_put:Nnn \l_chemmacros_language_prop { english } { english } +\prop_put:Nnn \l_chemmacros_language_prop { american } { english } +\prop_put:Nnn \l_chemmacros_language_prop { british } { english } +\prop_put:Nnn \l_chemmacros_language_prop { german } { german } +\prop_put:Nnn \l_chemmacros_language_prop { ngerman } { german } +\prop_put:Nnn \l_chemmacros_language_prop { italian } { italian } +\prop_put:Nnn \l_chemmacros_language_prop { french } { french } + +\prop_map_inline:Nn \l_chemmacros_language_prop + { + \cs_if_exist:cF { l_chemmacros_ #2 _bool } + { \bool_new:c { l_chemmacros_ #2 _bool } } + } + +\cs_new_nopar:Npn \chemmacros_set_language: + { + \prop_get:NoNTF + \l_chemmacros_language_prop + { \l_chemmacros_language_tl } + \l_chemmacros_current_language_tl + { + \bool_set_true:c + { l_chemmacros_ \l_chemmacros_current_language_tl _bool } + } + { + \chemmacros_msg:nnxx { chemmacros } { language-not-defined } + { \l_chemmacros_language_tl } { } + } + } + \AtEndPreamble { + \chemmacros_set_language: \chemmacros_make_phases: \bool_if:NT \l_chemmacros_ghsystem_bool { \RequirePackage { ghsystem } } @@ -209,21 +258,31 @@ { \RequirePackage { xspace } } \bool_if:NT \l_chemmacros_use_mhchem_bool { \RequirePackage[ version=3 ]{ mhchem } } - \@ifpackageloaded { upgreek } - { \bool_set_true:N \l_chemmacros_use_upgreek_bool } + \bool_if:NF \l_chemmacros_option_upgreek_set_bool { - \@ifpackageloaded { textgreek } - { \bool_set_true:N \l_chemmacros_use_textgreek_bool } - {} + \@ifpackageloaded { upgreek } + { \bool_set_true:N \l_chemmacros_use_upgreek_bool } + { + \@ifpackageloaded { textgreek } + { \bool_set_true:N \l_chemmacros_use_textgreek_bool } + {} + } } \bool_if:NTF \l_chemmacros_use_upgreek_bool { - \cs_set_nopar:Npn \Chemalpha { \ensuremath { \upalpha } } - \cs_set_nopar:Npn \Chembeta { \ensuremath { \upbeta } } - \cs_set_nopar:Npn \Chemgamma { \ensuremath { \upgamma } } - \cs_set_nopar:Npn \Chemdelta { \ensuremath { \updelta } } - \cs_set_nopar:Npn \Chemomega { \ensuremath { \upomega } } - \cs_set_nopar:Npn \ChemDelta { \ensuremath { \Updelta } } + \cs_set_nopar:Npn \Chemalpha { \ensuremath { \upalpha } } + \cs_set_nopar:Npn \Chembeta { \ensuremath { \upbeta } } + \cs_set_nopar:Npn \Chemgamma { \ensuremath { \upgamma } } + \cs_set_nopar:Npn \Chemdelta { \ensuremath { \updelta } } + \cs_set_nopar:Npn \Chemepsilon { \ensuremath { \upvarepsilon } } + \cs_set_nopar:Npn \Chemeta { \ensuremath { \upeta } } + \cs_set_nopar:Npn \Chemmu { \ensuremath { \upmu } } + \cs_set_nopar:Npn \Chemnu { \ensuremath { \upnu } } + \cs_set_nopar:Npn \Chemrho { \ensuremath { \uprho } } + \cs_set_nopar:Npn \Chempi { \ensuremath { \uppi } } + \cs_set_nopar:Npn \Chemsigma { \ensuremath { \upsigma } } + \cs_set_nopar:Npn \Chemomega { \ensuremath { \upomega } } + \cs_set_nopar:Npn \ChemDelta { \ensuremath { \Updelta } } } { \bool_if:NT \l_chemmacros_use_textgreek_bool @@ -236,6 +295,20 @@ { \ensuremath { \text { \textgamma } } } \cs_set_nopar:Npn \Chemdelta { \ensuremath { \text { \textdelta } } } + \cs_set_nopar:Npn \Chemepsilon + { \ensuremath { \text { \textepsilon } } } + \cs_set_nopar:Npn \Chemeta + { \ensuremath { \text { \texteta } } } + \cs_set_nopar:Npn \Chemmu + { \ensuremath { \text { \textmu } } } + \cs_set_nopar:Npn \Chemnu + { \ensuremath { \text { \textnu } } } + \cs_set_nopar:Npn \Chemrho + { \ensuremath { \text { \textrho } } } + \cs_set_nopar:Npn \Chempi + { \ensuremath { \text { \textpi } } } + \cs_set_nopar:Npn \Chemsigma + { \ensuremath { \text { \textsigma } } } \cs_set_nopar:Npn \Chemomega { \ensuremath { \text { \textomega } } } \cs_set_nopar:Npn \ChemDelta @@ -244,12 +317,19 @@ } } -\cs_new_nopar:Npn \Chemalpha { \ensuremath { \alpha } } -\cs_new_nopar:Npn \Chembeta { \ensuremath { \beta } } -\cs_new_nopar:Npn \Chemgamma { \ensuremath { \gamma } } -\cs_new_nopar:Npn \Chemdelta { \ensuremath { \delta } } -\cs_new_nopar:Npn \Chemomega { \ensuremath { \omega } } -\cs_new_nopar:Npn \ChemDelta { \ensuremath { \Delta } } +\cs_new_nopar:Npn \Chemalpha { \ensuremath { \alpha } } +\cs_new_nopar:Npn \Chembeta { \ensuremath { \beta } } +\cs_new_nopar:Npn \Chemgamma { \ensuremath { \gamma } } +\cs_new_nopar:Npn \Chemdelta { \ensuremath { \delta } } +\cs_new_nopar:Npn \Chemepsilon { \ensuremath { \varepsilon } } +\cs_new_nopar:Npn \Chemeta { \ensuremath { \eta } } +\cs_new_nopar:Npn \Chemmu { \ensuremath { \mu } } +\cs_new_nopar:Npn \Chemnu { \ensuremath { \nu } } +\cs_new_nopar:Npn \Chemrho { \ensuremath { \rho } } +\cs_new_nopar:Npn \Chempi { \ensuremath { \pi } } +\cs_new_nopar:Npn \Chemsigma { \ensuremath { \sigma } } +\cs_new_nopar:Npn \Chemomega { \ensuremath { \omega } } +\cs_new_nopar:Npn \ChemDelta { \ensuremath { \Delta } } \cs_new_nopar:Npn \chemmacros_xspace: { @@ -266,6 +346,16 @@ { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } } +\msg_set:nnnn { chemmacros } { language-not-defined } + { + The~language~#1~is~not~defined~by~chemmacros. + } + { + You~chose~the~language~`#1'~which~is~not~defined~by~chemmacros.~`english'~is + ~used~instead.~If~you~just~mistyped~try~again!~Otherwise~contact~the~author~ + and~he'll~probably~add~your~language. + } + \msg_set:nnnn { chemmacros } { already-defined } { The~command~#1~has~also~been~defined~by~another~package. @@ -295,7 +385,7 @@ { You've~tried~to~define~a~particle~with~\token_to_str:N \DeclareChemParticle, ~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists. - ~Choose~another~name. + ~Please~choose~another~name. } \msg_set:nnnn { chemmacros } { renew-particle } @@ -312,16 +402,33 @@ { You've~tried~to~define~a~latin~phrase~with~\token_to_str:N \DeclareChemLatin,~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl - already~exists.~Choose~another~name. + already~exists.~Please~choose~another~name. } -\msg_set:nnnn { chemmacros } { f } +\msg_set:nnnn { chemmacros } { renew-latin } { The~latin~phrase \token_to_str:N #1 \c_space_tl is~not~defined. } { You've~tried~to~renew~the~latin~phrase~\token_to_str:N #1 ,~but~it~doesn't~ exist. } +\msg_set:nnnn { chemmacros } { declare-nmr } + { + The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + } + { + You've~tried~to~define~a~NMR~command~with~\token_to_str:N + \DeclareChemParticle, ~but~the~command~sequence~ \token_to_str:N #1 + \c_space_tl already~exists.~Please~choose~another~name. + } + +\msg_set:nnnn { chemmacros } { renew-nmr } + { The~NMR~command~ \token_to_str:N #1 \c_space_tl is~not~defined. } + { + You've~tried~to~renew~the~NMR~command~\token_to_str:N #1 ,~but~it~doesn't~ + exist. + } + \msg_set:nnnn { chemmacros } { declare-phase } { The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. @@ -329,7 +436,7 @@ { You've~tried~to~define~a~particle~with~\token_to_str:N \DeclareChemPhase , ~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists. - ~Choose~another~name. + ~Please~choose~another~name. } \msg_set:nnnn { chemmacros } { renew-phase } @@ -555,6 +662,7 @@ \group_end: } } +\cs_generate_variant:Nn \chemmacros_chemformula:n { x } % --------------------------------------------------------------------------- % % particles, charges @@ -966,6 +1074,16 @@ \DeclareChemIUPAC \Sf { \textit { S } } \DeclareChemIUPAC \P { \textit { P } } +% language specific settings +\AtBeginDocument + { + \bool_if:NT \l_chemmacros_italian_bool + { + \DeclareChemIUPAC \sin { \textit { sin } } + \DeclareChemIUPAC \ter { \textit { ter } } + } + } + % greek letters \DeclareChemIUPAC\a{\Chemalpha} \DeclareChemIUPAC\b{\Chembeta} @@ -976,16 +1094,44 @@ % \iupac (basically the same as bpchem's \IUPAC) % - allows multiple breaking points as compound names can get really long and % especially in multicolumn documents can span more than two lines -% - add a (very) little space after the hyphen +% - add a (very) little space before the hyphen and a little negative space +% after it +% - add a little space at breaking points if not broken % - enables all naming commands regardless if they're definied otherwise or not \cs_new_protected:Nn \chemmacros_allow_hyphens: { \tex_penalty:D \c_ten_thousand \skip_horizontal:n { \c_zero_dim } } + +\dim_new:N \l_chemmacros_iupac_hyphen_pre_dim +\dim_set:Nn \l_chemmacros_iupac_hyphen_pre_dim { .01em } +\dim_new:N \l_chemmacros_iupac_hyphen_post_dim +\dim_set:Nn \l_chemmacros_iupac_hyphen_post_dim { -.03em } +\dim_new:N \l_chemmacros_iupac_break_dim +\dim_set:Nn \l_chemmacros_iupac_break_dim { .03em } + +\keys_define:nn { chemmacros / iupac } + { + hyphen-pre-space .dim_set:N = \l_chemmacros_iupac_hyphen_pre_dim , + hyphen-post-space .dim_set:N = \l_chemmacros_iupac_hyphen_post_dim , + break-space .dim_set:N = \l_chemmacros_iupac_break_dim + } + \cs_new_protected:Nn \chemmacros_break_point_hyphen: - { \tex_penalty:D \c_ten_thousand - \chemmacros_allow_hyphens: } + { + \tex_penalty:D \c_ten_thousand + \tex_discretionary:D { - } { } + { + \tex_kern:D \l_chemmacros_iupac_hyphen_pre_dim + - + \tex_kern:D \l_chemmacros_iupac_hyphen_post_dim + } + \chemmacros_allow_hyphens: + } + \cs_new_protected:Nn \chemmacros_break_point: { \tex_penalty:D \c_ten_thousand - \tex_discretionary:D { - } { } { \tex_kern:D .03em } + \tex_discretionary:D { - } { } + { \tex_kern:D \l_chemmacros_iupac_break_dim } \chemmacros_allow_hyphens: } @@ -1083,8 +1229,6 @@ \tl_new:N \l_chemmacros_if_bf_tl \tl_set:Nn \l_chemmacros_if_bf_tl { bx } -\char_set_catcode_math_subscript:N \@ - \cs_new_protected_nopar:Npn \Ka { \mbox @@ -1092,7 +1236,7 @@ \( \chemmacros_detect_bold:n { - K @ \mathrm + K \c_math_subscript_token \mathrm { \bool_if:NTF \l_chemmacros_german_bool { S } { A } } } \) @@ -1102,13 +1246,25 @@ \cs_new_protected_nopar:Npn \Kb { - \mbox { \( \chemmacros_detect_bold:n { K @ \mathrm { B } } \) } + \mbox + { + \( + \chemmacros_detect_bold:n + { K \c_math_subscript_token \mathrm { B } } + \) + } \chemmacros_xspace: } \cs_new_protected_nopar:Npn \Kw { - \mbox { \( \chemmacros_detect_bold:n { K @ \mathrm { W } } \) } + \mbox + { + \( + \chemmacros_detect_bold:n + { K \c_math_subscript_token \mathrm { W } } + \) + } \chemmacros_xspace: } @@ -1128,13 +1284,21 @@ \NewDocumentCommand \pKa { o } { - \p { \Ka \IfNoValueF { #1 } { @ { \chemmacros_detect_bold:n { #1 } } } } + \p + { + \Ka \IfNoValueF { #1 } + { \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } } + } \chemmacros_xspace: } \NewDocumentCommand \pKb { o } { - \p { \Kb \IfNoValueF { #1 } { @ { \chemmacros_detect_bold:n { #1 } } } } + \p + { + \Kb \IfNoValueF { #1 } + { \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } } + } \chemmacros_xspace: } @@ -1174,24 +1338,44 @@ \tl_set:Nn \l_chemmacros_mech_ar_tl { #3 } } -\char_set_catcode_math_subscript:N \@ \keys_define:nn { chemmacros / mech } { type .choice: , type / .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {N} $ } {} } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {N} $ } {} + } , type / 1 .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {N} $ 1 } {} } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {N} $ 1 } {} + } , type / 2 .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {N} $ 2 } {} } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {N} $ 2 } {} + } , type / se .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ } {} } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {E} $ } {} + } , type / 1e .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ 1 } {} } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {E} $ 1 } {} + } , type / 2e .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ 2 } {} } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {E} $ 2 } {} + } , type / ar .code:n = - { \chemmacros_set_mech:nnn { S } { $ @ \text {E} $ } { Ar - } } , + { + \chemmacros_set_mech:nnn { S } + { $ \c_math_subscript_token \text {E} $ } { Ar - } + } , type / e .code:n = { \chemmacros_set_mech:nnn { E } {} {} } , type / e1 .code:n = @@ -1199,7 +1383,10 @@ type / e2 .code:n = { \chemmacros_set_mech:nnn { E } { 2 } {} } , type / cb .code:n = - { \chemmacros_set_mech:nnn { E } { 1 $ @ \text {cb} $ } {} } , + { + \chemmacros_set_mech:nnn { E } + { 1 $ \c_math_subscript_token \text {cb} $ } {} + } , type .default:n = } @@ -1216,7 +1403,6 @@ } \chemmacros_xspace: } -\char_set_catcode_letter:N \@ % --------------------------------------------------------------------------- % % oxidation numbers @@ -1575,26 +1761,47 @@ % --------------------------------------------------------------------------- % % spectroscopy -\tl_new:N \l_chemmacros_nmr_isotope_tl +\tl_new:N \g_chemmacros_nmr_isotope_tl \tl_new:N \l_chemmacros_nmr_isotope_default_tl \tl_set:Nn \l_chemmacros_nmr_isotope_default_tl { 1 } -\tl_new:N \l_chemmacros_nmr_element_tl +\tl_new:N \g_chemmacros_nmr_element_tl \tl_new:N \l_chemmacros_nmr_element_default_tl \tl_set:Nn \l_chemmacros_nmr_element_default_tl { H } +\tl_new:N \l_chemmacros_nmr_format_tl +\tl_new:N \l_chemmacros_nmr_delta_tl +\tl_new:N \l_chemmacros_nmr_coupling_unit_tl +\tl_set:Nn \l_chemmacros_nmr_coupling_unit_tl { \hertz } +\tl_new:N \l_chemmacros_nmr_list_setup_tl +\tl_set:Nn \l_chemmacros_nmr_list_setup_tl + { + \topsep\z@skip \partopsep\z@skip + \itemsep\z@ \parsep\z@ \itemindent\z@ + \leftmargin\z@ + } \bool_new:N \l_chemmacros_nmr_frequency_bool \bool_new:N \l_chemmacros_nmr_solvent_bool \bool_new:N \l_chemmacros_nmr_delimiters_bool \bool_new:N \l_chemmacros_nmr_comma_bool +\bool_new:N \l_chemmacros_nmr_inner_bool +\bool_new:N \l_chemmacros_nmr_position_sub_bool +\bool_new:N \l_chemmacros_nmr_parse_bool +\bool_set_true:N \l_chemmacros_nmr_parse_bool +\bool_new:N \l_chemmacros_nmr_list_bool +% \bool_set_true:N \l_chemmacros_nmr_list_bool +\bool_new:N \l_chemmacros_nmr_use_equal_bool +% \bool_set_true:N \l_chemmacros_nmr_use_equal_bool +\bool_new:N \l_chemmacros_nmr_custom_command_active_bool +\bool_new:N \l_chemmacros_nmr_custom_command_used_bool \tl_new:N \l_chemmacros_nmr_unit_tl \tl_set:Nn \l_chemmacros_nmr_unit_tl { \mega\hertz } \cs_new_nopar:Npn \chemmacros_nmr_nucleus:w #1,#2 \q_stop { - \tl_set:Nn \l_chemmacros_nmr_isotope_tl { #1 } - \tl_set:Nn \l_chemmacros_nmr_element_tl { #2 } + \tl_gset:Nn \g_chemmacros_nmr_isotope_tl { #1 } + \tl_gset:Nn \g_chemmacros_nmr_element_tl { #2 } } \cs_new:Npn \chemmacros_nmr_default_nucleus:w #1,#2 \q_stop @@ -1624,10 +1831,50 @@ \keys_define:nn { chemmacros / nmr } { - unit .tl_set:N = \l_chemmacros_nmr_unit_tl , - unit .default:n = \mega\hertz , - nucleus .code:n = { \chemmacros_nmr_default_nucleus:w #1 \q_stop } , - nucleus .default:n = { 1,H } + unit .tl_set:N = \l_chemmacros_nmr_unit_tl , + unit .default:n = \mega\hertz , + nucleus .code:n = + { \chemmacros_nmr_default_nucleus:w #1 \q_stop } , + nucleus .default:n = { 1,H } , + format .tl_set:N = \l_chemmacros_nmr_format_tl , + pos-number .choice: , + pos-number / sub .code:n = + \bool_set_true:N \l_chemmacros_nmr_position_sub_bool , + pos-number / side .code:n = + \bool_set_false:N \l_chemmacros_nmr_position_sub_bool , + coupling-unit .tl_set:N = \l_chemmacros_nmr_coupling_unit_tl , + parse .bool_set:N = \l_chemmacros_nmr_parse_bool , + delta .code:n = + \tl_set:Nn \l_chemmacros_nmr_delta_tl { \, #1 } , + list .bool_set:N = \l_chemmacros_nmr_list_bool , + list .default:n = true , + list-setup .tl_set:N = \l_chemmacros_nmr_list_setup_tl , + use-equal .bool_set:N = \l_chemmacros_nmr_use_equal_bool , + use-equal .default:n = true + } + +\prop_new:N \l_chemmacros_nmr_prop + +\NewDocumentCommand \DeclareChemNMR { mm } + { + \prop_if_in:NnTF \l_chemmacros_nmr_prop { #1 } + { \chemmacros_msg:nnxx { chemmacros } { declare-nmr } { #1 } { } } + { + \prop_put:Nnn \l_chemmacros_nmr_prop { #1 } { #2 } + \NewDocumentCommand #1 { s } + { \IfBooleanTF {##1} { \NMR*{#2} } { \NMR{#2} } } + } + } + +\NewDocumentCommand \RenewChemNMR { mm } + { + \prop_if_in:NnTF \l_chemmacros_nmr_prop { #1 } + { + \prop_put:Nnn \l_chemmacros_nmr_prop { #1 } { #2 } + \NewDocumentCommand #1 { s } + { \IfBooleanTF {##1} { \NMR*{#2} } { \NMR{#2} } } + } + { \chemmacros_msg:nnxx { chemmacros } { renew-nmr } { #1 } { } } } \AtBeginDocument @@ -1636,7 +1883,9 @@ % \NMR* same but without ": $\delta$" at end \NewDocumentCommand \NMR { s g d() o } { + \bool_if:NT \l_chemmacros_nmr_list_bool { \item \scan_stop: } \group_begin: + \leavevmode \bool_set_false:N \l_chemmacros_nmr_frequency_bool \bool_set_false:N \l_chemmacros_nmr_solvent_bool \IfNoValueF { #3 } @@ -1668,39 +1917,63 @@ { \text { - \chemmacros_nmr_base:VV - \l_chemmacros_nmr_isotope_tl - \l_chemmacros_nmr_element_tl - \bool_if:NT \l_chemmacros_nmr_delimiters_bool - { ~ ( } - \bool_if:NT \l_chemmacros_nmr_frequency_bool - { \chemmacros_nmr_frequency:n { #3 } } - \bool_if:NT \l_chemmacros_nmr_comma_bool - { , ~ } - \bool_if:NT \l_chemmacros_nmr_solvent_bool - { \chemmacros_atom:n { #4 } } - \bool_if:NT \l_chemmacros_nmr_delimiters_bool - { ) } - \IfBooleanF { #1 } { : ~ } + \group_begin: + \tl_use:N \l_chemmacros_nmr_format_tl + \chemmacros_nmr_base:VV + \g_chemmacros_nmr_isotope_tl + \g_chemmacros_nmr_element_tl + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ~ ( } + \bool_if:NT \l_chemmacros_nmr_frequency_bool + { \chemmacros_nmr_frequency:n { #3 } } + \bool_if:NT \l_chemmacros_nmr_comma_bool + { , ~ } + \bool_if:NT \l_chemmacros_nmr_solvent_bool + { \chemmacros_atom:n { #4 } } + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ) } + \IfBooleanF { #1 } { : ~ } + \group_end: + } + \IfBooleanF { #1 } + { + \delta + \text { \l_chemmacros_nmr_delta_tl } + \bool_if:NT \l_chemmacros_nmr_use_equal_bool { = } } - \IfBooleanF { #1 } { \delta } } { - \chemmacros_nmr_base:VV - \l_chemmacros_nmr_isotope_tl - \l_chemmacros_nmr_element_tl - \bool_if:NT \l_chemmacros_nmr_delimiters_bool - { ~ ( } - \bool_if:NT \l_chemmacros_nmr_frequency_bool - { \chemmacros_nmr_frequency:n { #3 } } - \bool_if:NT \l_chemmacros_nmr_comma_bool - { , ~ } - \bool_if:NT \l_chemmacros_nmr_solvent_bool - { \chemmacros_chemformula:n { #4 } } - \bool_if:NT \l_chemmacros_nmr_delimiters_bool - { ) } + \group_begin: + \tl_use:N \l_chemmacros_nmr_format_tl + \chemmacros_nmr_base:VV + \g_chemmacros_nmr_isotope_tl + \g_chemmacros_nmr_element_tl + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ~ ( } + \bool_if:NT \l_chemmacros_nmr_frequency_bool + { \chemmacros_nmr_frequency:n { #3 } } + \bool_if:NT \l_chemmacros_nmr_comma_bool + { , ~ } + \bool_if:NT \l_chemmacros_nmr_solvent_bool + { + \bool_if:NTF \l_chemmacros_nmr_parse_bool + { + \bool_if:NTF \l_chemmacros_use_mhchem_bool + { \ce { #4 } } + { \ch { #4 } } + } + { #4 } + } + \bool_if:NT \l_chemmacros_nmr_delimiters_bool + { ) } + \IfBooleanF { #1 } { : } + \group_end: \IfBooleanF { #1 } - { : ~ $ \delta $ } + { + \tl_use:N \c_space_tl $ \delta $ + \l_chemmacros_nmr_delta_tl + \bool_if:NT \l_chemmacros_nmr_use_equal_bool { ~ = } + } \bool_if:NF \l_chemmacros_nmr_comma_bool { \IfBooleanF { #1 } { \chemmacros_xspace: } } } @@ -1708,6 +1981,119 @@ } } +\NewDocumentCommand \chemmacros_data:w { smo } + { + \bool_if:NT \l_chemmacros_nmr_list_bool { \item } + { + \tl_use:N \l_chemmacros_nmr_format_tl #2 + \IfNoValueF { #3 } { ~ ( #3 ) } + \IfBooleanT { #1 } { \bool_if:NT \l_chemmacros_nmr_use_equal_bool { : } } + } + \IfBooleanF { #1 } { \bool_if:NT \l_chemmacros_nmr_use_equal_bool { ~ = } } + } + +\cs_new_protected_nopar:Npn \chemmacros_val:n #1 + { + \tl_if_in:nnTF { #1 } { -- } + { \chemmacros_val_aux:w #1 \q_nil } + { \num { #1 } } + } +\cs_new_protected_nopar:Npn \chemmacros_val_aux:w #1--#2 \q_nil + { \numrange { #1 } { #2 } } + +\NewDocumentEnvironment { experimental } { o } + { + \group_begin: + \IfNoValueF { #1 } { \keys_set:nn { chemmacros / nmr } { #1 } } + \bool_set_true:N \l_chemmacros_nmr_inner_bool + \cs_set_eq:NN \# \chemmacros_nmr_number:n + \cs_set_eq:NN \pos \chemmacros_nmr_position:n + \cs_set_eq:NN \J \chemmacros_nmr_coupling:w + \cs_set_eq:NN \data \chemmacros_data:w + \cs_set_eq:NN \val \chemmacros_val:n + \bool_if:NT \l_chemmacros_nmr_list_bool + { \list {} { \l_chemmacros_nmr_list_setup_tl } } + } + { + \bool_if:NT \l_chemmacros_nmr_list_bool + { \endlist } + \group_end: + \ignorespaces + } + +\cs_new:Npn \chemmacros_nmr_number:n #1 + { + #1 \, + \bool_if:NTF \l_chemmacros_bpchem_bool + { \g_chemmacros_nmr_element_tl } + { \chemmacros_atom:n { \g_chemmacros_nmr_element_tl } } + } + +\cs_new:Npn \chemmacros_nmr_position:n #1 + { + \bool_if:NTF \l_chemmacros_bpchem_bool + { + \tl_use:N \g_chemmacros_nmr_element_tl + \bool_if:NTF \l_chemmacros_nmr_position_sub_bool + { $\sb{#1}$ } + { - #1 } + } + { + \bool_if:NTF \l_chemmacros_nmr_position_sub_bool + { + \chemmacros_chemformula:x { \g_chemmacros_nmr_element_tl _ #1 } + } + { \chemmacros_atom:n { \g_chemmacros_nmr_element_tl } - #1 } + } + } + +\cs_new:Npn \chemmacros_nmr_coupling:w + { + \peek_meaning:NTF [ + { \chemmacros_nmr_coupling_auxi:w } + { \chemmacros_nmr_coupling_auxii:n } + } + +\cs_new:Npn \chemmacros_nmr_coupling_auxi:w [#1]#2 + { + \group_begin: + \sisetup + { + list-final-separator={,~}, + list-pair-separator={,~}, + list-units=single + } + \tl_if_in:nnTF { #1 } { ; } + { \( J = \SIlist{#2}{#1} \) } + { \( J = \SI{#2}{#1} \) } + \group_end: + } + +\cs_new:Npn \chemmacros_nmr_coupling_auxii:n #1 + { + \group_begin: + \sisetup + { + list-final-separator={,~}, + list-pair-separator={,~}, + list-units=single + } + \tl_if_in:nnTF { #1 } { ; } + { + \( + J = \exp_args:Nno \SIlist + { #1 } { \l_chemmacros_nmr_coupling_unit_tl } + \) + } + { + \( + J = \exp_args:Nno \SI + { #1 } { \l_chemmacros_nmr_coupling_unit_tl } + \) + } + \group_end: + } + % --------------------------------------------------------------------------- % % placing text below atom/molecule \cs_new_nopar:Npn \dim_to_width:nn #1#2 @@ -1783,7 +2169,6 @@ space .dim_set:N = \l_chemmacros_phases_space_dim } -\char_set_catcode_math_subscript:N \@ \prop_new:N \l_chemmacros_phases_prop \prop_new:N \l_chemmacros_phases_german_prop @@ -1832,7 +2217,7 @@ \cs_set_nopar:cpn { #1 } { \bool_if:NTF \l_chemmacros_phases_sub_bool - { \ensuremath { @ { \text { (#2) } } } } + { \ensuremath { \c_math_subscript_token { \text { (#2) } } } } { \ensuremath { @@ -1851,7 +2236,7 @@ \NewDocumentCommand \phase { m } { \bool_if:NTF \l_chemmacros_phases_sub_bool - { \ensuremath { @ { \text { (#1) } } } } + { \ensuremath { \c_math_subscript_token { \text { (#1) } } } } { \ensuremath { @@ -1866,7 +2251,6 @@ \cs_new_eq:NN \solid \sld \cs_new_eq:NN \liquid \lqd } -\char_set_catcode_letter:N \@ % --------------------------------------------------------------------------- % % reaction environments @@ -1904,13 +2288,29 @@ % define \listofreactions \tl_new:N \l_chemmacros_reaction_lorname_tl +\tl_set:Nn \l_chemmacros_reaction_lorname_tl { Reaction ~ } \tl_new:N \reactionlistname -\tl_set:Nn \l_chemmacros_reaction_lorname_tl - { \bool_if:NTF \l_chemmacros_german_bool { Reaktion ~ } { Reaction ~ } } +\tl_set:Nn \reactionlistname { List~of~reactions } -\bool_if:NTF \l_chemmacros_german_bool - { \tl_set:Nn \reactionlistname { Reaktionsverzeichnis } } - { \tl_set:Nn \reactionlistname { List~of~reactions } } +% language settings +\AtBeginDocument + { + \bool_if:NT \l_chemmacros_german_bool + { + \tl_set:Nn \reactionlistname { Reaktionsverzeichnis } + \tl_set:Nn \l_chemmacros_reaction_lorname_tl { Reaktion ~ } + } + \bool_if:NT \l_chemmacros_italian_bool + { + \tl_set:Nn \reactionlistname { Elenco ~ delle ~ reazioni } + \tl_set:Nn \l_chemmacros_reaction_lorname_tl { Reazione ~ } + } + \bool_if:NT \l_chemmacros_french_bool + { + \tl_set:Nn \reactionlistname { Table ~ des ~ r\'eactions } + \tl_set:Nn \l_chemmacros_reaction_lorname_tl { R\'eaction ~ } + } + } \cs_new:Npn \listofreactions { \section* { \reactionlistname } \@starttoc { lor } } @@ -1942,8 +2342,6 @@ \bool_if:NTF \l_chemmacros_version_one_bool { \usetagform { CMreaction } } { \usetagform { reaction } } - % => this is problematic because it disallows resetting the counter: -% \tl_new:c { l_chemmacros_reaction_ \thereaction _tl } } % switch back to equation tags @@ -2117,7 +2515,6 @@ % old syntax (v2.0): % \State[]{}{} % {} is an optional argument! -\char_set_catcode_math_subscript:N \@ \cs_new_nopar:Npn \chemmacros_state:nnn #1#2#3 { \group_begin: @@ -2128,10 +2525,10 @@ \bool_if:NT \l_chemmacros_State_delta_bool { \tl_use:N \l_chemmacros_State_delta_tl } \bool_if:NT \l_chemmacros_State_subscript_left_bool - { @ { \text { #3 } } } + { \c_math_subscript_token { \text { #3 } } } #2 \bool_if:NF \l_chemmacros_State_subscript_left_bool - { @ { \text { #3 } } } + { \c_math_subscript_token { \text { #3 } } } \bool_if:NT \l_chemmacros_State_exponent_bool { ^ { \tl_use:N \l_chemmacros_State_exponent_tl } } } @@ -2153,7 +2550,6 @@ \group_end: } } -\char_set_catcode_letter:N \@ % --------------------------------------------------------------------------- % \tl_new:N \l_chemmacros_thermod_subscript_left_tl @@ -3317,8 +3713,16 @@ Version history counter now doesn't cause errors any more - \AddRxnDesc added which allows to add descriptions to each reaction in the "reactions" environment +2012/05/07 - version 3.3 - new environment `experimental' that allows some + formatting for the for displaying of measurement + results + - more greek letters for the \iupac command + - new features in chemformula.sty + - small adjustments of the iupac commands \| and \- + - bug fix: option `upgreek' is now working and was + renamed to `greek' + - proper language support % --------------------------------------------------------------------------- % % TODO: -- ox-option xfrac vs math? -- resolve conflict with \listofreactions and \setcounter{reaction}{} \ No newline at end of file +- ox-option xfrac vs math? \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty index 4c91a0b8796..e82ac0b0dcc 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty @@ -5,7 +5,7 @@ % - macros and commands for chemists - % % --------------------------------------------------------------------------- % % - Clemens Niederberger - % -% - 2012/03/20 - % +% - 2012/05/07 - % % --------------------------------------------------------------------------- % % - https://bitbucket.org/cgnieder/chemmacros/ - % % - contact@mychemistry.eu - % @@ -30,8 +30,8 @@ \RequirePackage{ expl3 } \ProvidesExplPackage {ghsystem} - {2012/03/20} - {3.2} + {2012/05/07} + {3.3} {globally harmonised system} % --------------------------------------------------------------------------- % @@ -137,8 +137,24 @@ \DeclareSIUnit { \GHSkilogram } { kg } \DeclareSIUnit { \GHSpounds } { lbs } -\bool_if:NTF \l_chemmacros_german_bool - { \input { language / ghsystem_german.def } \ExplSyntaxOn } +% language settings +\bool_new:N \l_ghsystem_language_file_loaded_bool +\bool_if:NT \l_chemmacros_english_bool + { + \bool_set_true:N \l_ghsystem_language_file_loaded_bool + \input { language / ghsystem_english.def } \ExplSyntaxOn + } +\bool_if:NT \l_chemmacros_german_bool + { + \bool_set_true:N \l_ghsystem_language_file_loaded_bool + \input { language / ghsystem_german.def } \ExplSyntaxOn + } +% \bool_if:NT \l_chemmacros_italian_bool +% { +% \bool_set_true:N \l_ghsystem_language_file_loaded_bool +% \input { language / ghsystem_italian.def } \ExplSyntaxOn +% } +\bool_if:NF \l_ghsystem_language_file_loaded_bool { \input { language / ghsystem_english.def } \ExplSyntaxOn } \cs_new_nopar:Nn \ghsystem_booktabs:n @@ -456,6 +472,8 @@ VERSION HISTORY 2012/03/03 - version 3.1b - changes in packages chemformula and chemmacros 2012/03/14 - version 3.1c - changes in packages chemformula and chemmacros 2012/03/20 - version 3.2 - changes in packages chemformula and chemmacros +2012/05/07 - version 3.3 - changes in packages chemformula and chemmacros + - support for chemmacros' new language settings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: -- cgit v1.2.3