From 38203e642e358a19a7cfc36864af651c0384068b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 23 Jan 2016 22:23:46 +0000 Subject: chemmacros (22jan16) git-svn-id: svn://tug.org/texlive/trunk@39468 c570f23f-e606-0410-a88d-b1316a301751 --- .../chemmacros.module.nomenclature.code.tex | 50 +++++++++++++++------- .../chemmacros/chemmacros.module.scheme.code.tex | 10 ++++- .../texmf-dist/tex/latex/chemmacros/chemmacros.sty | 6 ++- 3 files changed, 47 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex index 59cb743ad2b..551b03ae251 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex @@ -464,7 +464,8 @@ \bool_new:N \l__chemmacros_inside_iupac_bool -\seq_new:N \l__chemmacros_iupac_shorthands_seq +\seq_new:N \l__chemmacros_iupac_shorthands_seq +\prop_new:N \l__chemmacros_iupac_shorthands_prop % #1: token % #2: arg spec @@ -472,48 +473,64 @@ { \seq_if_in:NnF \l__chemmacros_iupac_shorthands_seq {#1} { \seq_put_right:Nn \l__chemmacros_iupac_shorthands_seq {#1} } - \char_set_active_eq:NN #1#2 + \prop_put:Nnn \l__chemmacros_iupac_shorthands_prop {#1} + { \char_set_active_eq:NN #1#2 } } \cs_new_protected:Npn \chemmacros_remove_shorthand:N #1 { \chemmacros_define_iupac_shorthand:NN #1 \c_empty_tl \seq_remove_all:Nn \l__chemmacros_iupac_shorthands_seq {#1} + \prop_remove:Nn \l__chemmacros_iupac_shorthands_prop {#1} } -\cs_new_protected:Npn \chemmacros_activate_iupac_shorthands:n #1 +\prg_new_conditional:Npnn \chemmacros_if_shorthand:N #1 {p,T,F,TF} { - \tl_map_inline:nn {#1} - { - \seq_if_in:NnT \l__chemmacros_iupac_shorthands_seq {##1} - { \char_set_catcode_active:N ##1 } - } + \seq_if_in:NnTF \l__chemmacros_iupac_shorthands_seq {#1} + { \prg_return_true: } + { \prg_return_false: } } + +\cs_new_protected:Npn \chemmacros_for_all_shorthands_do:n #1 + { \seq_map_inline:Nn \l__chemmacros_iupac_shorthands_seq {#1} } + +\cs_new_protected:Npn \chemmacros_activate_iupac_shorthand:N #1 + { \chemmacros_if_shorthand:NT #1 { \char_set_catcode_active:N #1 } } + +\cs_new_protected:Npn \chemmacros_activate_iupac_shorthands:n #1 + { \tl_map_inline:nn {#1} { \chemmacros_activate_iupac_shorthand:N ##1 } } + \cs_new_protected:Npn \chemmacros_activate_all_iupac_shorthands: { - \seq_map_inline:Nn \l__chemmacros_iupac_shorthands_seq - { \char_set_catcode_active:N ##1 } + \chemmacros_for_all_shorthands_do:n + { \chemmacros_activate_iupac_shorthand:N ##1 } + } + +\cs_new_protected:Npn \chemmacros_make_shorthands: + { + \chemmacros_for_all_shorthands_do:n + { \prop_item:Nn \l__chemmacros_iupac_shorthands_prop {##1} } } - + \NewDocumentCommand \DeclareChemIUPACShorthand {mm} { \chemmacros_define_iupac_shorthand:NN #1#2 } \NewDocumentCommand \NewChemIUPACShorthand {mm} { - \seq_if_in:NnTF \l__chemmacros_iupac_shorthands_seq {#1} + \chemmacros_if_shorthand:NTF #1 { \msg_error:nnn {chemmacros} {new-iupac-shorthand} {#1} } { \chemmacros_define_iupac_shorthand:NN #1#2 } } \NewDocumentCommand \ProvideChemIUPACShorthand {mm} { - \seq_if_in:NnF \l__chemmacros_iupac_shorthands_seq {#1} + \chemmacros_if_shorthand:NTF #1 { \chemmacros_define_iupac_shorthand:NN #1#2 } } \NewDocumentCommand \RenewChemIUPACShorthand {mm} { - \seq_if_in:NnTF \l__chemmacros_iupac_shorthands_seq {#1} + \chemmacros_if_shorthand:NTF #1 { \chemmacros_define_iupac_shorthand:NN #1#2 } { \msg_error:nnn {chemmacros} {renew-iupac-shorthand} {#1} } } @@ -543,6 +560,7 @@ \group_begin: \bool_set_true:N \l__chemmacros_inside_iupac_bool \chemmacros_make_iupac: + \chemmacros_make_shorthands: \chemmacros_ignore_spaces: \chemmacros_if_compatiblity:nnT {<=} {5.2} { \chemmacros_define_deprecated:NN \- - } @@ -684,7 +702,7 @@ \pdfstringdefDisableCommands { % \cs_set:Npn \- { - } % maybe not a good idea... - \cs_set:Npn \| { } + % \cs_set:Npn \| { } % \cs_set:Npn \pH { pH } % \cs_set:Npn \pOH { pOH } \cs_set:Npn \iupac #1 {#1} @@ -719,6 +737,7 @@ \cs_set:Npn \nitrogen {N} \cs_set:Npn \sulfur {S} \cs_set:Npn \phosphorus {P} + \cs_set:Npn \chemprime {'} } } @@ -730,3 +749,4 @@ - \cip only italicizes elements of csv list - fix bug in \RemoveChemIUPACShorthand 2016/01/02 - \chemprime +2016/01/23 - give shorthand definitions only inside \iupac diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex index 30fb015dc64..6ea3354fdb8 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex @@ -154,8 +154,13 @@ \AtEndPreamble { - \chemmacros_check_float_methods: - \chemmacros_define_float:nn {scheme} {los} + % the check is there since v5.3a -- let's wait and see if we actually need + % a compatibility check here: + \chemmacros_if_package_loaded:nF {chemscheme} + { + \chemmacros_check_float_methods: + \chemmacros_define_float:nn {scheme} {los} + } } % -------------------------------------------------------------------------- @@ -232,3 +237,4 @@ % -------------------------------------------------------------------------- 2015/09/19 - make the module compatible with floatrow 2015/10/23 - add info message to float method detection +2016/01/23 - make the module compatible with chemscheme diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index ca2552059ec..c557d7e1239 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -31,10 +31,10 @@ % -------------------------------------------------------------------------- % package information: -\tl_const:Nn \c_chemmacros_date_tl {2016/01/13} +\tl_const:Nn \c_chemmacros_date_tl {2016/01/23} \tl_const:Nn \c_chemmacros_version_major_number_tl {5} \tl_const:Nn \c_chemmacros_version_minor_number_tl {3} -\tl_const:Nn \c_chemmacros_version_subrelease_tl {} +\tl_const:Nn \c_chemmacros_version_subrelease_tl {a} \tl_const:Nx \c_chemmacros_version_number_tl {\c_chemmacros_version_major_number_tl.\c_chemmacros_version_minor_number_tl} \tl_const:Nx \c_chemmacros_version_tl @@ -496,3 +496,5 @@ Version history - add \chemprime and ' shorthand (nomenclature) - new option `space' (particles) - TikZ decoration `wave' (tikz) +2016/01/23 - version 5.3a - compatibility with chemscheme package (scheme) + - IUPAC shorthands only defined within \iupac (nomenclature) -- cgit v1.2.3