From e125f261f3433bb88672b645160d97b4ac2ea3f6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 9 Jul 2013 22:44:28 +0000 Subject: upmethodology (7jul13) git-svn-id: svn://tug.org/texlive/trunk@31148 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/chemmacros/chemformula.sty | 1116 +++++++---- .../texmf-dist/tex/latex/chemmacros/chemgreek.sty | 443 +++++ .../texmf-dist/tex/latex/chemmacros/chemmacros.sty | 2015 ++++++++++---------- .../texmf-dist/tex/latex/chemmacros/ghsystem.sty | 233 ++- .../latex/chemmacros/language/ghsystem_english.def | 913 ++++++--- .../latex/chemmacros/language/ghsystem_german.def | 4 +- .../latex/chemmacros/language/ghsystem_italian.def | 4 +- .../chemmacros/language/ghsystem_langtemplate.def | 6 +- 8 files changed, 3002 insertions(+), 1732 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty (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 12344325e7d..b29047b1e3d 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty @@ -1,41 +1,86 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% --------------------------------------------------------------------------- % -% - the CHEMMACROS bundle - % -% - chemformula.sty - % -% - macros and commands for chemists - % -% --------------------------------------------------------------------------- % -% - Clemens Niederberger - % -% --------------------------------------------------------------------------- % -% - https://bitbucket.org/cgnieder/chemmacros/ - % -% - contact@mychemistry.eu - % -% --------------------------------------------------------------------------- % -% - If you have any ideas, questions, suggestions or bugs to report, please - % -% - feel free to contact me. - % -% --------------------------------------------------------------------------- % -% - Copyright 2011-2013 Clemens Niederberger - % -% - - % -% - This work may be distributed and/or modified under the - % -% - conditions of the LaTeX Project Public License, either version 1.3 - % -% - of this license or (at your option) any later version. - % -% - The latest version of this license is in - % -% - http://www.latex-project.org/lppl.txt - % -% - and version 1.3 or later is part of all distributions of LaTeX - % -% - version 2005/12/01 or later. - % -% - - % -% - This work has the LPPL maintenance status `maintained'. - % -% - - % -% - The Current Maintainer of this work is Clemens Niederberger. - % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{ chemmacros } +% -------------------------------------------------------------------------- +% the CHEMMACROS bundle +% chemformula.sty +% macros and commands for chemists +% -------------------------------------------------------------------------- +% Clemens Niederberger +% -------------------------------------------------------------------------- +% https://bitbucket.org/cgnieder/chemmacros/ +% contact@mychemistry.eu +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +% Copyright 2011-2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +\RequirePackage{ expl3 , xparse , l3keys2e , tikz , amsmath , xfrac , nicefrac , scrlfile } +\usetikzlibrary{arrows} +\def\chemformula@version{4.0} +\def\chemformula@date{2013/07/06} + \ProvidesExplPackage {chemformula} - {\chemmacros@date} - {\chemmacros@version} + {\chemformula@date} + {\chemformula@version} {typeset chemical compounds and reactions} -%-----------------------------------------------------------------------------% -% WARNING AND ERROR MESSAGES -\msg_set:nnnn { chemformula } { missing-argument } +% -------------------------------------------------------------------------- +% check expl3 version: +\@ifpackagelater { expl3 } { 2012/11/21 } + { } + { + \PackageError { chemformula } { Support~package~expl3~too~old } + { + You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ + 'l3packages'.\MessageBreak + Loading~chemformula~will~abort! + } + \tex_endinput:D + } + +% -------------------------------------------------------------------------- +% warning and erroe messages: +\cs_new_protected:Npn \chemformula_error:nnxx #1#2#3#4 + { + \bool_if:NTF \l__chemformula_strict_bool + { \msg_error:nnxx { #1 } { #2 } { #3 } { #4 } } + { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } + } + +\cs_new_protected:Npn \chemformula_error:nn #1#2 + { + \bool_if:NTF \l__chemformula_strict_bool + { \msg_error:nnxx { #1 } { #2 } } + { \msg_warning:nnxx { #1 } { #2 } } + } + +\cs_new_protected:Npn \chemformula_warning:nnxx #1#2#3#4 + { + \bool_if:NTF \l__chemformula_strict_bool + { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } + { \msg_info:nnxx { #1 } { #2 } { #3 } { #4 } } + } + +\cs_new_protected:Npn \chemformula_warning:nn #1#2 + { + \bool_if:NTF \l__chemformula_strict_bool + { \msg_warning:nn { #1 } { #2 } } + { \msg_info:nn { #1 } { #2 } } + } + +\msg_new:nnnn { chemformula } { missing-argument } { Wrong~name~input~ \msg_line_context: . } @@ -47,15 +92,7 @@ Either~way~-~I~don't~know~what~to~do~ \msg_line_context: . } -\msg_set:nnnn { chemformula } { explicit } - { It~seems~you've~loaded~`chemformula'~explicitly. } - { - It~seems~you've loaded~`chemformula'~explicitly.~This~should~work~but~the~ - recommended~way~is~to~load~it~via~the~bundle,~i.e.~by~using~ - \token_to_str:N \usepackage \{ chemmacros \}. - } - -\msg_set:nnnn { chemformula } { declare-arrow } +\msg_new:nnnn { chemformula } { declare-arrow } { The~arrow~type~ \tl_to_str:n { #1 } \c_space_tl is~already~defined. } @@ -65,14 +102,14 @@ ~Choose~another~name. } -\msg_set:nnnn { chemformula } { renew-arrow } +\msg_new:nnnn { chemformula } { renew-arrow } { The~arrow~type~ \tl_to_str:n { #1 } \c_space_tl is~not~defined. } { You've~tried~to~renew~the~arrow~type~\tl_to_str:n { #1 } ~but~it~doesn't~ exist. } -\msg_set:nnnn { chemformula } { declare-bond } +\msg_new:nnnn { chemformula } { declare-bond } { The~bond~type~ \tl_to_str:n { #1 } \c_space_tl is~already~defined. } @@ -82,34 +119,248 @@ ~Choose~another~name. } -\msg_set:nnnn { chemformula } { renew-bond } +\msg_new:nnnn { chemformula } { renew-bond } { The~bond~type~ \tl_to_str:n { #1 } \c_space_tl is~not~defined. } { You've~tried~to~renew~the~bond~type~\tl_to_str:n { #1 } ~but~it~doesn't~ exist. } -% --------------------------------------------------------------------------- % -% scratch variables +\msg_new:nnnn { chemformula } { stand-alone } + { + You're~using~`chemformula'~as~a~stand-alone~package~or~have~loaded~it~ + before~you've~loaded~`chemmacros',~too.~Some~features~might~not~be~ + provided!~Espacially~you~cannot~use~\token_to_str:N \chemsetup \c_space_tl + to~setup~your~formulae. + } + { + You're~using~`chemformula'~as~a~stand-alone~package~or~have~loaded~it~ + before~you've~loaded~`chemmacros',~too.~Some~features~might~not~be~ + provided!~Espacially~you~cannot~use~\token_to_str:N \chemsetup \c_space_tl + to~setup~your~formulae. + } + +\msg_new:nnnn { chemformula } { command-deprecated } + { + The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ + \token_to_str:N #2 \c_space_tl instead. + } + { + The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ + \token_to_str:N #2 \c_space_tl instead. + } + +\cs_new_protected:Npn \chemformula_define_deprecated:NNn #1#2#3 + { + \cs_new_protected:Npn #1 + { + \chemformula_error:nnxx { chemformula } { command-deprecated } + { #1 } { #2 } + #3 + } + } + +\NewDocumentCommand \DeprecatedFormulaCommand { mmm } + { \chemformula_define_deprecated:NNn #1 #2 { #3 } } + +% -------------------------------------------------------------------------- +% variants of kernel functions: +\cs_generate_variant:Nn \keys_set:nn { nV } +\cs_generate_variant:Nn \tl_if_blank:nF { V } +\cs_generate_variant:Nn \tl_if_in:nnT { x } +\cs_generate_variant:Nn \prop_get:Nn { NV } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { NnV } + +% -------------------------------------------------------------------------- +% package options: +\bool_new:N \l__chemformula_strict_bool +\keys_define:nn { chemmacros / chemformula } + { + strict .bool_set:N = \l__chemformula_strict_bool , + strict .default:n = true + } + +\ProcessKeysOptions{ chemmacros / chemformula } + +\AtBeginDocument + { + \@ifpackageloaded{ chemmacros } + { + \bool_if:NT \l_chemmacros_strict_bool + { \bool_set_true:N \l__chemformula_strict_bool } + } + {} + } + +% -------------------------------------------------------------------------- +% VARIABLES +% temporary variables: \tl_new:N \l__chemformula_tmpa_tl \tl_new:N \l__chemformula_tmpb_tl \tl_new:N \l__chemformula_tmpc_tl + \dim_new:N \l__chemformula_tmpa_dim \dim_new:N \l__chemformula_tmpb_dim + \int_new:N \l__chemformula_tmpa_int \int_new:N \l__chemformula_tmpb_int + \box_new:N \l__chemformula_tmpa_box \box_new:N \l__chemformula_tmpb_box -%-----------------------------------------------------------------------------% -% gobble options -\DeclareOption* { } -\ProcessOptions \scan_stop: +% booleans: +% this one is officially used to detect wether we're in \ch or not: +\bool_new:N \l_chemformula_inside_ch_bool +% those are private: +\bool_new:N \l__chemformula_formal_charges_bool +\bool_new:N \l__chemformula_formal_chem_bool +\bool_set_true:N \l__chemformula_formal_chem_bool +\bool_new:N \l__chemformula_options_bool +\bool_new:N \l__chemformula_is_option_bool +\bool_new:N \l__chemformula_stoich_bool +\bool_new:N \l__chemformula_no_stoich_bool +\bool_new:N \l__chemformula_is_plus_bool +\bool_new:N \l__chemformula_is_up_bool +\bool_new:N \l__chemformula_is_down_bool +\bool_new:N \l__chemformula_is_arrow_bool +\bool_new:N \l__chemformula_is_name_bool +\bool_new:N \l__chemformula_stoich_is_iupac_bool +\bool_new:N \l__chemformula_stoich_parse_iupac_bool +\bool_new:N \l__chemformula_first_last_text_bool +\bool_new:N \l__chemformula_first_last_double_bool +\bool_new:N \l__chemformula_first_last_single_bool +\bool_new:N \l__chemformula_first_last_math_bool +\bool_new:N \l__chemformula_first_last_dollar_bool +\bool_new:N \l__chemformula_first_last_mathbraces_bool +\bool_new:N \l__chemformula_number_style_math_bool +\bool_new:N \l__chemformula_charge_style_math_bool +\bool_new:N \l__chemformula_sub_bool +\bool_new:N \l__chemformula_sup_bool +\bool_new:N \l__chemformula_is_isotope_bool +\bool_new:N \l__chemformula_xfrac_bool +\bool_new:N \l__chemformula_nicefrac_bool +\bool_new:N \l__chemformula_mathfrac_bool +\bool_set_true:N \l__chemformula_mathfrac_bool +\bool_new:N \l__chemformula_fss_bool +\bool_new:N \l__chemformula_fontspec_bool +\bool_new:N \l__chemformula_fss_family_bool +\bool_new:N \l__chemformula_fss_series_bool +\bool_new:N \l__chemformula_fss_shape_bool +\bool_new:N \l__chemformula_name_width_bool +\bool_new:N \l__chemformula_charge_full_shift_bool + +% dimensions: +\dim_new:N \l__chemformula_arrow_length_dim +\dim_new:N \l__chemformula_arrow_label_offset_dim +\dim_set:Nn \l__chemformula_arrow_label_offset_dim { 2pt } +\dim_new:N \l__chemformula_arrow_minimum_length_dim +\dim_new:N \l__chemformula_arrow_shortage_dim +\dim_new:N \l__chemformula_arrow_offset_dim +\dim_set:Nn \l__chemformula_arrow_offset_dim { .75em } +\dim_new:N \l__chemformula_compound_sep_dim +\dim_set:Nn \l__chemformula_compound_sep_dim { .5em } +\dim_new:N \l__chemformula_arrow_yshift_dim +\dim_set:Nn \l__chemformula_arrow_yshift_dim { 0pt } +\dim_new:N \l__chemformula_radical_radius_dim +\dim_set:Nn \l__chemformula_radical_radius_dim { .2ex } +\dim_new:N \l__chemformula_radical_hshift_dim +\dim_set:Nn \l__chemformula_radical_hshift_dim { .15em } +\dim_new:N \l__chemformula_radical_vshift_dim +\dim_set:Nn \l__chemformula_radical_vshift_dim { .5ex } +\dim_new:N \l__chemformula_radical_space_dim +\dim_set:Nn \l__chemformula_radical_space_dim { .15em } +\dim_new:N \l__chemformula_arrow_head_dim +\dim_new:N \l__chemformula_name_dim +\dim_new:N \l__chemformula_adduct_space_dim +\dim_set:Nn \l__chemformula_adduct_space_dim { .1333em } +\dim_new:N \l__chemformula_charge_shift_dim +\dim_set:Nn \l__chemformula_charge_shift_dim { .5ex } +\dim_new:N \l__chemformula_subscript_shift_dim +\dim_new:N \l__chemformula_superscript_shift_dim +\dim_new:N \l__chemformula_subscript_dim +\dim_zero:N \l__chemformula_subscript_dim +\dim_new:N \l__chemformula_superscript_dim +\dim_zero:N \l__chemformula_superscript_dim +\dim_new:N \l__chemformula_bond_dim +\dim_set:Nn \l__chemformula_bond_dim { .5833em } +\dim_new:N \l__chemformula_bond_space_dim +\dim_set:Nn \l__chemformula_bond_space_dim { .07em } + +% skips: +\skip_new:N \l__chemformula_stoich_space_skip +\skip_set:Nn \l__chemformula_stoich_space_skip { .1667em plus .0333em minus .0117em } +\skip_new:N \l__chemformula_math_space_skip +\skip_set:Nn \l__chemformula_math_space_skip { .1667em plus .0333em minus .0117em } +\skip_new:N \l__chemformula_plus_space_skip +\skip_set:Nn \l__chemformula_plus_space_skip { .3em plus .1em minus .1em } + -\RequirePackage { nicefrac } +% integers: +\int_new:N \l__chemformula_count_tokens_int + +% token lists: +\tl_new:N \l__chemformula_arrow_ratio_tl +\tl_set:Nn \l__chemformula_arrow_ratio_tl { .6 } +\tl_new:N \l__chemformula_radical_style_tl +\tl_new:N \l__chemformula_arrow_head_tl +\tl_set:Nn \l__chemformula_arrow_head_tl { cf } +\tl_new:N \l__chemformula_upper_label_tl +\tl_new:N \l__chemformula_lower_label_tl +\tl_new:N \l__chemformula_arrow_style_tl +\tl_new:N \l__chemformula_arrow_label_style_tl +\tl_set:Nn \l__chemformula_arrow_label_style_tl { \footnotesize } +\tl_new:N \l__chemformula_arrow_tmp_tl +\tl_new:N \l__chemformula_arrow_type_tl +\tl_new:N \l__chemformula_name_tmp_tl +\tl_new:N \l__chemformula_chemformula_tmpa_tl +\tl_new:N \g__chemformula_options_tl +\tl_new:N \g__chemformula_output_tl +\tl_new:N \l__chemformula_input_tl +\tl_new:N \l__chemformula_stoich_tl +\tl_new:N \l__chemformula_decimal_output_tl +\tl_set:Nn \l__chemformula_decimal_output_tl { . } +\tl_new:N \l__chemformula_font_family_tl +\tl_set_eq:NN \l__chemformula_font_family_tl \f@family +\tl_new:N \l__chemformula_font_series_tl +\tl_set_eq:NN \l__chemformula_font_series_tl \f@series +\tl_new:N \l__chemformula_font_shape_tl +\tl_set_eq:NN \l__chemformula_font_shape_tl \f@shape +\tl_new:N \l__chemformula_format_tl +\tl_new:N \l__chemformula_fontspec_options_tl +\tl_new:N \l__chemformula_fontspec_argument_tl +\tl_new:N \l__chemformula_name_format_tl +\tl_set:Nn \l__chemformula_name_format_tl { \scriptsize\centering } +\tl_new:N \l_chemormula_sup_super_factor_tl +\tl_new:N \l__chemformula_subscript_shift_additional_tl +\tl_set:Nn \l__chemformula_subscript_shift_additional_tl { 0pt } +\tl_new:N \l__chemformula_superscript_shift_additional_tl +\tl_set:Nn \l__chemformula_superscript_shift_additional_tl { 0pt } +\tl_new:N \l__chemformula_bond_style_tl +\tl_new:N \l__chemformula_subscript_tl +\tl_new:N \l__chemformula_superscript_tl +\tl_new:N \g__chemformula_input_up_tl + +% property lists: +\prop_new:N \l__chemformula_arrows_code_prop +\prop_new:N \l__chemformula_cmpd_prop +\prop_new:N \l__chemformula_bonds_prop +\prop_new:N \l__chemformula_stoich_prop +\prop_new:N \l__chemformula_charge_prop +\prop_new:N \l__chemformula_numbers_prop +\prop_new:N \l__chemformula_no_stoich_prop + +% sequences: +\seq_new:N \l__chemformula_arrows_type_seq +\seq_new:N \l__chemformula_input_seq + +% boxes: +\box_new:N \l__chemformula_arrow_arg_i_box +\box_new:N \l__chemformula_arrow_arg_ii_box +\box_new:N \l__chemformula_superscript_box +\box_new:N \l__chemformula_subscript_box -%-----------------------------------------------------------------------------% -% HELPER FUNCTIONS +% -------------------------------------------------------------------------- +% general and helper functions: \cs_new:Npn \chemformula_tikz:nn #1#2 { \tikz [ #1 ] { #2 } } \cs_generate_variant:Nn \chemformula_tikz:nn { xn,nf } @@ -118,50 +369,135 @@ { \draw [ #1 ] #2 ; } \cs_generate_variant:Nn \chemformula_draw:nn { xn,nx,xx,xf } -%-----------------------------------------------------------------------------% -% Some basic internal commands: -\cs_new:Npn \chemformula_plus: +\cs_new:Npn \chemformula_allow_break: + { \tex_penalty:D \c_zero } + +\cs_new_protected:Npn \chemformula_leave_vmode: + { \hbox_unpack:N \c_empty_box } + +\cs_new:Npn \chemformula_nobreak: + { \tex_penalty:D \c_ten_thousand } + +\cs_new:Npn \chemformula_skip_nobreak:N #1 + { + \chemformula_nobreak: + \skip_horizontal:N #1 + \chemformula_nobreak: + } + +\cs_new_protected:Npn \chemformula_dim_to_width:Nn #1#2 + { + \hbox_set:Nn \l__chemformula_tmpa_box { #2 } + \dim_set:Nn #1 { \box_wd:N \l__chemformula_tmpa_box } + \box_clear:N \l__chemformula_tmpa_box + } + +% an l3 conditional that can test 2e's conditionals that go like +% \iffoo ... \else ... \fi +% see http://tex.stackexchange.com/a/119806/5049 +\prg_new_conditional:Npnn \chemformula_latex_if:n #1 {p,T,F,TF} + { \use:c { if #1 } \prg_return_true: \else: \prg_return_false: \fi: } + +% -------------------------------------------------------------------------- +% circled charge signs: +\cs_new_protected:Npn \chemformula_fplus: + { \ensuremath { \__chemformula_fplus: } } + +\cs_new:Npn \__chemformula_fplus: + { \mathpalette \__chemformula_fplus_aux: \bigcirc } + +\cs_new:Npn \__chemformula_fplus_aux: #1#2 { - \bool_if:nTF - { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } + \ooalign { - \bool_if:NTF \l__chemmacros_circled_chem_bool - { \chemmacros_fplus: } - { \mode_if_math:TF { \oplus } { $ \oplus $ } } + \tex_hfil:D + $ + #1 + \chemformula_plain_plus: + $ + \tex_hfil:D + \tex_cr:D + \tex_hfil:D + $#1#2$ + \tex_hfil:D + \tex_cr:D } + } + +\cs_new_protected:Npn \chemformula_fminus: + { \ensuremath { \__chemformula_fminus: } } + +\cs_new:Npn \__chemformula_fminus: + { \mathpalette \__chemformula_fminus_aux_aux: \bigcirc } + +\cs_new:Npn \__chemformula_fminus_aux_aux: #1#2 + { + \ooalign { - \bool_if:NTF \l__chemformula_charge_style_math_bool - { \ensuremath { + } } - { \mode_if_math:TF { \text { + } } { + } } + \tex_hfil:D + $ + #1 + \chemformula_plain_minus: + $ + \tex_hfil:D + \tex_cr:D + \tex_hfil:D + $#1#2$ + \tex_hfil:D + \tex_cr:D } } -\cs_new:Npn \chemformula_minus: +\AtBeginDocument{ + \@ifpackageloaded { chemmacros } + { + \bool_if:nT + { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } + { \bool_set_true:N \l__chemformula_formal_charges_bool } + \bool_if:NF \l__chemmacros_circled_chem_bool + { \bool_set_false:N \l__chemformula_formal_chem_bool } + } + { } +} + +\cs_new_protected:Npn \chemformula_plain_plus: + { + \bool_if:NTF \l__chemformula_charge_style_math_bool + { \ensuremath { + } } + { \mode_if_math:TF { \text { + } } { + } } + } + +\cs_new_protected:Npn \chemformula_plus: { - \bool_if:nTF - { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } + \bool_if:NTF \l__chemformula_formal_charges_bool { - \bool_if:NTF \l__chemmacros_circled_chem_bool - { \chemmacros_fminus: } - { \mode_if_math:TF { \ominus } { $ \ominus $ } } + \bool_if:NTF \l__chemformula_formal_chem_bool + { \chemformula_fplus: } + { \mode_if_math:TF { \oplus } { \( \oplus \) } } } + { \chemformula_plain_plus: } + } + +\cs_new_protected:Npn \chemformula_plain_minus: + { + \bool_if:NTF \l__chemformula_charge_style_math_bool + { \ensuremath { - } } + { \mode_if_math:TF { \text { \textendash } } { \textendash } } + } + +\cs_new_protected:Npn \chemformula_minus: + { + \bool_if:NTF \l__chemformula_formal_charges_bool { - \bool_if:NTF \l__chemformula_charge_style_math_bool - { \ensuremath { - } } - { \mode_if_math:TF { \text { \textendash } } { \textendash } } + \bool_if:NTF \l__chemformula_formal_chem_bool + { \chemformula_fminus: } + { \mode_if_math:TF { \ominus } { \( \ominus \) } } } + { \chemformula_plain_minus: } } -\tl_new:N \l__chemformula_radical_style_tl -\dim_new:N \l__chemformula_radical_radius_dim -\dim_set:Nn \l__chemformula_radical_radius_dim { .2ex } -\dim_new:N \l__chemformula_radical_hshift_dim -\dim_set:Nn \l__chemformula_radical_hshift_dim { .15em } -\dim_new:N \l__chemformula_radical_vshift_dim -\dim_set:Nn \l__chemformula_radical_vshift_dim { .5ex } -\dim_new:N \l__chemformula_radical_space_dim -\dim_set:Nn \l__chemformula_radical_space_dim { .15em } - +% -------------------------------------------------------------------------- +% Some basic internal commands: \cs_new_protected:Npn \chemformula_radical: { \chemformula_tikz:xn @@ -194,16 +530,15 @@ \cs_new:Npn \chemformula_adduct: { - \skip_horizontal:N \l__chemformula_cdot_space_dim + \skip_horizontal:N \l__chemformula_adduct_space_dim \textperiodcentered - \skip_horizontal:N \l__chemformula_cdot_space_dim + \skip_horizontal:N \l__chemformula_adduct_space_dim } \cs_new_eq:NN \chemformula_star_adduct: \chemformula_adduct: -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- % ARROW DEFINITION % arrow heads: -\dim_new:N \l__chemformula_arrow_head_dim % full tip for pairs \pgfarrowsdeclare { cf } { cf } @@ -290,30 +625,14 @@ \pgfusepathqfillstroke } -% a possibility to overwrite the arrow tips: +% a possibility to overwrite the arrow tips -- undocumented: \providecommand*\pgfarrowsrenewalias[4]{% \let\savedef\pgf@arrows@check@already \def\pgf@arrows@check@already##1##2##3{##3}% \pgfarrowsdeclarealias{#1}{#2}{#3}{#4}% \let\pgf@arrows@check@already\savedef} -%-----------------------------------------------------------------------------% -% variables -\dim_new:N \l__chemformula_arrow_length_dim -\dim_new:N \l__chemformula_arrow_label_offset_dim -\dim_set:Nn \l__chemformula_arrow_label_offset_dim { 2pt } -\dim_new:N \l__chemformula_arrow_minimum_length_dim -\dim_new:N \l__chemformula_arrow_shortage_dim -\dim_new:N \l__chemformula_arrow_offset_dim -\dim_set:Nn \l__chemformula_arrow_offset_dim { .75em } -\dim_new:N \l__chemformula_compound_sep_dim -\dim_set:Nn \l__chemformula_compound_sep_dim { .5em } -\dim_new:N \l__chemformula_arrow_yshift_dim -\dim_set:Nn \l__chemformula_arrow_yshift_dim { 0pt } - -\tl_new:N \l__chemformula_arrow_ratio_tl -\tl_set:Nn \l__chemformula_arrow_ratio_tl { .6 } - +% -------------------------------------------------------------------------- % determine length in dependency of labels \cs_new_protected:Npn \__chemformula_determine_arrow_length:NN #1#2 { @@ -350,50 +669,18 @@ } } -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- % define arrow types -\tl_new:N \l__chemformula_arrow_head_tl -\tl_set:Nn \l__chemformula_arrow_head_tl { cf } -\tl_new:N \l__chemformula_upper_label_tl -\tl_new:N \l__chemformula_lower_label_tl -\tl_new:N \l__chemformula_arrow_style_tl -\tl_new:N \l__chemformula_arrow_label_style_tl -\tl_set:Nn \l__chemformula_arrow_label_style_tl { \footnotesize } -\tl_new:N \l__chemformula_arrow_tmp_tl -\prop_new:N \l__chemformula_arrows_code_prop -\seq_new:N \l__chemformula_arrows_type_seq -\tl_new:N \l__chemformula_arrow_type_tl -\box_new:N \l__chemformula_arrow_arg_i_box -\box_new:N \l__chemformula_arrow_arg_ii_box - -% read optional arguments -\cs_new:Npn \__chemformula_arrow_read_args:w - { - \peek_meaning:NTF [ - { \__chemformula_arrow_read_args_aux_i:w } - { \__chemformula_arrow_read_args_aux_iii: } - } +% read arrow labels: -\cs_new_protected:Npn \__chemformula_arrow_read_args_aux_i:w [#1] +\cs_new:Npn \chemformula_arrow_labels:nn #1#2 { \hbox_set:Nn \l__chemformula_arrow_arg_i_box { \tl_use:N \l__chemformula_arrow_label_style_tl #1 } - \peek_meaning:NTF [ - { \__chemformula_arrow_read_args_aux_ii:w } - { \__chemformula_arrow_read_args_aux_iii: } - } - -\cs_new_protected:Npn \__chemformula_arrow_read_args_aux_ii:w [#1] - { \hbox_set:Nn \l__chemformula_arrow_arg_ii_box - { \tl_use:N \l__chemformula_arrow_label_style_tl #1 } - \__chemformula_arrow_read_args_aux_iii: - } - -\cs_new:Npn \__chemformula_arrow_read_args_aux_iii: - { - % now we have both arguments do the actual drawing: + { \tl_use:N \l__chemformula_arrow_label_style_tl #2 } + % now that we have both arguments do the actual drawing: \prop_get:NVN \l__chemformula_arrows_code_prop \l__chemformula_arrow_type_tl \l__chemformula_tmpb_tl @@ -409,13 +696,19 @@ \box_clear:N \l__chemformula_arrow_arg_ii_box % then get the arrow type \tl_set:Nn \l__chemformula_arrow_type_tl { #1 } - \__chemformula_arrow_read_args:w + } + +% this will be \arrow inside \ch +\DeclareDocumentCommand \charrow { mO{}O{} } + { + \__chemformula_arrows_get:n { #1 } + \chemformula_arrow_labels:nn { #2 } { #3 } } % draw the arrows \cs_new:Npn \__chemformula_arrow_draw:n #1 { - \chemmacros_allow_break: + \chemformula_allow_break: % prepare arrow code for drawing: \tl_set_rescan:Nnn \l__chemformula_tmpc_tl { \char_set_catcode_letter:N \_ } { #1 } @@ -455,7 +748,7 @@ ; \tl_use:N \l__chemformula_tmpc_tl } - \chemmacros_allow_break: + \chemformula_allow_break: } \cs_generate_variant:Nn \__chemformula_arrow_draw:n { V } @@ -464,7 +757,7 @@ \NewDocumentCommand \DeclareChemArrow { mm } { \prop_if_in:NnTF \l__chemformula_arrows_code_prop { #1 } - { \chemmacros_msg:nnxx { chemformula } { declare-arrow } { #1 } {} } + { \chemformula_error:nnxx { chemformula } { declare-arrow } { #1 } {} } { % store type in the sequence and code in the property list \seq_put_right:Nn \l__chemformula_arrows_type_seq { #1 } @@ -476,7 +769,7 @@ { \prop_if_in:NnTF \l__chemformula_arrows_code_prop { #1 } { \prop_put:Nnn \l__chemformula_arrows_code_prop { #1 } { #2 } } - { \chemmacros_msg:nnxx { chemformula } { renew-arrow } { #1 } {} } + { \chemformula_error:nnxx { chemformula } { renew-arrow } { #1 } {} } } \NewDocumentCommand \ShowChemArrow { m } @@ -540,7 +833,7 @@ % net reaction: \DeclareChemArrow { == } { \node at ([yshift=-.2ex]cf_arrow_mid) { = } ; } -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- % arrow customization \keys_define:nn { chemmacros / chemformula } { @@ -550,53 +843,65 @@ arrow-ratio .tl_set:N = \l__chemformula_arrow_ratio_tl , label-offset .dim_set:N = \l__chemformula_arrow_label_offset_dim , compound-sep .dim_set:N = \l__chemformula_compound_sep_dim , -% arrow-tips .tl_set:N = \l__chemformula_arrow_head_tl , arrow-style .tl_set:N = \l__chemformula_arrow_style_tl , label-style .tl_set:N = \l__chemformula_arrow_label_style_tl } -%-----------------------------------------------------------------------------% -\seq_new:N \l__chemformula_input_seq +% -------------------------------------------------------------------------- % MAIN COMMAND \cs_new_protected:Npn \__chemformula_ch_main:n #1 { \group_begin: \seq_set_split:Nnn \l__chemformula_input_seq { ~ } { #1 } \cs_set_eq:NN \xspace \scan_stop: + % the next two necessary any more but shouldn't do harm, too: \cs_set_nopar:Npn \[ { [ } \cs_set_nopar:Npn \] { ] } - \bool_set_true:N \l__chemformula_inside_ch_bool - \tl_if_blank:oF { \g__chemformula_options_tl } + \bool_set_true:N \l_chemformula_inside_ch_bool + \tl_if_blank:VF \g__chemformula_options_tl { - \keys_set:no { chemmacros / chemformula } - { \g__chemformula_options_tl } + \keys_set:nV + { chemmacros / chemformula } + \g__chemformula_options_tl } \seq_map_function:NN \l__chemformula_input_seq \chemformula_input:n -% \tl_set_eq:NN -% \l__chemformula_output_tl -% \l__chemformula_input_tl - \tl_set_rescan:Nno \l__chemformula_input_tl + \tl_set_rescan:NnV \l__chemformula_input_tl { \ExplSyntaxOn \makeatletter } - { \l__chemformula_input_tl } + \l__chemformula_input_tl \chemformula_write:V \l__chemformula_input_tl \group_end: } +\cs_new:Npn \chemformula_write:n #1 + { + \mode_if_math:TF + { + \mathchoice + { \text { #1 } } + { \text { #1 } } + { \text { \scriptsize #1 } } + { \text { \tiny #1 } } + } + { #1 } + } +\cs_generate_variant:Nn \chemformula_write:n { V } + % internal version of \ch command: \cs_new_protected:Npn \chemformula_ch:nn #1#2 { \group_align_safe_begin: - \chemmacros_leave_vmode: - \IfNoValueTF { #1 } + \chemformula_leave_vmode: + \tl_if_blank:nTF { #1 } { \tl_gclear:N \g__chemformula_options_tl } - { \tl_gset:Nn \g__chemformula_options_tl { #1 } } + { \tl_gset:Nn \g__chemformula_options_tl { #1 } } \__chemformula_ch_aux_i:w #2 \\ \q_no_value \q_stop \group_align_safe_end: - \tl_use:N \g__chemformula_output_tl + \tl_use:N \g__chemformula_output_tl \tl_gclear:N \g__chemformula_output_tl } +\cs_generate_variant:Nn \chemformula_ch:nn { V , nV , VV } % Trickery to use \ch inside align environment: % bypass \\: @@ -627,18 +932,20 @@ \__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} } + \tl_gput_right:Nn \g__chemformula_output_tl { \label { #2 } } \__chemformula_ch_aux_iii:w #3 \q_stop } } +% here's something not working when used together with `hyperref' +% which seems to be related to \nonumber % bypass \tag: \cs_new_protected: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} } + \tl_gput_right:Nn \g__chemformula_output_tl { \protect\tag { #2 } } \__chemformula_ch_aux_iv:w #3 \q_stop } } @@ -650,30 +957,30 @@ { \__chemformula_ch_main:n { #1 } } \quark_if_no_value:nF { #3 } { - \tl_gput_right:Nn \g__chemformula_output_tl { \intertext{#2} } + \tl_gput_right:Nn \g__chemformula_output_tl { \intertext { #2 } } \__chemformula_ch_aux_v:w #3 \q_stop - } + } } -% user command: -\NewDocumentCommand \ch { om } +% -------------------------------------------------------------------------- +% user commands: +\NewDocumentCommand \ch { O{}m } { \chemformula_ch:nn { #1 } { #2 } } -\cs_new:Npn \chemformula_write:n #1 +\tl_new:N \l__chemformula_compound_tl +\cs_new_protected:Npn \chemformula_chcpd:nn #1#2 { - \mode_if_math:TF - { - \mathchoice - { \text { #1 } } - { \text { #1 } } - { \text { \scriptsize #1 } } - { \text { \tiny #1 } } - } - { #1 } + \group_begin: + \keys_set:nn { chemmacros / chemformula } { #1 } + \chemformula_input_cmpd:nN { #2 } \l__chemformula_compound_tl + \chemformula_write:V \l__chemformula_compound_tl + \group_end: } -\cs_generate_variant:Nn \chemformula_write:n { V } -%-----------------------------------------------------------------------------% +\NewDocumentCommand \chcpd { O{}m } + { \chemformula_chcpd:nn { #1 } { #2 } } + +% -------------------------------------------------------------------------- % arrow generation & detection \cs_new:Npn \__chemformula_generate_arrows:Nn #1#2 { @@ -681,7 +988,7 @@ \seq_map_inline:Nn \l__chemformula_arrows_type_seq { \tl_replace_all:Nnn \l__chemformula_tmpa_tl - { ##1 } { \__chemformula_arrows_get:n { ##1 } } + { ##1 } { \charrow { ##1 } } } \tl_set_eq:NN #1 \l__chemformula_tmpa_tl } @@ -698,37 +1005,35 @@ } } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% -------------------------------------------------------------------------- % compound names -\dim_new:N \l__chemformula_name_dim -\tl_new:N \l__chemformula_name_tmp_tl - \cs_new:Npn \__chemformula_name_cmpd:w - { \peek_meaning:NTF ( { \__chemformula_name_cmpd_aux:w } { ! } } + { \peek_meaning:NTF ( { \chname } { ! } } -% TODO -% this is no document command -- but now nesting of brackets is possible -\NewDocumentCommand \__chemformula_name_cmpd_aux:w {r()r()} +\NewDocumentCommand \chname { R(){}R(){} } + { \chemformula_chwritebelow:nn { #1 } { #2 } } + +\cs_new:Npn \chemformula_chwritebelow:nn #1#2 { \( \underset { \bool_if:NF \l__chemformula_name_width_bool { - \chemmacros_dim_to_width:Nn \l__chemformula_name_dim + \chemformula_dim_to_width:Nn \l__chemformula_name_dim { \l__chemformula_name_format_tl #1 } } \parbox { \dim_use:N \l__chemformula_name_dim } { \l__chemformula_name_format_tl #1 } } - { \text { \vphantom{\gas} #2 } } + { \text { \strut #2 } } \) } \cs_new_protected:Npn \__chemformula_generate_name:Nn #1#2 { - \tl_set:Nn \l__chemformula_tmpa_tl { #2 } + \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl { #2 } \tl_if_in:VnT \l__chemformula_tmpa_tl { ! } { \tl_replace_all:Nnn \l__chemformula_tmpa_tl @@ -747,97 +1052,8 @@ { \bool_set_true:N \l__chemformula_is_name_bool } } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% -------------------------------------------------------------------------- % parsing input -% booleans: -\bool_new:N \l__chemformula_inside_ch_bool -\bool_new:N \l__chemformula_options_bool -\bool_new:N \l__chemformula_is_option_bool -\bool_new:N \l__chemformula_stoich_bool -\bool_new:N \l__chemformula_no_stoich_bool -\bool_new:N \l__chemformula_is_plus_bool -\bool_new:N \l__chemformula_is_up_bool -\bool_new:N \l__chemformula_is_down_bool -\bool_new:N \l__chemformula_is_arrow_bool -\bool_new:N \l__chemformula_is_name_bool -\bool_new:N \l__chemformula_stoich_is_iupac_bool -\bool_new:N \l__chemformula_stoich_parse_iupac_bool -\bool_new:N \l__chemformula_first_last_text_bool -\bool_new:N \l__chemformula_first_last_double_bool -\bool_new:N \l__chemformula_first_last_single_bool -\bool_new:N \l__chemformula_first_last_math_bool -\bool_new:N \l__chemformula_first_last_dollar_bool -\bool_new:N \l__chemformula_first_last_mathbraces_bool -\bool_new:N \l__chemformula_number_style_math_bool -\bool_new:N \l__chemformula_charge_style_math_bool -\bool_new:N \l__chemformula_sub_bool -\bool_new:N \l__chemformula_sup_bool -\bool_new:N \l__chemformula_is_isotope_bool -\bool_new:N \l__chemformula_xfrac_bool -\bool_new:N \l__chemformula_nicefrac_bool -\bool_new:N \l__chemformula_mathfrac_bool - \bool_set_true:N \l__chemformula_mathfrac_bool -\bool_new:N \l__chemformula_fss_bool -\bool_new:N \l__chemformula_fontspec_bool -\bool_new:N \l__chemformula_fss_family_bool -\bool_new:N \l__chemformula_fss_series_bool -\bool_new:N \l__chemformula_fss_shape_bool -\bool_new:N \l__chemformula_name_width_bool -\bool_new:N \l__chemformula_charge_full_shift_bool - -% token lists: -\tl_new:N \l__chemformula_chemformula_tmpa_tl -\tl_new:N \g__chemformula_options_tl -\tl_new:N \g__chemformula_output_tl -% \tl_new:N \l__chemformula_output_tl -\tl_new:N \l__chemformula_input_tl -\tl_new:N \l__chemformula_stoich_tl -\tl_new:N \l__chemformula_decimal_output_tl -\tl_set:Nn \l__chemformula_decimal_output_tl { . } -\tl_new:N \l__chemformula_font_family_tl -\tl_set_eq:NN \l__chemformula_font_family_tl \f@family -\tl_new:N \l__chemformula_font_series_tl -\tl_set_eq:NN \l__chemformula_font_series_tl \f@series -\tl_new:N \l__chemformula_font_shape_tl -\tl_set_eq:NN \l__chemformula_font_shape_tl \f@shape -\tl_new:N \l__chemformula_format_tl -\tl_new:N \l__chemformula_fontspec_options_tl -\tl_new:N \l__chemformula_fontspec_argument_tl -\tl_new:N \l__chemformula_name_format_tl -\tl_set:Nn \l__chemformula_name_format_tl { \scriptsize\centering } -\tl_new:N \l_chemormula_sup_super_factor_tl -\tl_new:N \l__chemformula_subscript_shift_additional_tl -\tl_set:Nn \l__chemformula_subscript_shift_additional_tl { 0pt } -\tl_new:N \l__chemformula_superscript_shift_additional_tl -\tl_set:Nn \l__chemformula_superscript_shift_additional_tl { 0pt } -\tl_new:N \l__chemformula_bond_style_tl - -% dimensions and skips: -\skip_new:N \l__chemformula_stoich_space_skip -\skip_set:Nn \l__chemformula_stoich_space_skip { .1667em plus .0333em minus .0117em } -\skip_new:N \l__chemformula_math_space_skip -\skip_set:Nn \l__chemformula_math_space_skip { .1667em plus .0333em minus .0117em } -\skip_new:N \l__chemformula_plus_space_skip -\skip_set:Nn \l__chemformula_plus_space_skip { .3em plus .1em minus .1em } -\dim_new:N \l__chemformula_cdot_space_dim -\dim_set:Nn \l__chemformula_cdot_space_dim { .1333em } -\dim_new:N \l__chemformula_charge_shift_dim -\dim_set:Nn \l__chemformula_charge_shift_dim { .5ex } -\dim_new:N \l__chemformula_subscript_shift_dim -\dim_new:N \l__chemformula_superscript_shift_dim -\dim_new:N \l__chemformula_subscript_dim -\dim_zero:N \l__chemformula_subscript_dim -\dim_new:N \l__chemformula_superscript_dim -\dim_zero:N \l__chemformula_superscript_dim -\dim_new:N \l__chemformula_bond_dim -\dim_set:Nn \l__chemformula_bond_dim { .5833em } - -% integers: -\int_new:N \l__chemformula_count_tokens_int - -% property lists: -% behaviour in a compound -\prop_new:N \l__chemformula_cmpd_prop \prop_put:Nnn \l__chemformula_cmpd_prop { 0 } { \chemformula_subscript:n { 0 } } \prop_put:Nnn \l__chemformula_cmpd_prop { 1 } { \chemformula_subscript:n { 1 } } \prop_put:Nnn \l__chemformula_cmpd_prop { 2 } { \chemformula_subscript:n { 2 } } @@ -855,7 +1071,6 @@ \prop_put:Nnn \l__chemformula_cmpd_prop { + } { \chemformula_triple_bond: } % numbers -\prop_new:N \l__chemformula_numbers_prop \prop_put:Nnn \l__chemformula_numbers_prop { 0 } { 0 } \prop_put:Nnn \l__chemformula_numbers_prop { 1 } { 1 } \prop_put:Nnn \l__chemformula_numbers_prop { 2 } { 2 } @@ -868,23 +1083,21 @@ \prop_put:Nnn \l__chemformula_numbers_prop { 9 } { 9 } % behaviour in a charge -\prop_new:N \l__chemformula_charge_prop -\prop_put:Nnn \l__chemformula_charge_prop { 0 } { \__chemformula_charge_style:n { 0 } } -\prop_put:Nnn \l__chemformula_charge_prop { 1 } { \__chemformula_charge_style:n { 1 } } -\prop_put:Nnn \l__chemformula_charge_prop { 2 } { \__chemformula_charge_style:n { 2 } } -\prop_put:Nnn \l__chemformula_charge_prop { 3 } { \__chemformula_charge_style:n { 3 } } -\prop_put:Nnn \l__chemformula_charge_prop { 4 } { \__chemformula_charge_style:n { 4 } } -\prop_put:Nnn \l__chemformula_charge_prop { 5 } { \__chemformula_charge_style:n { 5 } } -\prop_put:Nnn \l__chemformula_charge_prop { 6 } { \__chemformula_charge_style:n { 6 } } -\prop_put:Nnn \l__chemformula_charge_prop { 7 } { \__chemformula_charge_style:n { 7 } } -\prop_put:Nnn \l__chemformula_charge_prop { 8 } { \__chemformula_charge_style:n { 8 } } -\prop_put:Nnn \l__chemformula_charge_prop { 9 } { \__chemformula_charge_style:n { 9 } } +\prop_put:Nnn \l__chemformula_charge_prop { 0 } { \chemformula_charge_style:n { 0 } } +\prop_put:Nnn \l__chemformula_charge_prop { 1 } { \chemformula_charge_style:n { 1 } } +\prop_put:Nnn \l__chemformula_charge_prop { 2 } { \chemformula_charge_style:n { 2 } } +\prop_put:Nnn \l__chemformula_charge_prop { 3 } { \chemformula_charge_style:n { 3 } } +\prop_put:Nnn \l__chemformula_charge_prop { 4 } { \chemformula_charge_style:n { 4 } } +\prop_put:Nnn \l__chemformula_charge_prop { 5 } { \chemformula_charge_style:n { 5 } } +\prop_put:Nnn \l__chemformula_charge_prop { 6 } { \chemformula_charge_style:n { 6 } } +\prop_put:Nnn \l__chemformula_charge_prop { 7 } { \chemformula_charge_style:n { 7 } } +\prop_put:Nnn \l__chemformula_charge_prop { 8 } { \chemformula_charge_style:n { 8 } } +\prop_put:Nnn \l__chemformula_charge_prop { 9 } { \chemformula_charge_style:n { 9 } } \prop_put:Nnn \l__chemformula_charge_prop { + } { \chemformula_plus: } \prop_put:Nnn \l__chemformula_charge_prop { - } { \chemformula_minus: } \prop_put:Nnn \l__chemformula_charge_prop { . } { \chemformula_radical: } % stoichiometric factors -\prop_new:N \l__chemformula_stoich_prop \prop_put:Nnn \l__chemformula_stoich_prop { 0 } { 0 } \prop_put:Nnn \l__chemformula_stoich_prop { 1 } { 1 } \prop_put:Nnn \l__chemformula_stoich_prop { 2 } { 2 } @@ -902,7 +1115,6 @@ \prop_put:Nnn \l__chemformula_stoich_prop { ( } { ( } \prop_put:Nnn \l__chemformula_stoich_prop { ) } { ) } -\prop_new:N \l__chemformula_no_stoich_prop \prop_put:Nnn \l__chemformula_no_stoich_prop { . } { } \prop_put:Nnn \l__chemformula_no_stoich_prop { , } { } \prop_put:Nnn \l__chemformula_no_stoich_prop { / } { } @@ -910,12 +1122,8 @@ \prop_put:Nnn \l__chemformula_no_stoich_prop { ( } { } \prop_put:Nnn \l__chemformula_no_stoich_prop { ) } { } -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- % bonds: -\dim_new:N \l__chemformula_bond_space_dim -\dim_set:Nn \l__chemformula_bond_space_dim { .07em } -\prop_new:N \l__chemformula_bonds_prop - \cs_new:Npn \chemformula@bondlength { \l__chemformula_bond_dim } @@ -932,9 +1140,9 @@ \cs_new:Npn \chemformula_triple_bond: { \chemformula_bond:n { triple } } -\cs_new:Npn \chemformula_bond:n #1 +\cs_new_protected:Npn \chemformula_bond:n #1 { - \chemmacros_skip_nobreak:N \l__chemformula_bond_space_dim + \chemformula_skip_nobreak:N \l__chemformula_bond_space_dim \chemformula_tikz:nn { inner~sep = 0 , @@ -953,14 +1161,14 @@ { \__chemformula_bond_draw:n { single } } { \__chemformula_bond_draw:n { #1 } } } - \chemmacros_skip_nobreak:N \l__chemformula_bond_space_dim + \chemformula_skip_nobreak:N \l__chemformula_bond_space_dim } \cs_new_protected:Npn \__chemformula_bond_draw:n #1 { \tl_set_rescan:Nnn \l__chemformula_tmpa_tl {} { #1 } - \exp_args:NNo \prop_get:Nn \l__chemformula_bonds_prop - { \l__chemformula_tmpa_tl } + \prop_get:NV \l__chemformula_bonds_prop + \l__chemformula_tmpa_tl } \tikzset { chembond/.style={butt~cap-butt~cap,\l__chemformula_bond_style_tl} } @@ -968,7 +1176,7 @@ \NewDocumentCommand \DeclareChemBond { mm } { \cs_if_exist:cTF { chemformula_bond_type_#1 } - { \chemmacros_msg:nnxx { chemformula } { declare-bond } { #1 } {} } + { \chemformula_error:nnxx { chemformula } { declare-bond } { #1 } {} } { \cs_new:cpn { chemformula_bond_type_#1 } {} \prop_put:Nnn \l__chemformula_bonds_prop { #1 } { #2 } @@ -978,7 +1186,7 @@ \NewDocumentCommand \DeclareChemBondAlias { mm } { \cs_if_exist:cTF { chemformula_bond_type_#1 } - { \chemmacros_msg:nnxx { chemformula } { declare-bond } { #1 } {} } + { \chemformula_error:nnxx { chemformula } { declare-bond } { #1 } {} } { \cs_new:cpn { chemformula_bond_type_#1 } {} \prop_get:NnN \l__chemformula_bonds_prop { #2 } \l__chemformula_tmpa_tl @@ -990,7 +1198,7 @@ { \cs_if_exist:cTF { chemformula_bond_type_#1 } { \prop_put:Nnn \l__chemformula_bonds_prop { #1 } { #2 } } - { \chemmacros_msg:nnxx { chemformula } { renew-bond } { #1 } {} } + { \chemformula_error:nnxx { chemformula } { renew-bond } { #1 } {} } } \NewDocumentCommand \ShowChemBond { m } @@ -1071,7 +1279,7 @@ { \draw[chembond,<-butt~cap] (chemformula-bond-start) -- (chemformula-bond-end) ; } \DeclareChemBondAlias{ #2: #3: #4: \cs_new_protected:Npn \__chemformula_bool_set_if_first_last:Nnnn #1#2#3#4 @@ -1861,6 +2074,7 @@ { \char_set_catcode_letter:N \_ \char_set_catcode_other:N \: + } { #1 } \tl_replace_all:Nnn \l__chemformula_tmpa_tl @@ -1869,9 +2083,6 @@ { _ } { \sb } \tl_replace_all:Nnn \l__chemformula_tmpa_tl { chemformulaplaceholder } { \_ } - \tl_set_rescan:Nno \l__chemformula_tmpa_tl - { }% TODO da war \ExplSyntaxOff drin: brauchts das? - { \l__chemformula_tmpa_tl } \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_tmpa_tl } @@ -1899,7 +2110,7 @@ } } -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- % input escaped math \cs_new_protected:Npn \chemformula_input_escape_math:n #1 { @@ -1930,12 +2141,9 @@ { _ } { \sb } \tl_replace_all:Nnn \l__chemformula_tmpa_tl { chemformulaplaceholder } { \_ } - \tl_set_rescan:Nno \l__chemformula_tmpa_tl - { }% TODO da war \ExplSyntaxOff drin: brauchts das? - { \l__chemformula_tmpa_tl } \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_tmpa_tl \tl_put_right:Nn \l__chemformula_input_tl - { \skip_horizontal:N \l__chemformula_math_space_skip } + { \chemformula_skip_nobreak:N \l__chemformula_math_space_skip } } \cs_new:Npn \__chemformula_read_escape_dollar:w $#1$ \q_nil @@ -1962,7 +2170,7 @@ } } -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- % customization of output other than arrows \keys_define:nn { chemmacros / chemformula } { @@ -2005,7 +2213,7 @@ \bool_set_false:N \l__chemformula_mathfrac_bool , stoich-paren-parse .bool_set:N = \l__chemformula_stoich_parse_iupac_bool , stoich-space .skip_set:N = \l__chemformula_stoich_space_skip , - adduct-space .dim_set:N = \l__chemformula_cdot_space_dim , + adduct-space .dim_set:N = \l__chemformula_adduct_space_dim , plus-space .skip_set:N = \l__chemformula_plus_space_skip , math-space .skip_set:N = \l__chemformula_math_space_skip , name-format .tl_set:N = \l__chemformula_name_format_tl , @@ -2046,21 +2254,125 @@ \tl_set:Nn \l__chemformula_format_tl { #1 } } -%-----------------------------------------------------------------------------% +% -------------------------------------------------------------------------- + +\NewDocumentCommand \setchemformula { m } + { \keys_set:nn { chemmacros / chemformula } { #1 } } + +% -------------------------------------------------------------------------- % hyperref support \AfterPackage* { hyperref } - { \pdfstringdefDisableCommands { \cs_set:Npn \ch #1 { #1 } } } + { + \pdfstringdefDisableCommands + { + \cs_set:Npn \chcpd #1 { #1 } + \cs_set:Npn \charrow #1 { #1 } + \cs_set:Npn \chname (#1)(#2) { #2~(#1) } + \cs_set:Npn \ch #1 { #1 } + } + } \tex_endinput:D -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -VERSION HISTORY -see the chemmacros.sty file -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% -------------------------------------------------------------------------- +VERSION HISTORY +2012/01/28 - version 3.0 - bundled with packages `chemmacros' and `ghs' +2012/01/30 - version 3.0a - bugfix + - renamed formula => chemformula + (following a request by Karl Berry for TeXlive) +2012/02/03 - version 3.0b - stepped number with `chemmacros' +2012/02/05 - version 3.0c - stepped number with `chemmacros' +2012/02/10 - version 3.0d - several bugfixes + - new arrow type <> +2012/02/19 - version 3.1 - new arrow types -/>, + - new commands \DeclareChemArrow, \RenewChemArrow and + \ShowChemArrow +2012/02/26 - version 3.1a - stepped number with `chemmacros' +2012/03/03 - version 3.1b - arrow types are stored in a sequence to automate the + search and replace in the right order + - new arrow type == + - IUPAC compliance for stoichiometric factors + - new handling of super- and subscripts to correct + various flaws: clear distinction between isotope and + formula + - new option charge-vshift +2012/03/14 - version 3.1c - improved arrow labels +2012/03/20 - version 3.2 - new: option input via @{} +2012/05/07 - version 3.3 - \ch now bypasses \ref{}, \label{}, and \intertext{} +2012/05/13 - version 3.3a - stepped number with `chemmacros' +2012/05/18 - version 3.3b - stepped number with `chemmacros' +2012/05/18 - version 3.3c - stepped number with `chemmacros' +2012/07/24 - version 3.3d - stepped number with `chemmacros' + - default bond length set to 1.1667ex + - bug fix in the bonds +2012/08/21 - version 3.3e - stepped number with `chemmacros' +2012/09/11 - version 3.4 - cleaned a little, minor bug fixes + - switched to internal scratch variables + - new command \bond, more bond types + - new commands \DeclareChemBond, \DeclareChemBondAlias, + \RenewChemBond and \ShowChemBond + - radical point thicker, new options `radical-style' + and `radical-radius' +2012/10/03 - version 3.4a - stepped number with `chemmacros' +2013/01/04 - version 3.4b - bug fix in the sub- and superscript handling +2013/01/28 - version 3.5 - disallow breaks at bonds + - allow breaks after arrows + - made some spaces in chemformulas stretch- and + shrinkable + - various internal code improvements + - changed defaults for horizontal spaces that have in + set in ex into corresponding values in em. + - improvements to the placement of sub- and superscripts +2013/02/19 - version 3.5a - stepped number with `chemmacros' +2013/02/26 - version 3.6 - support for use with the `breqn' package + - math escaping also via \(\) + - internal: clearer escaping macros + - new options: `radical-vshift', `radical-hshift' + and `radical-space' + - bug fix: `radical-...' options are now correctly set + - stoichiometric factors: add leading 0 if missing + - new option: `stoich-paren-parse' + - internal changes: be way more rigid about protected + and expandable macros + - internal changes: clearer distinction between + private macros and accessable module macros + - internal changes: clearer distinction between + document commands and module level commands + - !()() syntax now also works with babel's French +2013/02/27 - version 3.6a - bug fix: escaped text and math stays escaped, i.e. + also arrow code like `<=>' +2013/04/19 - version 3.6b - new option `arrow-min-length' + - bug fix: stoichiometric fractions correctly displayed +2013/07/06 - version 4.0 - don't need `chemmacros' package any more, + `chemformula' can be used stand-alone; + this has lead to a few definitions that previously + were done by chemmacros; chemmacros will get them + now from chemformula when needed + - bug fix: allow braces in subscripts and superscripts + by disabling superfluous \chemformula_subscript:n + and \chemformula_superscript:n in the scripts write + commands + - remove superfluous rescanning at the begin of the + formula input; this is handled by the sanitize + command later anyway + - changed internal mathshifts from $ ... $ to \( ... \) + - removed superfluous \textstyle from math-frac + definition + - new command \charrow{}[][] that allows direct + access to chemformula's arrows + - new command \chname()() that allows direct access + to chemformula's naming + - new command \chcpd[]{} that allows typesetting a + simple single formula - also not nestable with \ch + - new command \setchemformula + - package option: `strict' + - don't allow a line break before a plus + (`chem-and') + - don't allow a line break between a stoichiometric + factor and a compound + - changed formal charges to match ``plain'' charges + +% -------------------------------------------------------------------------- % TODO -- Bug: math- und text-escaping schützt nicht vor arrow-Umwandlung: \ch{"->"} - Addukte: Zahlen nach * und . automatisch erkennen? -- allow fractions in subscripts: _{$\frac{1}{2}$} ? - optionale Argumente von \\ nach außen weiterreichen? -- vertikalen Shift der Hoch- und Tiefstellungen mit \mathchoice anpassen: - \( K = \frac{[\ch{Na+}]^2[\ch{SO4^2-}]}{[\ch{Na2SO4}]} \) \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty b/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty new file mode 100644 index 00000000000..dc072de4205 --- /dev/null +++ b/Master/texmf-dist/tex/latex/chemmacros/chemgreek.sty @@ -0,0 +1,443 @@ +% ---------------------------------------------------------------------------- +% - the CHEMMACROS bundle +% - chemgreek.sty +% - macros and commands for chemists +% --------------------------------------------------------------------------- +% - Clemens Niederberger +% --------------------------------------------------------------------------- +% - https://bitbucket.org/cgnieder/chemmacros/ +% - contact@mychemistry.eu +% --------------------------------------------------------------------------- +% - If you have any ideas, questions, suggestions or bugs to report, please +% - feel free to contact me. +% --------------------------------------------------------------------------- +% - Copyright 2011-2013 Clemens Niederberger +% - +% - This work may be distributed and/or modified under the +% - conditions of the LaTeX Project Public License, either version 1.3 +% - of this license or (at your option) any later version. +% - The latest version of this license is in +% - http://www.latex-project.org/lppl.txt +% - and version 1.3 or later is part of all distributions of LaTeX +% - version 2005/12/01 or later. +% - +% - This work has the LPPL maintenance status `maintained'. +% - +% - The Current Maintainer of this work is Clemens Niederberger. +% ---------------------------------------------------------------------------- +\RequirePackage{expl3,xparse} +\def\chemgreek@version{0.1a} +\def\chemgreek@date{2013/07/06} + +\ProvidesExplPackage{chemgreek}{\chemgreek@date}{\chemgreek@version} + {interface for upright greek letters for use in chemistry (CN)} + +% ---------------------------------------------------------------------------- +% temporary variables: +\seq_new:N \l__chemgreek_tmpa_seq +\tl_new:N \l__chemgreek_tmpa_tl +\tl_new:N \l__chemgreek_tmpb_tl +\int_new:N \l__chemgreek_tmpa_int +\int_new:N \g__chemgreek_tmpa_int + +% ---------------------------------------------------------------------------- +% messages +\msg_new:nnnn { chemgreek } { mapping-not-defined } + { The~ mapping~ `#1'~ does~ not~ exist~ \msg_line_context: } + { + You~ chose~ the~ mapping~ `#1'~ which~ has~ apparently~ not~ been~ + defined,~ yet.~ If~ this~ is~ due~ to~ a~ miss-spelling~ you~ need~ to~ + declare~ it~ first~ via~ \token_to_str:N \newchemgreekmapping \c_space_tl + or~ \token_to_str:N \declarechemgreekmapping . + } + +\msg_new:nnnn { chemgreek } { mapping-defined } + { The~ mapping~ `#1'~ does~ already~ exist~ \msg_line_context: } + { + It~ seems~ you're~ trying~ to~ define~ the~ mapping~ `#1'.~ However,~ + this~ mapping~ does~ already~ exist.~ If~ this~ is~ not~ due~ to~ a~ + miss-spelling~ you~ need~ to~ redefine~ it~ via~ \token_to_str:N + \renewchemgreekmapping . + } + +% ---------------------------------------------------------------------------- +% a tokenlist constant that will be used to build the mapping property lists +% both for uppercase and lowercase and also for setting the output macros +\tl_const:Nn \c__chemgreek_order_tl + { + { alpha } % 1 + { beta } % 2 + { gamma } % 3 + { delta } % 4 + { epsilon } % 5 + { zeta } % 6 + { eta } % 7 + { theta } % 8 + { iota } % 9 + { kappa } % 10 + { lambda } % 11 + { mu } % 12 + { nu } % 13 + { xi } % 14 + { omikron } % 15 + { pi } % 16 + { rho } % 17 + { sigma } % 18 + { tau } % 19 + { upsilon } % 20 + { phi } % 21 + { psi } % 22 + { chi } % 23 + { omega } % 24 + } + +% ---------------------------------------------------------------------------- +% variants of kernel functions: +\cs_generate_variant:Nn \prop_put:Nnn { cxV } + +% ---------------------------------------------------------------------------- +% helper function to retrieve upper- and lowercase entries while the mapping +% happens: +\cs_new:Npn \__chemgreek_get_upper_lower:w #1 / #2 \q_stop + { + \tl_set:Nn \l__chemgreek_tmpa_tl { #1 } + \tl_set:Nn \l__chemgreek_tmpb_tl { #2 } + } + +% ---------------------------------------------------------------------------- +% a conditional to test if a mapping exists: +\prg_new_conditional:Npnn \chemgreek_if_mapping_exists:n #1 {p,T,F,TF} + { + \bool_if:nTF + { + \prop_if_exist_p:c { l__chemgreek_uppercase_mapping_#1_prop } && + \prop_if_exist_p:c { l__chemgreek_lowercase_mapping_#1_prop } + } + { \prg_return_true: } + { \prg_return_false: } + } + +% ---------------------------------------------------------------------------- +% the main mapping function: +% #1: mapping-name +% #2: mapping-entries +\cs_new_protected:Npn \chemgreek_new_mapping:nn #1#2 + { + \chemgreek_if_mapping_exists:nTF { #1 } + { \msg_error:nn { chemgreek } { mapping-defined } } + { + \prop_new:c { l__chemgreek_uppercase_mapping_#1_prop } + \prop_new:c { l__chemgreek_lowercase_mapping_#1_prop } + \__chemgreek_set_mapping:nn { #1 } { #2 } + } + } + +\cs_new_protected:Npn \chemgreek_renew_mapping:nn #1#2 + { + \chemgreek_if_mapping_exists:nTF { #1 } + { \__chemgreek_set_mapping:nn { #1 } { #2 } } + { \msg_error:nn { chemgreek } { mapping-not-defined } } + } + +\cs_new_protected:Npn \chemgreek_declare_mapping:nn #1#2 + { + \chemgreek_if_mapping_exists:nF { #1 } + { + \prop_new:c { l__chemgreek_uppercase_mapping_#1_prop } + \prop_new:c { l__chemgreek_lowercase_mapping_#1_prop } + } + \__chemgreek_set_mapping:nn { #1 } { #2 } + } + +\cs_new_protected:Npn \__chemgreek_set_mapping:nn #1#2 + { + \int_zero:N \l__chemgreek_tmpa_int + \clist_map_inline:nn { #2 } + { + \int_incr:N \l__chemgreek_tmpa_int + \__chemgreek_get_upper_lower:w ##1 \q_stop + \prop_put:cxV { l__chemgreek_lowercase_mapping_#1_prop } + { \tl_item:Nn \c__chemgreek_order_tl { \l__chemgreek_tmpa_int } } + \l__chemgreek_tmpa_tl + \prop_put:cxV { l__chemgreek_uppercase_mapping_#1_prop } + { \tl_item:Nn \c__chemgreek_order_tl { \l__chemgreek_tmpa_int } } + \l__chemgreek_tmpb_tl + } + } + +% the user command: +\NewDocumentCommand \newchemgreekmapping { mm } + { \chemgreek_new_mapping:nn { #1 } { #2 } } + +\NewDocumentCommand \renewchemgreekmapping { mm } + { \chemgreek_renew_mapping:nn { #1 } { #2 } } + +\NewDocumentCommand \declarechemgreekmapping { mm } + { \chemgreek_declare_mapping:nn { #1 } { #2 } } + +% ---------------------------------------------------------------------------- +% a function to selectively change specific entries in a mapping: +% #1: mapping-name +% #2: upper / lower +% #3: entry-name +% #4: entry +\cs_new_protected:Npn \chemgreek_change:nnnn #1#2#3#4 + { + \chemgreek_if_mapping_exists:nTF { #1 } + { + \prop_put:cnn { l__chemgreek_#2 case_mapping_#1_prop } + { #3 } + { #4 } + } + { \msg_error:nn { chemgreek } { mapping-not-defined } } + } + +% the user command: +\NewDocumentCommand \changechemgreeksymbol { mmmm } + { \chemgreek_change:nnnn { #1 } { #2 } { #3 } { #4 } } + +% ---------------------------------------------------------------------------- +% a function to activate a mapping: +% #1: mapping-name +\cs_new_protected:Npn \chemgreek_activate_mapping:n #1 + { + \chemgreek_if_mapping_exists:nTF { #1 } + { + \tl_map_inline:Nn \c__chemgreek_order_tl + { + \cs_set_protected:cpx { Chem \tl_expandable_uppercase:n ##1 } + { \prop_get:cn { l__chemgreek_uppercase_mapping_#1_prop } { ##1 } } + \cs_set_protected:cpx { Chem ##1 } + { \prop_get:cn { l__chemgreek_lowercase_mapping_#1_prop } { ##1 } } + } + } + { \msg_error:nn { chemgreek } { mapping-not-defined } } + } + +% user command that also loads the needed package: +% #1: load package +% #2: option +% #3: mapping-name +\NewDocumentCommand \activatechemgreekmapping { som } + { + \IfBooleanT { #1 } + { + \IfNoValueTF { #2 } + { \RequirePackage { #3 } } + { \RequirePackage [ #2 ] { #3 } } + } + \chemgreek_activate_mapping:n { #3 } + } +\@onlypreamble\activatechemgreekmapping + +% user command that activates a new mapping without loading the package: +\NewDocumentCommand \selectchemgreekmapping { m } + { \chemgreek_activate_mapping:n { #1 } } + +% ---------------------------------------------------------------------------- +% a debugging command: +\cs_new_protected:Npn \chemgreek_show_mapping:n #1 + { + \chemgreek_activate_mapping:n { #1 } + \int_gzero:N \g__chemgreek_tmpa_int + \begin { tabular } { llll } + pos & name & lower & upper \\ + \tl_map_inline:Nn \c__chemgreek_order_tl + { + \int_gincr:N \g__chemgreek_tmpa_int + \int_use:N \g__chemgreek_tmpa_int . & + ##1 & + \use:c { Chem ##1 } & + \use:c { Chem \tl_expandable_uppercase:n ##1 } \\ + } + \end{tabular} + } + +\cs_new_eq:NN \showchemgreekmapping \chemgreek_show_mapping:n + +% ---------------------------------------------------------------------------- +% predefine some mappings +% default: +\chemgreek_new_mapping:nn { default } + { + \ensuremath{\alpha} / \ensuremath{\mathrm{A}} , % 1 + \ensuremath{\beta} / \ensuremath{\mathrm{B}} , % 2 + \ensuremath{\gamma} / \ensuremath{\Gamma} , % 3 + \ensuremath{\delta} / \ensuremath{\Delta} , % 4 + \ensuremath{\epsilon} / \ensuremath{\mathrm{E}} , % 5 + \ensuremath{\zeta} / \ensuremath{\mathrm{Z}} , % 6 + \ensuremath{\eta} / \ensuremath{\mathrm{H}} , % 7 + \ensuremath{\theta} / \ensuremath{\Theta} , % 8 + \ensuremath{\iota} / \ensuremath{\mathrm{I}} , % 9 + \ensuremath{\kappa} / \ensuremath{\mathrm{K}} , % 10 + \ensuremath{\lambda} / \ensuremath{\Lambda} , % 11 + \ensuremath{\mu} / \ensuremath{\mathrm{M}} , % 12 + \ensuremath{\nu} / \ensuremath{\mathrm{N}} , % 13 + \ensuremath{\xi} / \ensuremath{\Xi} , % 14 + \ensuremath{o} / \ensuremath{\mathrm{O}} , % 15 + \ensuremath{\pi} / \ensuremath{\Pi} , % 16 + \ensuremath{\rho} / \ensuremath{\mathrm{P}} , % 17 + \ensuremath{\sigma} / \ensuremath{\Sigma} , % 18 + \ensuremath{\tau} / \ensuremath{\mathrm{T}} , % 19 + \ensuremath{\upsilon} / \ensuremath{\Upsilon} , % 20 + \ensuremath{\phi} / \ensuremath{\Phi} , % 21 + \ensuremath{\psi} / \ensuremath{\Psi} , % 22 + \ensuremath{\chi} / \ensuremath{\mathrm{X}} , % 23 + \ensuremath{\omega} / \ensuremath{\Omega} % 24 + } + +% default-variant: +\chemgreek_new_mapping:nn { var-default } + { + \ensuremath{\alpha} / \ensuremath{\mathrm{A}} , % 1 + \ensuremath{\beta} / \ensuremath{\mathrm{B}} , % 2 + \ensuremath{\gamma} / \ensuremath{\Gamma} , % 3 + \ensuremath{\delta} / \ensuremath{\Delta} , % 4 + \ensuremath{\varepsilon} / \ensuremath{\mathrm{E}} , % 5 + \ensuremath{\zeta} / \ensuremath{\mathrm{Z}} , % 6 + \ensuremath{\eta} / \ensuremath{\mathrm{H}} , % 7 + \ensuremath{\theta} / \ensuremath{\Theta} , % 8 + \ensuremath{\iota} / \ensuremath{\mathrm{I}} , % 9 + \ensuremath{\kappa} / \ensuremath{\mathrm{K}} , % 10 + \ensuremath{\lambda} / \ensuremath{\Lambda} , % 11 + \ensuremath{\mu} / \ensuremath{\mathrm{M}} , % 12 + \ensuremath{\nu} / \ensuremath{\mathrm{N}} , % 13 + \ensuremath{\xi} / \ensuremath{\Xi} , % 14 + \ensuremath{o} / \ensuremath{\mathrm{O}} , % 15 + \ensuremath{\pi} / \ensuremath{\Pi} , % 16 + \ensuremath{\varrho} / \ensuremath{\mathrm{P}} , % 17 + \ensuremath{\sigma} / \ensuremath{\Sigma} , % 18 + \ensuremath{\tau} / \ensuremath{\mathrm{T}} , % 19 + \ensuremath{\upsilon} / \ensuremath{\Upsilon} , % 20 + \ensuremath{\phi} / \ensuremath{\Phi} , % 21 + \ensuremath{\psi} / \ensuremath{\Psi} , % 22 + \ensuremath{\chi} / \ensuremath{\mathrm{X}} , % 23 + \ensuremath{\omega} / \ensuremath{\Omega} % 24 + } + +% textgreek: +\chemgreek_new_mapping:nn { textgreek } + { + \textalpha / \textAlpha , % 1 + \textbeta / \textBeta , % 2 + \textgamma / \textGamma , % 3 + \textdelta / \textDelta , % 4 + \textepsilon / \textEpsilon , % 5 + \textzeta / \textZeta , % 6 + \texteta / \textEta , % 7 + \texttheta / \textTheta , % 8 + \textiota / \textIota , % 9 + \textkappa / \textKappa , % 10 + \textlambda / \textLambda , % 11 + \textmugreek / \textMu , % 12 + \textnu / \textNu , % 13 + \textxi / \textXi , % 14 + \textomikron / \textOmikron , % 15 + \textpi / \textPi , % 16 + \textrho / \textRho , % 17 + \textsigma / \textSigma , % 18 + \texttau / \textTau , % 19 + \textupsilon / \textUpsilon , % 20 + \textphi / \textPhi , % 21 + \textpsi / \textPsi , % 22 + \textchi / \textChi , % 23 + \textomega / \textOmega % 24 + } + +% upgreek: +\chemgreek_new_mapping:nn { upgreek } + { + \ensuremath{\upalpha} / \ensuremath{\mathrm{A}} , % 1 + \ensuremath{\upbeta} / \ensuremath{\mathrm{B}} , % 2 + \ensuremath{\upgamma} / \ensuremath{\Upgamma} , % 3 + \ensuremath{\updelta} / \ensuremath{\Updelta} , % 4 + \ensuremath{\upepsilon} / \ensuremath{\mathrm{E}} , % 5 + \ensuremath{\upzeta} / \ensuremath{\mathrm{Z}} , % 6 + \ensuremath{\upeta} / \ensuremath{\mathrm{H}} , % 7 + \ensuremath{\uptheta} / \ensuremath{\Uptheta} , % 8 + \ensuremath{\upiota} / \ensuremath{\mathrm{I}} , % 9 + \ensuremath{\upkappa} / \ensuremath{\mathrm{K}} , % 10 + \ensuremath{\uplambda} / \ensuremath{\Uplambda} , % 11 + \ensuremath{\upmu} / \ensuremath{\mathrm{M}} , % 12 + \ensuremath{\upnu} / \ensuremath{\mathrm{N}} , % 13 + \ensuremath{\upxi} / \ensuremath{\Upxi} , % 14 + \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 + \ensuremath{\uppi} / \ensuremath{\Uppi} , % 16 + \ensuremath{\uprho} / \ensuremath{\mathrm{R}} , % 17 + \ensuremath{\upsigma} / \ensuremath{\Upsigma} , % 18 + \ensuremath{\uptau} / \ensuremath{\mathrm{T}} , % 19 + \ensuremath{\upupsilon} / \ensuremath{\Upupsilon} , % 20 + \ensuremath{\upphi} / \ensuremath{\Upphi} , % 21 + \ensuremath{\uppsi} / \ensuremath{\Uppsi} , % 22 + \ensuremath{\upchi} / \ensuremath{\mathrm{X}} , % 23 + \ensuremath{\upomega} / \ensuremath{\Upomega} % 24 + } + +% kpfonts: +\chemgreek_new_mapping:nn { kpfonts } + { + \ensuremath{\alphaup} / \ensuremath{\mathrm{A}} , % 1 + \ensuremath{\betaup} / \ensuremath{\mathrm{B}} , % 2 + \ensuremath{\gammaup} / \ensuremath{\Gammaup} , % 3 + \ensuremath{\deltaup} / \ensuremath{\Deltaup} , % 4 + \ensuremath{\epsilonup} / \ensuremath{\mathrm{E}} , % 5 + \ensuremath{\zetaup} / \ensuremath{\mathrm{Z}} , % 6 + \ensuremath{\etaup} / \ensuremath{\mathrm{H}} , % 7 + \ensuremath{\thetaup} / \ensuremath{\Thetaup} , % 8 + \ensuremath{\iotaup} / \ensuremath{\mathrm{I}} , % 9 + \ensuremath{\kappaup} / \ensuremath{\mathrm{K}} , % 10 + \ensuremath{\lambdaup} / \ensuremath{\Lambdaup} , % 11 + \ensuremath{\muup} / \ensuremath{\mathrm{M}} , % 12 + \ensuremath{\nuup} / \ensuremath{\mathrm{N}} , % 13 + \ensuremath{\xiup} / \ensuremath{\Xiup} , % 14 + \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 + \ensuremath{\piup} / \ensuremath{\Piup} , % 16 + \ensuremath{\rhoup} / \ensuremath{\mathrm{R}} , % 17 + \ensuremath{\sigmaup} / \ensuremath{\Sigmaup} , % 18 + \ensuremath{\tauup} / \ensuremath{\mathrm{T}} , % 19 + \ensuremath{\upsilonup} / \ensuremath{\Upsilonup} , % 20 + \ensuremath{\phiup} / \ensuremath{\Phiup} , % 21 + \ensuremath{\psiup} / \ensuremath{\Psiup} , % 22 + \ensuremath{\chiup} / \ensuremath{\mathrm{X}} , % 23 + \ensuremath{\omegaup} / \ensuremath{\Omegaup} % 24 + } + +% newtx: +\chemgreek_new_mapping:nn { newtx } + { + \ensuremath{\upalpha} / \ensuremath{\mathrm{A}} , % 1 + \ensuremath{\upbeta} / \ensuremath{\mathrm{B}} , % 2 + \ensuremath{\upgamma} / \ensuremath{\upGamma} , % 3 + \ensuremath{\updelta} / \ensuremath{\upDelta} , % 4 + \ensuremath{\upepsilon} / \ensuremath{\mathrm{E}} , % 5 + \ensuremath{\upzeta} / \ensuremath{\mathrm{Z}} , % 6 + \ensuremath{\upeta} / \ensuremath{\mathrm{H}} , % 7 + \ensuremath{\uptheta} / \ensuremath{\upTheta} , % 8 + \ensuremath{\upiota} / \ensuremath{\mathrm{I}} , % 9 + \ensuremath{\upkappa} / \ensuremath{\mathrm{K}} , % 10 + \ensuremath{\uplambda} / \ensuremath{\upLambda} , % 11 + \ensuremath{\upmu} / \ensuremath{\mathrm{M}} , % 12 + \ensuremath{\upnu} / \ensuremath{\mathrm{N}} , % 13 + \ensuremath{\upxi} / \ensuremath{\upXi} , % 14 + \ensuremath{\mathrm{o}} / \ensuremath{\mathrm{O}} , % 15 + \ensuremath{\uppi} / \ensuremath{\upPi} , % 16 + \ensuremath{\uprho} / \ensuremath{\mathrm{R}} , % 17 + \ensuremath{\upsigma} / \ensuremath{\upSigma} , % 18 + \ensuremath{\uptau} / \ensuremath{\mathrm{T}} , % 19 + \ensuremath{\upupsilon} / \ensuremath{\upUpsilon} , % 20 + \ensuremath{\upphi} / \ensuremath{\upPhi} , % 21 + \ensuremath{\uppsi} / \ensuremath{\upPsi} , % 22 + \ensuremath{\upchi} / \ensuremath{\mathrm{X}} , % 23 + \ensuremath{\upomega} / \ensuremath{\upOmega} % 24 + } + +% activate default mapping +\chemgreek_activate_mapping:n { default } + +\tex_endinput:D + +HISTORY: +2013/06/26 - v0.1 - first working version to be bundled with chemmacros +2013/07/06 - v0.1a - fixed stupid bug in `upgreek' mapping + - added error messages and added \renewchemgreekmapping and + \declarechemgreekmapping diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index efa0b0d2138..a1c7aa6c46f 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -1,67 +1,105 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% --------------------------------------------------------------------------- % -% - the CHEMMACROS bundle - % -% - chemmacros.sty - % -% - macros and commands for chemists - % -% --------------------------------------------------------------------------- % -% - Clemens Niederberger - % -% --------------------------------------------------------------------------- % -% - https://bitbucket.org/cgnieder/chemmacros/ - % -% - contact@mychemistry.eu - % -% --------------------------------------------------------------------------- % -% - If you have any ideas, questions, suggestions or bugs to report, please - % -% - feel free to contact me. - % -% --------------------------------------------------------------------------- % -% - Copyright 2011-2013 Clemens Niederberger - % -% - - % -% - This work may be distributed and/or modified under the - % -% - conditions of the LaTeX Project Public License, either version 1.3 - % -% - of this license or (at your option) any later version. - % -% - The latest version of this license is in - % -% - http://www.latex-project.org/lppl.txt - % -% - and version 1.3 or later is part of all distributions of LaTeX - % -% - version 2005/12/01 or later. - % -% - - % -% - This work has the LPPL maintenance status `maintained'. - % -% - - % -% - The Current Maintainer of this work is Clemens Niederberger. - % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx } -\RequirePackage{ tikz , mathtools , environ , scrlfile , etoolbox , bm } -\usetikzlibrary{calc,arrows} -\def\chemmacros@version{3.6b} -\def\chemmacros@date{2013/04/19} +% -------------------------------------------------------------------------- +% - the CHEMMACROS bundle +% - chemmacros.sty +% - loads of little helpers for chemists +% -------------------------------------------------------------------------- +% - Clemens Niederberger +% -------------------------------------------------------------------------- +% - https://bitbucket.org/cgnieder/chemmacros/ +% - contact@mychemistry.eu +% -------------------------------------------------------------------------- +% - If you have any ideas, questions, suggestions or bugs to report, please +% - feel free to contact me. +% -------------------------------------------------------------------------- +% - Copyright 2011-2013 Clemens Niederberger +% - +% - This work may be distributed and/or modified under the +% - conditions of the LaTeX Project Public License, either version 1.3 +% - of this license or (at your option) any later version. +% - The latest version of this license is in +% - http://www.latex-project.org/lppl.txt +% - and version 1.3 or later is part of all distributions of LaTeX +% - version 2005/12/01 or later. +% - +% - This work has the LPPL maintenance status `maintained'. +% - +% - The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +\RequirePackage{ expl3 , xparse , l3keys2e } +\def\chemmacros@version{4.0} +\def\chemmacros@date{2013/07/06} \ProvidesExplPackage {chemmacros} {\chemmacros@date} {\chemmacros@version} - {macros and commands for chemists} - -\@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } } - -\bool_new:N \l__chemmacros_version_one_bool -\bool_new:N \l__chemmacros_xspace_bool - \bool_set_true:N \l__chemmacros_xspace_bool -\bool_new:N \l__chemmacros_bpchem_bool -\bool_new:N \l__chemmacros_circled_bool - \bool_set_true:N \l__chemmacros_circled_bool -\bool_new:N \l__chemmacros_circled_formal_bool - \bool_set_true:N \l__chemmacros_circled_formal_bool -\bool_new:N \l__chemmacros_circled_chem_bool - \bool_set_true:N \l__chemmacros_circled_chem_bool -\bool_new:N \l__chemmacros_EZ_cool_bool -\bool_new:N \l__chemmacros_Nu_mathspec_bool -\bool_new:N \l__chemmacros_use_mhchem_bool -\bool_new:N \l__chemmacros_chemstyle_bool -\bool_new:N \l__chemmacros_hyperref_bool -\bool_new:N \l__chemmacros_varioref_bool -\bool_new:N \l__chemmacros_chemfig_bool -\bool_new:N \l__chemmacros_ghsystem_bool - \bool_set_true:N \l__chemmacros_ghsystem_bool -\bool_new:N \l__chemmacros_iupac_restricted_bool -\bool_new:N \l__chemmacros_iupac_strict_bool -\bool_new:N \l__chemmacros_in_document_bool + {loads of little helpers for chemists (CN)} + +% -------------------------------------------------------------------------- +% check expl3 version: +\@ifpackagelater { expl3 } { 2012/11/21 } + { } + { + \PackageError { chemmacros } { Support~package~expl3~too~old } + { + You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ + 'l3packages'.\MessageBreak + Loading~chemmacros~will~abort! + } + \tex_endinput:D + } + +% -------------------------------------------------------------------------- +% variants of kernel commands: +\cs_generate_variant:Nn \prop_if_in:NnTF { NV , Nx } +\cs_generate_variant:Nn \prop_put:Nnn { NV , NVx } +\cs_generate_variant:Nn \prop_get:NnNTF { NV } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { NnV } + +% -------------------------------------------------------------------------- +% load required packages +% the technical ones: +\RequirePackage { environ , scrlfile , etoolbox , translations } +% related to other topics like mathematics or graphics: +\RequirePackage { xfrac , siunitx , tikz, mathtools , bm } +% other packages of this bundle -- ghsystem is not loaded here but at the end +% of the preamble depending on a package option: +\RequirePackage { chemformula , chemgreek } +% TikZ libraries (the don't like expl3 syntax): +\ExplSyntaxOff +\usetikzlibrary{calc,arrows} +\ExplSyntaxOn + +% -------------------------------------------------------------------------- +% boolean variables for the package options +% versioning: +\bool_new:N \l__chemmacros_version_one_bool +\bool_new:N \l__chemmacros_version_three_bool +\bool_new:N \l__chemmacros_version_four_bool +\bool_set_true:N \l__chemmacros_version_four_bool + +\bool_new:N \l__chemmacros_xspace_bool +\bool_set_true:N \l__chemmacros_xspace_bool + +\bool_new:N \l__chemmacros_circled_bool +\bool_set_true:N \l__chemmacros_circled_bool +\bool_new:N \l__chemmacros_circled_formal_bool +\bool_set_true:N \l__chemmacros_circled_formal_bool +\bool_new:N \l__chemmacros_circled_chem_bool +\bool_set_true:N \l__chemmacros_circled_chem_bool + +\bool_new:N \l__chemmacros_EZ_cool_bool +\bool_new:N \l__chemmacros_Nu_mathspec_bool +\bool_new:N \l__chemmacros_chemstyle_bool +\bool_new:N \l__chemmacros_hyperref_bool +\bool_new:N \l__chemmacros_varioref_bool +\bool_new:N \l__chemmacros_chemfig_bool +\bool_new:N \l__chemmacros_ghsystem_bool +\bool_set_true:N \l__chemmacros_ghsystem_bool + +\bool_new:N \l__chemmacros_iupac_restricted_bool +\bool_new:N \l__chemmacros_iupac_strict_bool +\bool_new:N \l__chemmacros_in_document_bool \AtBeginDocument { @@ -80,211 +118,293 @@ { \bool_set_false:N \l__chemmacros_chemfig_bool } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % warning / error messages -\cs_new:Npn \chemmacros_msg:nnxx #1#2#3#4 +\cs_new_protected:Npn \chemmacros_msg:nnxx #1#2#3#4 { - \bool_if:NTF \l__chemmacros_strict_bool + \bool_if:NTF \l_chemmacros_strict_bool { \msg_error:nnxx { #1 } { #2 } { #3 } { #4 } } { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } } -\msg_set:nnnn { chemmacros } { language-not-defined } +\cs_new_protected:Npn \chemmacros_warning:nnxx #1#2#3#4 { - 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. + \bool_if:NTF \l_chemmacros_strict_bool + { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } + { \msg_info:nnxx { #1 } { #2 } { #3 } { #4 } } } -\msg_set:nnnn { chemmacros } { already-defined } +\msg_new:nnnn { chemmacros } { language-not-defined } + { The~ language~ `#1'~ is~ not~ defined~ by~ chemmacros. } { - The~command~#1~has~also~been~defined~by~another~package. + 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_new:nnnn { chemmacros } { already-defined } + { The~ command~ #1~ has~ also~ been~ defined~ by~ another~ package. } { - The~command~#1~has~also~been~defined~by~another~package.~ - chemmacros~provides~an~alternative~definition.~ - See~the~documentation~for~more~information. + The~ command~ #1~ has~ also~ been~ defined~ by~ another~ package.~ + chemmacros~ provides~ an~ alternative~ definition.~ See~ the~ + documentation~ for~ more~ information. } -\msg_set:nnnn { chemmacros } { option-deprecated } - { The~option~#1~is~deprecated.~I~will~ignore~it. } +\msg_new:nnnn { chemmacros } { option-deprecated } + { The~ option~ `#1'~ is~ deprecated.~ I~ will~ ignore~ it. } { - The~package~option~#1~is~deprecated~and~not~used~by~chemmacros~any~more. - ~It~will~therefore~simply~be~ignored. + The~ package~ option~ `#1'~ is~ deprecated~ and~ not~ used~ by~ + chemmacros~ any~ more.~ It~ will~ therefore~ simply~ be~ ignored. } -\msg_set:nnnn { chemmacros } { command-deprecated } +\msg_new:nnnn { chemmacros } { command-deprecated } { - The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ + The~ command~ \token_to_str:N #1 \c_space_tl is~ deprecated.~ Use~ \token_to_str:N #2 \c_space_tl instead. } { - The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ + The~ command~ \token_to_str:N #1 \c_space_tl is~ deprecated.~ Use~ \token_to_str:N #2 \c_space_tl instead. } -\cs_new_protected:Npn \chemmacros_define_deprecated:NNn #1#2#3 +\msg_new:nnnn { chemmacros } { command-dropped } { - \cs_new_protected:Npn #1 - { - \chemmacros_msg:nnxx { chemmacros } { command-deprecated } - { #1 } { #2 } - #3 - } + The~ command~ \token_to_str:N #1 \c_space_tl has~ been~ dropped.~ I'm~ + sorry. + } + { + The~ command~ \token_to_str:N #1 \c_space_tl has~ been~ dropped.~ I'm~ + sorry. } -\NewDocumentCommand \DeclareChemDeprecated { mmm } - { \chemmacros_define_deprecated:NNn #1 #2 { #3 } } - -\msg_set:nnnn { chemmacros } { command-dropped } - { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } - { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } -\msg_set:nnnn { chemmacros } { declare-particle } +\msg_new:nnnn { chemmacros } { declare-particle } { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + The~ command~ sequence~ \token_to_str:N #1 \c_space_tl is~ already~ + defined. } { - 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. - ~Please~choose~another~name. + 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.~ Please~ choose~ another~ name. } -\msg_set:nnnn { chemmacros } { renew-particle } - { The~particle~ \token_to_str:N #1 \c_space_tl is~not~defined. } +\msg_new:nnnn { chemmacros } { renew-particle } + { The~ particle~ \token_to_str:N #1 \c_space_tl is~ not~ defined. } { - You've~tried~to~renew~the~particle~\token_to_str:N #1 ,~but~it~doesn't~ - exist. + You've~ tried~ to~ renew~ the~ particle~ \token_to_str:N #1 ,~ but~ it~ + doesn't~ exist. } -\msg_set:nnnn { chemmacros } { declare-latin } +\msg_new:nnnn { chemmacros } { declare-latin } { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + The~ command~ sequence~ \token_to_str:N #1 \c_space_tl is~ already~ + defined. } { - 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.~Please~choose~another~name. + 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.~ Please~ choose~ another~ name. } -\msg_set:nnnn { chemmacros } { renew-latin } - { The~latin~phrase \token_to_str:N #1 \c_space_tl is~not~defined. } +\msg_new: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. + You've~ tried~ to~ renew~ the~ latin~ phrase~ \token_to_str:N #1 ,~ but~ + it~ doesn't~ exist. } -\msg_set:nnnn { chemmacros } { declare-nmr } +\msg_new:nnnn { chemmacros } { declare-nmr } { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + 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. + 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. } +\msg_new: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. + You've~ tried~ to~ renew~ the~ NMR~ command~ \token_to_str:N #1 ,~ but~ + it~ doesn't~ exist. } -\msg_set:nnnn { chemmacros } { declare-phase } +\msg_new:nnnn { chemmacros } { declare-phase } { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + The~ command~ sequence~ \token_to_str:N #1 \c_space_tl is~ already~ + defined. } { - 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. - ~Please~choose~another~name. + You've~ tried~ to~ define~ a~ phase~ with~ \token_to_str:N + \DeclareChemPhase ,~ but~ the~ command~ sequence~ \token_to_str:N #1 + \c_space_tl already~ exists.~ Please~ choose~ another~ name. } -\msg_set:nnnn { chemmacros } { renew-phase } - { The~phase~ \token_to_str:N #1 \c_space_tl is~not~defined. } +\msg_new:nnnn { chemmacros } { renew-phase } + { The~ phase~ \token_to_str:N #1 \c_space_tl is~ not~ defined. } { - You've~tried~to~renew~the~phase~\token_to_str:N #1 ,~but~it~doesn't~ - exist. + You've~ tried~ to~ renew~ the~ phase~ \token_to_str:N #1 ,~ but~ it~ + doesn't~ exist. } -\msg_set:nnnn { chemmacros } { declare-iupac } +\msg_new:nnnn { chemmacros } { declare-iupac } { - The~iupac~naming~command~ \token_to_str:N #1 \c_space_tl is~already~defined. + The~ iupac~ naming~ command~ \token_to_str:N #1 \c_space_tl is~ already~ + defined. } { - You've~tried~to~define~a~iupac~naming~command~with~\token_to_str:N - \DeclareChemIUPAC,~but~the~iupac~command~ \token_to_str:N #1 \c_space_tl - already~exists.~Choose~another~name~or~use~\token_to_str:N \RenewChemIUPAC . + You've~ tried~ to~ define~ a~ iupac~ naming~ command~ with~ + \token_to_str:N \DeclareChemIUPAC ,~ but~ the~ iupac~ command~ + \token_to_str:N #1 \c_space_tl already~ exists.~ Choose~ another~ name~ + or~ use~ \token_to_str:N \RenewChemIUPAC . } -\msg_set:nnnn { chemmacros } { renew-iupac } - { The~iupac~naming~command~ \token_to_str:N #1 \c_space_tl is~not~defined. } +\msg_new:nnnn { chemmacros } { renew-iupac } { - You've~tried~to~renew~the~iupac~command~\token_to_str:N #1 ,~but~it~doesn't~ - exist.~Use~\token_to_str:N \DeclareChemIUPAC \c_space_tl instead . + The~ iupac~ naming~ command~ \token_to_str:N #1 \c_space_tl is~ not~ + defined. + } + { + You've~ tried~ to~ renew~ the~ iupac~ command~ \token_to_str:N #1 ,~ but~ + it~ doesn't~ exist.~ Use~ \token_to_str:N \DeclareChemIUPAC \c_space_tl + instead. } -\msg_set:nnnn { chemmacros } { ox } +\msg_new:nnnn { chemmacros } { ox } { \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . } { \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . } -\msg_set:nnnn { chemmacros } { OX } +\msg_new:nnnn { chemmacros } { OX } { \token_to_str:N \OX \c_space_tl : ~ #1 ~ \msg_line_context: . } { \token_to_str:N \OX \c_space_tl : ~ #1 ~ \msg_line_context: . } -\msg_set:nnnn { chemmacros } { redox } +\msg_new:nnnn { chemmacros } { redox } { \token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: . } { \token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: . } -\msg_set:nnnn { chemmacros } { chemfig } +\msg_new:nnnn { chemmacros } { chemfig } { - You~need~to~load~the~chemfig~package~in~order~to~make~ - \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl - work~properly~\msg_line_context: . + You~ need~ to~ load~ the~ `chemfig'~ package~ in~ order~ to~ make~ + \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl work~ + properly~ \msg_line_context: . } { - You~need~to~load~the~chemfig~package~in~order~to~make~ - \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl - work~properly~\msg_line_context: . + You~ need~ to~ load~ the~ `chemfig'~ package~ in~ order~ to~ make~ + \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl work~ + properly~ \msg_line_context: . } -\msg_set:nnnn { chemmacros } { DeclareChemState } +\msg_new:nnnn { chemmacros } { DeclareChemState } { - The~state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: - \c_space_tl already~exists.~You~need~to~use~ - \token_to_str:N \RenewChemState \c_space_tl to~alter~it. + The~ state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl + already~ exists.~ You~ need~ to~ use~ \token_to_str:N \RenewChemState + \c_space_tl to~ alter~ it. } { - The~state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: - \c_space_tl already~exists.~You~need~to~use~ - \token_to_str:N \RenewChemState \c_space_tl to~alter~it. + The~ state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl + already~ exists.~ You~ need~ to~ use~ \token_to_str:N \RenewChemState + \c_space_tl to~ alter~ it. } -\msg_set:nnnn { chemmacros } { RenewChemState } +\msg_new:nnnn { chemmacros } { RenewChemState } { - The~state~\exp_after:wN \token_to_str:N \cs:w #1 \cs_end: - \c_space_tl isn't~set~up~yet.~You~need~to~use~ - \token_to_str:N \DeclareChemState \c_space_tl to~create~it. + The~ state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl + isn't~ set~ up~ yet.~ You~ need~ to~ use~ \token_to_str:N + \DeclareChemState \c_space_tl to~ create~ it. } { - The~state~\exp_after:wN \token_to_str:N \cs:w #1 \cs_end: - \c_space_tl isn't~set~up~yet.~You~need~to~use~ - \token_to_str:N \DeclareChemState \c_space_tl to~create~it. + The~ state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl + isn't~ set~ up~ yet.~ You~ need~ to~ use~ \token_to_str:N + \DeclareChemState \c_space_tl to~ create ~it. } -% --------------------------------------------------------------------------- % -% scratch variables +% declare an option as deprecated: +\cs_new_protected:Npn \chemmacros_option_deprecated:n #1 + { \chemmacros_msg:nnn { chemmacros } { option-deprecated } { #1 } } + +% define a deprecated command with hints to the corresponding new one: +\cs_new_protected:Npn \chemmacros_define_deprecated:NNn #1#2#3 + { + \cs_new_protected:Npn #1 + { + \chemmacros_msg:nnxx { chemmacros } { command-deprecated } + { #1 } { #2 } + #3 + } + } + +\NewDocumentCommand \DeclareChemDeprecated { mmm } + { \chemmacros_define_deprecated:NNn #1 #2 { #3 } } + +% define a command as dropped! +\cs_new_protected:Npn \chemmacros_define_dropped:N #1 + { + \cs_new_protected:Npn #1 + { \chemmacros_msg:nnxx { chemmacros } { command-dropped } { #1 } { } } + } + +\NewDocumentCommand \DeclareChemDropped { m } + { \chemmacros_define_dropped:N #1 } + +% -------------------------------------------------------------------------- +% temporary variables \tl_new:N \l__chemmacros_tmpa_tl \tl_new:N \l__chemmacros_tmpb_tl \int_new:N \l__chemmacros_tmpa_int \box_new:N \l__chemmacros_tmpa_box -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- +% language settings: +\bool_new:N \l__chemmacros_language_auto_bool +\bool_set_true:N \l__chemmacros_language_auto_bool +% this token list will hold the chosen language for chemmacros; since the +% language is either chosen automatically or by option it is only available at +% begin document +\tl_new:N \l_chemmacros_language_tl +\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 + { + \@trnslt@if@translation + { #1 } + { \l_chemmacros_language_tl } + { \GetTranslation{#1} } + { #2 } + } + +\AtBeginDocument{ + \bool_if:NTF \l__chemmacros_language_auto_bool + { + \tl_set:Nx \l_chemmacros_language_tl + { \@trnslt@language{\@trnslt@current@language} } + } + { + \tl_set_eq:NN + \l_chemmacros_language_tl + \l__chemmacros_current_language_tl + } +} + +% -------------------------------------------------------------------------- +% version management: +\tl_const:Nn \c__chemmacros_versions_tl { {one} {three} {four} } + +\cs_new_protected:Npn \chemmacros_set_version:n #1 + { + \tl_map_inline:Nn \c__chemmacros_versions_tl + { + \tl_if_eq:nnTF { #1 } { ##1 } + { \bool_set_true:c { l__chemmacros_version_##1_bool } } + { \bool_set_false:c { l__chemmacros_version_##1_bool } } + } + } + +% -------------------------------------------------------------------------- % package options -% bpchem => use \IUPAC inside for \NMR command % circled => circle charges % detect-bold => behaviour when font series bold % EZ => cool or chemmacros version of \E @@ -299,55 +419,52 @@ % version=1 => compatibility for documents set with v1.* % xspace => add an \xspace after a whole bunch of macros -\bool_new:N \l__chemmacros_strict_bool +% this boolean has to be public since the other packages of the bundle may +% want to know its value +\bool_new:N \l_chemmacros_strict_bool + \bool_new:N \l__chemmacros_detect_bold_bool \bool_set_true:N \l__chemmacros_detect_bold_bool + +\bool_new:N \l__chemmacros_option_greek_set_bool \bool_new:N \l__chemmacros_use_upgreek_bool \bool_new:N \l__chemmacros_use_textgreek_bool -\bool_new:N \l__chemmacros_option_greek_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 } +\bool_new:N \l__chemmacros_use_kpfonts_bool +\bool_new:N \l__chemmacros_use_newtx_bool \cs_new:Npn \chemmacros_inner_font: {} \keys_define:nn { chemmacros / option } { - bpchem .bool_set:N = \l__chemmacros_bpchem_bool , - bpchem .default:n = true , + bpchem .code:n = \chemmacros_option_deprecated:n { bpchem } , circletype .choice: , circletype / math .code:n = { \bool_set_false:N \l__chemmacros_circled_chem_bool } , circletype / chem .code:n = { \bool_set_true:N \l__chemmacros_circled_chem_bool } , circled .choice: , - circled / none .code:n = + circled / none .code:n = { \bool_set_false:N \l__chemmacros_circled_bool \bool_set_false:N \l__chemmacros_circled_formal_bool } , - circled / formal .code:n = + circled / formal .code:n = { \bool_set_true:N \l__chemmacros_circled_bool \bool_set_true:N \l__chemmacros_circled_formal_bool } , - circled / all .code:n = + circled / all .code:n = { \bool_set_true:N \l__chemmacros_circled_bool \bool_set_false:N \l__chemmacros_circled_formal_bool } , circled .default:n = all , - detect-bold .code:n = - \chemmacros_msg:nnxx { chemmacros } { option-deprecated } - { detect-bold } {} , - EZ .code:n = - \chemmacros_msg:nnxx { chemmacros } { option-deprecated } { EZ } {} , + detect-bold .code:n = \chemmacros_option_deprecated:n { detect-bold } , + EZ .code:n = \chemmacros_option_deprecated:n { EZ } , german .code:n = - \tl_set:Nn \l__chemmacros_language_tl { german } , + \tl_set:Nn \l__chemmacros_current_language_tl { german } , ngerman .code:n = - \tl_set:Nn \l__chemmacros_language_tl { ngerman } , + \tl_set:Nn \l__chemmacros_current_language_tl { ngerman } , ghsystem .bool_set:N = \l__chemmacros_ghsystem_bool , ghsystem .default:n = true , iupac .choice: , @@ -360,18 +477,20 @@ 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 , + language .code:n = + \bool_set_false:N \l__chemmacros_language_auto_bool + \tl_set:Nn \l__chemmacros_current_language_tl { #1 } , method .choice: , method / chemformula .code:n = - \bool_set_false:N \l__chemmacros_use_mhchem_bool , + \chemmacros_option_deprecated:n { method } , method / mhchem .code:n = - \bool_set_true:N \l__chemmacros_use_mhchem_bool , + \chemmacros_option_deprecated:n { method } , Nu .choice: , Nu / mathspec .code:n = \bool_set_true:N \l__chemmacros_Nu_mathspec_bool , Nu / chemmacros .code:n = \bool_set_false:N \l__chemmacros_Nu_mathspec_bool , - strict .bool_set:N = \l__chemmacros_strict_bool , + strict .bool_set:N = \l_chemmacros_strict_bool , strict .default:n = true , synchronize .choice: , synchronize / true .code:n = @@ -380,88 +499,54 @@ synchronize .default:n = true , greek .choice: , greek / upgreek .code:n = - \bool_set_true:N \l__chemmacros_use_upgreek_bool - \bool_set_false:N \l__chemmacros_use_textgreek_bool - \bool_set_true:N \l__chemmacros_option_greek_set_bool , + \chemgreek_activate_mapping:n { upgreek } + \bool_set_true:N \l__chemmacros_option_greek_set_bool , greek / textgreek .code:n = - \bool_set_false:N \l__chemmacros_use_upgreek_bool - \bool_set_true:N \l__chemmacros_use_textgreek_bool - \bool_set_true:N \l__chemmacros_option_greek_set_bool , + \chemgreek_activate_mapping:n { textgreek } + \bool_set_true:N \l__chemmacros_option_greek_set_bool, + greek / kpfonts .code:n = + \chemgreek_activate_mapping:n { kpfonts } + \bool_set_true:N \l__chemmacros_option_greek_set_bool, + greek / newtx .code:n = + \chemgreek_activate_mapping:n { newtx } + \bool_set_true:N \l__chemmacros_option_greek_set_bool, greek / math .code:n = - \bool_set_false:N \l__chemmacros_use_upgreek_bool - \bool_set_false:N \l__chemmacros_use_textgreek_bool - \bool_set_true:N \l__chemmacros_option_greek_set_bool , + \chemgreek_activate_mapping:n { default } + \bool_set_true:N \l__chemmacros_option_greek_set_bool, greek / auto .code:n = - \bool_set_false:N \l__chemmacros_use_upgreek_bool - \bool_set_false:N \l__chemmacros_use_textgreek_bool - \bool_set_false:N \l__chemmacros_option_greek_set_bool , + \bool_set_false:N \l__chemmacros_option_greek_set_bool, greek .default:n = auto , - upgreek .code:n = - \chemmacros_msg:nnxx { chemmacros } { option-deprecated } - { upgreek } {} , + upgreek .code:n = \chemmacros_option_deprecated:n { upgreek } , % dummy version for compatibility with KOMA's global option and backwards % compatibility of chemmacros - version .code:n = - \chemmacros_msg:nnxx { chemmacros } { option-deprecated } - { version } {} , + version .code:n = \chemmacros_option_deprecated:n { version } , cmversion .choice: , - cmversion / 1 .code:n = - { \bool_set_true:N \l__chemmacros_version_one_bool } , - cmversion / 2 .code:n = - { \bool_set_false:N \l__chemmacros_version_one_bool } , - cmversion / bundle .code:n = - { \bool_set_false:N \l__chemmacros_version_one_bool } , + cmversion / 1 .code:n = \chemmacros_set_version:n { one } , + cmversion / 2 .code:n = \chemmacros_set_version:n { three } , + cmversion / 3 .code:n = \chemmacros_set_version:n { three } , + cmversion / 4 .code:n = \chemmacros_set_version:n { four } , + cmversion / newest .code:n = \chemmacros_set_version:n { four } , + cmversion / bundle .code:n = + \chemmacros_option_deprecated:n { cmversion/bundle } , xspace .bool_set:N = \l__chemmacros_xspace_bool , xspace .default:n = true } -\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_protected: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 } { } - } - } +\ProcessKeysOptions { chemmacros / option } +% -------------------------------------------------------------------------- +% set up a few things: +% - is `ghsystem' requested? +% - do we need `xspace'? +% - what about the greek letters? \AtEndPreamble { - \chemmacros_set_language: - \chemmacros_make_phases: \bool_if:NT \l__chemmacros_ghsystem_bool { \RequirePackage { ghsystem } } - \bool_if:NT \l__chemmacros_bpchem_bool - { \RequirePackage { bpchem } } \bool_if:NT \l__chemmacros_xspace_bool { \RequirePackage { xspace } } - \bool_if:NT \l__chemmacros_use_mhchem_bool - { \RequirePackage[ version=3 ]{ mhchem } } \bool_if:NF \l__chemmacros_option_greek_set_bool { \@ifpackageloaded { upgreek } @@ -469,205 +554,113 @@ { \@ifpackageloaded { textgreek } { \bool_set_true:N \l__chemmacros_use_textgreek_bool } - { } + { + \@ifpackageloaded { kpfonts } + { \bool_set_true:N \l__chemmacros_use_kpfonts_bool } + { + \@ifpackageloaded { newtxmath } + { \bool_set_true:N \l__chemmacros_use_newtx_bool } + { } + } + } } } - \bool_if:NTF \l__chemmacros_use_upgreek_bool - { - \cs_set:Npn \Chemalpha { \ensuremath { \upalpha } } - \cs_set:Npn \Chembeta { \ensuremath { \upbeta } } - \cs_set:Npn \Chemgamma { \ensuremath { \upgamma } } - \cs_set:Npn \Chemdelta { \ensuremath { \updelta } } - \cs_set:Npn \Chemepsilon { \ensuremath { \upvarepsilon } } - \cs_set:Npn \Chemeta { \ensuremath { \upeta } } - \cs_set:Npn \Chemkappa { \ensuremath { \upkappa } } - \cs_set:Npn \Chemmu { \ensuremath { \upmu } } - \cs_set:Npn \Chemnu { \ensuremath { \upnu } } - \cs_set:Npn \Chemrho { \ensuremath { \uprho } } - \cs_set:Npn \Chempi { \ensuremath { \uppi } } - \cs_set:Npn \Chemsigma { \ensuremath { \upsigma } } - \cs_set:Npn \Chemomega { \ensuremath { \upomega } } - \cs_set:Npn \ChemDelta { \ensuremath { \Updelta } } - } - { - \bool_if:NT \l__chemmacros_use_textgreek_bool - { - \cs_set_protected:Npn \Chemalpha { \ensuremath { \text { \textalpha } } } - \cs_set_protected:Npn \Chembeta { \ensuremath { \text { \textbeta } } } - \cs_set_protected:Npn \Chemgamma { \ensuremath { \text { \textgamma } } } - \cs_set_protected:Npn \Chemdelta { \ensuremath { \text { \textdelta } } } - \cs_set_protected:Npn \Chemepsilon { \ensuremath { \text { \textepsilon } } } - \cs_set_protected:Npn \Chemeta { \ensuremath { \text { \texteta } } } - \cs_set_protected:Npn \Chemkappa { \ensuremath { \text { \textkappa } } } - \cs_set_protected:Npn \Chemmu { \ensuremath { \text { \textmu } } } - \cs_set_protected:Npn \Chemnu { \ensuremath { \text { \textnu } } } - \cs_set_protected:Npn \Chemrho { \ensuremath { \text { \textrho } } } - \cs_set_protected:Npn \Chempi { \ensuremath { \text { \textpi } } } - \cs_set_protected:Npn \Chemsigma { \ensuremath { \text { \textsigma } } } - \cs_set_protected:Npn \Chemomega { \ensuremath { \text { \textomega } } } - \cs_set_protected:Npn \ChemDelta { \ensuremath { \text { \textDelta } } } - } - } - } - -\cs_new:Npn \Chemalpha { \ensuremath { \alpha } } -\cs_new:Npn \Chembeta { \ensuremath { \beta } } -\cs_new:Npn \Chemgamma { \ensuremath { \gamma } } -\cs_new:Npn \Chemdelta { \ensuremath { \delta } } -\cs_new:Npn \Chemepsilon { \ensuremath { \varepsilon } } -\cs_new:Npn \Chemeta { \ensuremath { \eta } } -\cs_new:Npn \Chemkappa { \ensuremath { \kappa } } -\cs_new:Npn \Chemmu { \ensuremath { \mu } } -\cs_new:Npn \Chemnu { \ensuremath { \nu } } -\cs_new:Npn \Chemrho { \ensuremath { \rho } } -\cs_new:Npn \Chempi { \ensuremath { \pi } } -\cs_new:Npn \Chemsigma { \ensuremath { \sigma } } -\cs_new:Npn \Chemomega { \ensuremath { \omega } } -\cs_new:Npn \ChemDelta { \ensuremath { \Delta } } - -\cs_new:Npn \chemmacros_xspace: + \bool_if:NT \l__chemmacros_use_upgreek_bool + { \chemgreek_activate_mapping:n { upgreek } } + \bool_if:NT \l__chemmacros_use_textgreek_bool + { \chemgreek_activate_mapping:n { textgreek } } + \bool_if:NT \l__chemmacros_use_kpfonts_bool + { \chemgreek_activate_mapping:n { kpfonts } } + \bool_if:NT \l__chemmacros_use_newtx_bool + { \chemgreek_activate_mapping:n { newtx } } + } + +\cs_new_protected:Npn \chemmacros_xspace: { \bool_if:NT \l__chemmacros_xspace_bool { \xspace } } -% --------------------------------------------------------------------------- % -% TikZ drawings -\cs_new:Npn \chemmacros_tikz_picture:nn #1#2 +% -------------------------------------------------------------------------- +% TikZ drawings - helper macros +\cs_new_protected:Npn \chemmacros_tikz_picture:nn #1#2 { \tikzpicture[#1] #2 \endtikzpicture } \cs_generate_variant:Nn \chemmacros_tikz_picture:nn { fn,xn } -\cs_new:Npn \chemmacros_tikz_draw:n #1 +\cs_new_protected:Npn \chemmacros_tikz_draw:n #1 { \draw[#1] } \cs_generate_variant:Nn \chemmacros_tikz_draw:n { f,x } -\cs_new:Npn \chemmacros_tikz_node:n #1 +\cs_new_protected:Npn \chemmacros_tikz_node:n #1 { \node[#1] } \cs_generate_variant:Nn \chemmacros_tikz_node:n { f,x } -\cs_new:Npn \chemmacros_tikz_shade:n #1 +\cs_new_protected:Npn \chemmacros_tikz_shade:n #1 { \shade[#1] } \cs_generate_variant:Nn \chemmacros_tikz_shade:n { f,x } -\cs_new:Npn \chemmacros_tikz_shadedraw:n #1 +\cs_new_protected:Npn \chemmacros_tikz_shadedraw:n #1 { \shadedraw[#1] } \cs_generate_variant:Nn \chemmacros_tikz_shadedraw:n { f,x } -\cs_new:Npn \chemmacros_tikz_node_in_draw:n #1 +\cs_new_protected:Npn \chemmacros_tikz_node_in_draw:n #1 { node[#1] } \cs_generate_variant:Nn \chemmacros_tikz_node_in_draw:n { f,x } -% --------------------------------------------------------------------------- % -% general functions -\cs_new_protected:Npn \chemmacros_leave_vmode: - { \hbox_unpack:N \c_empty_box } - +% -------------------------------------------------------------------------- +% a few general functions: +\cs_new_eq:NN \chemmacros_leave_vmode: \chemformula_leave_vmode: \cs_new_eq:NN \chemmacros_ignore_spaces: \tex_ignorespaces:D +\cs_new_eq:NN \chemmacros_nobreak: \chemformula_nobreak: +\cs_new_eq:NN \chemmacros_allow_break: \chemformula_allow_break: +\cs_new_eq:NN \chemmacros_skip_nobreak:N \chemformula_skip_nobreak:N +\cs_new:Npn \chemmacros_remove_backslash:N #1 + { \exp_after:wN \use_none:n \token_to_str:N #1 } -\cs_new:Npn \chemmacros_nobreak: - { \tex_penalty:D \c_ten_thousand } -\cs_new:Npn \chemmacros_allow_break: - { \tex_penalty:D \c_zero } - -\cs_new:Npn \chemmacros_skip_nobreak:N #1 +% detection and handling of bold face: +\prg_new_conditional:Npnn \chemmacros_if_bold: { T,F,TF } { - \chemmacros_nobreak: - \skip_horizontal:N #1 - \chemmacros_nobreak: + \seq_if_in:NVTF \l__chemmacros_if_bf_seq \f@series + { \prg_return_true: } + { \prg_return_false: } } -% --------------------------------------------------------------------------- % -% circled charge signs -\cs_new_protected:Npn \chemmacros_fplus: - { \ensuremath { \__chemmacros_fplus: } } - -\cs_new:Npn \__chemmacros_fplus: - { \mathpalette \__chemmacros_fplus_aux: \bigcirc } +\seq_new:N \l__chemmacros_if_bf_seq -% TODO: can I rewrite this in a more "expl3-way"? -% and what about a ``text'' version? -\cs_new:Npn \__chemmacros_fplus_aux: #1#2 +\seq_set_split:Nnn \l__chemmacros_if_bf_seq { , } { - \ooalign - { - \tex_hfil:D - $#1+$ - \tex_hfil:D - \tex_cr:D - \tex_hfil:D - $#1#2$ - \tex_hfil:D - \tex_cr:D - } + b , bc , bm , bx , bux , + eb , ebc , ebx , mb , + sb , sbc , sbx , + ub , ubc , ubx } -\cs_new_protected:Npn \chemmacros_fminus: - { \ensuremath { \__chemmacros_fminus: } } - -\cs_new:Npn \__chemmacros_fminus: - { \mathpalette \__chemmacros_fminus_aux_aux: \bigcirc } - -\cs_new:Npn \__chemmacros_fminus_aux_aux: #1#2 +\cs_new_protected:Npn \chemmacros_bm:n #1 { - \ooalign - { - \tex_hfil:D - $#1-$ - \tex_hfil:D - \tex_cr:D - \tex_hfil:D - $#1#2$ - \tex_hfil:D - \tex_cr:D - } + \bool_if:NTF \l__chemmacros_detect_bold_bool + { \bm { #1 } } + { #1 } } -% use directly: -\cs_new_eq:NN \fplus \chemmacros_fplus: -\cs_new_eq:NN \fminus \chemmacros_fminus: - -% change output depending on circled-option -\cs_new:Npn \chemmacros_plus: +\cs_new_protected:Npn \chemmacros_bf:n #1 { - \bool_if:nTF - { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } - { - \bool_if:NTF \l__chemmacros_circled_chem_bool - { \chemmacros_fplus: } - { \oplus } - } - { + } + \bool_if:NTF \l__chemmacros_detect_bold_bool + { { \normalfont \bfseries #1 } } + { { \normalfont #1 } } } -\cs_new:Npn \chemmacros_minus: +\cs_new_protected:Npn \chemmacros_detect_bold:n #1 { - \bool_if:nTF - { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } + \chemmacros_if_bold:TF { - \bool_if:NTF \l__chemmacros_circled_chem_bool - { \chemmacros_fminus: } - { \ominus } + \mode_if_math:TF + { \chemmacros_bm:n { #1 } } + { \chemmacros_bf:n { #1 } } } - { - } - } - -\cs_new_protected:Npn \chemmacros_formal_plus: - { - \group_begin: - \bool_set_false:N \l__chemmacros_circled_formal_bool - \chemmacros_plus: - \group_end: - } - -\cs_new_protected:Npn \chemmacros_formal_minus: - { - \group_begin: - \bool_set_false:N \l__chemmacros_circled_formal_bool - \chemmacros_minus: - \group_end: + { #1 } } -% --------------------------------------------------------------------------- % +% --------------------------------------------------------------------------- % transition state symbol -\cs_new:Npn \__chemmacros_transition_state: +\cs_new_protected:Npn \__chemmacros_transition_state: { \text { @@ -693,165 +686,100 @@ } } +% \DeclareDocumentCommand? \cs_new_eq:NN \transitionstatesymbol \chemmacros_transition_state: -\cs_new:Nn \chemmacros_atom:n +% -------------------------------------------------------------------------- +% let's make use of `chemformula' inside some of `chemmacros' commands: +\cs_new_protected:Nn \chemmacros_atom:n { \mode_if_math:TF { \text { \chemmacros_inner_font: #1 } } { \group_begin: \chemmacros_inner_font: #1 \group_end: } } -\cs_generate_variant:Nn \chemmacros_atom:n { o,f,x,V } +\cs_generate_variant:Nn \chemmacros_atom:n { V } -\cs_new:Npn \chemmacros_text:n #1 +\cs_new_protected:Npn \chemmacros_text:n #1 { \mode_if_math:TF { \text { #1 } } { #1 } } -% add a possibility to let chemformula use the chemformula -% with method=chemformula, too \tl_new:N \l__chemmacros_chemformula_tl + \cs_new_protected:Npn \chemmacros_chemformula:n #1 { - \bool_if:NTF \l__chemmacros_use_mhchem_bool - { \ce { #1 } } - { - \group_begin: - \cs_set_eq:NN \chemformula_font_inner: \chemmacros_inner_font: - \chemformula_input_cmpd:nN { #1 } \l__chemmacros_chemformula_tl - \mode_if_math:TF - { \text { \l__chemmacros_chemformula_tl } } - { { \l__chemmacros_chemformula_tl } } - \group_end: - } + \group_begin: + \cs_set_eq:NN \chemformula_font_inner: \chemmacros_inner_font: + \chemformula_chcpd:nn {} { #1 } + \group_end: } \cs_generate_variant:Nn \chemmacros_chemformula:n { x,V } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % particles, charges -\bool_new:N \l__chemmacros_charge_append_bool -\bool_set_false:N \l__chemmacros_charge_append_bool - -% \DeclareChemParticle, \RenewChemParticle -\bool_if:NTF \l__chemmacros_use_mhchem_bool +\NewDocumentCommand \DeclareChemParticle { mm } { - \NewDocumentCommand \DeclareChemParticle { mm } - { - \cs_if_free:NTF #1 - { \cs_new:Npn #1 { \ce { #2 } \chemmacros_xspace: } } - { \chemmacros_msg:nnxx { chemmacros } { declare-particle } { #1 } {} } - } - \NewDocumentCommand \RenewChemParticle { mm } - { - \cs_if_free:NTF #1 - { \chemmacros_msg:nnxx { chemmacros } { renew-particle } { #1 } {} } - { \cs_set:Npn #1 { \ce { #2 } \chemmacros_xspace: } } - } + \cs_if_free:NTF #1 + { \chemmacros_new_particle:Nn #1 { #2 } } + { \chemmacros_msg:nnxx { chemmacros } { declare-particle } { #1 } {} } } + +\NewDocumentCommand \RenewChemParticle { mm } { - \NewDocumentCommand \DeclareChemParticle { mm } - { - \cs_if_free:NTF #1 - { \chemmacros_chem_particle:Nn #1 { #2 } } - { \chemmacros_msg:nnxx { chemmacros } { declare-particle } { #1 } {} } - } - \NewDocumentCommand \RenewChemParticle { mm } - { - \cs_if_free:NTF #1 - { \chemmacros_msg:nnxx { chemmacros } { renew-particle } { #1 } {} } - { \chemmacros_chem_particle:Nn #1 { #2 } } - } + \cs_if_free:NTF #1 + { \chemmacros_msg:nnxx { chemmacros } { renew-particle } { #1 } {} } + { \chemmacros_new_particle:Nn #1 { #2 } } } -\cs_new_protected:Nn \chemmacros_chem_particle:Nn +\cs_new_protected:Nn \chemmacros_new_particle:Nn { - \cs_set:Npn #1 + \cs_set_protected:Npn #1 { - \bool_if:NTF \l__chemformula_inside_ch_bool - { - \chemformula_input_cmpd:nN { #2 } \l__chemmacros_chemformula_tl - \tl_set_rescan:Nno \l__chemmacros_chemformula_tl - { \ExplSyntaxOn } - { \l__chemmacros_chemformula_tl } - \tl_use:N \l__chemmacros_chemformula_tl - \tl_clear:N \l__chemmacros_chemformula_tl - } - { - \group_begin: - \chemformula_input:n { #2 } - \tl_set_rescan:Nno \l__chemmacros_tmpa_tl - { \ExplSyntaxOn } - { \l__chemformula_input_tl } - \chemformula_write:V \l__chemmacros_tmpa_tl - \group_end: - \chemmacros_xspace: - } + \chemformula_chcpd:nn {} { #2 } + \chemmacros_xspace: } } -\bool_if:NTF \l__chemmacros_use_mhchem_bool - { - \cs_new:Npn \el { \chemmacros_atom:n { e } \mch \chemmacros_xspace: } - \cs_new:Npn \prt { \chemmacros_atom:n { p } \pch \chemmacros_xspace: } - } - { - \DeclareChemParticle \el { e- } - \DeclareChemParticle \prt { p+ } - } - +\DeclareChemParticle \el { e- } +\DeclareChemParticle \prt { p+ } \DeclareChemParticle \ntr { n^0 } -\cs_new:Npn \chemmacros_bm:n #1 - { - \bool_if:NTF \l__chemmacros_detect_bold_bool - { \bm { #1 } } - { #1 } - } +\DeclareChemDropped \Rad -\cs_new:Npn \chemmacros_bf:n #1 - { - \bool_if:NTF \l__chemmacros_detect_bold_bool - { { \normalfont \bfseries #1 } } - { { \normalfont #1 } } - } +% -------------------------------------------------------------------------- +% charges +% circled charge signs: they are defined in the `chemformula' module: +% use directly: + +\cs_new_protected:Npn \fplus { { \chemformula_fplus: } } +\cs_new_protected:Npn \fminus { { \chemformula_fminus: } } + +% change output depending on circled-option +\cs_new_eq:NN \chemmacros_plus: \chemformula_plus: +\cs_new_eq:NN \chemmacros_minus: \chemformula_minus: -\cs_new:Npn \chemmacros_detect_bold:n #1 +\cs_new_protected:Npn \chemmacros_formal_plus: { - \chemmacros_if_bold:TF - { - \mode_if_math:TF - { \chemmacros_bm:n { #1 } } - { \chemmacros_bf:n { #1 } } - } - { #1 } + \group_begin: + \bool_set_true:N \l__chemformula_formal_charges_bool + \chemformula_plus: + \group_end: } -\NewDocumentCommand \Rad { O{}G{} } +\cs_new_protected:Npn \chemmacros_formal_minus: { - \chemmacros_msg:nnxx { chemmacros } { command-dropped } - { \Rad } { } - #1#2 + \group_begin: + \bool_set_true:N \l__chemformula_formal_charges_bool + \chemformula_minus: + \group_end: } -% charges -\cs_new:Npn \chemmacros_charge:n #1 +\cs_new_protected:Npn \chemmacros_charge:n #1 { - \bool_if:NTF \l__chemmacros_charge_append_bool - { - \mode_if_math:TF - { {}^ { \chemmacros_detect_bold:n { #1 } } } - { $ {}^ { \chemmacros_detect_bold:n { #1 } } $ } - } - { - \mode_if_math:TF - { ^ { \chemmacros_detect_bold:n { #1 } } } - { $ ^ { \chemmacros_detect_bold:n { #1 } } $ } - } + \chemformula_superscript:n + { \chemmacros_detect_bold:n { #1 } } } \keys_define:nn { chemmacros / charges } - { - append .bool_set:N = \l__chemmacros_charge_append_bool , - append .default:n = true - } + { append .code:n = \chemmacros_option_deprecated:n { append } } \NewDocumentCommand \mch { o } { @@ -881,44 +809,67 @@ { \chemmacros_charge:n { #1 \chemmacros_formal_plus: } } } -\cs_new:Npn \delm - { \mbox { \tiny \( \delta \chemmacros_minus: \) } \chemmacros_xspace: } -\cs_new:Npn \delp - { \mbox { \tiny \( \delta \chemmacros_plus: \) } \chemmacros_xspace: } -\cs_new:Npn \fdelm - { \mbox { \tiny \( \delta \chemmacros_formal_minus: \) } \chemmacros_xspace: } -\cs_new:Npn \fdelp - { \mbox { \tiny \( \delta \chemmacros_formal_plus: \) } \chemmacros_xspace: } -\cs_new:Npn \scrm +\tl_new:N \l__chemmacros_partial_charge_format_tl +\tl_set:Nn \l__chemmacros_partial_charge_format_tl { \tiny } + +\cs_new_protected:Npn \delm + { + \mbox { + \l__chemmacros_partial_charge_format_tl + \( \delta \chemmacros_minus: \) + } + \chemmacros_xspace: + } +\cs_new_protected:Npn \delp + { + \mbox { + \l__chemmacros_partial_charge_format_tl + \( \delta \chemmacros_plus: \) + } + \chemmacros_xspace: + } +\cs_new_protected:Npn \fdelm + { + \mbox { + \l__chemmacros_partial_charge_format_tl + \( \delta \chemmacros_formal_minus: \) + } + \chemmacros_xspace: + } +\cs_new_protected:Npn \fdelp + { + \mbox { + \l__chemmacros_partial_charge_format_tl + \( \delta \chemmacros_formal_plus: \) + } + \chemmacros_xspace: + } + +\cs_new_protected:Npn \scrm { \ensuremath { \scriptstyle \chemmacros_minus: } } -\cs_new:Npn \scrp +\cs_new_protected:Npn \scrp { \ensuremath { \scriptstyle \chemmacros_plus: } } -\cs_new:Npn \fscrm +\cs_new_protected:Npn \fscrm { \ensuremath { \scriptstyle \chemmacros_formal_minus: } } -\cs_new:Npn \fscrp +\cs_new_protected:Npn \fscrp { \ensuremath { \scriptstyle \chemmacros_formal_plus: } } -\cs_new:Npn \fsscrm +\cs_new_protected:Npn \fsscrm { \ensuremath { \scriptscriptstyle \chemmacros_formal_minus: } } -\cs_new:Npn \fsscrp +\cs_new_protected:Npn \fsscrp { \ensuremath { \scriptscriptstyle \chemmacros_formal_plus: } } -% --------------------------------------------------------------------------- % -% ions, molecules -% proton, hydroxide, hydronium/oxonium, water, nucleophile, electrophile -\bool_if:NTF \l__chemmacros_use_mhchem_bool - { - \cs_new:Npn \Hpl { \chemmacros_atom:n { H } \pch \chemmacros_xspace: } - \cs_new:Npn \Hyd { \chemmacros_atom:n { OH } \mch \chemmacros_xspace: } - \cs_new:Npn \HtO { \chemmacros_chemformula:n { H3O } \pch \chemmacros_xspace: } - \cs_new:Npn \El { \chemmacros_atom:n { E } \pch \chemmacros_xspace: } - } +\keys_define:nn { chemmacros / charges } { - \DeclareChemParticle \Hpl { H+ } - \DeclareChemParticle \Hyd { OH- } - \DeclareChemParticle \HtO { H3O+ } - \DeclareChemParticle \El { E+ } + partial-format .tl_set:N = \l__chemmacros_partial_charge_format_tl } +% -------------------------------------------------------------------------- +% ions, molecules +% proton, hydroxide, hydronium/oxonium, water, nucleophile, electrophile +\DeclareChemParticle \Hpl { H+ } +\DeclareChemParticle \Hyd { OH- } +\DeclareChemParticle \HtO { H3O+ } +\DeclareChemParticle \El { E+ } \DeclareChemParticle \water { H2O } \NewDocumentCommand \chemmacros_Nu:w { o } @@ -926,11 +877,7 @@ \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } } \bool_if:NTF \l__chemmacros_particle_elpair_bool { \chemmacros_elpair:n { Nu } \mch } - { - \bool_if:NTF \l__chemmacros_use_mhchem_bool - { \chemmacros_atom:n { Nu } \mch } - { \chemmacros_chemformula:n { Nu- } } - } + { \chemmacros_chemformula:n { Nu- } } \chemmacros_xspace: } @@ -941,15 +888,11 @@ { \cs_set_eq:NN \Nu \chemmacros_Nu:w } } -\cs_new:Npn \chemmacros_ba: +\cs_new_protected:Npn \chemmacros_ba: { \bool_if:NTF \l__chemmacros_particle_elpair_bool { \chemmacros_elpair:n { ba } \mch } - { - \bool_if:NTF \l__chemmacros_use_mhchem_bool - { \chemmacros_atom:n { ba } \mch } - { \chemmacros_chemformula:n { ba- } } - } + { \chemmacros_chemformula:n { ba- } } \chemmacros_xspace: } @@ -961,7 +904,7 @@ \group_end: } -\cs_new:Npn \chemmacros_elpair:n #1 +\cs_new_protected:Npn \chemmacros_elpair:n #1 { \bool_if:NTF \l__chemmacros_chemfig_bool { @@ -998,20 +941,21 @@ elpair .default:n = dots } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% -------------------------------------------------------------------------- % IUPAC \prop_new:N \l__chemmacros_iupac_prop \cs_new_protected:Npn \chemmacros_declare_iupac:Nn #1#2 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl - { \char_set_catcode_letter:N \\ } - { #1 } - \tl_set:Nf \l__chemmacros_tmpa_tl - { \tl_tail:V \l__chemmacros_tmpa_tl } - \prop_if_in:NoTF \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } + \tl_set:Nx \l__chemmacros_tmpa_tl + { \chemmacros_remove_backslash:N #1 } + \prop_if_in:NVTF \l__chemmacros_iupac_prop \l__chemmacros_tmpa_tl { \chemmacros_msg:nnxx { chemmacros } { declare-iupac } { #1 } { } } - { \prop_put:Non \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } { #2 } } + { + \prop_put:NVn \l__chemmacros_iupac_prop + \l__chemmacros_tmpa_tl + { #2 } + } \chemmacros_make_iupac: } @@ -1022,8 +966,12 @@ { #1 } \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } - \prop_if_in:NoTF \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } - { \prop_put:Non \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } { #2 } } + \prop_if_in:NVTF \l__chemmacros_iupac_prop \l__chemmacros_tmpa_tl + { + \prop_put:NVn \l__chemmacros_iupac_prop + \l__chemmacros_tmpa_tl + { #2 } + } { \chemmacros_msg:nnxx { chemmacros } { renew-iupac } { #1 } { } } \chemmacros_make_iupac: } @@ -1076,8 +1024,8 @@ \NewDocumentCommand \cip { m } { \chemmacros_cip:n { #1 } } -\cs_new:Npn \chemmacros_cip:n #1 - { (\textit{#1}\tex_kern:D \l__chemmacros_cip_kern_dim) } +\cs_new_protected:Npn \chemmacros_cip:n #1 + { ( \textit{#1} \tex_kern:D \l__chemmacros_cip_kern_dim ) } \DeclareChemDeprecated \Rcip \R { \cip { R } } \DeclareChemDeprecated \Scip \S { \cip { S } } @@ -1087,7 +1035,7 @@ % TikZ needs : to be other \ExplSyntaxOff -\def\chemmacros@sconf#1% +\protected\def\chemmacros@sconf#1% {% \tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex] { @@ -1096,7 +1044,7 @@ }% } -\def\chemmacros@rconf#1% +\protected\def\chemmacros@rconf#1% {% \tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex] { @@ -1119,8 +1067,8 @@ \DeclareChemIUPAC \tert { \textit { tert } } % Fischer -\DeclareChemDeprecated \Dfi \D { \textsc { d } } -\DeclareChemDeprecated \Lfi \L { \textsc { l } } +\DeclareChemDropped \Dfi +\DeclareChemDropped \Lfi \DeclareChemIUPAC \D { \textsc { d } } \DeclareChemIUPAC \L { \textsc { l } } @@ -1148,10 +1096,10 @@ coord-use-hyphen .default:n = true } -\cs_new:Npn \chemformula_hapto:n #1 +\cs_new_protected:Npn \chemformula_hapto:n #1 { \Chemeta \chemformula_superscript:n { #1 } \chemmacros_break_point_hyphen: } -\cs_new:Npn \chemformula_bridge:n #1 +\cs_new_protected:Npn \chemformula_bridge:n #1 { \Chemmu \tl_if_blank:nF { #1 } @@ -1167,11 +1115,11 @@ \DeclareChemIUPAC \bridge { \chemformula_bridge:n } % attachments to heteroatoms / added hydrogen -\DeclareChemIUPAC \H { \textit { H } } -\DeclareChemIUPAC \O { \textit { O } } -\DeclareChemIUPAC \N { \textit { N } } -\DeclareChemIUPAC \Sf { \textit { S } } -\DeclareChemIUPAC \P { \textit { P } } +\DeclareChemIUPAC \H { \textit { H } } +\DeclareChemIUPAC \O { \textit { O } } +\DeclareChemIUPAC \N { \textit { N } } +\DeclareChemIUPAC \Sf { \textit { S } } +\DeclareChemIUPAC \P { \textit { P } } % language specific settings \AtBeginDocument @@ -1265,6 +1213,7 @@ \NewDocumentCommand \iupac { m } { \chemmacros_iupac:n { #1 } } +% -------------------------------------------------------------------------- % latin phrases \tl_new:N \l__chemmacros_latin_format_tl \tl_set:Nn \l__chemmacros_latin_format_tl { \itshape } @@ -1272,7 +1221,7 @@ \keys_define:nn { chemmacros / latin } { format . tl_set:N = \l__chemmacros_latin_format_tl } -\cs_new:Npn \chemmacros_latin:n #1 +\cs_new_protected:Npn \chemmacros_latin:n #1 { { \l__chemmacros_latin_format_tl #1 } } \prop_new:N \l__chemmacros_latin_prop @@ -1281,7 +1230,8 @@ { \cs_if_free:NTF #1 { - \cs_new:Npn #1 { \chemmacros_latin:n { #2 } \chemmacros_xspace: } + \cs_new_protected:Npn #1 + { \chemmacros_latin:n { #2 } \chemmacros_xspace: } \prop_put:Nnn \l__chemmacros_latin_prop { #1 } { #2 } } { \chemmacros_msg:nnxx { chemmacros } { declare-latin } { #1 } { } } @@ -1313,13 +1263,13 @@ { \cs_new_eq:NN \latin \chemmacros_latin:n } - \DeclareChemLatin \insitu { in~situ } + \DeclareChemLatin \insitu { in~situ } \DeclareChemLatin \abinitio { ab~initio } - \DeclareChemLatin \invacuo { in~vacuo } + \DeclareChemLatin \invacuo { in~vacuo } } % --------------------------------------------------------------------------- % -% acid/base +% acid / base \keys_define:nn { chemmacros / acid-base } { p-style .choice: , @@ -1330,64 +1280,56 @@ \cs_new_eq:NN \chemmacros_p_style:n \textup -% TODO: rewrite in expl3 style -\cs_new:Npn \chemmacros_if_bold:TF #1#2 - { - \ifx\f@series\l__chemmacros_if_bf_tl - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi - { #1 }{ #2 } - } - -\tl_new:N \l__chemmacros_if_bf_tl -\tl_set:Nn \l__chemmacros_if_bf_tl { bx } - \cs_new_protected:Npn \Ka { - \mbox + \ensuremath { - \( - \chemmacros_detect_bold:n - { - K \c_math_subscript_token \mathrm - { \bool_if:NTF \l__chemmacros_german_bool { S } { A } } - } - \) + \chemmacros_detect_bold:n + { + K + \c_math_subscript_token + { \chemmacros_translate:nn { K-acid } { A } } + } } \chemmacros_xspace: } \cs_new_protected:Npn \Kb { - \mbox + \ensuremath { - \( - \chemmacros_detect_bold:n - { K \c_math_subscript_token \mathrm { B } } - \) + \chemmacros_detect_bold:n + { + K + \c_math_subscript_token + { \chemmacros_translate:nn { K-base } { B } } + } } \chemmacros_xspace: } \cs_new_protected:Npn \Kw { - \mbox + \ensuremath { - \( - \chemmacros_detect_bold:n - { K \c_math_subscript_token \mathrm { W } } - \) + \chemmacros_detect_bold:n + { + K + \c_math_subscript_token + { \chemmacros_translate:nn { K-water } { W } } + } } \chemmacros_xspace: } -\cs_new:Npn \chemmacros_p:n #1 +\cs_new_protected:Npn \chemmacros_p:n #1 { \group_begin: - \chemmacros_p_style:n { p } - \ensuremath { #1 } + \mbox + { + \chemmacros_p_style:n { p } + \ensuremath { #1 } + } \group_end: } @@ -1411,7 +1353,7 @@ \chemmacros_p:n { \Ka \IfNoValueF { #1 } - { \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } } + { {} \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } } } \chemmacros_xspace: } @@ -1421,12 +1363,12 @@ \chemmacros_p:n { \Kb \IfNoValueF { #1 } - { \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } } + { {} \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } } } \chemmacros_xspace: } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % units \DeclareSIUnit { \atm } { atm } \DeclareSIUnit { \atmosphere } { atm } @@ -1448,7 +1390,7 @@ \DeclareSIUnit { \normal } { \textsc{n} } \DeclareSIUnit { \torr } { torr } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % reaction mechanisms % \mech[] % - substitutions: {}, 1, 2, se, 1e, 2e, ar @@ -1545,27 +1487,27 @@ { \chemmacros_mech:n { #1 } } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % oxidation numbers % \ox{,} -\bool_new:N \l__chemmacros_ox_sign_bool -\bool_new:N \l__chemmacros_ox_integer_bool -\bool_new:N \l__chemmacros_ox_explicit_sign_bool +\bool_new:N \l__chemmacros_ox_sign_bool +\bool_new:N \l__chemmacros_ox_integer_bool +\bool_new:N \l__chemmacros_ox_explicit_sign_bool \bool_set_false:N \l__chemmacros_ox_explicit_sign_bool -\bool_new:N \l__chemmacros_ox_format_roman_bool -\bool_set_true:N \l__chemmacros_ox_format_roman_bool -\bool_new:N \l__chemmacros_ox_decimal_marker_comma_bool +\bool_new:N \l__chemmacros_ox_format_roman_bool +\bool_set_true:N \l__chemmacros_ox_format_roman_bool +\bool_new:N \l__chemmacros_ox_decimal_marker_comma_bool \bool_set_false:N \l__chemmacros_ox_decimal_marker_comma_bool -\bool_new:N \l__chemmacros_ox_parse_bool -\bool_set_true:N \l__chemmacros_ox_parse_bool -\bool_new:N \l__chemmacros_ox_side_bool -\bool_new:N \l__chemmacros_ox_super_bool -\bool_new:N \l__chemmacros_ox_top_bool -\bool_set_true:N \l__chemmacros_ox_top_bool -\bool_new:N \l__chemmacros_ox_align_center_bool +\bool_new:N \l__chemmacros_ox_parse_bool +\bool_set_true:N \l__chemmacros_ox_parse_bool +\bool_new:N \l__chemmacros_ox_side_bool +\bool_new:N \l__chemmacros_ox_super_bool +\bool_new:N \l__chemmacros_ox_top_bool +\bool_set_true:N \l__chemmacros_ox_top_bool +\bool_new:N \l__chemmacros_ox_align_center_bool -\int_new:N \l__chemmacros_ox_number_int -\fp_new:N \l__chemmacros_ox_number_fp +\int_new:N \l__chemmacros_ox_number_int +\fp_new:N \l__chemmacros_ox_number_fp \cs_new_protected:Npn \__chemmacros_ox_process_number:n #1 { @@ -1591,16 +1533,20 @@ slash-symbol-font = lmr } -\cs_new:Npn \__chemmacros_ox_fraction:n #1/#2 +\cs_new_protected:Npn \__chemmacros_ox_fraction:n #1/#2 { \bool_set_false:N \l__chemmacros_ox_format_roman_bool \__chemmacros_ox_sign:n { #1 } \bool_if:NTF \l__chemmacros_ox_side_bool { \sfrac { \__chemmacros_ox_value:n { #1 } } { #2 } } - { \sfrac [ chemmacros-ox-frac ] { \__chemmacros_ox_value:n { #1 } } { #2 } } + { + \sfrac [ chemmacros-ox-frac ] + { \__chemmacros_ox_value:n { #1 } } + { #2 } + } } -\cs_new:Npn \__chemmacros_ox_sign:n #1 +\cs_new_protected:Npn \__chemmacros_ox_sign:n #1 { \fp_compare:nNnT { #1 } > { 0 } { \bool_if:NT \l__chemmacros_ox_explicit_sign_bool { $+$ } } @@ -1616,13 +1562,11 @@ \fp_abs:N \l__chemmacros_ox_number_fp \__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 - } + { \__chemmacros_fp_to_Roman:V \l__chemmacros_ox_number_fp } { \bool_if:NTF \l__chemmacros_ox_integer_bool - { \__chemmacros_fp_to_arabic:V \l__chemmacros_ox_number_fp } - { \__chemmacros_fp_show:V \l__chemmacros_ox_number_fp } + { $ \__chemmacros_fp_to_arabic:V \l__chemmacros_ox_number_fp $ } + { $ \__chemmacros_fp_show:V \l__chemmacros_ox_number_fp $ } } } @@ -1646,10 +1590,11 @@ \group_begin: \fp_set:Nn \l__chemmacros_tmpa_tl { #1 } \fp_round_places:Nn \l__chemmacros_tmpa_tl { 0 } - \int_set:Nn \l__chemmacros_tmpa_int { \fp_to_tl:N \l__chemmacros_tmpa_tl } + \int_set:Nn \l__chemmacros_tmpa_int + { \fp_to_tl:N \l__chemmacros_tmpa_tl } \int_compare:nTF { \l__chemmacros_tmpa_int = 0 } { 0 } - { \int_to_Roman:n { \int_use:N \l__chemmacros_tmpa_int } } + { \int_to_Roman:n { \l__chemmacros_tmpa_int } } \group_end: } \cs_generate_variant:Nn \__chemmacros_fp_to_Roman:n { V } @@ -1669,7 +1614,8 @@ \fp_set:Nn \l__chemmacros_tmpa_tl { #1 } \bool_if:NTF \l__chemmacros_ox_decimal_marker_comma_bool { - \tl_set:Nx \l__chemmacros_tmpb_tl { \fp_to_tl:N \l__chemmacros_tmpa_tl } + \tl_set:Nx \l__chemmacros_tmpb_tl + { \fp_to_tl:N \l__chemmacros_tmpa_tl } \tl_replace_once:Nnn \l__chemmacros_tmpb_tl { . } { {,} } \tl_use:N \l__chemmacros_tmpb_tl } @@ -1810,12 +1756,19 @@ \cs_new_protected:Npn \chemmacros_redox_partner:nn #1#2 { - \tl_if_blank:nT { #1 } - { \msg_error:nnx { chemmacros } { OX } { node~name~missing } } - \tl_if_blank:nT { #2 } - { \msg_error:nnx { chemmacros } { OX } { atom~missing } } - \tikz[baseline=(#1.base),remember~picture] - { \node [inner~sep=0] (#1) { #2 } ; } + \chemformula_latex_if:nTF { measuring@ } + { + \tikz[baseline=(#1.base)] + { \node [inner~sep=0] (#1) { #2 } ; } + } + { + \tl_if_blank:nT { #1 } + { \msg_error:nnx { chemmacros } { OX } { node~name~missing } } + \tl_if_blank:nT { #2 } + { \msg_error:nnx { chemmacros } { OX } { atom~missing } } + \tikz[baseline=(#1.base),remember~picture] + { \node [inner~sep=0] (#1) { #2 } ; } + } } \cs_new_protected:Npn \__chemmacros_redox_coordinates:nn #1#2 @@ -1937,20 +1890,18 @@ \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_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 +\bool_new:N \l__chemmacros_nmr_list_bool +\bool_new: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 \cs_new_protected:Npn \__chemmacros_nmr_nucleus:w #1,#2 \q_stop { @@ -1983,33 +1934,25 @@ \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} } } \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { #2 } - \bool_if:NTF \l__chemmacros_bpchem_bool - { \IUPAC { \^ { #1 } \g__chemmacros_nmr_element_coupled_tl - NMR } } - { - \iupac { \^ { #1 } } - \bool_if:NTF \l__chemmacros_nmr_parse_bool - { - \bool_if:NTF \l__chemmacros_use_mhchem_bool - { \exp_args:No \ce { \g__chemmacros_nmr_element_coupled_tl } } - { \exp_args:No \ch { \g__chemmacros_nmr_element_coupled_tl } } - } - { \chemmacros_atom:V \g__chemmacros_nmr_element_coupled_tl } - - NMR - } + \iupac { \^ { #1 } } + \bool_if:NTF \l__chemmacros_nmr_parse_bool + { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl } + { \chemmacros_atom:V \g__chemmacros_nmr_element_coupled_tl } + - NMR } \cs_generate_variant:Nn \__chemmacros_nmr_base:nn { VV } -\cs_new:Npn \__chemmacros_nmr_frequency:n #1 +\cs_new_protected:Npn \__chemmacros_nmr_frequency:n #1 { \tl_if_in:nnTF { #1 } { , } { \__chemmacros_nmr_frequency_aux_i:w #1 \q_stop } { \__chemmacros_nmr_frequency_aux_ii:n { #1 } } } -\cs_new:Npn \__chemmacros_nmr_frequency_aux_i:w #1,#2 \q_stop +\cs_new_protected:Npn \__chemmacros_nmr_frequency_aux_i:w #1,#2 \q_stop { \SI { #1 } { #2 } } -\cs_new:Npn \__chemmacros_nmr_frequency_aux_ii:n #1 +\cs_new_protected:Npn \__chemmacros_nmr_frequency_aux_ii:n #1 { \SI { #1 } { \tl_use:N \l__chemmacros_nmr_unit_tl } } \keys_define:nn { chemmacros / nmr } @@ -2066,21 +2009,27 @@ \NewDocumentCommand \RenewChemNMR { mm } { \chemmacros_renew_nmr:Nn #1 { #2 } } -% TODO: separate document and module level +\NewDocumentCommand \NMR { s G{} D(){} O{} } + { + \IfBooleanTF { #1 } + { \chemmacros_nmr:nnnn { * } { #2 } { #3 } { #4 } } + { \chemmacros_nmr:nnnn { } { #2 } { #3 } { #4 } } + } + \AtBeginDocument { % \NMR{,}(,)[] ALL arguments are optional % \NMR* same but without ": $\delta$" at end - \NewDocumentCommand \NMR { s g d() o } + \cs_new_protected:Npn \chemmacros_nmr:nnnn #1#2#3#4 { \bool_if:NT \l__chemmacros_nmr_list_bool { \item \scan_stop: } \group_begin: \chemmacros_leave_vmode: \bool_set_false:N \l__chemmacros_nmr_frequency_bool \bool_set_false:N \l__chemmacros_nmr_solvent_bool - \IfNoValueF { #3 } + \tl_if_empty:nF { #3 } { \bool_set_true:N \l__chemmacros_nmr_frequency_bool } - \IfNoValueF { #4 } + \tl_if_empty:nF { #4 } { \bool_set_true:N \l__chemmacros_nmr_solvent_bool } \bool_if:nT { @@ -2096,7 +2045,7 @@ \l__chemmacros_nmr_solvent_bool } { \bool_set_true:N \l__chemmacros_nmr_comma_bool } - \IfNoValueTF { #2 } + \tl_if_empty:nTF { #2 } { \__chemmacros_nmr_nucleus:w \l__chemmacros_nmr_isotope_default_tl , @@ -2122,10 +2071,10 @@ { \chemmacros_atom:n { #4 } } \bool_if:NT \l__chemmacros_nmr_delimiters_bool { ) } - \IfBooleanF { #1 } { : ~ } + \tl_if_blank:nT { #1 } { : ~ } \group_end: } - \IfBooleanF { #1 } + \tl_if_blank:nT { #1 } { \delta \text { \l__chemmacros_nmr_delta_tl } @@ -2147,25 +2096,21 @@ \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 } } - } + { \chemformula_ch:nn { } { #4 } } { #4 } } \bool_if:NT \l__chemmacros_nmr_delimiters_bool { ) } - \IfBooleanF { #1 } { : } + \tl_if_blank:nT { #1 } { : } \group_end: - \IfBooleanF { #1 } + \tl_if_blank:nT { #1 } { \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: } } + { \tl_if_blank:nT { #1 } { \chemmacros_xspace: } } } \group_end: } @@ -2188,6 +2133,7 @@ { \chemmacros_val_aux:w #1 \q_nil } { \num { #1 } } } + \cs_new_protected:Npn \chemmacros_val_aux:w #1--#2 \q_nil { \numrange { #1 } { #2 } } @@ -2211,30 +2157,14 @@ \chemmacros_ignore_spaces: } -\cs_new:Npn \chemmacros_nmr_number:n #1 - { - #1 \, - \bool_if:NTF \l__chemmacros_bpchem_bool - { \g__chemmacros_nmr_element_tl } - { \chemmacros_atom:V \g__chemmacros_nmr_element_tl } - } +\cs_new_protected:Npn \chemmacros_nmr_number:n #1 + { #1 \, \chemmacros_atom:V \g__chemmacros_nmr_element_tl } -\cs_new:Npn \chemmacros_nmr_position:n #1 +\cs_new_protected: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:V \g__chemmacros_nmr_element_tl - #1 } - } + \bool_if:NTF \l__chemmacros_nmr_position_sub_bool + { \chemmacros_chemformula:x { \g__chemmacros_nmr_element_tl _ #1 } } + { \chemmacros_atom:V \g__chemmacros_nmr_element_tl - #1 } } \cs_new_protected:Npn \chemmacros_nmr_coupling:w @@ -2255,14 +2185,14 @@ \__chemmacros_nmr_coupling_aux_i:w } -\cs_new:Npn \__chemmacros_nmr_coupling_aux_i:w +\cs_new_protected:Npn \__chemmacros_nmr_coupling_aux_i:w { \peek_meaning:NTF [ { \__chemmacros_nmr_coupling_aux_ii:w } { \__chemmacros_nmr_coupling_aux_iii:n } } -\cs_new:Npn \__chemmacros_nmr_coupling_aux_ii:w [#1]#2 +\cs_new_protected:Npn \__chemmacros_nmr_coupling_aux_ii:w [#1]#2 { \group_begin: \sisetup @@ -2278,7 +2208,7 @@ \group_end: } -\cs_new:Npn \__chemmacros_nmr_coupling_aux_iii:n #1 +\cs_new_protected:Npn \__chemmacros_nmr_coupling_aux_iii:n #1 { \group_begin: \sisetup @@ -2295,14 +2225,10 @@ \group_end: } -% --------------------------------------------------------------------------- % -% placing text below atom/molecule -\cs_new_protected:Npn \chemmacros_dim_to_width:Nn #1#2 - { - \hbox_set:Nn \l__chemmacros_tmpa_box { #2 } - \dim_set:Nn #1 { \box_wd:N \l__chemmacros_tmpa_box } - \box_clear:N \l__chemmacros_tmpa_box - } +% -------------------------------------------------------------------------- +% placing text below atom/molecule -- only for `mhchem' users or users of +% version 1 +\cs_new_eq:NN \chemmacros_dim_to_width:Nn \chemformula_dim_to_width:Nn \bool_new:N \l__chemmacros_mhname_width_bool \bool_set_false:N \l__chemmacros_mhname_width_bool @@ -2331,7 +2257,7 @@ } % \mhName[]{}{} -\bool_if:nF { \l__chemmacros_version_one_bool || \l__chemmacros_use_mhchem_bool } +\bool_if:NF \l__chemmacros_version_one_bool { \NewDocumentCommand \mhName { o m m } { @@ -2352,7 +2278,7 @@ #3 } } - { \ce { #2 } } + { \cf { #2 } } } \group_end: } @@ -2374,75 +2300,57 @@ space .dim_set:N = \l__chemmacros_phases_space_dim } -\cs_new_protected:Npn \chemmacros_declare_phase:Nnn #1#2#3 +\cs_new_protected:Npn \chemmacros_declare_phase:Nn #1#2 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl - { \char_set_catcode_letter:N \\ } - { #1 } - \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } - \cs_if_free:NTF #1 - { \cs_new:Npn #1 {} } + \tl_set:Nx \l__chemmacros_tmpa_tl + { \chemmacros_remove_backslash:N #1 } + \cs_if_free:NF #1 { \chemmacros_msg:nnxx { chemmacros } { declare-phase } { #1 } {} } - \tl_if_blank:nTF { #2 } - { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #3 } } - { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #2 } } - \prop_put:Non \l__chemmacros_phases_prop - { \l__chemmacros_tmpa_tl } - { #3 } - \chemmacros_make_phases: + \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 } + \__chemmacros_define_phase:Nx #1 + { + \exp_not:N \chemmacros_translate:nn + { phase-\l__chemmacros_tmpa_tl } + { #2 } + } } -\cs_new_protected:Npn \chemmacros_renew_phase:Nnn #1#2#3 +\cs_new_protected:Npn \chemmacros_renew_phase:Nn #1#2 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl - { \char_set_catcode_letter:N \\ } - { #1 } - \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } + \tl_set:Nx \l__chemmacros_tmpa_tl + { \chemmacros_remove_backslash:N #1 } \cs_if_free:NT #1 { \chemmacros_msg:nnxx { chemmacros } { renew-phase } { #1 } {} } - \tl_if_blank:nTF { #2 } - { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #3 } } - { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #2 } } - \prop_put:Non \l__chemmacros_phases_prop - { \l__chemmacros_tmpa_tl } - { #3 } - \chemmacros_make_phases: + \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 } + \__chemmacros_define_phase:Nx #1 + { + \exp_not:N \chemmacros_translate:nn + { phase-\l__chemmacros_tmpa_tl } + { #2 } + } } \NewDocumentCommand \DeclareChemPhase { mom } { \IfNoValueTF { #2 } - { \chemmacros_declare_phase:Nnn #1 { } { #3 } } - { \chemmacros_declare_phase:Nnn #1 { #2 } { #3 } } + { \chemmacros_declare_phase:Nn #1 { #3 } } + { \chemmacros_declare_phase:Nn #1 { #3 } } } \NewDocumentCommand \RenewChemPhase { mom } { \IfNoValueTF { #2 } - { \chemmacros_renew_phase:Nnn #1 { } { #3 } } - { \chemmacros_renew_phase:Nnn #1 { #2 } { #3 } } - } - -\cs_new_protected:Npn \chemmacros_make_phases: - { - \bool_if:NTF \l__chemmacros_german_bool - { - \prop_map_function:NN \l__chemmacros_phases_german_prop - \__chemmacros_define_phases:nn - } - { - \prop_map_function:NN \l__chemmacros_phases_prop - \__chemmacros_define_phases:nn - } + { \chemmacros_renew_phase:Nn #1 { #3 } } + { \chemmacros_renew_phase:Nn #1 { #3 } } } -\cs_new_protected:Npn \__chemmacros_define_phases:nn #1#2 +\cs_new_protected:Npn \__chemmacros_define_phase:Nn #1#2 { - \cs_set:cpn { #1 } + \cs_set_protected:Npn #1 { \bool_if:NTF \l__chemmacros_phases_sub_bool { - \bool_if:NTF \l__chemformula_inside_ch_bool + \bool_if:NTF \l_chemformula_inside_ch_bool { \chemformula_subscript:n { ( #2 ) } } { \ensuremath { \c_math_subscript_token { \text { (#2) } } } } } @@ -2455,13 +2363,14 @@ } } } +\cs_generate_variant:Nn \__chemmacros_define_phase:Nn { Nx } -\DeclareChemPhase \sld [ f ] { s } -\DeclareChemPhase \lqd [ f{}l ] { l } -\DeclareChemPhase \gas { g } -\DeclareChemPhase \aq { aq } +\DeclareChemPhase\sld{ s } +\DeclareChemPhase\lqd{ l } +\DeclareChemPhase\gas{ g } +\DeclareChemPhase\aq { aq } -\cs_new:Npn \chemmacros_phase:n #1 +\cs_new_protected:Npn \chemmacros_phase:n #1 { \bool_if:NTF \l__chemmacros_phases_sub_bool { \ensuremath { \c_math_subscript_token { \text { (#1) } } } } @@ -2483,29 +2392,42 @@ \cs_new_eq:NN \liquid \lqd } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % reaction environments +\cs_new_protected:Npn \__chemmacros_record_for_lor:nnnnn #1#2#3#4#5 + { + \tl_if_eq:nnT { #1 } { reaction } + { + \group_begin: + % we need to prevent \Hy@make@anchor from being written to the lor + % file: + \bool_if:NT \l__chemmacros_hyperref_bool + { \cs_set:Npn \Hy@make@anchor {} } + \addcontentsline { lor } { reaction } + { + \tl_use:N \l__chemmacros_reaction_lorname_tl + #2 #3 #4 #5 + \tl_use:N \g__chemmacros_reaction_description_tl + } + \tl_gclear:N \g__chemmacros_reaction_description_tl + \group_end: + } + } % redefine mathtools' command \MT_define_tagform:nwnn to ensure we add an % entry to the list of reactions even if the user redefines the reaction tag +% this should probably be done via patching... \AfterPackage* { mathtools } { - \cs_set:Npn \MT_define_tagform:nwnn #1[#2]#3#4 + \cs_set_protected:Npn \MT_define_tagform:nwnn #1[#2]#3#4 { \@namedef{MT_tagform_#1:n}##1 { % this is the original part: \maketag@@@{#3\ignorespaces#2{##1}\unskip\@@italiccorr#4} - % this is added: - \tl_if_eq:nnT { #1 } { reaction } - { - \addcontentsline { lor } { reaction } - { - \l__chemmacros_reaction_lorname_tl #3 #2 ##1 #4 - \tl_use:N \g__chemmacros_reaction_description_tl - } - \tl_gclear:N \g__chemmacros_reaction_description_tl - } + % this is added => this disturbs hyperref: + \__chemmacros_record_for_lor:nnnnn + { #1 } { #3 } { #2 } { ##1 } { #4 } } } } @@ -2522,35 +2444,21 @@ { \chemmacros_add_reaction_description:n { #1 } } % 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 \reactionlistname { List~of~reactions } +\tl_new:N \l__chemmacros_reaction_lorname_tl +\tl_new:N \reactionlistname -% language settings % TODO -\AtBeginDocument +% TODO: add option +\cs_new:Npn \__chemmacros_reaction_heading:n #1 + { \section* { #1 } } +\cs_generate_variant:Nn \__chemmacros_reaction_heading:n { V } + +\cs_new_protected:Npn \listofreactions { - \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 ~ } - } + \__chemmacros_reaction_heading:V \reactionlistname + \@starttoc { lor } } -\cs_new:Npn \listofreactions - { \section* { \reactionlistname } \@starttoc { lor } } - -\cs_new:Npn \l@reaction #1#2 +\cs_new_protected:Npn \l@reaction #1#2 { \@dottedtocline { 1 } { 1.5em } { 2.3em } { #1 } { #2 } } % create tagform @@ -2561,7 +2469,7 @@ \newcounter { reaction } % switch to reaction tags -\cs_new:Npn \__chemmacros_begin_reaction: +\cs_new_protected:Npn \__chemmacros_begin_reaction: { % create individual names for `hyperref': \bool_if:NT \l__chemmacros_hyperref_bool @@ -2580,7 +2488,7 @@ } % switch back to equation tags -\cs_new:Npn \__chemmacros_end_reaction: +\cs_new_protected:Npn \__chemmacros_end_reaction: { \setcounter { reaction } { \value { equation } } \setcounter { equation } { \value { chemmacros_save_reaction } } @@ -2592,88 +2500,85 @@ \keys_define:nn { chemmacros / reaction } { - star .bool_set:N = \l__chemmacros_reactions_star_bool , - star .default:n = true , - arg .bool_set:N = \l__chemmacros_reactions_args_bool , - arg .default:n = true , - list-name .tl_set:N = \reactionlistname , - list-entry .code:n = - \tl_set:Nn \l__chemmacros_reaction_lorname_tl { #1 ~ } + star .bool_set:N = \l__chemmacros_reactions_star_bool , + star .default:n = true , + arg .bool_set:N = \l__chemmacros_reactions_args_bool , + arg .default:n = true , + list-name .tl_set:N = \reactionlistname , + list-entry .code:n = + \tl_set:Nn \l__chemmacros_reaction_lorname_tl { #1 ~ } , + list-heading .code:n = + \cs_set:Npn \__chemmacros_reaction_heading:n ##1 { #1 { ##1 } } } -% TODO separate document and module level % \DeclareChemReaction[]{}{} -\bool_if:NF \l__chemmacros_version_one_bool +\cs_new_protected:Npn \chemmacros_new_reaction:nnn #1#2#3 { - \NewDocumentCommand \DeclareChemReaction { o m m } - { - \cs_if_exist:cTF { #2 } - { \msg_error:nnx { chemmacros } { already-defined } { #2 } } - { - \IfNoValueTF { #1 } - { - \bool_set_false:N \l__chemmacros_reactions_star_bool - \bool_set_false:N \l__chemmacros_reactions_args_bool - } - { \keys_set:nn { chemmacros / reaction } { #1 } } - \bool_if:NTF \l__chemmacros_reactions_args_bool - { - \NewEnviron { #2 } [ 2 ] [] - { - \__chemmacros_begin_reaction: - \AddRxnDesc { ##1 } - \begin { #3 } { ##2 } - \chemmacros_equation_chemformula:V \BODY - \end{ #3 } - \__chemmacros_end_reaction: - } - \bool_if:NT \l__chemmacros_reactions_star_bool - { - \NewEnviron { #2* } [ 1 ] - { - \begin { #3* } { ##1 } - \chemmacros_equation_chemformula:V \BODY - \end { #3* } - } - } - } - { - \NewEnviron { #2 } [ 1 ] [] - { - \__chemmacros_begin_reaction: - \AddRxnDesc { ##1 } - \begin { #3 } - \chemmacros_equation_chemformula:V \BODY - \end { #3 } - \__chemmacros_end_reaction: - } - \bool_if:NT \l__chemmacros_reactions_star_bool - { - \NewEnviron { #2* } - { - \begin { #3* } - \chemmacros_equation_chemformula:V \BODY - \end { #3* } - } - } - } - } - \ignorespaces - } - \cs_set:Npn \newreaction + \cs_if_exist:cTF { #2 } + { \msg_error:nnx { chemmacros } { already-defined } { #2 } } { - \chemmacros_msg:nnxx { chemmacros } { command-deprecated } - { \newreaction } { \DeclareChemReaction } - \DeclareChemReaction + \bool_set_false:N \l__chemmacros_reactions_star_bool + \bool_set_false:N \l__chemmacros_reactions_args_bool + \keys_set:nn { chemmacros / reaction } { #1 } + \bool_if:NTF \l__chemmacros_reactions_args_bool + { + \NewEnviron { #2 } [ 2 ] [] + { + \__chemmacros_begin_reaction: + \AddRxnDesc { ##1 } + \begin { #3 } { ##2 } + \chemmacros_equation_chemformula:V \BODY + \end{ #3 } + \__chemmacros_end_reaction: + } + \bool_if:NT \l__chemmacros_reactions_star_bool + { + \NewEnviron { #2* } [ 1 ] + { + \begin { #3* } { ##1 } + \chemmacros_equation_chemformula:V \BODY + \end { #3* } + } + } + } + { + \NewEnviron { #2 } [ 1 ] [] + { + \__chemmacros_begin_reaction: + \AddRxnDesc { ##1 } + \begin { #3 } + \chemmacros_equation_chemformula:V \BODY + \end { #3 } + \__chemmacros_end_reaction: + } + \bool_if:NT \l__chemmacros_reactions_star_bool + { + \NewEnviron { #2* } + { + \begin { #3* } + \chemmacros_equation_chemformula:V \BODY + \end { #3* } + } + } + } } + \ignorespaces } -\cs_new:Npn \chemmacros_equation_chemformula:n #1 +\bool_if:NF \l__chemmacros_version_one_bool { - \bool_if:NTF \l__chemmacros_use_mhchem_bool - { \cee { #1 } } - { \ch { #1 } } + \NewDocumentCommand \DeclareChemReaction { o m m } + { + \IfNoValueTF { #1 } + { \chemmacros_new_reaction:nnn { } { #2 } { #3 } } + { \chemmacros_new_reaction:nnn { #1 } { #2 } { #3 } } + } + \DeclareChemDeprecated \newreaction \DeclareChemReaction + { \DeclareChemReaction } } + +\cs_new_protected:Npn \chemmacros_equation_chemformula:n #1 + { \chemformula_ch:nn { } { #1 } } \cs_generate_variant:Nn \chemmacros_equation_chemformula:n { V } % predefined: @@ -2683,43 +2588,44 @@ \DeclareChemReaction [ star ] { reactions } { align } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % thermodynamics et.al. % \standardstate as defined by the chemstyle package. Thanks to Joseph Wright -\cs_if_exist:NF \standardstate +% the `chemstyle' provides it with \providecommand so it doesn't matter which +% package defines it first +\ProvideDocumentCommand \standardstate {} + { \ensuremath { \chemmacros_standardstate: } } + +\cs_new_protected:Npn \chemmacros_standardstate: + { \mathpalette \chemmacros_standardstate_aux: \circ } + +\cs_new_protected:Npn \chemmacros_standardstate_aux: #1#2 { - \cs_new:Npn \standardstate - { \ensuremath { \chemmacros_standardstate: } } - \cs_new:Npn \chemmacros_standardstate: - { \mathpalette \chemmacros_standardstate_aux: \circ } - \cs_new:Npn \chemmacros_standardstate_aux: #1#2 + \ooalign { - \ooalign - { - \tex_hfil:D - $#1-$ - \tex_hfil:D - \tex_cr:D - \tex_hfil:D - $#1#2$ - \tex_hfil:D - \tex_cr:D - } + \tex_hfil:D + $#1-$ + \tex_hfil:D + \tex_cr:D + \tex_hfil:D + $#1#2$ + \tex_hfil:D + \tex_cr:D } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % \State -\tl_new:N \l__chemmacros_State_delta_tl -\tl_set:Nn \l__chemmacros_State_delta_tl { \Delta } -\tl_new:N \l__chemmacros_State_exponent_tl -\tl_set:Nn \l__chemmacros_State_exponent_tl { \standardstate } +\tl_new:N \l__chemmacros_State_delta_tl +\tl_set:Nn \l__chemmacros_State_delta_tl { \Delta } +\tl_new:N \l__chemmacros_State_exponent_tl +\tl_set:Nn \l__chemmacros_State_exponent_tl { \standardstate } -\bool_new:N \l__chemmacros_State_delta_bool +\bool_new:N \l__chemmacros_State_delta_bool \bool_set_true:N \l__chemmacros_State_delta_bool -\bool_new:N \l__chemmacros_State_subscript_left_bool +\bool_new:N \l__chemmacros_State_subscript_left_bool \bool_set_true:N \l__chemmacros_State_subscript_left_bool -\bool_new:N \l__chemmacros_State_exponent_bool +\bool_new:N \l__chemmacros_State_exponent_bool \bool_set_true:N \l__chemmacros_State_exponent_bool \keys_define:nn { chemmacros / state } @@ -2752,7 +2658,7 @@ % old syntax (v2.0): % \State[]{}{} % {} is an optional argument! -\cs_new:Npn \chemmacros_state:nnn #1#2#3 +\cs_new_protected:Npn \chemmacros_state:nnn #1#2#3 { \group_begin: \IfNoValueF { #1 } @@ -2788,7 +2694,7 @@ } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- \tl_new:N \l__chemmacros_thermod_subscript_left_tl \tl_new:N \l__chemmacros_thermod_subscript_left_default_tl \tl_new:N \l__chemmacros_thermod_subscript_tl @@ -2829,7 +2735,7 @@ % \DeclareChemState[]{}{}{} \bool_if:NF \l__chemmacros_version_one_bool { - \cs_new:Npn \DeclareChemState + \cs_new_protected:Npn \DeclareChemState { \bool_set_false:N \l__chemmacros_renewstate_bool \__chemmacros_setnewstate_reset: @@ -2838,7 +2744,7 @@ { \__chemmacros_setnewstate_aux:nnn } } % \RenewChemState[]{}{}{} - \cs_new:Npn \RenewChemState + \cs_new_protected:Npn \RenewChemState { \bool_set_true:N \l__chemmacros_renewstate_bool \__chemmacros_setnewstate_reset: @@ -2846,13 +2752,13 @@ { \__chemmacros_setnewstate:n } { \__chemmacros_setnewstate_aux:nnn } } - \cs_set:Npn \setnewstate + \cs_set_protected:Npn \setnewstate { \chemmacros_msg:nnxx { chemmacros } { command-deprecated } { \setnewstate } { \DeclareChemState } \DeclareChemState } - \cs_set:Npn \renewstate + \cs_set_protected:Npn \renewstate { \chemmacros_msg:nnxx { chemmacros } { command-deprecated } { \renewstate } { \RenewChemState } @@ -2860,7 +2766,7 @@ } } -\cs_new:Npn \__chemmacros_setnewstate_reset: +\cs_new_protected:Npn \__chemmacros_setnewstate_reset: { \tl_set:Nn \l__chemmacros_thermod_subscript_left_default_tl { true } \tl_clear:N \l__chemmacros_thermod_subscript_default_tl @@ -2868,13 +2774,13 @@ \tl_set:Nn \l__chemmacros_thermod_delta_default_tl { \Delta } } -\cs_new:Npn \__chemmacros_setnewstate:n [#1] +\cs_new_protected:Npn \__chemmacros_setnewstate:n [#1] { \keys_set:nn { chemmacros / setnewstate } { #1 } \__chemmacros_setnewstate_aux:nnn } -\cs_new:Npn \__chemmacros_setnewstate_aux:nnn #1#2#3 +\cs_new_protected:Npn \__chemmacros_setnewstate_aux:nnn #1#2#3 { \bool_if:NTF \l__chemmacros_renewstate_bool { @@ -2911,7 +2817,7 @@ \tl_const:cn { l__chemmacros_ #1 _unit_tl } { #3 } - \cs_new:cpn {chemmacros_ #1 _reset: } + \cs_new_protected:cpn {chemmacros_ #1 _reset: } { \tl_set_eq:Nc \l__chemmacros_thermod_subscript_tl @@ -2929,7 +2835,7 @@ \l__chemmacros_thermod_unit_tl { l__chemmacros_ #1 _unit_tl } } - \cs_new:cpn { #1 } + \cs_new_protected:cpn { #1 } { \use:c {chemmacros_ #1 _reset: } \peek_meaning:NTF [ @@ -2940,19 +2846,19 @@ { \tl_use:c { #1 _aux_iii:n } } } } - \cs_new:cpn { #1 _aux_i:n } [##1] + \cs_new_protected:cpn { #1 _aux_i:n } [##1] { \keys_set:nn { chemmacros / State } { ##1 } \peek_meaning:NTF ( { \tl_use:c { #1 _aux_ii:n } } { \tl_use:c { #1 _aux_iii:n } } } - \cs_new:cpn { #1 _aux_ii:n } (##1) + \cs_new_protected:cpn { #1 _aux_ii:n } (##1) { \tl_set:Nn \l__chemmacros_thermod_subscript_tl { ##1 } \tl_use:c { #1 _aux_iii:n } } - \cs_new:cpn { #1 _aux_iii:n } ##1 + \cs_new_protected:cpn { #1 _aux_iii:n } ##1 { \ensuremath { @@ -3000,21 +2906,21 @@ {G} {\kilo\joule\per\mole} } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % Newman projections -\fp_new:N \l__chemmacros_newman_rel_angle_fp -\fp_zero:N \l__chemmacros_newman_rel_angle_fp -\fp_new:N \l__chemmacros_newman_tmp_angle_fp -\fp_new:N \l__chemmacros_newman_abs_angle_fp -\fp_zero:N \l__chemmacros_newman_abs_angle_fp -\fp_new:N \l__chemmacros_newman_scale_fp -\fp_set:Nn \l__chemmacros_newman_scale_fp { 1 } -\fp_new:N \l__chemmacros_newman_x_fp -\fp_new:N \l__chemmacros_newman_y_fp - -\tl_new:N \l__chemmacros_newman_tikz_ring_tl -\tl_new:N \l__chemmacros_newman_tikz_front_tl -\tl_new:N \l__chemmacros_newman_tikz_back_tl +\fp_new:N \l__chemmacros_newman_rel_angle_fp +\fp_zero:N \l__chemmacros_newman_rel_angle_fp +\fp_new:N \l__chemmacros_newman_tmp_angle_fp +\fp_new:N \l__chemmacros_newman_abs_angle_fp +\fp_zero:N \l__chemmacros_newman_abs_angle_fp +\fp_new:N \l__chemmacros_newman_scale_fp +\fp_set:Nn \l__chemmacros_newman_scale_fp { 1 } +\fp_new:N \l__chemmacros_newman_x_fp +\fp_new:N \l__chemmacros_newman_y_fp + +\tl_new:N \l__chemmacros_newman_tikz_ring_tl +\tl_new:N \l__chemmacros_newman_tikz_front_tl +\tl_new:N \l__chemmacros_newman_tikz_back_tl \bool_new:N \l__chemmacros_newman_tikz_back_bool @@ -3050,7 +2956,7 @@ % place atoms: % #1: angle % #2 - #7: atoms -\cs_new:Npn \chemmacros_newman_atoms:nnnnnnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \chemmacros_newman_atoms:nnnnnnn #1#2#3#4#5#6#7 { \tl_if_blank:nTF { #1 } { @@ -3107,14 +3013,14 @@ % #2: fp variable for y % #3: angle % #4: radius -\cs_new:Npn \chemmacros_polar_to_cartesian:NNnn #1#2#3#4 +\cs_new_protected:Npn \chemmacros_polar_to_cartesian:NNnn #1#2#3#4 { \fp_set:Nn #1 { #4 * cos( #3 / 180 * pi ) }% x \fp_set:Nn #2 { #4 * sin( #3 / 180 * pi ) }% y } % place back nodes -\cs_new:Npn \chemmacros_newman_back_node:nn #1#2 +\cs_new_protected:Npn \chemmacros_newman_back_node:nn #1#2 { \group_begin: \fp_add:Nn \l__chemmacros_newman_rel_angle_fp { #1 } @@ -3155,7 +3061,7 @@ \cs_generate_variant:Nn \chemmacros_newman_back_node:nn { nf } % place front nodes: -\cs_new:Npn \chemmacros_newman_front_node:nn #1#2 +\cs_new_protected:Npn \chemmacros_newman_front_node:nn #1#2 { \chemmacros_polar_to_cartesian:NNnn \l__chemmacros_newman_x_fp @@ -3185,27 +3091,27 @@ } \cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % \orbital[]{} % variables: -\bool_new:N \l__chemmacros_orbital_type_s_bool -\bool_new:N \l__chemmacros_orbital_type_p_bool -\bool_new:N \l__chemmacros_orbital_type_sp_bool -\bool_new:N \l__chemmacros_orbital_type_sptwo_bool -\bool_new:N \l__chemmacros_orbital_type_spthree_bool -\bool_new:N \l__chemmacros_orbital_s_phase_bool +\bool_new:N \l__chemmacros_orbital_type_s_bool +\bool_new:N \l__chemmacros_orbital_type_p_bool +\bool_new:N \l__chemmacros_orbital_type_sp_bool +\bool_new:N \l__chemmacros_orbital_type_sptwo_bool +\bool_new:N \l__chemmacros_orbital_type_spthree_bool +\bool_new:N \l__chemmacros_orbital_s_phase_bool \bool_set_true:N \l__chemmacros_orbital_s_phase_bool -\bool_new:N \l__chemmacros_orbital_p_phase_bool +\bool_new:N \l__chemmacros_orbital_p_phase_bool \bool_set_true:N \l__chemmacros_orbital_p_phase_bool -\bool_new:N \l__chemmacros_orbital_sp_phase_bool +\bool_new:N \l__chemmacros_orbital_sp_phase_bool \bool_set_true:N \l__chemmacros_orbital_sp_phase_bool -\bool_new:N \l__chemmacros_orbital_sptwo_phase_bool +\bool_new:N \l__chemmacros_orbital_sptwo_phase_bool \bool_set_true:N \l__chemmacros_orbital_sptwo_phase_bool -\bool_new:N \l__chemmacros_orbital_spthree_phase_bool +\bool_new:N \l__chemmacros_orbital_spthree_phase_bool \bool_set_true:N \l__chemmacros_orbital_spthree_phase_bool -\bool_new:N \l__chemmacros_orbital_p_half_bool -\bool_new:N \l__chemmacros_orbital_overlay_bool -\bool_new:N \l__chemmacros_orbital_opacity_bool +\bool_new:N \l__chemmacros_orbital_p_half_bool +\bool_new:N \l__chemmacros_orbital_overlay_bool +\bool_new:N \l__chemmacros_orbital_opacity_bool \tl_new:N \l__chemmacros_orbital_s_color_tl \tl_set:Nn \l__chemmacros_orbital_s_color_tl { black } @@ -3260,9 +3166,9 @@ { opacity = { \fp_use:N \l__chemmacros_orbital_opacity_fp } } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % s-orbitals -\cs_new:Npn \__chemmacros_orbital_type_s: +\cs_new_protected:Npn \__chemmacros_orbital_type_s: { \bool_set_true:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool @@ -3282,7 +3188,7 @@ color .tl_set:N = \l__chemmacros_orbital_s_color_tl } -\cs_new:Npn \__chemmacros_orbital_s_draw:n #1 +\cs_new_protected:Npn \__chemmacros_orbital_s_draw:n #1 { \keys_set:nn { chemmacros / orbital / s } { #1 } \bool_if:NTF \l__chemmacros_orbital_s_phase_bool @@ -3309,9 +3215,9 @@ } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % p-orbitals -\cs_new:Npn \__chemmacros_orbital_type_p: +\cs_new_protected:Npn \__chemmacros_orbital_type_p: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_true:N \l__chemmacros_orbital_type_p_bool @@ -3334,7 +3240,7 @@ half .default:n = true } -\cs_new:Npn \__chemmacros_orbital_p_draw:n #1 +\cs_new_protected:Npn \__chemmacros_orbital_p_draw:n #1 { \keys_set:nn { chemmacros / orbital / p } { #1 } \bool_if:NTF \l__chemmacros_orbital_p_phase_bool @@ -3405,9 +3311,9 @@ } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % sp-orbitals -\cs_new:Npn \__chemmacros_orbital_type_sp: +\cs_new_protected:Npn \__chemmacros_orbital_type_sp: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool @@ -3428,7 +3334,7 @@ color .tl_set:N = \l__chemmacros_orbital_sp_color_tl } -\cs_new:Npn \__chemmacros_orbital_sp_draw:n #1 +\cs_new_protected:Npn \__chemmacros_orbital_sp_draw:n #1 { \keys_set:nn { chemmacros / orbital / sp } { #1 } \bool_if:NTF \l__chemmacros_orbital_sp_phase_bool @@ -3496,9 +3402,9 @@ } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % sp2-orbitals -\cs_new:Npn \__chemmacros_orbital_type_sptwo: +\cs_new_protected:Npn \__chemmacros_orbital_type_sptwo: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool @@ -3519,7 +3425,7 @@ color .tl_set:N = \l__chemmacros_orbital_sptwo_color_tl } -\cs_new:Npn \__chemmacros_orbital_sptwo_draw:n #1 +\cs_new_protected:Npn \__chemmacros_orbital_sptwo_draw:n #1 { \keys_set:nn { chemmacros / orbital / sp2 } { #1 } \bool_if:NTF \l__chemmacros_orbital_sptwo_phase_bool @@ -3587,9 +3493,9 @@ } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % sp3-orbitals -\cs_new:Npn \__chemmacros_orbital_type_spthree: +\cs_new_protected:Npn \__chemmacros_orbital_type_spthree: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool @@ -3610,7 +3516,7 @@ color .tl_set:N = \l__chemmacros_orbital_spthree_color_tl } -\cs_new:Npn \__chemmacros_orbital_spthree_draw:n #1 +\cs_new_protected:Npn \__chemmacros_orbital_spthree_draw:n #1 { \keys_set:nn { chemmacros / orbital / sp3 } { #1 } \bool_if:NTF \l__chemmacros_orbital_spthree_phase_bool @@ -3678,7 +3584,7 @@ } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % main command \keys_define:nn { chemmacros / orbital } { @@ -3702,7 +3608,7 @@ sp3 .code:n = { \__chemmacros_orbital_type_spthree: } } -\cs_new:Npn \chemmacros_orbital:n #1 +\cs_new_protected:Npn \chemmacros_orbital:n #1 { \bool_if:NT \l__chemmacros_orbital_type_s_bool { \__chemmacros_orbital_s_draw:n { #1 } } @@ -3726,7 +3632,7 @@ \group_end: } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % arrow tips for electron movement \dim_new:N \l__chemmacros_el_length_dim @@ -3815,22 +3721,30 @@ \pgfusepathqfillstroke } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % setup \NewDocumentCommand \chemsetup { o m } { \IfNoValueTF { #1 } { \keys_set:nn { chemmacros } { #2 } } - { \keys_set:nn { chemmacros / #1 } { #2 } } + { + \bool_if:NTF \l__chemmacros_version_four_bool + { + \tl_if_eq:nnTF { #1 } { chemformula } + { \setchemformula { #2 } } + { \keys_set:nn { chemmacros / #1 } { #2 } } + } + { \keys_set:nn { chemmacros / #1 } { #2 } } + } \ignorespaces } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % load old definitions: \bool_if:NT \l__chemmacros_version_one_bool { \file_input:n { chemmacros-version1 . cfg } } -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- % hyperref support % ?? unsure about adding IUPAC commands \AfterPackage* { hyperref } @@ -3839,15 +3753,72 @@ { \cs_set:Npn \- { - }% myabe not a good idea... \cs_set:Npn \| { } - \cs_set:Npn \iupac #1 { #1 } \cs_set:Npn \pH { pH } \cs_set:Npn \pOH { pOH } - } + \cs_set:Npn \iupac #1 { #1 } + % \cs_set:Npn \a { alpha } + % \cs_set:Npn \g { gamma } + % \cs_set:Npn \d { delta } + % \cs_set:Npn \m { mu } + % \cs_set:Npn \n { eta } + % \cs_set:Npn \w { omega } + % \cs_set:Npn \N { N } + % \cs_set:Npn \O { O } + % \cs_set:Npn \Sf { S } + % \cs_set:Npn \P { P } + % \cs_set:Npn \R { (R) } + \cs_set:Npn \cip #1 { (#1) } + % \cs_set:Npn \E { (E) } + % \cs_set:Npn \Z { (Z) } + \cs_set:Npn \cis { cis } + \cs_set:Npn \trans { trans } + \cs_set:Npn \tert { tert } + % \cs_set:Npn \D { D } + \cs_set:Npn \ortho { o } + \cs_set:Npn \meta { m } + \cs_set:Npn \para { p } + \cs_set:Npn \syn { syn } + \cs_set:Npn \anti { anti } + } + } + +% -------------------------------------------------------------------------- +% language support -- provided through `translations' +% equilibrium constants: +\DeclareTranslationFallback{K-acid}{A} +\DeclareTranslationFallback{K-base}{B} +\DeclareTranslationFallback{K-water}{W} +\DeclareTranslation{German}{K-acid}{S} +% phases: +\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 } +\DeclareTranslation{German} {list-of-reactions} { Reaktionsverzeichnis } +\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 ~ } + +\tl_set:Nn \l__chemmacros_reaction_lorname_tl + { + \chemmacros_translate:nn + {lor-reaction} { Reaction ~ } + } +\tl_set:Nn \reactionlistname + { + \chemmacros_translate:nn + {list-of-reactions} { List ~ of ~ reactions } } \tex_endinput:D -% --------------------------------------------------------------------------- % +% -------------------------------------------------------------------------- Version history 2011/05/15 - version 1.0 - CTAN release 2011/06/22 - version 1.1 - "LaTeXified" whole package for safer usage @@ -4005,11 +3976,39 @@ Version history 2013/04/19 - version 3.6b - chemformula: new key `arrow-min-length' - bug fix: stoichiometric fractions correctly displayed - changed appearance of \cip to use upright parentheses +2013/07/06 - version 4.0 - `chemformula' doesn't automatically load + `chemmacros' any more but can be used stand-alone + - option `bpchem' has been dropped + - improved detection of bold font series + - changed wrongly used \mbox in definition of \Ka, + \Kb and \Kw into \ensuremath + - adapt \mch and \pch to match `chemformula's + charges + - dropped option `method=mhchem' + - support for `kpfonts' and `newtxmath' upright + greek letters added, greek alphabet complete both + for uppercase and lowercase; this is handled by + the new package in the family: `chemgreek' + - \OX and \redox now work in `amsmath's environment + by ignoring the measuring phase + - language management with the halp of the + `translations' package => + recognize document language automatically and use + it if it a) is known to `chemmacros' and b) has + not been overwritten by the `language' option; + this also made minor changes to `ghsystem' + necessary; additionally this lead to changes in + the way phases are defined + - status of \Dfi and \Lfi changed from `deprecated' + to `dropped' + - new option `charges/partial-format' + - fixed wrongly written contents to the lor when + used together with `hyperref' + - new option `reaction/list-heading' + - option `charges/append' deprecated + % --------------------------------------------------------------------------- % -% TODO: -- ox-option xfrac vs math? -- drop option `bpchem' +% TODO: fuer version 4 - add d-orbitals -- add kpfonts to `greek' option so \Chemalpha and kin use \alphaup ... of kpfonts - package \ No newline at end of file +- make electron movement arrow tips (`el', `left el' and `right el') public diff --git a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty index 90e387ff1d8..5f552b8e2a0 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty @@ -26,13 +26,29 @@ % - - % % - The Current Maintainer of this work is Clemens Niederberger. - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{ chemmacros } +\RequirePackage{ expl3, xparse, l3keys2e } +\def\ghsystem@version{4.0} +\def\ghsystem@date{2013/07/06} \ProvidesExplPackage {ghsystem} - {\chemmacros@date} - {\chemmacros@version} + {\ghsystem@date} + {\ghsystem@version} {globally harmonised system} +% -------------------------------------------------------------------------- +% check expl3 version: +\@ifpackagelater { expl3 } { 2012/11/21 } + { } + { + \PackageError { ghsystem } { Support~package~expl3~too~old } + { + You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ + 'l3packages'.\MessageBreak + Loading~ghsystem~will~abort! + } + \tex_endinput:D + } + % --------------------------------------------------------------------------- % % error and warning messages: \msg_set:nnnn { ghsystem } { explicit } @@ -62,6 +78,45 @@ sure~to~load~it~in~your~preamble. } +\cs_new_protected:Npn \ghsystem_msg:nnxx #1#2#3#4 + { + \bool_if:NTF \l__ghsystem_strict_bool + { \msg_error:nnxx { #1 } { #2 } { #3 } { #4 } } + { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } + } + +% -------------------------------------------------------------------------- +% package options: +\bool_new:N \l__ghsystem_strict_bool +\keys_define:nn { chemmacros / ghsystem } + { + strict .bool_set:N = \l__ghsystem_strict_bool , + strict .default:n = true , + language .code:n = \ghsystem_load_language:n { #1 } + } + +\AtBeginDocument + { + \@ifpackageloaded{ chemmacros } + { + \bool_if:NT \l_chemmacros_strict_bool + { \bool_set_true:N \l__ghsystem_strict_bool } + } + { + \cs_new:Npn \iupac #1 + { + \group_begin: + \cs_set_eq:NN \| \scan_stop: + #1 + \group_end: + } + } + } + +% --------------------------------------------------------------------------- % +% variants of kernel functions: +\cs_generate_variant:Nn \file_if_exist:nTF { x } + % --------------------------------------------------------------------------- % % scratch variables \tl_new:N \l__ghsystem_tmpa_tl @@ -69,13 +124,8 @@ \int_new:N \l__ghsystem_tmpa_int \int_new:N \l__ghsystem_tmpb_int -% --------------------------------------------------------------------------- % -% gobble options -\DeclareOption* { } -\ProcessOptions \scan_stop: - % load required packages: -\RequirePackage{ graphicx , tabu , longtable , ifpdf } +\RequirePackage{ translations , siunitx , graphicx , longtable , ifpdf } % --------------------------------------------------------------------------- % % define variables: @@ -126,7 +176,10 @@ \tl_new:N \l__ghsystem_table_caption_short_tl \tl_new:N \l__ghsystem_table_label_tl \tl_set:Nn \l__ghsystem_table_label_tl { tab : ghs-hp-statements } +\tl_new:N \l__ghsystem_list_all_column_format_tl +\dim_new:N \l__ghsystem_list_all_column_width_dim +\dim_set:Nn \l__ghsystem_list_all_column_width_dim { .7\linewidth } \dim_new:N \l__ghsystem_table_line_sep_dim \dim_set:Nn \l__ghsystem_table_line_sep_dim { 3pt } @@ -142,46 +195,63 @@ \bool_new:N \l__ghsystem_language_file_loaded_bool \bool_new:N \l__ghsystem_language_directory_bool -\file_if_exist:nTF { language / ghsystem_english_def } - { \bool_set_true:N \l__ghsystem_language_directory_bool } - { \bool_set_false:N \l__ghsystem_language_directory_bool } +% load the language file -- it needs expl3 namespace but shouldn't care about +% what catcode regime was before and simply restore it -\bool_if:NTF \l__ghsystem_language_directory_bool +\cs_new:Npn \__ghsystem_namespace_restore: {} + +\cs_new_protected:Npn \__ghsystem_expl_namespace: { - \prop_map_inline:Nn \l__chemmacros_language_prop - { - \bool_if:cT { l__chemmacros_#1_bool } - { - \file_if_exist:nTF { language / ghsystem_#2.def } - { - \bool_set_true:N \l__ghsystem_language_file_loaded_bool - \input { language / ghsystem_#2.def } \ExplSyntaxOn - } - { \input { language / ghsystem_english.def } \ExplSyntaxOn } - } - } + \group_begin: + \cs_gset_protected:Npx \__ghsystem_namespace_restore: + { + \char_set_catcode:nn { 9 } { \char_value_catcode:n { 9 } } + \char_set_catcode:nn { 32 } { \char_value_catcode:n { 32 } } + \char_set_catcode:nn { 34 } { \char_value_catcode:n { 34 } } + \char_set_catcode:nn { 38 } { \char_value_catcode:n { 38 } } + \char_set_catcode:nn { 58 } { \char_value_catcode:n { 58 } } + \char_set_catcode:nn { 94 } { \char_value_catcode:n { 94 } } + \char_set_catcode:nn { 95 } { \char_value_catcode:n { 95 } } + \char_set_catcode:nn { 124 } { \char_value_catcode:n { 124 } } + \char_set_catcode:nn { 126 } { \char_value_catcode:n { 126 } } + \tex_endlinechar:D = \tex_the:D \tex_endlinechar:D \scan_stop: + } + \group_end: + \ExplSyntaxOn + } + +\cs_new:Npn \ghsystem_load_language_file:n #1 + { + \__ghsystem_expl_namespace: + \input ghsystem_#1.def \scan_stop: + \__ghsystem_namespace_restore: } + +\cs_new_protected:Npn \ghsystem_load_language:n #1 { - \prop_map_inline:Nn \l__chemmacros_language_prop + \file_if_exist:xTF { ghsystem_ #1 .def } { - \bool_if:cT { l__chemmacros_#1_bool } - { - \file_if_exist:nTF { ghsystem_#2.def } - { - \bool_set_true:N \l__ghsystem_language_file_loaded_bool - \input { ghsystem_#2.def } \ExplSyntaxOn - } - { \input { ghsystem_english.def } \ExplSyntaxOn } - } + \bool_set_true:N \l__ghsystem_language_file_loaded_bool + \ghsystem_load_language_file:n { #1 } } + { \ghsystem_load_language_file:n { english } } } +\cs_generate_variant:Nn \ghsystem_load_language:n { V } -\bool_if:NF \l__ghsystem_language_file_loaded_bool - { - \bool_if:NTF \l__ghsystem_language_directory_bool - { \input { language / ghsystem_english.def } \ExplSyntaxOn } - { \input { ghsystem_english.def } \ExplSyntaxOn } - } +\NewDocumentCommand \loadghsystemlanguage { m } + { \ghsystem_load_language:n { #1 } } + +\AtBeginDocument{ + \bool_if:NF \l__ghsystem_language_file_loaded_bool + { + \cs_if_exist:NTF \l_chemmacros_language_tl + { \ghsystem_load_language:V \l_chemmacros_language_tl } + { + \ghsystem_load_language:n + { \@trnslt@language{\@trnslt@current@language} } + } + } +} \cs_new_nopar:Nn \ghsystem_booktabs:n { @@ -193,12 +263,6 @@ % define options: \keys_define:nn { chemmacros / ghsystem } { - % general options: - language .code:n = - \bool_set_true:c { l__ghsystem_#1_bool } - \bool_if:NTF \l__ghsystem_language_directory_bool - { \input { language / ghsystem_#1.def } } - { \input { ghsystem_#1.def } } , % \ghs options: hide .bool_set:N = \l__ghsystem_hide_statement_bool , @@ -289,10 +353,16 @@ \tl_clear:N \l__ghsystem_table_top_head_rule_tl \tl_clear:N \l__ghsystem_table_foot_rule_tl \tl_clear:N \l__ghsystem_table_last_foot_rule_tl , - table-caption .tl_set:N = \l__ghsystem_table_caption_tl , + table-caption .tl_set:N = + \l__ghsystem_table_caption_tl , table-caption-short .tl_set:N = \l__ghsystem_table_caption_short_tl , - table-label .tl_set:N = \l__ghsystem_table_label_tl + table-label .tl_set:N = + \l__ghsystem_table_label_tl , + table-column-format .tl_set:N = + \l__ghsystem_list_all_column_format_tl , + table-column-width .dim_set:N = + \l__ghsystem_list_all_column_width_dim } % --------------------------------------------------------------------------- % @@ -318,7 +388,7 @@ \bool_if:NF \l__ghsystem_hide_statement_bool { \tl_use:N \l__ghsystem_tmpb_tl } } - { \chemmacros_msg:nnxx { ghsystem } { statements } { #1 } { #2 } } + { \ghsystem_msg:nnxx { ghsystem } { statements } { #1 } { #2 } } } \cs_new_protected:Nn \__ghsystem_get_type:nN @@ -400,8 +470,13 @@ \int_zero:N \l__ghsystem_tmpa_int \int_zero:N \l__ghsystem_tmpb_int \prop_map_inline:Nn \l__ghsystem_p_prop { \int_incr:N \l__ghsystem_tmpa_int } - \dim_set_eq:NN \tabulinesep \l__ghsystem_table_line_sep_dim - \begin { longtabu } { X[3]X[7,L] } + \dim_set_eq:NN \extrarowheight \l__ghsystem_table_line_sep_dim + \begin { longtable } + { + l + >{ \l__ghsystem_list_all_column_format_tl } + p{ \l__ghsystem_list_all_column_width_dim } + } \caption [ \l__ghsystem_table_caption_short_tl ] { \l__ghsystem_table_caption_tl @@ -435,7 +510,7 @@ \__ghsystem_read_number:nn { P } { ##1 } & ##2 \int_compare:nNnT { \l__ghsystem_tmpb_int } < { \l__ghsystem_tmpa_int } { \\ } } - \end { longtabu } + \end { longtable } } \cs_new:Nn \__ghsystem_read_number:nn @@ -491,37 +566,49 @@ \cs_new_protected:Npn \ghsystem_pic:n #1 { - \file_if_exist:nTF { pictures / ghsystem_ #1 . \l__ghsystem_picture_type_tl } - { \bool_set_true:N \l__ghsystem_picture_directory_bool } - { \bool_set_false:N \l__ghsystem_picture_directory_bool } - \bool_if:NTF \l__ghsystem_picture_directory_bool - { - \__ghsystem_includegraphics:xn - { - scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp - \l__ghsystem_picture_includegraphics_tl - } - { pictures / ghsystem_ #1 . \l__ghsystem_picture_type_tl } - } + \__ghsystem_includegraphics:xn { - \__ghsystem_includegraphics:xn - { - scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp - \l__ghsystem_picture_includegraphics_tl - } - { ghsystem_ #1 . \l__ghsystem_picture_type_tl } + scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp + \exp_not:V \l__ghsystem_picture_includegraphics_tl } + { ghsystem_ #1 . \l__ghsystem_picture_type_tl } } \cs_new:Nn \__ghsystem_includegraphics:nn { \includegraphics[#1]{#2} } \cs_generate_variant:Nn \__ghsystem_includegraphics:nn { xn } +% -------------------------------------------------------------------------- +% options and setup +\ProcessKeysOptions{ chemmacros / ghsystem } + +\cs_new_protected:Npn \ghsystem_setup:n #1 + { \keys_set:nn { chemmacros / ghsystem } { #1 } } + +\NewDocumentCommand \ghssetup { m } + { \ghsystem_setup:n { #1 } } + \tex_endinput:D %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VERSION HISTORY -see the chemmacros.sty file +2012/01/30 - version 3.0a - renamed ghs => ghsystem to make the names unique + (following a request by Karl Berry for TeXlive) +2012/02/05 - version 3.0c - renamed pictogram files (following a request by + Karl Berry for TeXlive) +2012/05/13 - version 3.3a - Italian translations of the H, EUH and P statements +2012/05/18 - version 3.3b - compatibility with MiKTeX +2012/05/18 - version 3.3c - fix in the `ghsystem/language' option +2012/07/24 - version 3.3d - additional picture file type `pdf' +2013/02/19 - version 3.5a - bug fix: `ghsystem' recognizes language again +2013/07/06 - version 4.0 - dropped requirement of `tabu' package. + - new options `table-column-width' and + `table-column-format' + - adapted to changed language setting mechanism in + `chemmacros' + - new command: \loadghsystemlanguage + - the package can be used independently from + `chemmacros' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: -- add option to switch between `longtable` and `supertabular` for \ghslistall ? \ No newline at end of file +- add option to switch between `longtable` and `supertabular` for \ghslistall ? diff --git a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def index e4324bc4c71..4dc71bee897 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def +++ b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def @@ -27,7 +27,6 @@ % - - % % - The Current Maintainer of this work is Clemens Niederberger. - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\ExplSyntaxOn % ENGLISH DEFINITIONS \prop_clear:N \l__ghsystem_h_prop \prop_clear:N \l__ghsystem_euh_prop @@ -45,7 +44,13 @@ { \bool_if:NT \l__ghsystem_fill_in_bool { - \c_space_tl \textit{\textless state~route~of~ex\-po\-sure~if~it~is~ con\-clu\-sive\-ly~pro\-ven~that~no~other~routes~of~ex\-po\-sure~cause~the~ha\-zard \textgreater} + \c_space_tl + \textit{ + \textless state~ route~ of~ exposure~ if~ it~ is~ + conclusively~ proven~ that~ no~ other~ routes~ of~ + exposure~ cause~ the~ hazard + \textgreater + } } } @@ -54,7 +59,10 @@ { \bool_if:NT \l__ghsystem_fill_in_bool { - \c_space_tl \textit{\textless state~spe\-ci\-fic~effect~if~known \textgreater} + \c_space_tl + \textit{ + \textless state~ specific~ effect~ if~ known \textgreater + } } } @@ -63,7 +71,10 @@ { \bool_if:nT { \l__ghsystem_fill_in_bool && !\l__ghsystem_organs_bool } { - \c_space_tl \textit{\textless or~state~all~or\-gans~affec\-ted,~if~known \textgreater} + \c_space_tl + \textit{ + \textless or~ state~ all~ organs~ affected,~ if~ known \textgreater + } } } @@ -72,272 +83,696 @@ { \bool_if:NF \l__ghsystem_substance_bool { - \c_space_tl \textit{\textless name~of~sen\-si\-ti\-sing~sub\-stance \textgreater} + \c_space_tl + \textit{ + \textless name~ of~ sensitising~ substance \textgreater + } } } % HAZARD STATEMENTS (Annex 3) % 1. Hazard Statements % 1.1 Physical Hazards -\prop_put:Nnn \l__ghsystem_h_prop { 200 } { Un\-stable~ex\-plo\-sives. } -\prop_put:Nnn \l__ghsystem_h_prop { 201 } { Ex\-plo\-sive;~mass~ex\-plo\-sion~ha\-zard. } -\prop_put:Nnn \l__ghsystem_h_prop { 202 } { Ex\-plo\-sive,~se\-vere~pro\-jec\-tion~ha\-zard. } -\prop_put:Nnn \l__ghsystem_h_prop { 203 } { Ex\-plo\-sive;~fire,~blast~or~pro\-jec\-tion~ha\-zard. } -\prop_put:Nnn \l__ghsystem_h_prop { 204 } { Fire~or~pro\-jec\-tion~ha\-zard. } -\prop_put:Nnn \l__ghsystem_h_prop { 205 } { May~mass~ex\-plode~in~fire. } -\prop_put:Nnn \l__ghsystem_h_prop { 220 } { Ex\-treme\-ly~flammable~gas. } -\prop_put:Nnn \l__ghsystem_h_prop { 221 } { Flammable~gas. } -\prop_put:Nnn \l__ghsystem_h_prop { 222 } { Ex\-treme\-ly~flammable~aero\-sol. } -\prop_put:Nnn \l__ghsystem_h_prop { 223 } { Flammable~aero\-sol. } -\prop_put:Nnn \l__ghsystem_h_prop { 224 } { Ex\-treme\-ly~flammable~li\-quid~and~va\-pour. } -\prop_put:Nnn \l__ghsystem_h_prop { 225 } { High\-ly~flammable~liquid~and~va\-pour. } -\prop_put:Nnn \l__ghsystem_h_prop { 226 } { Flammable~li\-quid~and~va\-pour. } -\prop_put:Nnn \l__ghsystem_h_prop { 228 } { Flammable~so\-lid. } -\prop_put:Nnn \l__ghsystem_h_prop { 240 } { Heating~may~cause~an~ex\-plo\-sion. } -\prop_put:Nnn \l__ghsystem_h_prop { 241 } { Heating~may~cause~a~fire~or~ex\-plo\-sion. } -\prop_put:Nnn \l__ghsystem_h_prop { 242 } { Heating~may~cause~a~fire. } -\prop_put:Nnn \l__ghsystem_h_prop { 250 } { Catches~fire~spon\-ta\-ne\-ous\-ly~if~ex\-po\-sed~to~air. } -\prop_put:Nnn \l__ghsystem_h_prop { 251 } { Self-heating : ~may~catch~fire. } -\prop_put:Nnn \l__ghsystem_h_prop { 252 } { Self-heating~in~large~quan\-ti\-ties;~may~catch~fire. } -\prop_put:Nnn \l__ghsystem_h_prop { 260 } { In~con\-tact~with~wa\-ter~re\-leases~flammable~ga\-ses~which~may~ig\-nite~spon\-ta\-ne\-ous\-ly. } -\prop_put:Nnn \l__ghsystem_h_prop { 261 } { In~con\-tact~with~wa\-ter~re\-leases~flammable~ga\-ses. } -\prop_put:Nnn \l__ghsystem_h_prop { 270 } { May~cause~or~in\-ten\-si\-fy~fire;~oxi\-di\-ser. } -\prop_put:Nnn \l__ghsystem_h_prop { 271 } { May~cause~fire~or~ex\-plo\-sion;~strong~oxi\-di\-ser. } -\prop_put:Nnn \l__ghsystem_h_prop { 272 } { May~in\-ten\-si\-fy~fire;~oxi\-di\-ser. } -\prop_put:Nnn \l__ghsystem_h_prop { 280 } { Con\-tains~gas~un\-der~pressure;~may~ex\-plode~if~heated. } -\prop_put:Nnn \l__ghsystem_h_prop { 281 } { Con\-tains~re\-fri\-ge\-ra\-ted~gas;~may~cause~cryo\-ge\-nic~burns~or~in\-ju\-ry. } -\prop_put:Nnn \l__ghsystem_h_prop { 290 } { May~be~corro\-sive~to~me\-tals. } +\prop_put:Nnn \l__ghsystem_h_prop { 200 } + { Unstable~ explosives. } +\prop_put:Nnn \l__ghsystem_h_prop { 201 } + { Explosive;~ mass~ explosion~ hazard. } +\prop_put:Nnn \l__ghsystem_h_prop { 202 } + { Explosive,~ severe~ projection~hazard. } +\prop_put:Nnn \l__ghsystem_h_prop { 203 } + { Explosive;~ fire,~ blast~ or~ projection~hazard. } +\prop_put:Nnn \l__ghsystem_h_prop { 204 } + { Fire~ or~ projection~ hazard. } +\prop_put:Nnn \l__ghsystem_h_prop { 205 } + { May~ mass~ explode~ in~ fire. } +\prop_put:Nnn \l__ghsystem_h_prop { 220 } + { Extremely~ flammable~ gas. } +\prop_put:Nnn \l__ghsystem_h_prop { 221 } + { Flammable~ gas. } +\prop_put:Nnn \l__ghsystem_h_prop { 222 } + { Extremely~ flammable~ aerosol. } +\prop_put:Nnn \l__ghsystem_h_prop { 223 } + { Flammable~ aerosol. } +\prop_put:Nnn \l__ghsystem_h_prop { 224 } + { Extremely~ flammable~ liquid~ and~ vapour. } +\prop_put:Nnn \l__ghsystem_h_prop { 225 } + { Highly~ flammable~ liquid~ and~ vapour. } +\prop_put:Nnn \l__ghsystem_h_prop { 226 } + { Flammable~ liquid~ and~ vapour. } +\prop_put:Nnn \l__ghsystem_h_prop { 228 } + { Flammable~ solid. } +\prop_put:Nnn \l__ghsystem_h_prop { 240 } + { Heating~ may~ cause~ an~ explosion. } +\prop_put:Nnn \l__ghsystem_h_prop { 241 } + { Heating~ may~ cause~ a~ fire~ or~ explosion. } +\prop_put:Nnn \l__ghsystem_h_prop { 242 } + { Heating~ may~ cause~ a~ fire. } +\prop_put:Nnn \l__ghsystem_h_prop { 250 } + { Catches~ fire~ spontaneously~ if~ exposed~ to~ air. } +\prop_put:Nnn \l__ghsystem_h_prop { 251 } + { Self-heating:~ may~ catch~ fire. } +\prop_put:Nnn \l__ghsystem_h_prop { 252 } + { Self-heating~ in~ large~ quantities;~ may~ catch~ fire. } +\prop_put:Nnn \l__ghsystem_h_prop { 260 } + { + In~ contact~ with~ water~ releases~ flammable~ gases~ which~ may~ ignite~ + spontaneously. + } +\prop_put:Nnn \l__ghsystem_h_prop { 261 } + { In~ contact~ with~ water~ releases~ flammable~ gases. } +\prop_put:Nnn \l__ghsystem_h_prop { 270 } + { May~ cause~ or~ intensify~ fire;~ oxidiser. } +\prop_put:Nnn \l__ghsystem_h_prop { 271 } + { May~ cause~ fire~ or~ explosion;~ strong~ oxidiser. } +\prop_put:Nnn \l__ghsystem_h_prop { 272 } + { May~ intensify~ fire;~ oxidiser. } +\prop_put:Nnn \l__ghsystem_h_prop { 280 } + { Contains~ gas~ under~ pressure;~ may~ explode~ if~ heated. } +\prop_put:Nnn \l__ghsystem_h_prop { 281 } + { Contains~ refrigerated~ gas;~ may~ cause~ cryogenic~ burns~ or~ injury. } +\prop_put:Nnn \l__ghsystem_h_prop { 290 } + { May~ be~ corrosive~ to~ metals. } % 1.2 Health Hazards -\prop_put:Nnn \l__ghsystem_h_prop { 300 } { Fa\-tal~if~swallowed. } -\prop_put:Nnn \l__ghsystem_h_prop { 301 } { To\-xic~if~swallowed. } -\prop_put:Nnn \l__ghsystem_h_prop { 302 } { Harm\-ful~if~swallowed. } -\prop_put:Nnn \l__ghsystem_h_prop { 304 } { May~be~fa\-tal~if~swallowed~and~en\-ters~air\-ways. } -\prop_put:Nnn \l__ghsystem_h_prop { 310 } { Fa\-tal~in~con\-tact~with~skin. } -\prop_put:Nnn \l__ghsystem_h_prop { 311 } { To\-xic~in~con\-tact~with~skin. } -\prop_put:Nnn \l__ghsystem_h_prop { 312 } { Harm\-ful~in~con\-tact~with~skin. } -\prop_put:Nnn \l__ghsystem_h_prop { 314 } { Cau\-ses~se\-vere~skin~burns~and~eye~da\-mage. } -\prop_put:Nnn \l__ghsystem_h_prop { 315 } { Cau\-ses~skin~ir\-ri\-ta\-tion. } -\prop_put:Nnn \l__ghsystem_h_prop { 317 } { May~cause~an~aller\-gic~skin~reac\-tion. } -\prop_put:Nnn \l__ghsystem_h_prop { 318 } { Causes~se\-rious~eye~da\-mage. } -\prop_put:Nnn \l__ghsystem_h_prop { 319 } { Causes~se\-rious~eye~irri\-ta\-tion. } -\prop_put:Nnn \l__ghsystem_h_prop { 330 } { Fa\-tal~if~in\-haled. } -\prop_put:Nnn \l__ghsystem_h_prop { 331 } { To\-xic~if~in\-haled. } -\prop_put:Nnn \l__ghsystem_h_prop { 332 } { Harm\-ful~if~in\-haled. } -\prop_put:Nnn \l__ghsystem_h_prop { 334 } { May~cause~aller\-gy~or~asth\-ma~symp\-toms~or\-breathing~diffi\-cul\-ties~if~in\-haled. } -\prop_put:Nnn \l__ghsystem_h_prop { 335 } { May~cause~res\-pi\-ra\-to\-ry~irri\-ta\-tion. } -\prop_put:Nnn \l__ghsystem_h_prop { 336 } { May~cause~drowsi\-ness~or~dizzi\-ness. } -\prop_put:Nnn \l__ghsystem_h_prop { 340 } { May~cause~ge\-ne\-tic~de\-fects. \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 341 } { Sus\-pec\-ted~of~causing~ge\-ne\-tic~de\-fects. \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 350 } { May~cause~can\-cer. \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 351 } { Sus\-pec\-ted~of~causing~cancer. \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 360 } { May~da\-mage~fer\-ti\-li\-ty~or~the~un\-born~child. \ghsystem_effect: \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 361 } { Sus\-pec\-ted~of~da\-ma\-ging~fer\-ti\-li\-ty~or~the~un\-born~child. \ghsystem_effect: \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 362 } { May~cause~harm~to~breast-fed~child\-ren. } -\prop_put:Nnn \l__ghsystem_h_prop { 370 } { Causes~da\-mage \bool_if:NF \l__ghsystem_organs_bool { ~to~or\-gans } \ghsystem_organs: . \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 371 } { May~cause~da\-mage \bool_if:NF \l__ghsystem_organs_bool { ~to~or\-gans } \ghsystem_organs: . \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 372 } { Causes~da\-mage \bool_if:NF \l__ghsystem_organs_bool { ~to~or\-gans } \ghsystem_organs:\ through~pro\-longed~or~re\-pea\-ted~ex\-po\-sure. \ghsystem_exposure: } -\prop_put:Nnn \l__ghsystem_h_prop { 373 } { May~cause~da\-mage \bool_if:NF \l__ghsystem_organs_bool { ~to~or\-gans } \ghsystem_organs:\ through~pro\-longed~or~re\-pea\-ted~ex\-po\-sure. \ghsystem_exposure: } +\prop_put:Nnn \l__ghsystem_h_prop { 300 } + { Fatal~ if~ swallowed. } +\prop_put:Nnn \l__ghsystem_h_prop { 301 } + { Toxic~ if~ swallowed. } +\prop_put:Nnn \l__ghsystem_h_prop { 302 } + { Harmful~ if~ swallowed. } +\prop_put:Nnn \l__ghsystem_h_prop { 304 } + { May~ be~ fatal~ if~ swallowed~ and~ enters~ airways. } +\prop_put:Nnn \l__ghsystem_h_prop { 310 } + { Fatal~ in~ contact~ with~ skin. } +\prop_put:Nnn \l__ghsystem_h_prop { 311 } + { Toxic~ in~ contact~ with~ skin. } +\prop_put:Nnn \l__ghsystem_h_prop { 312 } + { Harmful~ in~ contact~ with~ skin. } +\prop_put:Nnn \l__ghsystem_h_prop { 314 } + { Causes~ severe~ skin~ burns~ and~ eye~ damage. } +\prop_put:Nnn \l__ghsystem_h_prop { 315 } + { Causes~ skin~ irritation. } +\prop_put:Nnn \l__ghsystem_h_prop { 317 } + { May~ cause~ an~ allergic~ skin~ reaction. } +\prop_put:Nnn \l__ghsystem_h_prop { 318 } + { Causes~ serious~ eye~ damage. } +\prop_put:Nnn \l__ghsystem_h_prop { 319 } + { Causes~ serious~ eye~ irritation. } +\prop_put:Nnn \l__ghsystem_h_prop { 330 } + { Fatal~ if~ inhaled. } +\prop_put:Nnn \l__ghsystem_h_prop { 331 } + { Toxic~ if~ inhaled. } +\prop_put:Nnn \l__ghsystem_h_prop { 332 } + { Harmful~ if~ inhaled. } +\prop_put:Nnn \l__ghsystem_h_prop { 334 } + { + May~ cause~ allergy~ or~ asthma~ symptoms~ orbreathing~ difficulties~ if~ + inhaled. + } +\prop_put:Nnn \l__ghsystem_h_prop { 335 } + { May~ cause~ respiratory~ irritation. } +\prop_put:Nnn \l__ghsystem_h_prop { 336 } + { May~ cause~ drowsiness~ or~ dizziness. } +\prop_put:Nnn \l__ghsystem_h_prop { 340 } + { May~ cause~ genetic~ defects. \ghsystem_exposure: } +\prop_put:Nnn \l__ghsystem_h_prop { 341 } + { Suspected~ of~ causing~ genetic~ defects. \ghsystem_exposure: } +\prop_put:Nnn \l__ghsystem_h_prop { 350 } + { May~ cause~ cancer. \ghsystem_exposure: } +\prop_put:Nnn \l__ghsystem_h_prop { 351 } + { Suspected~ of~ causing~ cancer. \ghsystem_exposure: } +\prop_put:Nnn \l__ghsystem_h_prop { 360 } + { + May~ damage~ fertility~ or~ the~ unborn~ child. + \ghsystem_effect: + \ghsystem_exposure: + } +\prop_put:Nnn \l__ghsystem_h_prop { 361 } + { + Suspected~ of~ damaging~ fertility~ or~ the~ unborn~ child. + \ghsystem_effect: + \ghsystem_exposure: + } +\prop_put:Nnn \l__ghsystem_h_prop { 362 } + { May~ cause~ harm~ to~ breast-fed~ children. } +\prop_put:Nnn \l__ghsystem_h_prop { 370 } + { + Causes~ damage + \bool_if:NF \l__ghsystem_organs_bool { ~to~ organs } + \ghsystem_organs: . + \ghsystem_exposure: + } +\prop_put:Nnn \l__ghsystem_h_prop { 371 } + { + May~ cause~ damage + \bool_if:NF \l__ghsystem_organs_bool { ~to~ organs } + \ghsystem_organs: . + \ghsystem_exposure: + } +\prop_put:Nnn \l__ghsystem_h_prop { 372 } + { + Causes~ damage + \bool_if:NF \l__ghsystem_organs_bool { ~to~ organs } + \ghsystem_organs: \c_space_tl + through~ prolonged~ or~ repeated~ exposure. + \ghsystem_exposure: + } +\prop_put:Nnn \l__ghsystem_h_prop { 373 } + { + May~ cause~ damage + \bool_if:NF \l__ghsystem_organs_bool { ~to~ organs } + \ghsystem_organs:\c_space_rl + through~ prolonged~ or~ repeated~ exposure. + \ghsystem_exposure: + } % 1.3 Environmental hazards -\prop_put:Nnn \l__ghsystem_h_prop { 400 } { Ve\-ry~to\-xic~to~aqua\-tic~life. } -\prop_put:Nnn \l__ghsystem_h_prop { 410 } { Ve\-ry~to\-xic~to~aqua\-tic~life~with~long~las\-ting~effects. } -\prop_put:Nnn \l__ghsystem_h_prop { 411 } { To\-xic~to~aqua\-tic~life~with~long~las\-ting~effects. } -\prop_put:Nnn \l__ghsystem_h_prop { 412 } { Harm\-ful~to~aqua\-tic~life~ with~long~las\-ting~effects. } -\prop_put:Nnn \l__ghsystem_h_prop { 413 } { May~cause~long~las\-ting~harm\-ful~effects~to~aqua\-tic~life. } +\prop_put:Nnn \l__ghsystem_h_prop { 400 } + { Very~ toxic~ to~ aquatic~ life. } +\prop_put:Nnn \l__ghsystem_h_prop { 410 } + { Very~ toxic~ to~ aquatic~ life~ with~ long~ lasting~ effects. } +\prop_put:Nnn \l__ghsystem_h_prop { 411 } + { Toxic~ to~ aquatic~ life~ with~ long~ lasting~ effects. } +\prop_put:Nnn \l__ghsystem_h_prop { 412 } + { Harmful~ to~ aquatic~ life~ with~ long~ lasting~ effects. } +\prop_put:Nnn \l__ghsystem_h_prop { 413 } + { May~ cause~ long~ lasting~ harmful~ effects~ to~ aquatic~ life. } % 2 Supplemental Hazard Informations % 2.1 Physical Properties -\prop_put:Nnn \l__ghsystem_euh_prop { 001 } { Ex\-plo\-sive~when~dry. } -\prop_put:Nnn \l__ghsystem_euh_prop { 006 } { Ex\-plo\-sive~with~or~with\-out~con\-tact~with~air. } -\prop_put:Nnn \l__ghsystem_euh_prop { 014 } { Reacts~vio\-lent\-ly~with~wa\-ter. } -\prop_put:Nnn \l__ghsystem_euh_prop { 018 } { In~use~may~form~flammable/ex\-plo\-sive~va\-pour-air~mix\-ture. } -\prop_put:Nnn \l__ghsystem_euh_prop { 019 } { May~form~ex\-plo\-sive~per\-oxides. } -\prop_put:Nnn \l__ghsystem_euh_prop { 044 } { Risk~of~ex\-plo\-sion~if~heated~un\-der~con\-fine\-ment. } +\prop_put:Nnn \l__ghsystem_euh_prop { 001 } + { Explosive~ when~ dry. } +\prop_put:Nnn \l__ghsystem_euh_prop { 006 } + { Explosive~ with~ or~ without~ contact~ with~ air. } +\prop_put:Nnn \l__ghsystem_euh_prop { 014 } + { Reacts~ violently~ with~ water. } +\prop_put:Nnn \l__ghsystem_euh_prop { 018 } + { In~ use~ may~ form~ flammable\slash explosive~ vapour-air~ mixture. } +\prop_put:Nnn \l__ghsystem_euh_prop { 019 } + { May~ form~ explosive~ peroxides. } +\prop_put:Nnn \l__ghsystem_euh_prop { 044 } + { Risk~ of~ explosion~ if~ heated~ under~ confinement. } % 2.2 Health Properties -\prop_put:Nnn \l__ghsystem_euh_prop { 029 } { Con\-tact~with~wa\-ter~li\-be\-rates~to\-xic~gas. } -\prop_put:Nnn \l__ghsystem_euh_prop { 031 } { Con\-tact~with~acids~li\-be\-rates~to\-xic~gas. } -\prop_put:Nnn \l__ghsystem_euh_prop { 032 } { Con\-tact~with~acids~li\-be\-rates~ve\-ry~to\-xic~gas. } -\prop_put:Nnn \l__ghsystem_euh_prop { 066 } { Re\-pea\-ted~ex\-po\-sure~may~cause~skin~dry\-ness~or~cracking. } -\prop_put:Nnn \l__ghsystem_euh_prop { 070 } { Toxic~by~eye~con\-tact. } -\prop_put:Nnn \l__ghsystem_euh_prop { 071 } { Corro\-sive~to~the~respi\-ra\-to\-ry~tract. } +\prop_put:Nnn \l__ghsystem_euh_prop { 029 } + { Contact~ with~ water~ liberates~ toxic~ gas. } +\prop_put:Nnn \l__ghsystem_euh_prop { 031 } + { Contact~ with~ acids~ liberates~ toxic~ gas. } +\prop_put:Nnn \l__ghsystem_euh_prop { 032 } + { Contact~ with~ acids~ liberates~ very~ toxic~ gas. } +\prop_put:Nnn \l__ghsystem_euh_prop { 066 } + { Repeated~ exposure~ may~ cause~ skin~ dryness~ or~ cracking. } +\prop_put:Nnn \l__ghsystem_euh_prop { 070 } + { Toxic~ by~ eye~ contact. } +\prop_put:Nnn \l__ghsystem_euh_prop { 071 } + { Corrosive~ to~ the~ respiratory~ tract. } % 2.3 Environmental Properties -\prop_put:Nnn \l__ghsystem_euh_prop { 059 } { Ha\-zar\-dous~to~the~ozone~layer. } +\prop_put:Nnn \l__ghsystem_euh_prop { 059 } + { Hazardous~ to~ the~ ozone~ layer. } % 2.4 Supplemental Label Elements/Information On Certain Substances And Mixtures -\prop_put:Nnn \l__ghsystem_euh_prop { 201 } { Con\-tains~lead.~Should~not~be~used~on~sur\-faces~liable~to~be~chewed~or~sucked~by~child\-ren. } -\prop_put:Nnn \l__ghsystem_euh_prop { 201A } { Warning!~con\-tains~lead. } -\prop_put:Nnn \l__ghsystem_euh_prop { 202 } { \iupac { Cyano\|acrylate } . ~ Dan\-ger.~Bonds~skin~and~eyes~in~se\-conds.~Keep~out~of~the~reach~of~child\-ren. } -\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { Con\-tains ~ \ox[pos=side]{ 6 , chromium } . ~ May~pro\-duce~an~aller\-gic~reac\-tion. } -\prop_put:Nnn \l__ghsystem_euh_prop { 204 } { Con\-tains ~ \iupac { iso\|cyanates } . ~ May~pro\-duce~an~aller\-gic~reac\-tion. } -\prop_put:Nnn \l__ghsystem_euh_prop { 205 } { Con\-tains~epoxy~consti\-tuents.~May~pro\-duce~an~aller\-gic~reac\-tion. } -\prop_put:Nnn \l__ghsystem_euh_prop { 206 } { War\-ning!~Do~not~use~to\-gether~with~other~pro\-ducts.~May~re\-lease~dan\-ge\-rous~gases~(chlorine). } -\prop_put:Nnn \l__ghsystem_euh_prop { 207 } { War\-ning!~Con\-tains ~ \iupac { cad\|mium } . ~ Dan\-ge\-rous~fumes~are~formed~du\-ring~use.~See~in\-for\-ma\-tion~supplied~by~the~ma\-nu\-fac\-turer.~Comply~with~the~safety~in\-struc\-tions. } -\prop_put:Nnn \l__ghsystem_euh_prop { 208 } { Con\-tains \ghsystem_substance: . ~ May~pro\-duce~an~aller\-gic~reac\-tion. } -\prop_put:Nnn \l__ghsystem_euh_prop { 209 } { Can~be\-come~high\-ly~flammable~in~use. } -\prop_put:Nnn \l__ghsystem_euh_prop { 209A } { Can~be\-come~flammable~in~use. } -\prop_put:Nnn \l__ghsystem_euh_prop { 210 } { Safe\-ty~da\-ta~sheet~available~on~re\-quest. } -\prop_put:Nnn \l__ghsystem_euh_prop { 401 } { To~avoid~risks~to~hu\-man~health~and~the~en\-vi\-ron\-ment,~comply~with~the~in\-struc\-tions~for~use. } +\prop_put:Nnn \l__ghsystem_euh_prop { 201 } + { + Contains~ lead.~ Should~ not~ be~ used~ on~ surfaces~ liable~ to~ be~ + chewed~ or~ sucked~ by~ children. + } +\prop_put:Nnn \l__ghsystem_euh_prop { 201A } + { Warning!~ contains~ lead. } +\prop_put:Nnn \l__ghsystem_euh_prop { 202 } + { + \iupac { Cyano\|acrylate } . ~ Danger.~ Bonds~ skin~ and~ eyes~ in~ + seconds.~ Keep~ out~ of~ the~ reach~ of~ children. + } +\prop_put:Nnn \l__ghsystem_euh_prop { 203 } + { + Contains ~ chromium \, (VI) .~ May~ produce~ an~ allergic~ + reaction. + } +\prop_put:Nnn \l__ghsystem_euh_prop { 204 } + { + Contains ~ \iupac { iso\|cyanates } . ~ May~ produce~ an~ allergic~ + reaction. + } +\prop_put:Nnn \l__ghsystem_euh_prop { 205 } + { Contains~ epoxy~ constituents.~ May~ produce~ an~ allergic~ reaction. } +\prop_put:Nnn \l__ghsystem_euh_prop { 206 } + { + Warning!~ Do~ not~ use~ together~ with~ other~ products.~ May~ release~ + dangerous~ gases ~(chlorine). + } +\prop_put:Nnn \l__ghsystem_euh_prop { 207 } + { + Warning!~ Contains ~ \iupac { cadmium } .~ Dangerous~ fumes~ are~ formed~ + during~ use.~ See~ information~ supplied~ by~ the~ manufacturer.~ Comply~ + with~ the~ safety~ instructions. + } +\prop_put:Nnn \l__ghsystem_euh_prop { 208 } + { Contains \ghsystem_substance: .~ May~ produce~ an~ allergic~ reaction. } +\prop_put:Nnn \l__ghsystem_euh_prop { 209 } + { Can~ become~ highly~ flammable~ in~ use. } +\prop_put:Nnn \l__ghsystem_euh_prop { 209A } + { Can~ become~ flammable~ in~ use. } +\prop_put:Nnn \l__ghsystem_euh_prop { 210 } + { Safety~ data~ sheet~ available~ on~ request. } +\prop_put:Nnn \l__ghsystem_euh_prop { 401 } + { + To~ avoid~ risks~ to~ human~ health~ and~ the~ environment,~ comply~ with~ + the~ instructions~ for~ use. + } % PRECAUTIONARY STATEMENTS (Annex 4 page 19ff) % 3 Precautionary Statements % 3.1 General -\prop_put:Nnn \l__ghsystem_p_prop { 101 } { If~me\-di\-cal~ad\-vice~is~needed,~have~pro\-duct~con\-tainer~or~la\-bel~at~hand. } -\prop_put:Nnn \l__ghsystem_p_prop { 102 } { Keep~out~of~reach~of~child\-ren. } -\prop_put:Nnn \l__ghsystem_p_prop { 103 } { Read~label~be\-fore~use. } +\prop_put:Nnn \l__ghsystem_p_prop { 101 } + { + If~ medical~ advice~ is~ needed,~ have~ product~ container~ or~ label~ at~ + hand. + } +\prop_put:Nnn \l__ghsystem_p_prop { 102 } + { Keep~ out~ of~ reach~ of~ children. } +\prop_put:Nnn \l__ghsystem_p_prop { 103 } + { Read~ label~ before~ use. } % 3.2 Precautionary Statements — Prevention -\prop_put:Nnn \l__ghsystem_p_prop { 201 } { Ob\-tain~spe\-cial~in\-struc\-tions~be\-fore~use. } -\prop_put:Nnn \l__ghsystem_p_prop { 202 } { Do~not~handle~un\-til~all~safe\-ty~pre\-cau\-tions~have~been~read~and~un\-der\-stood. } -\prop_put:Nnn \l__ghsystem_p_prop { 210 } { Keep~away~from~heat/sparks/open~flames/hot~sur\-faces.~\textemdash\ No~smo\-king. } -\prop_put:Nnn \l__ghsystem_p_prop { 211 } { Do~not~spray~on~an~open~flame~or~other~ig\-ni\-tion~source. } -\prop_put:Nnn \l__ghsystem_p_prop { 220 } { Keep/Store~away~from~clothing/ \l__ghsystem_dots_tl /com\-bus\-tible~ma\-te\-rials. } -\prop_put:Nnn \l__ghsystem_p_prop { 221 } { Take~any~pre\-cau\-tion~to~avoid~mi\-xing~with~com\-bus\-tibles ~ \l__ghsystem_dots_tl } -\prop_put:Nnn \l__ghsystem_p_prop { 222 } { Do~not~allow~con\-tact~with~air. } -\prop_put:Nnn \l__ghsystem_p_prop { 223 } { Keep~away~from~any~possible~con\-tact~with~wa\-ter,~be\-cause~of~vio\-lent~reac\-tion~and~possible~flash~fire. } -\prop_put:Nnn \l__ghsystem_p_prop { 230 } { Keep~wetted~with ~ \l__ghsystem_dots_tl } -\prop_put:Nnn \l__ghsystem_p_prop { 231 } { Handle~un\-der~inert~gas. } -\prop_put:Nnn \l__ghsystem_p_prop { 232 } { Pro\-tect~from~mois\-ture. } -\prop_put:Nnn \l__ghsystem_p_prop { 233 } { Keep~con\-tainer~tight\-ly~closed. } -\prop_put:Nnn \l__ghsystem_p_prop { 234 } { Keep~only~in~ori\-gi\-nal~con\-tai\-ner. } -\prop_put:Nnn \l__ghsystem_p_prop { 235 } { Keep~cool. } -\prop_put:Nnn \l__ghsystem_p_prop { 240 } { Ground/bond~con\-tai\-ner~and~re\-cei\-ving~equip\-ment. } -\prop_put:Nnn \l__ghsystem_p_prop { 241 } { Use~ex\-plo\-sion-proof~elec\-tri\-cal/ven\-ti\-la\-ting/ligh\-ting / \l__ghsystem_dots_tl\ e\-quip\-ment. } -\prop_put:Nnn \l__ghsystem_p_prop { 242 } { Use~on\-ly~non-spar\-king~tools. } -\prop_put:Nnn \l__ghsystem_p_prop { 243 } { Take~pre\-cau\-tionary~mea\-sures~against~sta\-tic~dis\-charge. } -\prop_put:Nnn \l__ghsystem_p_prop { 244 } { Keep~re\-duc\-tion~valves~free~from~grease~and~oil. } -\prop_put:Nnn \l__ghsystem_p_prop { 250 } { Do~not~sub\-ject~to~grin\-ding/shock / \l__ghsystem_dots_tl / fric\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 251 } { Pressu\-rized~con\-tai\-ner : ~ Do~not~pierce~or~burn,~even~after~use. } -\prop_put:Nnn \l__ghsystem_p_prop { 260 } { Do~not~breathe~dust/fume/gas/mist/va\-pours/spray. } -\prop_put:Nnn \l__ghsystem_p_prop { 261 } { Avoid~brea\-thing~dust/fume/gas/mist/va\-pours/spray. } -\prop_put:Nnn \l__ghsystem_p_prop { 262 } { Do~not~get~in~eyes,~on~skin,~or~on~clothing. } -\prop_put:Nnn \l__ghsystem_p_prop { 263 } { Avoid~con\-tact~du\-ring~preg\-nan\-cy/while~nur\-sing. } -\prop_put:Nnn \l__ghsystem_p_prop { 264 } { Wash ~ \l__ghsystem_dots_tl\ tho\-rough\-ly~after~hand\-ling. } -\prop_put:Nnn \l__ghsystem_p_prop { 270 } { Do~not~eat,~drink~or~smoke~when~using~this~pro\-duct. } -\prop_put:Nnn \l__ghsystem_p_prop { 271 } { Use~on\-ly~out\-doors~or~in~a~well-ven\-ti\-la\-ted~area. } -\prop_put:Nnn \l__ghsystem_p_prop { 272 } { Con\-ta\-mi\-na\-ted~work~clo\-thing~should~not~be~allowed~out~of~the~work\-place. } -\prop_put:Nnn \l__ghsystem_p_prop { 273 } { Avoid~re\-lease~to~the~en\-vi\-ron\-ment. } -\prop_put:Nnn \l__ghsystem_p_prop { 280 } { Wear~pro\-tec\-tive~gloves/pro\-tec\-tive~clo\-thing/eye~pro\-tec\-tion/face~pro\-tec\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 281 } { Use~per\-so\-nal~pro\-tec\-tive~equip\-ment~as~re\-quired. } -\prop_put:Nnn \l__ghsystem_p_prop { 282 } { Wear~cold~in\-su\-la\-ting~gloves/face~shield/eye~pro\-tec\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 283 } { Wear~fire/flame~re\-sis\-tant/re\-tar\-dant~clo\-thing. } -\prop_put:Nnn \l__ghsystem_p_prop { 284 } { Wear~res\-pi\-ra\-to\-ry~pro\-tec\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 285 } { In~case~of~in\-ade\-quate~ven\-ti\-la\-tion~wear~res\-pi\-ra\-to\-ry~pro\-tec\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 231 + 232 } { Handle~un\-der~inert~gas.~Pro\-tect~from~mois\-ture. } -\prop_put:Nnn \l__ghsystem_p_prop { 235 + 410 } { Keep~cool.~Pro\-tect~from~sun\-light. } +\prop_put:Nnn \l__ghsystem_p_prop { 201 } + { Obtain~ special~ instructions~ before~ use. } +\prop_put:Nnn \l__ghsystem_p_prop { 202 } + { + Do~ not~ handle~ until~ all~ safety~ precautions~ have~ been~ read~ and~ + understood. + } +\prop_put:Nnn \l__ghsystem_p_prop { 210 } + { + Keep~ away~ from~ heat\slash sparks\slash open~ flames\slash hot~ + surfaces.~ \textemdash\ No~ smoking. + } +\prop_put:Nnn \l__ghsystem_p_prop { 211 } + { Do~ not~ spray~ on~ an~ open~ flame~ or~ other~ ignition~ source. } +\prop_put:Nnn \l__ghsystem_p_prop { 220 } + { + Keep\slash Store~ away~ from~ clothing\slash \l__ghsystem_dots_tl \slash + combustible~ materials. + } +\prop_put:Nnn \l__ghsystem_p_prop { 221 } + { + Take~ any~ precaution~ to~ avoid~ mixing~ with~ combustibles~ + \l__ghsystem_dots_tl + } +\prop_put:Nnn \l__ghsystem_p_prop { 222 } + { Do~ not~ allow~ contact~ with~ air. } +\prop_put:Nnn \l__ghsystem_p_prop { 223 } + { + Keep~ away~ from~ any~ possible~ contact~ with~ water,~ because~ of~ + violent~ reaction~ and~ possible~ flash~ fire. + } +\prop_put:Nnn \l__ghsystem_p_prop { 230 } + { Keep~ wetted~ with~ \l__ghsystem_dots_tl } +\prop_put:Nnn \l__ghsystem_p_prop { 231 } + { Handle~ under~ inert~ gas. } +\prop_put:Nnn \l__ghsystem_p_prop { 232 } + { Protect~ from~ moisture. } +\prop_put:Nnn \l__ghsystem_p_prop { 233 } + { Keep~ container~ tightly~ closed. } +\prop_put:Nnn \l__ghsystem_p_prop { 234 } + { Keep~ only~ in~ original~ container. } +\prop_put:Nnn \l__ghsystem_p_prop { 235 } + { Keep~ cool. } +\prop_put:Nnn \l__ghsystem_p_prop { 240 } + { Ground\slash bond~ container~ and~ receiving~ equipment. } +\prop_put:Nnn \l__ghsystem_p_prop { 241 } + { + Use~ explosion-proof~ electrical\slash ventilating\slash lighting \slash + \l__ghsystem_dots_tl\ equipment. + } +\prop_put:Nnn \l__ghsystem_p_prop { 242 } + { Use~ only~ non-sparking~ tools. } +\prop_put:Nnn \l__ghsystem_p_prop { 243 } + { Take~ precautionary~ measures~ against~ static~ discharge. } +\prop_put:Nnn \l__ghsystem_p_prop { 244 } + { Keep~ reduction~ valves~ free~ from~ grease~ and~ oil. } +\prop_put:Nnn \l__ghsystem_p_prop { 250 } + { + Do~ not~ subject~ to~ grinding\slash shock \slash \l__ghsystem_dots_tl + \slash friction. + } +\prop_put:Nnn \l__ghsystem_p_prop { 251 } + { Pressurized~ container:~ Do~ not~ pierce~ or~ burn,~ even~ after~ use. } +\prop_put:Nnn \l__ghsystem_p_prop { 260 } + { + Do~ not~ breathe~ dust\slash fume\slash gas\slash mist\slash vapours\slash + spray. + } +\prop_put:Nnn \l__ghsystem_p_prop { 261 } + { + Avoid~ breathing~ dust\slash fume\slash gas\slash mist\slash vapours\slash + spray. + } +\prop_put:Nnn \l__ghsystem_p_prop { 262 } + { Do~ not~ get~ in~ eyes,~ on~ skin,~ or~ on~ clothing. } +\prop_put:Nnn \l__ghsystem_p_prop { 263 } + { Avoid~ contact~ during~ pregnancy\slash while~ nursing. } +\prop_put:Nnn \l__ghsystem_p_prop { 264 } + { Wash~ \l__ghsystem_dots_tl\ thoroughly~ after~ handling. } +\prop_put:Nnn \l__ghsystem_p_prop { 270 } + { Do~ not~ eat,~ drink~ or~ smoke~ when~ using~ this~ product. } +\prop_put:Nnn \l__ghsystem_p_prop { 271 } + { Use~ only~ outdoors~ or~ in~ a~ well-ventilated~ area. } +\prop_put:Nnn \l__ghsystem_p_prop { 272 } + { + Contaminated~ work~ clothing~ should~ not~ be~ allowed~ out~ of~ the~ + workplace. + } +\prop_put:Nnn \l__ghsystem_p_prop { 273 } + { Avoid~ release~ to~ the~ environment. } +\prop_put:Nnn \l__ghsystem_p_prop { 280 } + { + Wear~ protective~ gloves\slash protective~ clothing\slash eye~ + protection\slash face~ protection. + } +\prop_put:Nnn \l__ghsystem_p_prop { 281 } + { Use~ personal~ protective~ equipment~ as~ required. } +\prop_put:Nnn \l__ghsystem_p_prop { 282 } + { Wear~ cold~ insulating~ gloves\slash face~ shield\slash eye~ protection. } +\prop_put:Nnn \l__ghsystem_p_prop { 283 } + { Wear~ fire\slash flame~ resistant\slash retardant~ clothing. } +\prop_put:Nnn \l__ghsystem_p_prop { 284 } + { Wear~ respiratory~ protection. } +\prop_put:Nnn \l__ghsystem_p_prop { 285 } + { In~ case~ of~ inadequate~ ventilation~ wear~ respiratory~ protection. } +\prop_put:Nnn \l__ghsystem_p_prop { 231 + 232 } + { Handle~ under~ inert~ gas.~ Protect~ from~ moisture. } +\prop_put:Nnn \l__ghsystem_p_prop { 235 + 410 } + { Keep~ cool.~ Protect~ from~ sunlight. } % 3.3 Precautionary Statements — Response -\prop_put:Nnn \l__ghsystem_p_prop { 301 } { IF~SWALLOWED : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 302 } { IF~ON~SKIN : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 303 } { IF~ON~SKIN~(or~hair) : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 304 } { IF~IN\-HALED : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 305 } { IF~IN~EYES : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 306 } { IF~ON~CLO\-THING : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 307 } { IF~ex\-po\-sed : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 308 } { IF~ex\-po\-sed~or~con\-cerned : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 309 } { IF~ex\-po\-sed~or~if~you~feel~un\-well : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 310 } { Imme\-diate\-ly~call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian. } -\prop_put:Nnn \l__ghsystem_p_prop { 311 } { Call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian. } -\prop_put:Nnn \l__ghsystem_p_prop { 312 } { Call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian~if~you~feel~un\-well. } -\prop_put:Nnn \l__ghsystem_p_prop { 313 } { Get~me\-di\-cal~ad\-vice/atten\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 314 } { Get~me\-di\-cal~ad\-vice/atten\-tion~if~you~feel~un\-well. } -\prop_put:Nnn \l__ghsystem_p_prop { 315 } { Get~imme\-diate~me\-di\-cal~ad\-vice/atten\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 320 } { Spe~ci\-fic~treat\-ment~is~ur\-gent~(see ~ \l__ghsystem_dots_tl\ on~this~la\-bel). } -\prop_put:Nnn \l__ghsystem_p_prop { 321 } { Spe~ci\-fic~treat\-ment~(see ~ \l__ghsystem_dots_tl\ on~this~la\-bel). } -\prop_put:Nnn \l__ghsystem_p_prop { 322 } { Spe~ci\-fic~mea\-sures~(see ~ \l__ghsystem_dots_tl\ on~this~la\-bel). } -\prop_put:Nnn \l__ghsystem_p_prop { 330 } { Rinse~mouth. } -\prop_put:Nnn \l__ghsystem_p_prop { 331 } { Do~NOT~in\-duce~vo\-mitting. } -\prop_put:Nnn \l__ghsystem_p_prop { 332 } { If~skin~irri\-tation~occurs : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 333 } { If~skin~irri\-tation~or~rash~occurs : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 334 } { Immerse~in~cool~wa\-ter/wrap~in~wet~ban\-da\-ges. } -\prop_put:Nnn \l__ghsystem_p_prop { 335 } { Brush~off~loose~par\-ticles~from~skin. } -\prop_put:Nnn \l__ghsystem_p_prop { 336 } { Thaw~frosted~parts~with~luke\-warm~wa\-ter.~Do~not~rub~affec\-ted~area. } -\prop_put:Nnn \l__ghsystem_p_prop { 337 } { If~eye~irri\-ta\-tion~per\-sists : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 338 } { Re\-move~con\-tact~lenses,~if~present~and~easy~to~do.~Con\-tinue~rin\-sing. } -\prop_put:Nnn \l__ghsystem_p_prop { 340 } { Re\-move~vic\-tim~to~fresh~air~and~keep~at~rest~in~a~po\-si\-tion~com\-for\-table~for~breathing. } -\prop_put:Nnn \l__ghsystem_p_prop { 341 } { If~brea\-thing~is~diffi\-cult,~re\-move~vic\-tim~to~fresh~air~and~keep~at~rest~in~a~po\-si\-tion~com\-for\-table~for~brea\-thing. } -\prop_put:Nnn \l__ghsystem_p_prop { 342 } { If~ex\-pe\-rien\-cing~res\-pi\-ra\-to\-ry~symp\-toms : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 350 } { Gently~wash~with~plen\-ty~of~soap~and~wa\-ter. } -\prop_put:Nnn \l__ghsystem_p_prop { 351 } { Rinse~cau\-tious\-ly~with~water~for~se\-ve\-ral~mi\-nutes. } -\prop_put:Nnn \l__ghsystem_p_prop { 352 } { Wash~with~plen\-ty~of~soap~and~wa\-ter. } -\prop_put:Nnn \l__ghsystem_p_prop { 353 } { Rinse~skin~with~wa\-ter/shower. } -\prop_put:Nnn \l__ghsystem_p_prop { 360 } { Rinse~imme\-diate\-ly~con\-ta\-mi\-na\-ted~clo\-thing~and~skin~with~plen\-ty~of~wa\-ter~be\-fore~re\-moving~clothes. } -\prop_put:Nnn \l__ghsystem_p_prop { 361 } { Re\-move/Take~off~imme\-diate\-ly~all~con\-ta\-mi\-na\-ted~clo\-thing. } -\prop_put:Nnn \l__ghsystem_p_prop { 362 } { Take~off~con\-ta\-mi\-na\-ted~clo\-thing~and~wash~be\-fore~r\-euse. } -\prop_put:Nnn \l__ghsystem_p_prop { 363 } { Wash~con\-ta\-mi\-na\-ted~clo\-thing~be\-fore~re\-use. } -\prop_put:Nnn \l__ghsystem_p_prop { 370 } { In~case~of~fire : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 371 } { In~case~of~ma\-jor~fire~and~large~quan\-ti\-ties : \ghsystem_text: } -\prop_put:Nnn \l__ghsystem_p_prop { 372 } { Ex\-plo\-sion~risk~in~case~of~fire. } -\prop_put:Nnn \l__ghsystem_p_prop { 373 } { DO~NOT~fight~fire~when~fire~reaches~ex\-plo\-sives. } -\prop_put:Nnn \l__ghsystem_p_prop { 374 } { Fight~fire~with~nor\-mal~pre\-cau\-tions~from~a~reasonable~dis\-tance. } -\prop_put:Nnn \l__ghsystem_p_prop { 375 } { Fight~fire~re\-mote\-ly~due~to~the~risk~of~ex\-plo\-sion. } -\prop_put:Nnn \l__ghsystem_p_prop { 376 } { Stop~leak~if~safe~to~do~so. } -\prop_put:Nnn \l__ghsystem_p_prop { 377 } { Lea\-king~gas~fire : \ghsystem_text:\ Do~not~ex\-tin\-guish,~un\-less~leak~can~be~stopped~safe\-ly. } -\prop_put:Nnn \l__ghsystem_p_prop { 378 } { Use ~ \l__ghsystem_dots_tl\ for~ex\-tinc\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 380 } { Eva\-cu\-ate~area. } -\prop_put:Nnn \l__ghsystem_p_prop { 381 } { Eli\-mi\-nate~all~igni\-tion~sources~if~safe~to~do~so. } -\prop_put:Nnn \l__ghsystem_p_prop { 390 } { Ab\-sorb~spillage~to~pre\-vent~ma\-te\-rial~da\-mage. } -\prop_put:Nnn \l__ghsystem_p_prop { 391 } { Collect~spillage. } -\prop_put:Nnn \l__ghsystem_p_prop { 301 + 310 } { IF~SWALLOWED : ~ Imme\-diate\-ly~call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian. } -\prop_put:Nnn \l__ghsystem_p_prop { 301 + 312 } { IF~SWALLOWED : ~ Call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian~if~you~feel~un\-well. } -\prop_put:Nnn \l__ghsystem_p_prop { 301 + 330 + 331 } { IF~SWALLOWED : ~ rinse~mouth.~Do~NOT~in\-duce~vo\-mitting. } -\prop_put:Nnn \l__ghsystem_p_prop { 302 + 334 } { IF~ON~SKIN : ~ Immerse~in~cool~wa\-ter/wrap~in~wet~ban\-dages. } -\prop_put:Nnn \l__ghsystem_p_prop { 302 + 350 } { IF~ON~SKIN : ~ Gent\-ly~wash~with~plen\-ty~of~soap~and~wa\-ter. } -\prop_put:Nnn \l__ghsystem_p_prop { 302 + 352 } { IF~ON~SKIN : ~ Wash~with~plen\-ty~of~soap~and~wa\-ter. } -\prop_put:Nnn \l__ghsystem_p_prop { 303 + 361 + 353 } { IF~ON~SKIN~(or~hair) : ~ Re\-move/Take~off~imme\-diate\-ly~all~con\-ta\-mi\-na\-ted~clo\-thing.~Rinse~skin~with~wa\-ter/shower. } -\prop_put:Nnn \l__ghsystem_p_prop { 304 + 340 } { IF~IN\-HALED : ~ Re\-move~vic\-tim~to~fresh~air~and~keep~at~rest~in~a~po\-si\-tion~com\-for\-table~for~brea\-thing. } -\prop_put:Nnn \l__ghsystem_p_prop { 304 + 341 } { IF~IN\-HALED : ~ If~brea\-thing~is~diffi\-cult,~re\-move~vic\-tim~to~fresh~air~and~keep~at~rest~in~a~po\-si\-tion~com\-for\-table~for~brea\-thing. } -\prop_put:Nnn \l__ghsystem_p_prop { 305 + 351 + 338 } { IF~IN~EYES : ~ Rinse~cau\-tious\-ly~with~water~for~se\-ve\-ral~mi\-nutes.~Re\-move~con\-tact~lenses,~if~pre\-sent~and~easy~to~do.~Con\-tinue~rin\-sing. } -\prop_put:Nnn \l__ghsystem_p_prop { 306 + 360 } { IF~ON~CLO\-THING : ~ Rinse~imme\-diate\-ly~con\-ta\-mi\-na\-ted~clo\-thing~and~skin~with~plen\-ty~of~wa\-ter~be\-fore~re\-moving~clothes. } -\prop_put:Nnn \l__ghsystem_p_prop { 307 + 311 } { IF~ex\-po\-sed : ~ Call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian. } -\prop_put:Nnn \l__ghsystem_p_prop { 308 + 313 } { IF~ex\-po\-sed~or~con\-cerned : ~ Get~me\-di\-cal~ad\-vice/atten\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 309 + 311 } { IF~ex\-po\-sed~or~if~you~feel~un\-well : ~ Call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian. } -\prop_put:Nnn \l__ghsystem_p_prop { 332 + 313 } { If~skin~irri\-ta\-tion~occurs : ~ Get~me\-di\-cal~ad\-vice/atten\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 333 + 313 } { If~skin~irri\-ta\-tion~or~rash~occurs : ~ Get~me\-di\-cal~ad\-vice/atten\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 335 + 334 } { Brush~off~loose~par\-ticles~from~skin.~Immerse~in~cool~wa\-ter/wrap~in~wet~ban\-dages. } -\prop_put:Nnn \l__ghsystem_p_prop { 337 + 313 } { If~eye~irri\-ta\-tion~per\-sists : ~ Get~me\-di\-cal~ad\-vice/atten\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 342 + 311 } { If~ex\-pe\-rien\-cing~res\-pi\-ra\-to\-ry~symp\-toms : ~ Call~a~POI\-SON~CEN\-TER~or~doc\-tor/phy\-si\-cian. } -\prop_put:Nnn \l__ghsystem_p_prop { 370 + 376 } { In~case~of~fire : ~ Stop~leak~if~safe~to~do~so. } -\prop_put:Nnn \l__ghsystem_p_prop { 370 + 378 } { In~case~of~fire : ~ Use ~ \l__ghsystem_dots_tl\ for~ex\-tinc\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 370 + 380 } { In~case~of~fire : ~ Eva\-cuate~area. } -\prop_put:Nnn \l__ghsystem_p_prop { 370 + 380 + 375 } { In~case~of~fire : ~ Eva\-cuate~area.~Fight~fire~re\-mote\-ly~due~to~the~risk~of~ex\-plo\-sion. } -\prop_put:Nnn \l__ghsystem_p_prop { 371 + 380 + 375 } { In~case~of~ma\-jor~fire~and~large~quan\-ti\-ties : ~ Eva\-cuate~area.~Fight~fire~re\-mote\-ly~due~to~the~risk~of~ex\-plo\-sion. } +\prop_put:Nnn \l__ghsystem_p_prop { 301 } + { IF~ SWALLOWED: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 302 } + { IF~ ON~ SKIN: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 303 } + { IF~ ON~ SKIN~ (or~ hair): \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 304 } + { IF~ INHALED: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 305 } + { IF~ IN~ EYES: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 306 } + { IF~ ON~ CLOTHING: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 307 } + { IF~ exposed: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 308 } + { IF~ exposed~ or~ concerned: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 309 } + { IF~ exposed~ or~ if~ you~ feel~ unwell : \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 310 } + { Immediately~ call~ a~ POISON~ CENTER~ or~ doctor\slash physician. } +\prop_put:Nnn \l__ghsystem_p_prop { 311 } + { Call~ a~ POISON~ CENTER~ or~ doctor\slash physician. } +\prop_put:Nnn \l__ghsystem_p_prop { 312 } + { + Call~ a~ POISON~ CENTER~ or~ doctor\slash physician~ if~ you~ feel~ + unwell. + } +\prop_put:Nnn \l__ghsystem_p_prop { 313 } + { Get~ medical~ advice\slash attention. } +\prop_put:Nnn \l__ghsystem_p_prop { 314 } + { Get~ medical~ advice\slash attention~ if~ you~ feel~ unwell. } +\prop_put:Nnn \l__ghsystem_p_prop { 315 } + { Get~ immediate~ medical~ advice\slash attention. } +\prop_put:Nnn \l__ghsystem_p_prop { 320 } + { + Specific~ treatment~ is~ urgent~ (see~ \l__ghsystem_dots_tl\ on~ this~ + label). + } +\prop_put:Nnn \l__ghsystem_p_prop { 321 } + { Specific~ treatment~ (see~ \l__ghsystem_dots_tl\ on~ this~ label). } +\prop_put:Nnn \l__ghsystem_p_prop { 322 } + { Specific~ measures~ (see~ \l__ghsystem_dots_tl\ on~ this~ label). } +\prop_put:Nnn \l__ghsystem_p_prop { 330 } + { Rinse~ mouth. } +\prop_put:Nnn \l__ghsystem_p_prop { 331 } + { Do~ NOT~ induce~ vomitting. } +\prop_put:Nnn \l__ghsystem_p_prop { 332 } + { If~ skin~ irritation~ occurs : \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 333 } + { If~ skin~ irritation~ or~ rash~ occurs : \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 334 } + { Immerse~ in~ cool~ water\slash wrap~ in~ wet~ bandages. } +\prop_put:Nnn \l__ghsystem_p_prop { 335 } + { Brush~ off~ loose~ particles~ from~ skin. } +\prop_put:Nnn \l__ghsystem_p_prop { 336 } + { + Thaw~ frosted~ parts~ with~ lukewarm~ water.~ Do~ not~ rub~ affected~ + area. + } +\prop_put:Nnn \l__ghsystem_p_prop { 337 } + { If~ eye~ irritation~ persists: \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 338 } + { + Remove~ contact~ lenses,~ if~ present~ and~ easy~ to~ do.~ Continue~ + rinsing. + } +\prop_put:Nnn \l__ghsystem_p_prop { 340 } + { + Remove~ victim~ to~ fresh~ air~ and~ keep~ at~ rest~ in~ a~ position~ + comfortable~ for~ breathing. + } +\prop_put:Nnn \l__ghsystem_p_prop { 341 } + { + If~ breathing~ is~ difficult,~ remove~ victim~ to~ fresh~ air~ and~ keep~ + at~ rest~ in~ a~ position~ comfortable~ for~ breathing. + } +\prop_put:Nnn \l__ghsystem_p_prop { 342 } + { If~ experiencing~ respiratory~ symptoms : \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 350 } + { Gently~ wash~ with~ plenty~ of~ soap~ and~ water. } +\prop_put:Nnn \l__ghsystem_p_prop { 351 } + { Rinse~ cautiously~ with~ water~ for~ several~ minutes. } +\prop_put:Nnn \l__ghsystem_p_prop { 352 } + { Wash~ with~ plenty~ of~ soap~ and~ water. } +\prop_put:Nnn \l__ghsystem_p_prop { 353 } + { Rinse~ skin~ with~ water\slash shower. } +\prop_put:Nnn \l__ghsystem_p_prop { 360 } + { + Rinse~ immediately~ contaminated~ clothing~ and~ skin~ with~ plenty~ of~ + water~ before~ removing~ clothes. + } +\prop_put:Nnn \l__ghsystem_p_prop { 361 } + { Remove\slash Take~ off~ immediately~ all~ contaminated~ clothing. } +\prop_put:Nnn \l__ghsystem_p_prop { 362 } + { Take~ off~ contaminated~ clothing~ and~ wash~ before~ reuse. } +\prop_put:Nnn \l__ghsystem_p_prop { 363 } + { Wash~ contaminated~ clothing~ before~ reuse. } +\prop_put:Nnn \l__ghsystem_p_prop { 370 } + { In~ case~ of~ fire : \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 371 } + { In~ case~ of~ major~ fire~ and~ large~ quantities : \ghsystem_text: } +\prop_put:Nnn \l__ghsystem_p_prop { 372 } + { Explosion~ risk~ in~ case~ of~ fire. } +\prop_put:Nnn \l__ghsystem_p_prop { 373 } + { DO~ NOT~ fight~ fire~ when~ fire~ reaches~ explosives. } +\prop_put:Nnn \l__ghsystem_p_prop { 374 } + { Fight~ fire~ with~ normal~ precautions~ from~ a~ reasonable~ distance. } +\prop_put:Nnn \l__ghsystem_p_prop { 375 } + { Fight~ fire~ remotely~ due~ to~ the~ risk~ of~ explosion. } +\prop_put:Nnn \l__ghsystem_p_prop { 376 } + { Stop~ leak~ if~ safe~ to~ do~ so. } +\prop_put:Nnn \l__ghsystem_p_prop { 377 } + { + Leaking~ gas~ fire: \ghsystem_text:\ Do~ not~ extinguish,~ unless~ leak~ + can~ be~ stopped~ safely. + } +\prop_put:Nnn \l__ghsystem_p_prop { 378 } + { Use~ \l__ghsystem_dots_tl\ for~ extinction. } +\prop_put:Nnn \l__ghsystem_p_prop { 380 } + { Evacuate~ area. } +\prop_put:Nnn \l__ghsystem_p_prop { 381 } + { Eliminate~ all~ ignition~ sources~ if~ safe~ to~ do~ so. } +\prop_put:Nnn \l__ghsystem_p_prop { 390 } + { Absorb~ spillage~ to~ prevent~ material~ damage. } +\prop_put:Nnn \l__ghsystem_p_prop { 391 } + { Collect~ spillage. } +\prop_put:Nnn \l__ghsystem_p_prop { 301 + 310 } + { + IF~ SWALLOWED:~ Immediately~ call~ a~ POISON~ CENTER~ or~ doctor\slash + physician. + } +\prop_put:Nnn \l__ghsystem_p_prop { 301 + 312 } + { + IF~ SWALLOWED:~ Call~ a~ POISON~ CENTER~ or~ doctor\slash physician~ if~ + you~ feel~ unwell. + } +\prop_put:Nnn \l__ghsystem_p_prop { 301 + 330 + 331 } + { IF~ SWALLOWED:~ rinse~ mouth.~ Do~ NOT~ induce~ vomitting. } +\prop_put:Nnn \l__ghsystem_p_prop { 302 + 334 } + { IF~ ON~ SKIN:~ Immerse~ in~ cool~ water\slash wrap~ in~ wet~ bandages. } +\prop_put:Nnn \l__ghsystem_p_prop { 302 + 350 } + { IF~ ON~ SKIN:~ Gently~ wash~ with~ plenty~ of~ soap~ and~ water. } +\prop_put:Nnn \l__ghsystem_p_prop { 302 + 352 } + { IF~ ON~ SKIN:~ Wash~ with~ plenty~ of~ soap~ and~ water. } +\prop_put:Nnn \l__ghsystem_p_prop { 303 + 361 + 353 } + { + IF~ ON~ SKIN~ (or~ hair):~ Remove\slash Take~ off~ immediately~ all~ + contaminated~ clothing.~ Rinse~ skin~ with~ water\slash shower. + } +\prop_put:Nnn \l__ghsystem_p_prop { 304 + 340 } + { + IF~ INHALED:~ Remove~ victim~ to~ fresh~ air~ and~ keep~ at~ rest~ in~ a~ + position~ comfortable~ for~ breathing. + } +\prop_put:Nnn \l__ghsystem_p_prop { 304 + 341 } + { + IF~ INHALED:~ If~ breathing~ is~ difficult,~ remove~ victim~ to~ fresh~ + air~ and~ keep~ at~ rest~ in~ a~ position~ comfortable~ for~ breathing. + } +\prop_put:Nnn \l__ghsystem_p_prop { 305 + 351 + 338 } + { + IF~ IN~ EYES:~ Rinse~ cautiously~ with~ water~ for~ several~ minutes.~ + Remove~ contact~ lenses,~ if~ present~ and~ easy~ to~ do.~ Continue~ + rinsing. + } +\prop_put:Nnn \l__ghsystem_p_prop { 306 + 360 } + { + IF~ ON~ CLOTHING:~ Rinse~ immediately~ contaminated~ clothing~ and~ skin~ + with~ plenty~ of~ water~ before~ removing~ clothes. + } +\prop_put:Nnn \l__ghsystem_p_prop { 307 + 311 } + { IF~ exposed:~ Call~ a~ POISON~ CENTER~ or~ doctor\slash physician. } +\prop_put:Nnn \l__ghsystem_p_prop { 308 + 313 } + { IF~ exposed~ or~ concerned:~ Get~ medical~ advice\slash attention. } +\prop_put:Nnn \l__ghsystem_p_prop { 309 + 311 } + { + IF~ exposed~ or~ if~ you~ feel~ unwell:~ Call~ a~ POISON~ CENTER~ or~ + doctor\slash physician. + } +\prop_put:Nnn \l__ghsystem_p_prop { 332 + 313 } + { If~ skin~ irritation~ occurs:~ Get~ medical~ advice\slash attention. } +\prop_put:Nnn \l__ghsystem_p_prop { 333 + 313 } + { + If~ skin~ irritation~ or~ rash~ occurs:~ Get~ medical~ advice\slash + attention. + } +\prop_put:Nnn \l__ghsystem_p_prop { 335 + 334 } + { + Brush~ off~ loose~ particles~ from~ skin.~ Immerse~ in~ cool~ water\slash + wrap~ in~ wet~ bandages. + } +\prop_put:Nnn \l__ghsystem_p_prop { 337 + 313 } + { If~ eye~ irritation~ persists:~ Get~ medical~ advice\slash attention. } +\prop_put:Nnn \l__ghsystem_p_prop { 342 + 311 } + { + If~ experiencing~ respiratory~ symptoms:~ Call~ a~ POISON~ CENTER~ or~ + doctor\slash physician. + } +\prop_put:Nnn \l__ghsystem_p_prop { 370 + 376 } + { In~ case~ of~ fire:~ Stop~ leak~ if~ safe~ to~ do~ so. } +\prop_put:Nnn \l__ghsystem_p_prop { 370 + 378 } + { In~ case~ of~ fire:~ Use~ \l__ghsystem_dots_tl\ for~ extinction. } +\prop_put:Nnn \l__ghsystem_p_prop { 370 + 380 } + { In~ case~ of~ fire:~ Evacuate~ area. } +\prop_put:Nnn \l__ghsystem_p_prop { 370 + 380 + 375 } + { + In~ case~ of~ fire:~ Evacuate~ area.~ Fight~ fire~ remotely~ due~ to~ the~ + risk~ of~ explosion. + } +\prop_put:Nnn \l__ghsystem_p_prop { 371 + 380 + 375 } + { + In~ case~ of~ major~ fire~ and~ large~ quantities:~ Evacuate~ area.~ + Fight~ fire~ remotely~ due~ to~ the~ risk~ of~ explosion. + } % 3.4 Precautionary Statements — Storage -\prop_put:Nnn \l__ghsystem_p_prop { 401 } { Store ~ \l__ghsystem_dots_tl } -\prop_put:Nnn \l__ghsystem_p_prop { 402 } { Store~in~a~dry~place. } -\prop_put:Nnn \l__ghsystem_p_prop { 403 } { Store~in~a~well-ven\-ti\-lated~place. } -\prop_put:Nnn \l__ghsystem_p_prop { 404 } { Store~in~a~closed~con\-tainer. } -\prop_put:Nnn \l__ghsystem_p_prop { 405 } { Store~locked~up. } -\prop_put:Nnn \l__ghsystem_p_prop { 406 } { Store~in~cor\-ro\-sive~re\-sis\-tant / \l__ghsystem_dots_tl\ con\-tai\-ner~with~a~re\-sis\-tant~in\-ner~liner. } -\prop_put:Nnn \l__ghsystem_p_prop { 407 } { Main\-tain~air~gap~bet\-ween~stacks/pallets. } -\prop_put:Nnn \l__ghsystem_p_prop { 410 } { Pro\-tect~from~sun\-light. } -\prop_put:Nnn \l__ghsystem_p_prop { 411 } { Store~at~tem\-pera\-tures~not~ex\-cee\-ding ~ \exp_args:No \SI { \l__ghsystem_celsius_temperature_tl }{ \GHScelsius } / \exp_args:No \SI { \l__ghsystem_fahrenheit_temperature_tl } { \GHSfahrenheit } . } -\prop_put:Nnn \l__ghsystem_p_prop { 412 } { Store~at~tem\-pera\-tures~not~ex\-cee\-ding ~ \SI { 50 } { \GHScelsius } / \SI { 122 } { \GHSfahrenheit } . } -\prop_put:Nnn \l__ghsystem_p_prop { 413 } { Store~bulk~masses~greater~than ~ \exp_args:No \SI { \l__ghsystem_kg_mass_tl } { \GHSkilogram } / \exp_args:No \SI { \l__ghsystem_lbs_mass_tl } { \GHSpounds } ~ at~tem\-pera\-tures~not~ex\-cee\-ding ~ \exp_args:No \SI { \l__ghsystem_celsius_temperature_tl } { \GHScelsius } / \exp_args:No \SI { \l__ghsystem_fahrenheit_temperature_tl } { \GHSfahrenheit } . } -\prop_put:Nnn \l__ghsystem_p_prop { 420 } { Store~away~from~other~ma\-te\-rials. } -\prop_put:Nnn \l__ghsystem_p_prop { 422 } { Store~con\-tents~un\-der ~ \l__ghsystem_dots_tl } -\prop_put:Nnn \l__ghsystem_p_prop { 402 + 404 } { Store~in~a~dry~place.~Store~in~a~closed~con\-tai\-ner. } -\prop_put:Nnn \l__ghsystem_p_prop { 403 + 233 } { Store~in~a~well-ven\-ti\-la\-ted~place.~Keep~con\-tainer~tight\-ly~closed. } -\prop_put:Nnn \l__ghsystem_p_prop { 403 + 235 } { Store~in~a~well-ven\-ti\-la\-ted~place.~Keep~cool. } -\prop_put:Nnn \l__ghsystem_p_prop { 410 + 403 } { Pro\-tect~from~sun\-light.~Store~in~a~well-ven\-ti\-la\-ted~place. } -\prop_put:Nnn \l__ghsystem_p_prop { 410 + 412 } { Pro\-tect~from~sun\-light.~Do~not~ex\-pose~to~tem\-pera\-tures~ex\-cee\-ding ~ \SI { 50 } { \GHScelsius } / \SI { 122 } { \GHSfahrenheit } . } -\prop_put:Nnn \l__ghsystem_p_prop { 411 + 235 } { Store~at~tem\-pera\-tures~not~ex\-cee\-ding ~ \exp_args:No \SI { \l__ghsystem_celsius_temperature_tl }{ \GHScelsius } / \exp_args:No \SI { \l__ghsystem_fahrenheit_temperature_tl } { \GHSfahrenheit } ~ . ~ Keep~cool. } +\prop_put:Nnn \l__ghsystem_p_prop { 401 } + { Store~ \l__ghsystem_dots_tl } +\prop_put:Nnn \l__ghsystem_p_prop { 402 } + { Store~ in~ a~ dry~ place. } +\prop_put:Nnn \l__ghsystem_p_prop { 403 } + { Store~ in~ a~ well-ventilated~ place. } +\prop_put:Nnn \l__ghsystem_p_prop { 404 } + { Store~ in~ a~ closed~ container. } +\prop_put:Nnn \l__ghsystem_p_prop { 405 } + { Store~ locked~ up. } +\prop_put:Nnn \l__ghsystem_p_prop { 406 } + { + Store~ in~ corrosive~ resistant\slash \l__ghsystem_dots_tl\ container~ + with~ a~ resistant~ inner~ liner. + } +\prop_put:Nnn \l__ghsystem_p_prop { 407 } + { Maintain~ air~ gap~ between~ stacks\slash pallets. } +\prop_put:Nnn \l__ghsystem_p_prop { 410 } + { Protect~ from~ sunlight. } +\prop_put:Nnn \l__ghsystem_p_prop { 411 } + { + Store~ at~ temperatures~ not~ exceeding~ + \exp_args:No + \SI { \l__ghsystem_celsius_temperature_tl }{ \GHScelsius } + \slash + \exp_args:No + \SI { \l__ghsystem_fahrenheit_temperature_tl } { \GHSfahrenheit } . + } +\prop_put:Nnn \l__ghsystem_p_prop { 412 } + { + Store~at~temperatures~not~exceeding ~ \SI { 50 } { \GHScelsius } \slash + \SI { 122 } { \GHSfahrenheit } . + } +\prop_put:Nnn \l__ghsystem_p_prop { 413 } + { + Store~bulk~masses~greater~than ~ + \exp_args:No \SI { \l__ghsystem_kg_mass_tl } { \GHSkilogram } \slash + \exp_args:No \SI { \l__ghsystem_lbs_mass_tl } { \GHSpounds } ~ + at~ temperatures~ not~ exceeding ~ + \exp_args:No \SI { \l__ghsystem_celsius_temperature_tl } { \GHScelsius } \slash + \exp_args:No \SI { \l__ghsystem_fahrenheit_temperature_tl } { \GHSfahrenheit } . + } +\prop_put:Nnn \l__ghsystem_p_prop { 420 } + { Store~ away~ from~ other~ materials. } +\prop_put:Nnn \l__ghsystem_p_prop { 422 } + { Store~ contents~ under~ \l__ghsystem_dots_tl } +\prop_put:Nnn \l__ghsystem_p_prop { 402 + 404 } + { Store~ in~ a~ dry~ place.~ Store~ in~ a~ closed~ container. } +\prop_put:Nnn \l__ghsystem_p_prop { 403 + 233 } + { Store~ in~ a~ well-ventilated~ place.~ Keep~ container~ tightly~ closed. } +\prop_put:Nnn \l__ghsystem_p_prop { 403 + 235 } + { Store~ in~ a~ well-ventilated~ place.~ Keep~ cool. } +\prop_put:Nnn \l__ghsystem_p_prop { 410 + 403 } + { Protect~ from~ sunlight.~ Store~ in~ a~ well-ventilated~ place. } +\prop_put:Nnn \l__ghsystem_p_prop { 410 + 412 } + { + Protect~ from~ sunlight.~ Do~ not~ expose~ to~ temperatures~ exceeding~ + \SI { 50 } { \GHScelsius } \slash \SI { 122 } { \GHSfahrenheit } . + } +\prop_put:Nnn \l__ghsystem_p_prop { 411 + 235 } + { + Store~at~temperatures~not~exceeding ~ + \exp_args:No \SI { \l__ghsystem_celsius_temperature_tl }{ \GHScelsius } \slash + \exp_args:No \SI { \l__ghsystem_fahrenheit_temperature_tl } { \GHSfahrenheit } + ~ . ~ Keep~ cool. + } % 3.5 Precautionary Statements — Disposal -\prop_put:Nnn \l__ghsystem_p_prop { 501 } { Dis\-pose~of~con\-tents/con\-tainer~to ~ \l__ghsystem_dots_tl } +\prop_put:Nnn \l__ghsystem_p_prop { 501 } + { Dispose~ of~ contents\slash container~ to~ \l__ghsystem_dots_tl } % 4 Hazard Statement Codes (Annex 6 page 4f) -\prop_put:Nnn \l__ghsystem_h_prop { 350i } { May~cause~can\-cer~by~in\-ha\-la\-tion. } -\prop_put:Nnn \l__ghsystem_h_prop { 360F } { May~da\-mage~fer\-ti\-li\-ty. } -\prop_put:Nnn \l__ghsystem_h_prop { 360D } { May~da\-mage~the~un\-born~child. } -\prop_put:Nnn \l__ghsystem_h_prop { 361f } { Sus\-pec\-ted~of~da\-ma\-ging~fer\-ti\-li\-ty. } -\prop_put:Nnn \l__ghsystem_h_prop { 361d } { Sus\-pec\-ted~of~da\-ma\-ging~the~un\-born~child. } -\prop_put:Nnn \l__ghsystem_h_prop { 360FD } { May~da\-mage~fer\-ti\-li\-ty.~May~da\-mage~the~un\-born~child. } -\prop_put:Nnn \l__ghsystem_h_prop { 361fd } { Suspected~of~damaging~fer\-ti\-li\-ty.~Sus\-pec\-ted~of~da\-ma\-ging~the~un\-born~child. } -\prop_put:Nnn \l__ghsystem_h_prop { 360Fd } { May~da\-mage~fer\-ti\-li\-ty.~Sus\-pec\-ted~of~da\-ma\-ging~the~un\-born~child. } -\prop_put:Nnn \l__ghsystem_h_prop { 360Df } { May~da\-mage~the~un\-born~child.~Sus\-pec\-ted~of~da\-ma\-ging~fer\-ti\-li\-ty. } +\prop_put:Nnn \l__ghsystem_h_prop { 350i } + { May~ cause~ cancer~ by~ inhalation. } +\prop_put:Nnn \l__ghsystem_h_prop { 360F } + { May~ damage~ fertility. } +\prop_put:Nnn \l__ghsystem_h_prop { 360D } + { May~ damage~ the~ unborn~ child. } +\prop_put:Nnn \l__ghsystem_h_prop { 361f } + { Suspected~ of~ damaging~ fertility. } +\prop_put:Nnn \l__ghsystem_h_prop { 361d } + { Suspected~ of~ damaging~ the~ unborn~ child. } +\prop_put:Nnn \l__ghsystem_h_prop { 360FD } + { May~ damage~ fertility.~ May~ damage~ the~ unborn~ child. } +\prop_put:Nnn \l__ghsystem_h_prop { 361fd } + { + Suspected~ of~ damaging~ fertility.~ Suspected~ of~ damaging~ the~ unborn~ + child. + } +\prop_put:Nnn \l__ghsystem_h_prop { 360Fd } + { May~ damage~ fertility.~ Suspected~ of~ damaging~ the~ unborn~ child. } +\prop_put:Nnn \l__ghsystem_h_prop { 360Df } + { May~ damage~ the~ unborn~ child.~ Suspected~ of~ damaging~ fertility. } -\ExplSyntaxOff \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_german.def b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_german.def index 07c2491bf17..50ac02c3a6e 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_german.def +++ b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_german.def @@ -27,7 +27,6 @@ % - - % % - The Current Maintainer of this work is Clemens Niederberger. - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\ExplSyntaxOn % GERMAN DEFINITIONS \prop_clear:N \l__ghsystem_h_prop \prop_clear:N \l__ghsystem_euh_prop @@ -189,7 +188,7 @@ \prop_put:Nnn \l__ghsystem_euh_prop { 201 } { Ent\-h\"alt~Blei.~Nicht~f\"ur~den~An\-strich~von~Ge\-gen\-st\"an\-den~ver\-wen\-den,~die~von~Kin\-dern~ge\-kaut~oder~ge\-lutscht~wer\-den~k\"onn\-ten. } \prop_put:Nnn \l__ghsystem_euh_prop { 201A } { Ach\-tung!~Ent\-h\"alt~Blei. } \prop_put:Nnn \l__ghsystem_euh_prop { 202 } { \iupac{Cyan\|acryl\|at}.~Ge\-fahr.~Klebt~inner\-halb~von~Se\-kun\-den~Haut~und~Au\-gen\-li\-der~zu\-sam\-men.~Darf~nicht~in~die~H\"an\-de~von~Kin\-dern~ge\-lan\-gen. } -\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { Ent\-h\"alt~\ox[pos=side]{6,Chrom}.~Kann~aller\-gi\-sche~Re\-ak\-tio\-nen~her\-vor\-ru\-fen. } +\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { Ent\-h\"alt~Chrom\,(VI).~Kann~aller\-gi\-sche~Re\-ak\-tio\-nen~her\-vor\-ru\-fen. } \prop_put:Nnn \l__ghsystem_euh_prop { 204 } { Ent\-h\"alt~\iupac{Iso\|cyan\|ate}.~Kann~aller\-gi\-sche~Re\-ak\-tio\-nen~her\-vor\-ru\-fen. } \prop_put:Nnn \l__ghsystem_euh_prop { 205 } { Ent\-h\"alt~epoxid\-halti\-ge~Ver\-bin\-dun\-gen.~Kann~aller\-gi\-sche~Re\-ak\-tio\-nen~her\-vor\-ru\-fen. } \prop_put:Nnn \l__ghsystem_euh_prop { 206 } { Ach\-tung!~Nicht~zu\-sam\-men~mit~an\-de\-ren~Pro\-duk\-ten~ver\-wen\-den,~da~ge\-f\"ahr\-liche~Ga\-se~(Chlor)~frei\-ge\-setzt~wer\-den~k\"on\-nen. } @@ -359,4 +358,3 @@ \prop_put:Nnn \l__ghsystem_h_prop { 360Fd } { Kann~die~Frucht\-bar\-keit~be\-ein\-tr\"ach\-ti\-gen.~Kann~ver\-mut\-lich~das~Kind~im~Mut\-ter\-leib~sch\"a\-di\-gen. } \prop_put:Nnn \l__ghsystem_h_prop { 360Df } { Kann~das~Kind~im~Mut\-ter\-leib~sch\"a\-di\-gen.~Kann~ver\-mut\-lich~die~Frucht\-bar\-keit~be\-ein\-tr\"ach\-ti\-gen. } -\ExplSyntaxOff \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_italian.def b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_italian.def index 55fa18aba7e..7780caa36ab 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_italian.def +++ b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_italian.def @@ -29,7 +29,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % - the Italian translation was kindly provided by Jonas Rivetti. Many thanks! -\ExplSyntaxOn % ITALIAN DEFINITIONS \prop_clear:N \l__ghsystem_h_prop \prop_clear:N \l__ghsystem_euh_prop @@ -191,7 +190,7 @@ \prop_put:Nnn \l__ghsystem_euh_prop { 201 } { Con\-tie\-ne~piom\-bo.~Non~u\-ti\-liz\-za\-re~su~og\-get\-ti~che~pos\-so\-no~es\-se\-re~ma\-sti\-ca\-ti~o~suc\-chia\-ti~dai~bam\-bi\-ni. } \prop_put:Nnn \l__ghsystem_euh_prop { 201A } { At\-ten\-zio\-ne!~Con\-tie\-ne~piom\-bo. } \prop_put:Nnn \l__ghsystem_euh_prop { 202 } { Ciano\-acrilato.~Pe\-ri\-co\-lo.~In\-col\-la~la~pel\-le~e~gli~oc\-chi~in~po\-chi~se\-con\-di.~Te\-ne\-re~fuo\-ri~dal\-la~por\-ta\-ta~dei~bam\-bi\-ni. } -\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { Con\-tie\-ne~\ox[pos=side]{6,cromo}.~Pu\`o~pro\-vo\-ca\-re~u\-na~re\-a\-zio\-ne~al\-ler\-gi\-ca. } +\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { Con\-tie\-ne~cromo\,(VI).~Pu\`o~pro\-vo\-ca\-re~u\-na~re\-a\-zio\-ne~al\-ler\-gi\-ca. } \prop_put:Nnn \l__ghsystem_euh_prop { 204 } { Con\-tie\-ne~iso\-cianati.~Pu\`o~pro\-vo\-ca\-re~u\-na~re\-a\-zio\-ne~al\-ler\-gi\-ca. } \prop_put:Nnn \l__ghsystem_euh_prop { 205 } { Con\-tie\-ne~com\-po\-nen\-ti~epossi\-di\-ci.~Pu\`o~pro\-vo\-ca\-re~u\-na~re\-a\-zio\-ne~al\-ler\-gi\-ca. } \prop_put:Nnn \l__ghsystem_euh_prop { 206 } { At\-ten\-zio\-ne!~Non~u\-ti\-liz\-za\-re~in~com\-bi\-na\-zio\-ne~con~al\-tri~pro\-dot\-ti.~Pos\-so\-no~li\-be\-rar\-si~gas~pe\-ri\-co\-lo\-si~(cloro). } @@ -361,4 +360,3 @@ \prop_put:Nnn \l__ghsystem_h_prop { 360Fd } { Pu\`o~nuo\-ce\-re~al\-la~fer\-ti\-li\-t\`a.~So\-spet\-ta\-to~di~nuo\-ce\-re~al~fe\-to. } \prop_put:Nnn \l__ghsystem_h_prop { 360Df } { Pu\`o~nuo\-ce\-re~al~fe\-to.~So\-spet\-ta\-to~di~nuo\-ce\-re~al\-la~fer\-ti\-li\-t\`a. } -\ExplSyntaxOff \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_langtemplate.def b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_langtemplate.def index 28863950bca..a7455f844d5 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_langtemplate.def +++ b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_langtemplate.def @@ -28,7 +28,7 @@ % - The Current Maintainer of this work is Clemens Niederberger. - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% A few informations how to use this template: +% Some information how to use this template: % % The H, EUH, and P statements are stored in a property list, respectively. % The commands for adding a respective entry are pre-typed so you only have to @@ -72,7 +72,6 @@ % \end{document} % ----------------------------------------------------------------------------- % -\ExplSyntaxOn % DEFINITIONS \prop_clear:N \l__ghsystem_h_prop \prop_clear:N \l__ghsystem_euh_prop @@ -214,7 +213,7 @@ \prop_put:Nnn \l__ghsystem_euh_prop { 201 } { ... } \prop_put:Nnn \l__ghsystem_euh_prop { 201A } { ... } \prop_put:Nnn \l__ghsystem_euh_prop { 202 } { \iupac { ... } . ~ ... } -\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { ... ~ \ox[pos=side]{ 6 , ... } . ~ ... } +\prop_put:Nnn \l__ghsystem_euh_prop { 203 } { ... ~ ... \,(VI) . ~ ... } \prop_put:Nnn \l__ghsystem_euh_prop { 204 } { ... ~ \iupac { ... } . ~ ... } \prop_put:Nnn \l__ghsystem_euh_prop { 205 } { ... } \prop_put:Nnn \l__ghsystem_euh_prop { 206 } { ... } @@ -384,4 +383,3 @@ \prop_put:Nnn \l__ghsystem_h_prop { 360Fd } { ... } \prop_put:Nnn \l__ghsystem_h_prop { 360Df } { ... } -\ExplSyntaxOff \ No newline at end of file -- cgit v1.2.3