diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-02 22:49:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-02 22:49:31 +0000 |
commit | 9d63d20b395741946482b9029e072ae7ebff21f0 (patch) | |
tree | 26e2e930c4b2f12cf1d8a96c9958ae138d7b5ccd /Master/texmf-dist/tex/latex/chemmacros | |
parent | 069503af305d75c1cef7a93d073495529d717229 (diff) |
chemmacros (2may16)
git-svn-id: svn://tug.org/texlive/trunk@40838 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros')
13 files changed, 757 insertions, 201 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex index 2bb4a557d6e..28ffe5d485f 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{acid-base}{2016/02/04 acid/base} +\ChemModule{acid-base}{2016/04/27 acid/base} \chemmacros_load_modules:n {charges} @@ -137,5 +137,41 @@ } % -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslation {English} {K-acid} {\mathrm{a}} +\DeclareTranslation {German} {K-acid} {\mathrm{s}} +\DeclareTranslation {Dutch} {K-acid} {\mathrm{z}} + +\DeclareTranslation {English} {K-base} {\mathrm{b}} + +\DeclareTranslation {English} {K-water} {\mathrm{w}} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {K-acid} + { + fallback = \mathrm {a} , + English = \mathrm {a} , + German = \mathrm {s} , + Dutch = \mathrm {z} + } + +\chemmacros_declare_translations:nn {K-base} + { + fallback = \mathrm {b} , + English = \mathrm {b} , + German = \mathrm {b} + } + +\chemmacros_declare_translations:nn {K-water} + { + fallback = \mathrm {w} , + English = \mathrm {w} , + German = \mathrm {w} + } +\EndChemCompatibility +% -------------------------------------------------------------------------- \tex_endinput:D + 2016/02/04 - \NewChemEqConstant and family, new option `eq-constant' +2016/04/27 - moved translations from lang module to acid-base module diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex index 1cfdfaf7a30..158bb962b70 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{base}{2016/02/09 basic chemmacros module} +\ChemModule{base}{2016/04/25 basic chemmacros module} % for the document hooks \ChemCompatibilityFrom{5.1} @@ -244,6 +244,121 @@ } \EndChemCompatibility +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \chemmacros_cs_if_free_new:Npn #1 + { + \cs_if_exist:NF #1 + { \cs_new:Npn #1 } + } +\cs_generate_variant:Nn \chemmacros_cs_if_free_new:Npn {c} + +\cs_new_protected:Npn \chemmacros_cs_if_free_new_protected:Npn #1 + { + \cs_if_exist:NF #1 + { \cs_new_protected:Npn #1 } + } +\cs_generate_variant:Nn \chemmacros_cs_if_free_new_protected:Npn {c} + +% #1: counter +% #2: singular +% #3: plural +% #4: Singular +% #5: Plural +\cs_new_protected:Npn \chemmacros_add_cleveref_support:nnnnn #1#2#3#4#5 + { + \AfterEndPreamble + { + \chemmacros_if_package_loaded:nT {cleveref} + { + \cs_if_exist:cF {cref@#1@name} + { + \crefname {#1} {#2} {#3} + \Crefname {#1} {#4} {#5} + } + } + } + } +\cs_generate_variant:Nn \chemmacros_add_cleveref_support:nnnnn {nnnx , nnnxx , nnnnx } + +% #1: counter +% #2: singular +% #3: Singular (optional) +% #4: plural +% #5: Plural (optional) +\NewDocumentCommand \ChemCleverefSupport {mmomo} + { + \IfNoValueTF {#3} + { + \IfNoValueTF {#5} + { + \chemmacros_add_cleveref_support:nnnnn + {#1} + {#2} + {#4} + { \tl_mixed_case:n {#2} } + { \tl_mixed_case:n {#4} } + } + { + \chemmacros_add_cleveref_support:nnnnn + {#1} + {#2} + {#4} + { \tl_mixed_case:n {#2} } + {#5} + } + } + { + \IfNoValueTF {#5} + { + \chemmacros_add_cleveref_support:nnnnn + {#1} + {#2} + {#4} + {#3} + { \tl_mixed_case:n {#4} } + } + { \chemmacros_add_cleveref_support:nnnnn {#1} {#2} {#4} {#3} {#5} } + } + } +\@onlypreamble\ChemCleverefSupport + +% #1: id +% #2: mid sentence +% #3: begin sentence +\cs_new_protected:Npn \chemmacros_add_fancyref_support:nnn #1#2#3 + { + \AfterEndPreamble + { + \chemmacros_if_package_loaded:nT {fancyref} + { + \chemmacros_cs_if_free_new:cpn {fancyref#1labelprefix} {#1} + \chemmacros_cs_if_free_new:cpn {fref#1name} {#2} + \chemmacros_cs_if_free_new:cpn {Fref#1name} {#3} + \exp_args:Nnx \frefformat {vario} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {fref#1name} \fancyrefdefaultspacing ##1##3 } + \exp_args:Nnx \Frefformat {vario} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {Fref#1name} \fancyrefdefaultspacing ##1##3 } + \exp_args:Nnx \frefformat {plain} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {fref#1name} \fancyrefdefaultspacing ##1 } + \exp_args:Nnx \Frefformat {plain} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {Fref#1name} \fancyrefdefaultspacing ##1 } + } + } + } +\cs_generate_variant:Nn \chemmacros_add_fancyref_support:nnn {nnx} + +% #1: id +% #2: mid sentence +% #3: begin sentence (optional) +\NewDocumentCommand \ChemFancyrefSupport {mmo} + { + \IfNoValueTF {#3} + { \chemmacros_add_fancyref_support:nnn {#1} {#2} { \tl_mixed_case:n {#3} } } + { \chemmacros_add_fancyref_support:nnn {#1} {#2} {#3} } + } +\@onlypreamble\ChemFancyrefSupport +\EndChemCompatibility + % -------------------------------------------------------------------------- % some checks at begin document: \bool_new:N \l__chemmacros_in_document_bool @@ -359,3 +474,5 @@ 2015/10/14 - load `errorcheck' module 2016/02/09 - starred version of \NewChemMacroset 2016/03/07 - \chemmacros_define_keys:nn and friends +2016/04/25 - macros for cleveref and fancyref support, \ChemCleverefSupport + \ChemFancyrefSupport diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex index f9bddf7f04f..e15bc518d6a 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex @@ -25,15 +25,14 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{chemformula}{2015/10/13 integration of chemical formulas} +\ChemModule{chemformula}{2016/04/27 integration of chemical formulas} \RequirePackage{amstext} \chemmacros_load_module:n {charges} \msg_new:nnn {chemmacros} {unknown-formula-method} { - You~ chose~ the~ formula~ method~ `#1'~ which~ is~ not~ available.~ Valid~ - methods~ are~ (the~ recommended~ choice)~ `chemformula'~ and~ `mhchem'.~ + You~ chose~ the~ formula~ method~ `#1'~ which~ is~ not~ available.~ I'm~ falling~ back~ to~ `chemformula'~ now. } @@ -45,61 +44,156 @@ \msg_new:nnn {chemmacros} {formula-conflict} { - You~ have~ loaded~ both~ `mhchem'~ and~ `chemformula'!~ You~ should~ - decide~ for~ only~ one~ of~ both~ packages~ for~ having~ a~ consistent~ - layout.~ I~ will~ use~ `chemformula'. + You~ have~ loaded~ multiple~ formula~ method~ packages~ but~ haven't~ + chosen~ which~ method~ to~ use!~ I~ will~ use~ `chemformula'. \\ + You~ should~ decide~ for~ only~ one~ of~ the~ packages~ for~ having~ a~ + consistent~ layout. } +% -------------------------------------------------------------------------- +% generic functions for usage in other packages; those are to be set in each +% method setup: +\cs_new_protected:Npn \chemmacros_reaction:n #1 {#1} +\cs_new_protected:Npn \chemmacros_chemformula:n #1 {#1} +\cs_generate_variant:Nn \chemmacros_chemformula:n { x,V } + +\cs_new_protected:Npn \chemmacros@formula #1 { \chemmacros_chemformula:n {#1} } +\cs_new_protected:Npn \chemmacros@reaction #1 { \chemmacros_reaction:n {#1} } + +% -------------------------------------------------------------------------- +% setup, check and define each method: \bool_new:N \l__chemmacros_formula_method_set_bool \tl_new:N \g_chemmacros_formula_method_tl \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} -\cs_new_protected:Npn \chemmacros_set_formula_method:n #1 +\prop_new:N \l__chemmacros_method_packages_prop + +% #1: package/method name +% #2: preparations +\cs_new_protected:Npn \chemmacros_add_method_package:nn #1#2 + { \prop_put:Nnn \l__chemmacros_method_packages_prop {#1} {#2} } + +\cs_new_protected:Npn \chemmacros_setup_method_package:n #1 + { + \prop_item:Nn \l__chemmacros_method_packages_prop {#1} + \tl_gset:Nn \g_chemmacros_formula_method_tl {#1} + } + +\prg_new_conditional:Npnn \chemmacros_if_method_package:n #1 {p,T,F,TF} + { + \prop_if_in:NnTF \l__chemmacros_method_packages_prop {#1} + { \prg_return_true: } + { \prg_return_false: } + } + +\cs_new_protected:Npn \chemmacros_check_formula_method: { \bool_if:NF \l__chemmacros_formula_method_set_bool { - \str_case:nnTF {#1} + \bool_set_false:N \l__chemmacros_tmpa_bool + \prop_map_inline:Nn \l__chemmacros_method_packages_prop { - {chemformula} { - \chemmacros_integrate_package:nnn {} {chemformula} {2015/09/08} - \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} - } - {mhchem} { - \chemmacros_integrate_package:nnn {version=4} {mhchem} {} - \cs_set_protected:Npn \chemmacros_chemformula:n ##1 { \ce {##1} } - \cs_set_protected:Npn \chemmacros_reaction:n ##1 { \ce {##1} } - \chemmacros_after_module:nn {charges} - { - \cs_set_protected:Npn \chemmacros_elpair:n ##1 { \ce{##1} : } - \cs_set_protected:Npn \chemmacros_plus: { + } - \cs_set_protected:Npn \chemmacros_minus: { - } - \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } - \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } - \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } - \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } - } - \tl_gset:Nn \g_chemmacros_formula_method_tl {mhchem} + \chemmacros_if_package_loaded:nT {##1} + { + \bool_if:NTF \l__chemmacros_tmpa_bool + { + \msg_warning:nn {chemmacros} {formula-conflict} + \chemmacros_set_formula_method:n {chemformula} + } + { \chemmacros_set_formula_method:n {##1} } + \bool_set_true:N \l__chemmacros_tmpa_bool + } } + \bool_if:NF \l__chemmacros_tmpa_bool + { + \msg_info:nn {chemmacros} {default-formula-method} + \chemmacros_set_formula_method:n {chemformula} } - { \bool_set_true:N \l__chemmacros_formula_method_set_bool } - { \bool_set_false:N \l__chemmacros_formula_method_set_bool } } } + +\cs_new_protected:Npn \chemmacros_set_formula_method:n #1 + { + \chemmacros_if_method_package:nTF {#1} + { \chemmacros_setup_method_package:n {#1} } + { + \msg_warning:nnn {chemmacros} {unknown-formula-method} {#1} + \chemmacros_setup_method_package:n {chemformula} + } + \bool_set_true:N \l__chemmacros_formula_method_set_bool + } \cs_generate_variant:Nn \chemmacros_set_formula_method:n {V} % -------------------------------------------------------------------------- -% let's make use of `chemformula' inside some of `chemmacros' commands: -\cs_new_protected:Npn \chemmacros_chemformula:n #1 - { \chemformula_chcpd:nn {} {#1} } -\cs_generate_variant:Nn \chemmacros_chemformula:n { x,V } +% add formula methods: +\chemmacros_add_method_package:nn {chemformula} + { + \chemmacros_integrate_package:nnn {} {chemformula} {2015/09/08} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 + { \chemformula_chcpd:nn {} {#1} } + \cs_set_protected:Npn \chemmacros_reaction:n #1 + { \chemformula_ch:nn {} {#1} } + } + +\chemmacros_add_method_package:nn {mhchem} + { + \chemmacros_integrate_package:nnn {version=4} {mhchem} {} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 { \ce {#1} } + \cs_set_protected:Npn \chemmacros_reaction:n #1 { \ce {#1} } + \chemmacros_after_module:nn {charges} + { + \cs_set_protected:Npn \chemmacros_elpair:n #1 { \ce{#1} : } + \cs_set_protected:Npn \chemmacros_plus: { + } + \cs_set_protected:Npn \chemmacros_minus: { - } + \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } + \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } + \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } + \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } + } + } -\cs_new_protected:Npn \chemmacros_reaction:n #1 - { \chemformula_ch:nn {} {#1} } +\ChemCompatibilityFrom{5.6} +\chemmacros_add_method_package:nn {chemist} + { + \RequirePackage {chemist} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 + { \chemmacros_text:n { \ChemForm {#1} } } + \cs_set_protected:Npn \chemmacros_reaction:n #1 + { \chemmacros_text:n { \ChemForm {#1} } } + \chemmacros_after_module:nn {charges} + { + \cs_set_protected:Npn \chemmacros_elpair:n #1 + { \chemmacros_text:n { \ChemForm {#1} : } } + \cs_set_protected:Npn \chemmacros_plus: { + } + \cs_set_protected:Npn \chemmacros_minus: { - } + \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } + \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } + \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } + \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } + } + } -% for module writers prefering traditional 2e programming: -\cs_new_protected:Npn \chemmacros@formula #1 { \chemmacros_chemformula:n {#1} } -\cs_new_protected:Npn \chemmacros@reaction #1 { \chemmacros_reaction:n {#1} } +\chemmacros_add_method_package:nn {chemfig} + { + \RequirePackage {chemfig} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 + { \printatom {#1} } + \cs_set_protected:Npn \chemmacros_reaction:n #1 + { \printatom {#1} } + \chemmacros_after_module:nn {charges} + { + \cs_set_protected:Npn \chemmacros_elpair:n #1 + { \Lewis { 0: , \printatom {#1} } } + \cs_set_protected:Npn \chemmacros_plus: { + } + \cs_set_protected:Npn \chemmacros_minus: { - } + \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } + \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } + \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } + \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } + } + } +\EndChemCompatibility % -------------------------------------------------------------------------- \ChemCompatibilityTo{5.0} @@ -108,52 +202,25 @@ \ChemCompatibilityFrom{5.1} \chemmacros_define_global_keys:n - { - formula .choices:nn = - { chemformula , mhchem } - { \chemmacros_set_formula_method:V \l_keys_choice_tl } , - formula / unknown .code:n = - \msg_warning:nnn {chemmacros} {unknown-formula-method} {#1} - \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} - } + { formula .code:n = \chemmacros_set_formula_method:n {#1} } \EndChemCompatibility -\cs_new_protected:Npn \chemmacros_check_formula_method: +\AtEndPreamble { - \bool_if:nTF - { - \chemmacros_if_package_loaded_p:n {chemformula} && - \chemmacros_if_package_loaded_p:n {mhchem} && - } - { - \msg_warning:nn {chemmacros} {formula-conflict} - \bool_if:NF \l__chemmacros_formula_method_set_bool - { - \msg_info:nn {chemmacros} {default-formula-method} - \chemmacros_set_formula_method:n {chemformula} - } - } + \bool_if:nT { - \chemmacros_if_package_loaded:nTF {mhchem} - { \chemmacros_set_formula_method:n {mhchem} } - { - \chemmacros_if_package_loaded:nF {chemformula} - { \msg_info:nn {chemmacros} {default-formula-method} } - \chemmacros_set_formula_method:n {chemformula} - } + !\l__chemmacros_formula_method_set_bool + && + \chemmacros_if_compatiblity_p:nn {>=} {5.2} + && + \chemmacros_if_compatiblity_p:nn {<} {5.6} } - } - -\AtEndPreamble - { - \bool_if:NF \l__chemmacros_formula_method_set_bool + { \chemmacros_check_formula_method: } { - \chemmacros_if_compatiblity:nnTF {>=} {5.2} - { \chemmacros_check_formula_method: } - { - \msg_info:nn {chemmacros} {default-formula-method} - \chemmacros_set_formula_method:V \g_chemmacros_formula_method_tl - } + \chemmacros_if_compatiblity:nnTF {>=} {5.6} + { \msg_warning:nn {chemmacros} {default-formula-method} } + { \msg_info:nn {chemmacros} {default-formula-method} } + \chemmacros_set_formula_method:n {chemformula} } } @@ -165,3 +232,7 @@ 2015/10/13 - add missing compatibility definitions - check for `mhchem' and `chemformula' and set method accordingly if possible +2016/04/27 - further generalization of the `method' concept, new methods + `chemist' and `chemfig' + - don't automatically load an available method: load `chemformula' + if the users haven't decided for themselves and issue a warning diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex index 6872adaf469..8d0abe1695e 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{lang}{2016/02/03 language settings for chemmacros} +\ChemModule{lang}{2016/04/27 language settings for chemmacros} \RequirePackage{translations} @@ -93,54 +93,51 @@ } % -------------------------------------------------------------------------- -\DeclareTranslationFallback {scheme-name} {Scheme} -\DeclareTranslation {English} {scheme-name} {Scheme} -\DeclareTranslation {German} {scheme-name} {Schema} - -\DeclareTranslationFallback {scheme-list} {List~ of~ Schemes} -\DeclareTranslation {English} {scheme-list} {List~ of~ Schemes} -\DeclareTranslation {German} {scheme-list} {Verzeichnis~ der~ Schemata} - -% -------------------------------------------------------------------------- -\DeclareTranslation {English} {K-acid} {\mathrm{a}} -\DeclareTranslation {German} {K-acid} {\mathrm{s}} -\DeclareTranslation {Dutch} {K-acid} {\mathrm{z}} - -\DeclareTranslation {English} {K-base} {\mathrm{b}} - -\DeclareTranslation {English} {K-water} {\mathrm{w}} - -% -------------------------------------------------------------------------- -\DeclareTranslation {English} {phase-sld} {s} -\DeclareTranslation {German} {phase-sld} {f} - -\DeclareTranslation {English} {phase-lqd} {l} -\DeclareTranslation {German} {phase-lqd} {f\/l} - -\DeclareTranslation {English} {phase-gas} {g} -\DeclareTranslation {German} {phase-gas} {g} +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \__chemmacros_declare_translation:nw #1#2=#3\q_stop + { + \tl_set:Nx \l__chemmacros_tmpa_tl { \tl_trim_spaces:n {#2} } + \tl_set:Nx \l__chemmacros_tmpb_tl { \tl_trim_spaces:n {#3} } + \use:x + { + \chemmacros_declare_translation:nnn + { \exp_not:V \l__chemmacros_tmpa_tl } + { \exp_not:n {#1} } + { \exp_not:V \l__chemmacros_tmpb_tl } + } + } -\DeclareTranslation {English} {phase-aq} {aq} -\DeclareTranslation {German} {phase-aq} {aq} +% #1: key +% #2: lang +% #3: translation +\cs_new_protected:Npn \chemmacros_declare_translation:nnn #1#2#3 + { \DeclareTranslation {#1} {#2} {#3} } -% -------------------------------------------------------------------------- -\DeclareTranslationFallback {list-of-reactions} {List~ of~ Reactions} -\DeclareTranslation {English} {list-of-reactions} {List~ of~ Reactions} -\DeclareTranslation {German} {list-of-reactions} {Reaktionsverzeichnis} -\DeclareTranslation {Italian} {list-of-reactions} {Elenco~ delle~ reazioni} -\DeclareTranslation {French} {list-of-reactions} {Table~ des~ r\'eactions} -\DeclareTranslation {Dutch} {list-of-reactions} {Lijst~ van~ reacties} +% #1: key +% #2: csv list: { <lang1> = <translation1> , <lang2> = <translation2> } +\cs_new_protected:Npn \chemmacros_declare_translations:nn #1#2 + { + \clist_map_inline:nn {#2} + { \__chemmacros_declare_translation:nw {#1} ##1 \q_stop } + } -\DeclareTranslationFallback {reaction} {Reaction} -\DeclareTranslation {English} {reaction} {Reaction} -\DeclareTranslation {German} {reaction} {Reaktion} -\DeclareTranslation {Italian} {reaction} {Reazione} -\DeclareTranslation {French} {reaction} {R\'eaction} -\DeclareTranslation {Dutch} {reaction} {Reactie} +\NewDocumentCommand \DeclareChemTranslations {mm} + { \chemmacros_declare_translations:nn {#1} {#2} } +\@onlypreamble \DeclareChemTranslations + +\NewDocumentCommand \DeclareChemTranslation {mmm} + { \chemmacros_declare_translation:nnn {#1} {#2} {#3} } +\@onlypreamble \DeclareChemTranslation +\EndChemCompatibility % -------------------------------------------------------------------------- - \tex_endinput:D 2015/11/17 - remove options `german' and `ngerman', starting with v5.3 2016/02/03 - adapt to changes in `acid-base' module +2016/04/27 - additions/changes to reaction and scheme translations + - \chemmacros_declare_translation:nnn and + \chemmacros_declare_translations:nn + - \DeclareChemTranslation and \DeclareChemTranslations + - moved translations from lang module to the corresponding modules + they belong to diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex index 7fbf68463f0..53828dcf71a 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{newman}{2015/07/13 newman projections} +\ChemModule{newman}{2016/04/23 newman projections} \chemmacros_load_module:n {tikz} @@ -36,7 +36,7 @@ \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_set:Nn \l__chemmacros_newman_scale_fp {1} \fp_new:N \l__chemmacros_newman_x_fp \fp_new:N \l__chemmacros_newman_y_fp @@ -62,68 +62,64 @@ } % \newman[<keyval>](<angle>){<1>,<2>,<3>,<4>,<5>,<6>} -\NewDocumentCommand \newman { o d() > { \SplitArgument { 5 } { , } } m } +\NewDocumentCommand \newman {od()m} { \group_begin: - \IfNoValueF { #1 } { \chemmacros_set_keys:nn {newman} { #1 } } - \IfNoValueTF { #2 } - { \chemmacros_newman_atoms:nnnnnnn { } #3 } - { \chemmacros_newman_atoms:nnnnnnn { #2 } #3 } + \IfNoValueF {#1} { \chemmacros_set_keys:nn {newman} {#1} } + \IfNoValueTF {#2} + { \chemmacros_newman:nn { } {#3} } + { \chemmacros_newman:nn {#2} {#3} } \group_end: } +% #1: angle +% #2: csv list of atoms +\cs_new_protected:Npn \chemmacros_newman:nn #1#2 + { \__chemmacros_newman_feed_atoms:nw {#1}#2 ,,,,,, \q_stop } + +\cs_new_protected:Npn \__chemmacros_newman_feed_atoms:nw #1#2,#3,#4,#5,#6,#7,#8 \q_stop + { \chemmacros_newman_atoms:nnnnnnn {#1} {#2} {#3} {#4} {#5} {#6} {#7} } + % place atoms: % #1: angle % #2 - #7: atoms \cs_new_protected:Npn \chemmacros_newman_atoms:nnnnnnn #1#2#3#4#5#6#7 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \fp_set_eq:NN \l__chemmacros_newman_rel_angle_fp \l__chemmacros_newman_abs_angle_fp } - { \fp_set:Nn \l__chemmacros_newman_rel_angle_fp { #1 } } + { \fp_set:Nn \l__chemmacros_newman_rel_angle_fp {#1} } \chemmacros_tikz_picture:xn { scale = \fp_to_decimal:N \l__chemmacros_newman_scale_fp , chemmacros_newman_atom_front / .style = { - inner~sep=0pt, - outer~sep=0pt, - \tl_use:N \l__chemmacros_newman_tikz_front_tl + inner~sep = 0pt , + outer~sep = 0pt , + \exp_not:V \l__chemmacros_newman_tikz_front_tl }, chemmacros_newman_atom_back / .style = { - inner~sep=0pt, - outer~sep=0pt, + inner~sep = 0pt , + outer~sep = 0pt , \bool_if:NTF \l__chemmacros_newman_tikz_back_bool - { \tl_use:N \l__chemmacros_newman_tikz_back_tl } - { \tl_use:N \l__chemmacros_newman_tikz_front_tl } + { \exp_not:V \l__chemmacros_newman_tikz_back_tl } + { \exp_not:V \l__chemmacros_newman_tikz_front_tl } } } { \chemmacros_tikz_draw:x { \exp_not:V \l__chemmacros_newman_tikz_ring_tl } (0pt,0pt) circle (\fp_to_dim:N \l__chemmacros_newman_scale_fp * 15) ; - \chemmacros_newman_back_node:nn - { 30 } - { \IfNoValueF { #6 } { #6 } } - \chemmacros_newman_back_node:nf - { 150 } - { \IfNoValueF { #7 } { #7 } } - \chemmacros_newman_back_node:nf - { 270 } - { \IfNoValueF { #5 } { #5 } } - \chemmacros_newman_front_node:nf - { 90 } - { \IfNoValueF { #2 } { #2 } } - \chemmacros_newman_front_node:nf - { 210 } - { \IfNoValueF { #3 } { #3 } } - \chemmacros_newman_front_node:nf - { 330 } - { \IfNoValueF { #4 } { #4 } } + \chemmacros_newman_back_node:nn {30} {#6} + \chemmacros_newman_back_node:nn {150} {#7} + \chemmacros_newman_back_node:nn {270} {#5} + \chemmacros_newman_front_node:nn {90} {#2} + \chemmacros_newman_front_node:nn {210} {#3} + \chemmacros_newman_front_node:nn {330} {#4} } } @@ -209,3 +205,8 @@ { #2 } ; } \cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf } + +% -------------------------------------------------------------------------- +\tex_endinput:D + +2016/04/23 - some changes on how \newman is processed internally 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 431129e7482..32fd36fdd52 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 @@ -544,12 +544,14 @@ \NewChemIUPACShorthand ^ \chemmacros_superscript:n \NewChemIUPACShorthand | \chemmacros_break_point: \NewChemIUPACShorthand - \chemmacros_break_point_hyphen: + \ChemCompatibilityFrom{5.1} \NewChemIUPACShorthand ( \chemmacros_break_point_opening_paren: \NewChemIUPACShorthand ) \chemmacros_break_point_closing_paren: \NewChemIUPACShorthand [ \chemmacros_break_point_opening_bracket: \NewChemIUPACShorthand ] \chemmacros_break_point_closing_bracket: \EndChemCompatibility + \ChemCompatibilityFrom{5.3} \NewChemIUPAC \chemprime { \ensuremath {{}^{\prime}} } \NewChemIUPACShorthand ' \chemprime diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex index 72622f37f07..f30b71e10b1 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex @@ -144,7 +144,8 @@ \tl_set:Nn \l__chemmacros_orbital_s_phase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn{ \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shade:x { ball~color = \exp_not:V \l__chemmacros_orbital_s_phase_color_tl } @@ -208,7 +209,8 @@ \tl_set:Nn \l__chemmacros_orbital_p_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { @@ -302,7 +304,8 @@ \tl_set:Nn \l__chemmacros_orbital_sp_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { @@ -393,7 +396,8 @@ \tl_set:Nn \l__chemmacros_orbital_sptwo_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { @@ -484,7 +488,8 @@ \tl_set:Nn \l__chemmacros_orbital_spthree_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex index a373a0f58d8..fc07911ccc7 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex @@ -25,14 +25,21 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{particles}{2016/01/13 particles} +\ChemModule{particles}{2016/04/02 particles} \chemmacros_load_modules:n {charges,chemformula} % -------------------------------------------------------------------------- % particles \cs_new_protected:Nn \chemmacros_define_particle:Nn - { \cs_set_protected:Npn #1 { \chemmacros_chemformula:n {#2} } } + { + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \ExplSyntaxOff } {#2} + \use:x + { + \cs_set_protected:Npn \exp_not:N #1 + { \chemmacros_chemformula:n { \exp_not:V \l__chemmacros_tmpa_tl } } + } + } \NewChemMacroset {Particle} {mm} { \chemmacros_define_particle:Nn #1 {#2} } @@ -88,7 +95,7 @@ { \skip_horizontal:N \l__chemmacros_nucleophile_dim } \chemmacros_chemformula:n { {}^{-} } } - { \chemmacros_chemformula:n { #2- } } + { \chemmacros_chemformula:n { #2^{-} } } } \DeclareDocumentCommand #1 {o} { @@ -105,19 +112,19 @@ % -------------------------------------------------------------------------- % particles: -\NewChemParticle \el { e- } -\NewChemParticle \prt { p+ } +\NewChemParticle \el { e^- } +\NewChemParticle \prt { p^+ } \NewChemParticle \ntr { n^0 } % ions, molecules % proton, hydroxide, hydronium/oxonium, water: -\NewChemParticle \Hpl { H+ } -\NewChemParticle \Hyd { OH- } -\NewChemParticle \Oxo { H3O+ } -\NewChemParticle \water { H2O } +\NewChemParticle \Hpl { H^+ } +\NewChemParticle \Hyd { OH^- } +\NewChemParticle \Oxo { H_3O^+ } +\NewChemParticle \water { H_2O } % electrophile: -\NewChemParticle \El { E+ } +\NewChemParticle \El { E^+ } % nucleophiles: \NewChemNucleophile \Nuc {Nu} @@ -131,3 +138,4 @@ % -------------------------------------------------------------------------- \tex_endinput:D 2016/01/13 - new option particles/space +2016/04/02 - adapt to formula methods `chemist' and `chemfig' diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex index f2f9e6f0406..38fa658a8f5 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex @@ -83,3 +83,52 @@ \NewChemPhase \aq {aq} % -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslation {English} {phase-sld} {s} +\DeclareTranslation {German} {phase-sld} {f} + +\DeclareTranslation {English} {phase-lqd} {l} +\DeclareTranslation {German} {phase-lqd} {f\/l} + +\DeclareTranslation {English} {phase-gas} {g} +\DeclareTranslation {German} {phase-gas} {g} + +\DeclareTranslation {English} {phase-aq} {aq} +\DeclareTranslation {German} {phase-aq} {aq} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {phase-sld} + { + fallback = s , + English = s , + German = f + } + +\chemmacros_declare_translations:nn {phase-lqd} + { + fallback = l , + English = l , + German = f\/l + } + +\chemmacros_declare_translations:nn {phase-gas} + { + fallback = g , + English = g , + German = g + } + +\chemmacros_declare_translations:nn {phase-aq} + { + fallback = aq , + English = aq , + German = aq + } +\EndChemCompatibility + +% -------------------------------------------------------------------------- +\tex_endinput:D + +2015/06/09 - first version +2016/04/27 - moved translations from lang module to phases module diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex index 8f8a98f8d95..ed8f48cfd5c 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{reactions}{2016/02/09 reaction environments} +\ChemModule{reactions}{2016/04/27 reaction environments} \chemmacros_load_module:n {chemformula} @@ -34,14 +34,14 @@ % -------------------------------------------------------------------------- \cs_new_protected:Npn \__chemmacros_record_for_lor:nnnnn #1#2#3#4#5 { - \tl_if_eq:nnT { #1 } { reaction } + \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 } + \addcontentsline {lor} {reaction} { \tl_use:N \l__chemmacros_reaction_lorname_tl \tl_use:N \c_space_tl @@ -66,7 +66,7 @@ \maketag@@@{#3\ignorespaces#2{##1}\unskip\@@italiccorr#4} % this is added => this disturbs hyperref: \__chemmacros_record_for_lor:nnnnn - { #1 } { #3 } { #2 } { ##1 } { #4 } + {#1} {#3} {#2} {##1} {#4} } } } @@ -75,12 +75,12 @@ \cs_new_protected:Npn \chemmacros_add_reaction_description:n #1 { - \tl_if_blank:nF { #1 } - { \tl_gset:Nn \g__chemmacros_reaction_description_tl { : ~ #1 } } + \tl_if_blank:nF {#1} + { \tl_gset:Nn \g__chemmacros_reaction_description_tl {:~#1} } } -\NewDocumentCommand \AddRxnDesc { m } - { \chemmacros_add_reaction_description:n { #1 } } +\NewDocumentCommand \AddRxnDesc {m} + { \chemmacros_add_reaction_description:n {#1} } % define \listofreactions \tl_new:N \l__chemmacros_reaction_lorname_tl @@ -88,10 +88,18 @@ \tl_new:N \l__chemmacros_reaction_heading_tl \cs_new:Npn \__chemmacros_reaction_heading:n #1 - { \l__chemmacros_reaction_heading_tl { #1 } } + { \l__chemmacros_reaction_heading_tl {#1} } \cs_generate_variant:Nn \__chemmacros_reaction_heading:n { V } -\tl_set:Nn \l__chemmacros_reaction_lorname_tl { \chemmacros_translate:n {reaction} } +\ChemCompatibilityTo{5.5} +\tl_set:Nn \l__chemmacros_reaction_lorname_tl + { \chemmacros_translate:n {reaction} } +\EndChemCompatibility +\ChemCompatibilityFrom{5.6} +\tl_set:Nn \l__chemmacros_reaction_lorname_tl + { \chemmacros_translate:n {Reaction} } +\EndChemCompatibility + \tl_set:Nn \reactionlistname { \chemmacros_translate:n {list-of-reactions} } \chemmacros_define_keys:nn {reactions} @@ -109,12 +117,20 @@ \cs_if_exist:NTF \chapter { - \chemmacros_set_keys:nn {reactions} - { list-heading-cmd = \chapter* {#1} } + \chemmacros_if_compatiblity:nnTF {>=} {5.2} + { + \chemmacros_set_keys:nn {reactions} + { list-heading-cmd = \chapter* {#1} } + } + { \cs_set_protected:Npn \__chemmacros_reaction_heading:n { \chapter* } } } { - \chemmacros_set_keys:nn {reactions} - { list-heading-cmd = \section* {#1} } + \chemmacros_if_compatiblity:nnTF {>=} {5.2} + { + \chemmacros_set_keys:nn {reactions} + { list-heading-cmd = \section* {#1} } + } + { \cs_set_protected:Npn \__chemmacros_reaction_heading:n { \section* } } } \cs_new_protected:Npn \listofreactions @@ -123,14 +139,53 @@ \@starttoc {lor} } +\ChemCompatibilityTo{5.5} \cs_new_protected:Npn \l@reaction #1#2 - { \@dottedtocline { 1 } { 1.5em } { 2.3em } { #1 } { #2 } } + { \@dottedtocline {1} {1.5em} {2.3em} {#1} {#2} } +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\cs_new_eq:NN \l@reaction \l@figure + +\bool_new:N \l__chemmacros_reactions_tocbasic_bool +\cs_if_exist:NT \KOMAClassName + { \bool_set_true:N \l__chemmacros_reactions_tocbasic_bool } + +\chemmacros_define_keys:nn {reactions} + { tocbasic .bool_set:N = \l__chemmacros_reactions_tocbasic_bool } + +\AtEndPreamble + { + \bool_if:nT + { + \chemmacros_if_package_loaded_p:n {tocbasic} || + \l__chemmacros_reactions_tocbasic_bool + } + { + \RequirePackage {tocbasic} + \addtotoclist [float] {lor} + \cs_set_protected:Npn \listofreactions { \listoftoc {lor} } + \cs_new:Npn \listoflorname { \reactionlistname } + } + } + +\ChemCleverefSupport {reaction} + { \chemmacros_translate:n {reaction} } + [ \chemmacros_translate:n {Reaction} ] + { \chemmacros_translate:n {reactions} } + [ \chemmacros_translate:n {Reactions} ] +\ChemFancyrefSupport {rct} + { \chemmacros_translate:n {reaction} } + [ \chemmacros_translate:n {Reaction} ] +\EndChemCompatibility + % create new tagform \newtagform {reaction} {\{} {\}} \newcounter {chemmacros_save_reaction} \newcounter {reaction} +\ChemCompatibilityTo{5.5} \cs_new_protected:Npn \__chemmacros_begin_reaction: { % create individual names for `hyperref': @@ -146,6 +201,23 @@ \setcounter {equation} { \value {reaction} } \usetagform {reaction} } +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \__chemmacros_begin_reaction: + { + \patchcmd \thereaction {reaction} {equation} {} {} + \cs_set_eq:NN \theequation \thereaction + \cs_set_eq:NN \r@equation \r@reaction + \cs_set_eq:NN \p@equation \p@reaction + \cs_set:Npn \theHequation { R . \theHsection . \theequation } + \setcounter {chemmacros_save_reaction} { \value {equation} } + \setcounter {equation} { \value {reaction} } + \chemmacros_if_package_loaded:nT {cleveref} + { \crefalias {equation} {reaction} } + \usetagform {reaction} + } +\EndChemCompatibility % switch back to equation tags \cs_new_protected:Npn \__chemmacros_end_reaction: @@ -166,14 +238,14 @@ \tl_clear:N \l__chemmacros_reactions_args_tl \int_step_function:nnnN {2} {1} {#3+1} \__chemmacros_reactions_build_args:n } - \chemmacros_reaction_env:nnnV {#1} {#2} {#3} \l__chemmacros_reactions_args_tl + \chemmacros_declare_reaction_env:nnnV {#1} {#2} {#3} \l__chemmacros_reactions_args_tl } % #1: chem % #2: math % #3: args number % #4: argument list ({#2}{#3}...) -\cs_new_protected:Npn \chemmacros_reaction_env:nnnn #1#2#3#4 +\cs_new_protected:Npn \chemmacros_declare_reaction_env:nnnn #1#2#3#4 { \exp_args:Nnx \DeclareDocumentEnvironment {#1} { O{} \prg_replicate:nn {#3+0} {m} } { @@ -186,8 +258,9 @@ \ignorespacesafterend } } -\cs_generate_variant:Nn \chemmacros_reaction_env:nnnn {nnnV} - +\cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV} + +\ChemCompatibilityTo{5.5} \cs_new_protected:Npn \chemmacros_reaction_read:nnw #1#2#3 \end { \begin{#1}#2 @@ -195,6 +268,45 @@ \end{#1} \end } +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \chemmacros_reaction_read:nnw #1#2#3 \end + { + \tl_clear:N \l__chemmacros_tmpa_tl + \seq_clear:N \l__chemmacros_tmpc_seq + \seq_set_split:Nnn \l__chemmacros_tmpa_seq {\\} {#3} + \int_set:Nn \l__chemmacros_tmpa_int + { \seq_count:N \l__chemmacros_tmpa_seq } + \int_zero:N \l__chemmacros_tmpb_int + \seq_map_inline:Nn \l__chemmacros_tmpa_seq + { + \int_incr:N \l__chemmacros_tmpb_int + \seq_clear:N \l__chemmacros_tmpc_seq + \seq_set_split:Nnn \l__chemmacros_tmpb_seq {&} {##1} + \seq_map_inline:Nn \l__chemmacros_tmpb_seq + { + \seq_put_right:Nn \l__chemmacros_tmpc_seq + { \chemmacros_reaction:n {####1} } + } + \tl_put_right:Nx \l__chemmacros_tmpa_tl + { \seq_use:Nn \l__chemmacros_tmpc_seq {&} } + \int_compare:nF + { \l__chemmacros_tmpa_int = \l__chemmacros_tmpb_int } + { \tl_put_right:Nn \l__chemmacros_tmpa_tl {\\} } + } + \chemmacros_reaction_write:nnV {#1} {#2} \l__chemmacros_tmpa_tl + \end + } + +\cs_new_protected:Npn \chemmacros_reaction_write:nnn #1#2#3 + { + \begin{#1}#2 + #3 + \end{#1} + } +\cs_generate_variant:Nn \chemmacros_reaction_write:nnn { nnV } +\EndChemCompatibility \NewChemMacroset* {Reaction} {mO{}m} { \chemmacros_define_reaction:nnn {#1} {#3} {#2} } @@ -205,9 +317,85 @@ \NewChemReaction {reactions*} {align*} % -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslationFallback {list-of-reactions} {List~ of~ Reactions} +\DeclareTranslation {English} {list-of-reactions} {List~ of~ Reactions} +\DeclareTranslation {German} {list-of-reactions} {Reaktionsverzeichnis} +\DeclareTranslation {Italian} {list-of-reactions} {Elenco~ delle~ reazioni} +\DeclareTranslation {French} {list-of-reactions} {Table~ des~ r\'eactions} +\DeclareTranslation {Dutch} {list-of-reactions} {Lijst~ van~ reacties} + +\DeclareTranslationFallback {reaction} {Reaction} +\DeclareTranslation {English} {reaction} {Reaction} +\DeclareTranslation {German} {reaction} {Reaktion} +\DeclareTranslation {Italian} {reaction} {Reazione} +\DeclareTranslation {French} {reaction} {R\'eaction} +\DeclareTranslation {Dutch} {reaction} {Reactie} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {list-of-reactions} + { + fallback = List~ of~ Reactions , + English = List~ of~ Reactions , + German = Reaktionsverzeichnis , + Italian = Elenco~ delle~ reazioni , + French = Table~ des~ r\'eactions , + Dutch = Lijst~ van~ reacties + } + +\chemmacros_declare_translations:nn {reaction} + { + fallback = reaction , + English = reaction , + German = Reaktion , + Italian = reazione , + French = r\'{e}action , + Dutch = reactie + } + +\chemmacros_declare_translations:nn {reactions} + { + fallback = reactions , + English = reactions , + German = Reaktionen , + Italian = reazioni , + French = r\'{e}actions , + Dutch = reacties + } + +\chemmacros_declare_translations:nn {Reaction} + { + fallback = Reaction , + English = Reaction , + German = Reaktion , + Italian = Reazione , + French = R\'{e}action , + Dutch = Reactie + } + +\chemmacros_declare_translations:nn {Reactions} + { + fallback = Reactions , + English = Reactions , + German = Reaktionen , + Italian = Reazioni , + French = R\'{e}actions , + Dutch = Reacties + } +\EndChemCompatibility +% -------------------------------------------------------------------------- \tex_endinput:D 2015/09/15 - adapt to `method' option => do not use chemformula's macros directly 2015/10/14 - new option `list-heading-cmd' 2016/02/09 - added \ignorespacesafterend to environments +2016/03/17 - tocbasic integration of lor + - add missing compatibility check for the usage of the + `list-heading-cmd' option +2016/04/02 - adapt to new formula methods +2016/04/27 - correct \__chemmacros_begin_reaction: so tags obey \thereaction + - add cleveref support + - add fancyref support + - moved translations from lang module to reactions module diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex index 7d89d2e4ff9..ba4a9959b7a 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex @@ -331,6 +331,7 @@ \NewDocumentCommand \OX { >{\SplitArgument{1}{,}}m } { \chemmacros_redox_partner:nn #1 } +% TODO: add option to make `#2' be parsed as chem formula \cs_new_protected:Npn \chemmacros_redox_partner:nn #1#2 { \chemmacros_tex_if:nnTF {measuring@} {} 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 6ea3354fdb8..3545b0663a4 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 @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{scheme}{2015/10/23 a scheme floating environment} +\ChemModule{scheme}{2016/04/25 a scheme floating environment} \RequirePackage {chemnum} @@ -164,6 +164,19 @@ } % -------------------------------------------------------------------------- +\ChemCompatibilityFrom{5.6} +\ChemCleverefSupport {scheme} + { \chemmacros_translate:n {scheme} } + [ \chemmacros_translate:n {Scheme} ] + { \chemmacros_translate:n {schemes} } + [ \chemmacros_translate:n {Schemes} ] + +\ChemFancyrefSupport {sch} + { \chemmacros_translate:n {scheme} } + [ \chemmacros_translate:n {Scheme} ] +\EndChemCompatibility + +% -------------------------------------------------------------------------- % #1: env name \cs_new_protected:Npn \chemmacros_define_float:nn #1#2 { @@ -229,12 +242,68 @@ \cs_new_eq:cN {l@#1} \l@figure } } - \cs_set:Npn \schemename {\chemmacros_translate:n {#1-name}} - \cs_set:Npn \listschemename {\chemmacros_translate:n {#1-list}} + \cs_set:cpn {#1name} {\chemmacros_translate:n {#1-name}} + \cs_set:cpn {list#1name} {\chemmacros_translate:n {#1-list}} + } + +% -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslationFallback {scheme-name} {Scheme} +\DeclareTranslation {English} {scheme-name} {Scheme} +\DeclareTranslation {German} {scheme-name} {Schema} + +\DeclareTranslationFallback {scheme-list} {List~ of~ Schemes} +\DeclareTranslation {English} {scheme-list} {List~ of~ Schemes} +\DeclareTranslation {German} {scheme-list} {Verzeichnis~ der~ Schemata} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {scheme-name} + { + fallback = Scheme , + English = Scheme , + German = Schema + } + +\chemmacros_declare_translations:nn {scheme-list} + { + fallback = List~ of~ Schemes , + English = List~ of~ Schemes , + German = Verzeichnis~ der~ Schemata } +\chemmacros_declare_translations:nn {scheme} + { + fallback = scheme , + English = scheme , + German = Schema + } + +\chemmacros_declare_translations:nn {Scheme} + { + fallback = Scheme , + English = Scheme , + German = Schema + } + +\chemmacros_declare_translations:nn {schemes} + { + fallback = schemes , + English = schemes , + German = Schemata + } + +\chemmacros_declare_translations:nn {Schemes} + { + fallback = Schemes , + English = Schemes , + German = Schemata + } +\EndChemCompatibility + \tex_endinput:D % -------------------------------------------------------------------------- 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 +2016/04/25 - cleveref and fancyref support diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 31e6f679976..e119d05200c 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -31,9 +31,9 @@ % -------------------------------------------------------------------------- % package information: -\tl_const:Nn \c_chemmacros_date_tl {2016/03/08} +\tl_const:Nn \c_chemmacros_date_tl {2016/05/02} \tl_const:Nn \c_chemmacros_version_major_number_tl {5} -\tl_const:Nn \c_chemmacros_version_minor_number_tl {5} +\tl_const:Nn \c_chemmacros_version_minor_number_tl {6} \tl_const:Nn \c_chemmacros_version_subrelease_tl {} \tl_const:Nx \c_chemmacros_version_number_tl {\c_chemmacros_version_major_number_tl.\c_chemmacros_version_minor_number_tl} @@ -85,7 +85,11 @@ \fp_compare:nTF { floor(#1) = floor(#3) } { \fp_compare:nTF - { (\chemmacros_get_minor:f {#1}) #2 (\chemmacros_get_minor:f {#3}) } + { + ( \chemmacros_get_minor_version:f {#1} ) + #2 + ( \chemmacros_get_minor_version:f {#3} ) + } { \prg_return_true: } { \prg_return_false: } } @@ -96,11 +100,11 @@ } } -\cs_new:Npn \__chemmacros_get_minor:w #1.#2.#3 \q_stop +\cs_new:Npn \__chemmacros_get_minor_version:w #1.#2.#3 \q_stop { \tl_if_blank:nTF {#2} {0} {#2} } -\cs_new:Npn \chemmacros_get_minor:n #1 - { \__chemmacros_get_minor:w #1.. \q_stop } -\cs_generate_variant:Nn \chemmacros_get_minor:n {f} +\cs_new:Npn \chemmacros_get_minor_version:n #1 + { \__chemmacros_get_minor_version:w #1.. \q_stop } +\cs_generate_variant:Nn \chemmacros_get_minor_version:n {f} % check compatibility % #1: relation @@ -506,3 +510,11 @@ Version history (base) - new option `explicit-zero-sign' (redox) 2016/03/08 - version 5.5 - new module `polymers' +2016/04/25 - version 5.6 - generalization of the formula method concept, new + methods `chemist' and `chemfig' (chemformula) + - use `tocbasic' for the list of reactions if + available (reactions) + - fix reaction environments to obey \thereaction + (reactions) + - add cleveref and fancyref support (reactions) + |