From 1fa5dc712fe904b27fd05f80c8bc268c400b31ad Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 13 Feb 2022 21:25:05 +0000 Subject: chemmacros (13feb22) git-svn-id: svn://tug.org/texlive/trunk@62004 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/chemmacros/chemmacros.sty | 1104 +++++++++++--------- 1 file changed, 631 insertions(+), 473 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index c9a913e9223..649aed58b64 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -1,40 +1,39 @@ % -------------------------------------------------------------------------- -% the CHEMMACROS package +% the CHEMMACROS package v6.1 2022/02/13 % % comprehensive support for typesetting chemistry documents % % -------------------------------------------------------------------------- -% Clemens Niederberger -% -------------------------------------------------------------------------- -% https://github.org/cgnieder/chemmacros/ -% contact@mychemistry.eu +% Web: https://github.org/cgnieder/chemmacros/ +% E-Mail: chemmacros@cnltx.de % -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. +% feel free to contact us. % -------------------------------------------------------------------------- -% Copyright 2011--2022 Clemens Niederberger +% Copyright 2011--2021 Clemens Niederberger +% 2022-- Clemens Niederberger & Sonja K. % % This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% conditions of the LaTeX Project Public License, either version 1.3c % 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. +% and version 1.3c or later is part of all distributions of LaTeX +% version 2008/05/04 or later. % % This work has the LPPL maintenance status `maintained'. % -% The Current Maintainer of this work is Clemens Niederberger. +% The Current Maintainers of this work are Clemens Niederberger and Sonja K. % -------------------------------------------------------------------------- -\RequirePackage{l3keys2e} +\RequirePackage {l3keys2e} \ExplSyntaxOn % -------------------------------------------------------------------------- % package information: -\tl_const:Nn \c_chemmacros_date_tl {2022/01/18} +\tl_const:Nn \c_chemmacros_date_tl {2022/02/13} \tl_const:Nn \c_chemmacros_version_major_number_tl {6} -\tl_const:Nn \c_chemmacros_version_minor_number_tl {0} -\tl_const:Nn \c_chemmacros_version_subrelease_tl {a} +\tl_const:Nn \c_chemmacros_version_minor_number_tl {1} +\tl_const:Nn \c_chemmacros_version_subrelease_tl {} \tl_const:Nx \c_chemmacros_version_number_tl { \c_chemmacros_version_major_number_tl . @@ -52,7 +51,7 @@ {chemmacros} {\c_chemmacros_date_tl} {\c_chemmacros_version_tl} - {\c_chemmacros_info_tl \c_space_tl (CN)} + {\c_chemmacros_info_tl \c_space_tl (CN~ &~ SK)} % -------------------------------------------------------------------------- % variants of kernel functions: @@ -69,7 +68,7 @@ \cs_generate_variant:Nn \int_to_arabic:n {V} -\cs_generate_variant:Nn \msg_error:nnnnn {nnnx} +\cs_generate_variant:Nn \msg_error:nnnnn {nnnx,nnnxx} \cs_generate_variant:Nn \msg_error:nnnn {nnnx} \cs_generate_variant:Nn \msg_error:nnn {nnV} \cs_generate_variant:Nn \msg_warning:nnn {nnV} @@ -122,29 +121,36 @@ \clist_new:N \l_chemmacros_modules_clist \clist_set:Nn \l_chemmacros_modules_clist { - base, errorcheck, lang, greek, chemformula, charges, acid-base, symbols, + base, errorcheck, lang, greek, formula, charges, acid-base, symbols, particles, phases, nomenclature, tikz, xfrac, translations } \clist_const:Nn \c_chemmacros_all_modules_clist { - base, errorcheck, lang, greek, chemformula, charges, acid-base, symbols, + base, errorcheck, lang, greek, formula, charges, acid-base, symbols, particles, phases, nomenclature, tikz, isotopes, mechanisms, newman, orbital, polymers, reactions, redox, xfrac, scheme, spectroscopy, thermodynamics, units, reactants, translations } -\keys_define:nn {chemmacros/package-options} +\tl_new:N \g__chemmacros_module_stop_tl + +\cs_new_protected:Npn \chemmacros_stop_module:n #1 + { \tl_gput_right:Nn \g__chemmacros_module_stop_tl {{#1}} } + +\keys_define:nn {chemmacros/load-time} { minimal .bool_set:N = \l__chemmacros_minimal_bool , minimal .initial:n = false , modules .code:n = \clist_if_in:NnF \l_chemmacros_modules_clist {#1} { \clist_put_right:Nn \l_chemmacros_modules_clist {#1} } , + stop .code:n = + \clist_map_inline:nn {#1} { \chemmacros_stop_module:n {##1} } , unknown .code:n = \__chemmacros_loadtime_warning:n {unknown-option} } -\ProcessKeysPackageOptions {chemmacros/package-options} +\ProcessKeysPackageOptions {chemmacros/load-time} \keys_define:nn {chemmacros} { @@ -152,8 +158,8 @@ modules .code:n = \msg_warning:nn {chemmacros} {module-mechanism} \__chemmacros_loadtime_warning:n {load-time-option} , - package-options / minimal .meta:nn = {chemmacros} {minimal} , - package-options / modules .meta:nn = {chemmacros} {modules} + load-time / minimal .meta:nn = {chemmacros} {minimal} , + load-time / modules .meta:nn = {chemmacros} {modules} } \NewDocumentCommand \usechemmodule {m} @@ -219,8 +225,14 @@ \msg_new:nnn {chemmacros} {forbidden-module} { You've~ requested~ the~ chemmacros~ module~ `modules'~ \msg_line_context: .~ - This~ module~ is~ a~ pseudo~ module~ which~ may~ not~ be~ loaded~ through~ - the~ module~ loading~ mechansim. + This~ module~ is~ a~ pseudo~ module~ which~ may~ not~ be~ loaded~ through~ + the~ module~ loading~ mechansim. + } + +\msg_new:nnn {chemmacros} {before-module} + { + The~ module~ `#1'~ has~ already~ been~ loaded.~ The~ code~ cannot~ be~ + inserted~ before~ it~ \msg_line_context: } % ---------------------------------------------------------------------------- @@ -231,10 +243,88 @@ { \prg_return_false: } } +% ---------------------------------------------------------------------------- +% deprecation & removal +\msg_new:nnn {chemmacros} {deprecated} + { + On~ line~ \msg_line_number: : \\ + The~ #1~ `#2'~ is~ deprecated.~ Use~ #1~ `#3'~ instead . + } + +\msg_new:nnn {chemmacros} {deprecated-function} + { The~ command~ #1~ is~ deprecated.~ Use~ #2 instead . } + +\msg_new:nnn {chemmacros} {removed-function} + { The~ command~ #1~ has~ been~ removed. } + +\msg_new:nnn {chemmacros} {removed} + { + On~ line~ \msg_line_number: : \\ + The~ #1~ `#2'~ has~ been~ removed~ from~ chemmacros. \\ + If~ you~ need~ it~ back~ please~ open~ an~ issue~ on~ \\ + https://github.com/cgnieder/chemmacros/issues + \tl_if_blank:nF {#3} { \\ #3 } + } + +% #1: type +% #2: old +% #3: new +\cs_new_protected:Npn \__chemmacros_deprecation_warning:nnn #1#2#3 + { \msg_warning:nnnnn {chemmacros} {deprecated} {#1} {#2} {#3} } +\cs_generate_variant:Nn \__chemmacros_deprecation_warning:nnn {nne,nV} + +% #1: type +% #2: old +% #3: additional text +\cs_new_protected:Npn \chemmacros_removal_warning:nnn #1#2#3 + { \msg_warning:nnnnn {chemmacros} {removed} {#1} {#2} {#3} } +\cs_generate_variant:Nn \chemmacros_removal_warning:nnn {nV} + +% #1: type +% #2: old +\cs_new_protected:Npn \chemmacros_removal_warning:nn #1#2 + { \msg_warning:nnnn {chemmacros} {removed} {#1} {#2} } +\cs_generate_variant:Nn \chemmacros_removal_warning:nn {nV} + +% #1: new +\cs_new_protected:Npn \chemmacros_deprecate_option:n #1 + { \__chemmacros_deprecation_warning:nVn {option} \l_keys_key_str {#1} } + +\cs_new_protected:Npn \chemmacros_deprecate_option: + { \__chemmacros_deprecation_warning:nV {option} \l_keys_key_str } + +% #1: additional text +\cs_new_protected:Npn \chemmacros_remove_option:n #1 + { \chemmacros_removal_warning:nVn {option} \l_keys_key_str {#1} } + +\cs_new_protected:Npn \chemmacros_remove_option: + { \chemmacros_removal_warning:nV {option} \l_keys_key_str } + +% #1: old +% #2: new +\cs_new_protected:Npn \chemmacros_deprecate_function:NN #1#2 + { + \cs_set_protected:Npn #1 + { + \msg_error:nnnn {chemmacros} {deprecated-function} {#1} {#2} + #2 + } + } + +% #1: old +\cs_new_protected:Npn \chemmacros_remove_function:N #1 + { + \cs_set_protected:Npn #1 + { \msg_error:nnn {chemmacros} {removed-function} {#1} } + } + +\NewDocumentCommand \DeclareChemDeprecated {mm} + { \chemmacros_deprecate_function:NN #1 #2 } + % ---------------------------------------------------------------------------- % this is for external file modules called "styles": \tl_const:Nn \c__chemmacros_module_extension_tl {code.tex} -\tl_const:Nn \c__chemmacros_module_prefix_tl {chemmacros} +\tl_const:Nn \c__chemmacros_module_prefix_tl {chemmacros.style} \tl_new:N \g__chemmacros_modules_loaded_tl @@ -256,7 +346,8 @@ \chemmacros_module_if_exist:nTF {#1} { \__chemmacros_module_hook_use:nn {#1} {before} - \msg_info:nnn {chemmacros} {loading-module} {#1} + \msg_log:nnn {chemmacros} {loading-module} {#1} + \msg_term:nnn {chemmacros} {loading-module} {#1} \@onefilewithoptions {\c__chemmacros_module_prefix_tl.#1}[][] \c__chemmacros_module_extension_tl @@ -297,8 +388,8 @@ % #2: code \cs_new_protected:Npn \chemmacros_module_before:nn #1#2 { - % TODO: error in T case? - \chemmacros_module_if_loaded:nF {#1} + \chemmacros_module_if_loaded:nTF {#1} + { \msg_error:nnn {chemmacros} {before-module} {#1} } { \__chemmacros_add_to_module_hook:nnn {#1} {before} {#2} } } @@ -328,14 +419,9 @@ \cs_generate_variant:Nn \__chemmacros_module_hook_use:nn {V} % -------------------------------------------------------------------------- -\tl_new:N \l__chemmacros_module_date_tl -\tl_new:N \l__chemmacros_module_version_tl - -\tl_set_eq:NN \l__chemmacros_module_date_tl \c_chemmacros_date_tl -\tl_set_eq:NN \l__chemmacros_module_version_tl \c_chemmacros_version_tl - \cs_new_protected:Npn \__chemmacros_module:nn #1#2 { + \str_if_in:NnT \g__chemmacros_module_stop_tl {{#1}} { \file_input_stop: } \tl_gput_right:Nn \g__chemmacros_modules_loaded_tl {{#1}} \str_if_eq:xxF {\c__chemmacros_module_prefix_tl.#1.\c__chemmacros_module_extension_tl} @@ -345,24 +431,38 @@ {#1} {\@currname.\@currext} } - \ProvidesFile - {\c__chemmacros_module_prefix_tl.#1.\c__chemmacros_module_extension_tl} - [ - \l__chemmacros_module_date_tl - \c_space_tl - v \l__chemmacros_module_version_tl - \c_space_tl - chemmacros~ style~ file~ `#1'~ (#2) - ] + \tl_if_blank:nTF {#2} + { + \ProvidesFile + {\c__chemmacros_module_prefix_tl.#1.\c__chemmacros_module_extension_tl} + } + { + \ProvidesFile + {\c__chemmacros_module_prefix_tl.#1.\c__chemmacros_module_extension_tl} + [#2] + } } +% define a chemmacros style: +% standard modules are written in the expl3 programming environment, the +% starred version only uses a 2e programming environment, i.e., with @ as a +% letter +% #1: name +% #2: description +\NewDocumentCommand \ChemStyle {smo} + { + \IfNoValueTF {#3} + { \__chemmacros_module:nn {#2} {#3} } + { \__chemmacros_module:nn {#2} {} } + \bool_if:nF {#1} { \ExplSyntaxOn } + } + +% command for loading styles: +\NewDocumentCommand \usechemstyle {m} { \chemmacros_modules_load:n {#1} } + % -------------------------------------------------------------------------- % define internal chemmacros modules: \tl_new:N \g_chemmacros_module_tl -\tl_new:N \g__chemmacros_module_stop_tl - -\cs_new_protected:Npn \chemmacros_stop_module:n #1 - { \tl_gput_right:Nn \g__chemmacros_module_stop_tl {{#1}} } % #1: name % #2: description @@ -370,8 +470,8 @@ { \str_if_in:NnT \g__chemmacros_module_stop_tl {{#1}} { \__chemmacros_gobble_module:w } - \msg_log:nnnn {chemmacros} {loading-module} {#1} {#2} - \msg_term:nnnn {chemmacros} {loading-module} {#1} {#2} + \msg_log:nnn {chemmacros} {loading-module} {#1} + \msg_term:nnn {chemmacros} {loading-module} {#1} \tl_gput_right:Nn \g__chemmacros_modules_loaded_tl {{#1}} \tl_gset:Nn \g_chemmacros_module_tl {#1} \__chemmacros_module_hook_use:nn {#1} {before} @@ -392,22 +492,12 @@ \ChemModule{base}{2022/01/10 basic chemmacros module} % -------------------------------------------------------------------------- -\msg_new:nnn {chemmacros} {command-deprecated} - { - The~ command~ \token_to_str:N #1 \c_space_tl is~ deprecated.~ Use~ - \token_to_str:N #2 \c_space_tl instead. - } - -% define a deprecated command with hints to the corresponding new one: -\cs_new_protected:Npn \chemmacros_define_deprecated:NN #1#2 +\msg_new:nnn {chemmacros} {patch-failed} { - \cs_set_protected:Npn #1 - { \msg_warning:nnnn {chemmacros} {command-deprecated} {#1} {#2} #2 } + I~ failed~ to~ patch~ \token_to_str:N #1 .~ Please~ contact~ the~ package~ + author. } -\NewDocumentCommand \DeclareChemDeprecated {mm} - { \chemmacros_define_deprecated:NN #1 #2 } - % -------------------------------------------------------------------------- % define a macro set: % \NewChem... \RenewChem... \DeclareChem... \ProvideChem... @@ -519,7 +609,7 @@ \cs_new_protected:Npn \chemmacros_set_keys:nn #1#2 { \keys_set:nn {chemmacros/#1} {#2} } -\cs_generate_variant:Nn \chemmacros_set_keys:nn {x,nx} +\cs_generate_variant:Nn \chemmacros_set_keys:nn {e,ne} \cs_new_protected:Npn \chemmacros_set_keys_groups:nnn #1#2#3 { \keys_set_groups:nnn {chemmacros/#1} {#2} {#3} } @@ -595,6 +685,8 @@ { \prg_return_true: } { \prg_return_false: } } + +% -------------------------------------------------------------------------- \cs_new_protected:Npn \chemmacros_cs_if_free_new:Npn #1 { \cs_if_exist:NF #1 @@ -609,6 +701,15 @@ } \cs_generate_variant:Nn \chemmacros_cs_if_free_new_protected:Npn {c} +% -------------------------------------------------------------------------- +\cs_new_protected:Npn \chemmacros_patch_cmd:Nnn #1#2#3 + { + \patchcmd #1 {#2} {#3} + {} + { \msg_warning:nnn {chemmacros} {patch-failed} {#1} } + } + +% -------------------------------------------------------------------------- % #1: counter % #2: singular % #3: plural @@ -729,7 +830,7 @@ \seq_new:N \l__chemmacros_if_bf_seq -\seq_set_split:Nnn \l__chemmacros_if_bf_seq { , } +\seq_set_split:Nnn \l__chemmacros_if_bf_seq {,} { b , bc , bm , bx , bux , eb , ebc , ebx , mb , @@ -748,9 +849,6 @@ {#1} } -\cs_new_protected:Npn \chemmacros_detect_bold:n - { \error \chemmacros_bold:n } - % -------------------------------------------------------------------------- \RequirePackage{amstext} @@ -808,7 +906,7 @@ } \ChemModuleEnd -\ChemModule{errorcheck}{2022/01/16 error checking for unloaded modules} +\ChemModule{errorcheck}{2022/01/23 error checking for unloaded modules} \msg_new:nnn {chemmacros} {undefined} { @@ -881,6 +979,24 @@ \chemmacros_command_requires_module:Nn \listofreactions {reactions} \chemmacros_command_requires_module:Nn \AddRxnDesc {reactions} +% reactants module +\chemmacros_command_requires_module:Nn \DeclareChemReactant {reactants} +\chemmacros_command_requires_module:Nn \reactant {reactants} +\chemmacros_command_requires_module:Nn \reactants {reactants} +\chemmacros_command_requires_module:Nn \reactantl {reactants} +\chemmacros_command_requires_module:Nn \Reactant {reactants} +\chemmacros_command_requires_module:Nn \solvent {reactants} +\chemmacros_command_requires_module:Nn \solvents {reactants} +\chemmacros_command_requires_module:Nn \solventl {reactants} +\chemmacros_command_requires_module:Nn \Solvent {reactants} +\chemmacros_command_requires_module:Nn \reactantplain {reactants} +\chemmacros_command_requires_module:Nn \Reactantplain {reactants} +\chemmacros_command_requires_module:Nn \submainreactantplain {reactants} +\chemmacros_command_requires_module:Nn \Submainreactantplain {reactants} +\chemmacros_command_requires_module:Nn \solventplain {reactants} +\chemmacros_command_requires_module:Nn \Solventplain {reactants} +\chemmacros_command_requires_module:Nn \printreactants {reactants} + % redox module \chemmacros_command_requires_module:Nn \ox {redox} \chemmacros_command_requires_module:Nn \OX {redox} @@ -1092,7 +1208,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{chemformula}{2020/11/29 integration of chemical formulas} +\ChemModule{formula}{2022/01/29 integration of chemical formulas} \RequirePackage{amstext} @@ -1108,10 +1224,14 @@ method~ `chemformula'. } +\msg_new:nnn {chemmacros} {formula-method} + { Using~ the~ formula~ method~ `#1'. } + \msg_new:nnn {chemmacros} {formula-conflict} { - You~ have~ loaded~ multiple~ formula~ method~ packages~ but~ haven't~ - chosen~ which~ method~ to~ use!~ I~ will~ use~ `chemformula'. \\ + You~ have~ loaded~ both~ `chemformula'~ and~ `mhchem'~ as~ formula~ + package~ but~ haven't~ chosen~ which~ formula~ method~ to~ use! \\ + I~ will~ use~ `chemformula'. \\ You~ should~ decide~ for~ only~ one~ of~ the~ packages~ for~ having~ a~ consistent~ layout. } @@ -1120,10 +1240,12 @@ % 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:n #1 {#1} +\cs_generate_variant:Nn \chemmacros_formula:n { x,V,e } + +\chemmacros_deprecate_function:NN \chemmacros_chemformula:n \chemmacros_formula:n -\cs_new_protected:Npn \chemmacros@formula #1 { \chemmacros_chemformula:n {#1} } +\cs_new_protected:Npn \chemmacros@formula #1 { \chemmacros_formula:n {#1} } \cs_new_protected:Npn \chemmacros@reaction #1 { \chemmacros_reaction:n {#1} } % -------------------------------------------------------------------------- @@ -1133,22 +1255,22 @@ \tl_new:N \g_chemmacros_formula_method_tl \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} -\prop_new:N \l__chemmacros_method_packages_prop +\prop_new:N \l__chemmacros_formula_methods_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_add_formula_method:nn #1#2 + { \prop_put:Nnn \l__chemmacros_formula_methods_prop {#1} {#2} } -\cs_new_protected:Npn \chemmacros_setup_method_package:n #1 +\cs_new_protected:Npn \chemmacros_setup_formula_method:n #1 { - \prop_item:Nn \l__chemmacros_method_packages_prop {#1} + \prop_item:Nn \l__chemmacros_formula_methods_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} +\prg_new_conditional:Npnn \chemmacros_if_formula_method:n #1 {p,T,F,TF} { - \prop_if_in:NnTF \l__chemmacros_method_packages_prop {#1} + \prop_if_in:NnTF \l__chemmacros_formula_methods_prop {#1} { \prg_return_true: } { \prg_return_false: } } @@ -1158,7 +1280,7 @@ \bool_if:NF \l__chemmacros_formula_method_set_bool { \bool_set_false:N \l__chemmacros_tmpa_bool - \prop_map_inline:Nn \l__chemmacros_method_packages_prop + \clist_map_inline:nn {chemformula,mhchem} { \chemmacros_if_package_loaded:nT {##1} { @@ -1181,11 +1303,11 @@ \cs_new_protected:Npn \chemmacros_set_formula_method:n #1 { - \chemmacros_if_method_package:nTF {#1} - { \chemmacros_setup_method_package:n {#1} } + \chemmacros_if_formula_method:nTF {#1} + { \chemmacros_setup_formula_method:n {#1} } { \msg_warning:nnn {chemmacros} {unknown-formula-method} {#1} - \chemmacros_setup_method_package:n {chemformula} + \chemmacros_setup_formula_method:n {chemformula} } \bool_set_true:N \l__chemmacros_formula_method_set_bool } @@ -1193,19 +1315,19 @@ % -------------------------------------------------------------------------- % add formula methods: -\chemmacros_add_method_package:nn {chemformula} +\chemmacros_add_formula_method:nn {chemformula} { - \chemmacros_integrate_package:nnn {} {chemformula} {2015/09/08} - \cs_set_protected:Npn \chemmacros_chemformula:n #1 + \chemmacros_integrate_package:nnn {} {chemformula} {2022/01/23} + \cs_set_protected:Npn \chemmacros_formula: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_add_formula_method:nn {mhchem} { \chemmacros_integrate_package:nnn {version=4} {mhchem} {} - \cs_set_protected:Npn \chemmacros_chemformula:n #1 { \ce {#1} } + \cs_set_protected:Npn \chemmacros_formula:n #1 { \ce {#1} } \cs_set_protected:Npn \chemmacros_reaction:n #1 { \ce {#1} } \chemmacros_module_after:nn {charges} { @@ -1219,10 +1341,10 @@ } } -\chemmacros_add_method_package:nn {chemist} +\chemmacros_add_formula_method:nn {chemist} { \RequirePackage {chemist} - \cs_set_protected:Npn \chemmacros_chemformula:n #1 + \cs_set_protected:Npn \chemmacros_formula:n #1 { \chemmacros_text:n { \ChemForm {#1} } } \cs_set_protected:Npn \chemmacros_reaction:n #1 { \chemmacros_text:n { \ChemForm {#1} } } @@ -1239,17 +1361,16 @@ } } -\chemmacros_add_method_package:nn {chemfig} +\chemmacros_add_formula_method:nn {chemfig} { \RequirePackage {chemfig} - \cs_set_protected:Npn \chemmacros_chemformula:n #1 - { \printatom {#1} } + \cs_set_protected:Npn \chemmacros_formula:n #1 { \printatom {#1} } \cs_set_protected:Npn \chemmacros_reaction:n #1 - { \printatom {#1} } + { \schemestart #1 \schemestop } \chemmacros_module_after:nn {charges} { \cs_set_protected:Npn \chemmacros_elpair:n #1 - { \Lewis { 0: , \printatom {#1} } } + { \Charge { 0=\: } {#1} } \cs_set_protected:Npn \chemmacros_plus: { + } \cs_set_protected:Npn \chemmacros_minus: { - } \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } @@ -1264,17 +1385,11 @@ { formula .code:n = \chemmacros_set_formula_method:n {#1} } \hook_gput_code:nnn {begindocument/before} {chemmacros} - { - \bool_if:NF \l__chemmacros_formula_method_set_bool - { - \msg_info:nn {chemmacros} {default-formula-method} - \chemmacros_set_formula_method:n {chemformula} - } - } + { \chemmacros_check_formula_method: } % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{charges}{2020/11/29 charges} +\ChemModule{charges}{2022/01/29 charges} % -------------------------------------------------------------------------- % circled charge signs: they are defined in the `chemformula' package: @@ -1339,7 +1454,7 @@ \cs_new_protected:Npn \chemmacros_formal_minus: { \chemformula_formal_minus: } \cs_new_protected:Npn \chemmacros_charge:n #1 - { \chemmacros_chemformula:n { {}^{#1} } } + { \chemmacros_formula:n { {}^{#1} } } \cs_new_protected:Npn \chemmacros_new_charge_command:Nn #1#2 { @@ -1403,7 +1518,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{acid-base}{2022/01/13 acid/base} +\ChemModule{acid-base}{2022/01/29 acid/base} % -------------------------------------------------------------------------- % equilibrium constants: @@ -1487,8 +1602,8 @@ } \NewDocumentCommand \p {m} { \chemmacros_p:n {#1} } -\NewDocumentCommand \pH {} { \chemmacros_p:n { \chemmacros_chemformula:n {H} } } -\NewDocumentCommand \pOH {} { \chemmacros_p:n { \chemmacros_chemformula:n {OH} } } +\NewDocumentCommand \pH {} { \chemmacros_p:n { \chemmacros_formula:n {H} } } +\NewDocumentCommand \pOH {} { \chemmacros_p:n { \chemmacros_formula:n {OH} } } \NewDocumentCommand \pKa {o} { @@ -1573,7 +1688,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{particles}{2020/11/29 particles} +\ChemModule{particles}{2022/01/29 particles} % -------------------------------------------------------------------------- % particles @@ -1583,7 +1698,7 @@ \use:x { \cs_set_protected:Npn \exp_not:N #1 - { \chemmacros_chemformula:n { \exp_not:V \l__chemmacros_tmpa_tl } } + { \chemmacros_formula:n { \exp_not:V \l__chemmacros_tmpa_tl } } } } @@ -1634,9 +1749,9 @@ { \chemmacros_elpair:n { #2 } \skip_horizontal:N \l__chemmacros_nucleophile_dim - \chemmacros_chemformula:n { {}^{-} } + \chemmacros_formula:n { {}^{-} } } - { \chemmacros_chemformula:n { #2^{-} } } + { \chemmacros_formula:n { #2^{-} } } } \DeclareDocumentCommand #1 {o} { @@ -1713,7 +1828,7 @@ { \mode_leave_vertical: \bool_if:NTF \l__chemmacros_phases_sub_bool - { \chemformula_subscript:n { (#1) } } + { \chemmacros_formula:n { {}_{(#1)} } } { \skip_horizontal:N \l__chemmacros_phases_space_dim \chemmacros_text:n { (#1) } @@ -1730,7 +1845,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{nomenclature}{2022/01/10 chemical names} +\ChemModule{nomenclature}{2022/01/29 chemical names} \bool_new:N \l__chemmacros_iupac_restricted_bool \bool_new:N \l__chemmacros_iupac_strict_bool @@ -1899,44 +2014,15 @@ \NewDocumentCommand \LetChemIUPAC {mm} { \chemmacros_let_iupac:NN #1 #2 } -% -------------------------------------------------------------------------- -\chemmacros_define_keys:nn {nomenclature} - { - iupac .choice: , - iupac / restricted .code:n = - \bool_set_true:N \l__chemmacros_iupac_restricted_bool - \bool_set_false:N \l__chemmacros_iupac_strict_bool , - iupac / auto .code:n = - \bool_set_false:N \l__chemmacros_iupac_restricted_bool - \bool_set_false:N \l__chemmacros_iupac_strict_bool , - iupac / strict .code:n = - \bool_set_false:N \l__chemmacros_iupac_restricted_bool - \bool_set_true:N \l__chemmacros_iupac_strict_bool , - iupac .initial:n = auto - } - % -------------------------------------------------------------------------- % stereo descriptors and other nomenclature commands % Cahn-Ingold-Prelog \dim_new:N \l__chemmacros_cip_kern_dim \dim_set:Nn \l__chemmacros_cip_kern_dim {.075em} -\chemmacros_define_keys:nn {nomenclature} - { cip-kern .dim_set:N = \l__chemmacros_cip_kern_dim } - \tl_new:N \l__chemmacros_cip_inner_tl \tl_new:N \l__chemmacros_cip_outer_tl \tl_new:N \l__chemmacros_cip_number_tl - -\chemmacros_define_keys:nn {nomenclature} - { - cip-inner-format .tl_set:N = \l__chemmacros_cip_inner_tl , - cip-inner-format .initial:n = \itshape , - cip-outer-format .tl_set:N = \l__chemmacros_cip_outer_tl , - cip-outer-format .initial:n = \upshape , - cip-number-format .tl_set:N = \l__chemmacros_cip_number_tl , - cip-number-format .initial:n = \upshape - } \cs_new_protected:Npn \__chemmacros_cip:n #1 { @@ -2005,29 +2091,18 @@ % coordination chemistry \bool_new:N \l__chemmacros_bridge_super_bool -\chemmacros_define_keys:nn {nomenclature} - { - bridge-number .choice: , - bridge-number / sub .code:n = - \bool_set_false:N \l__chemmacros_bridge_super_bool , - bridge-number / super .code:n = - \bool_set_true:N \l__chemmacros_bridge_super_bool , - coord-use-hyphen .bool_set:N = \l__chemmacros_coord_use_hyphen_bool , - coord-use-hyphen .initial:n = true - } - % #1: boolean - if true hyphen is turned on % #2: boolean - if true superscript will be used % #3: symbol % #4: sub-/superscript \cs_new_protected:Npn \chemmacros_coordination_symbol:nnnn #1#2#3#4 { - \chemmacros_chemformula:n {#3} + \chemmacros_formula:n {#3} \tl_if_blank:nF {#4} { \bool_if:nTF {#2} - { \chemmacros_chemformula:n { {}^{#4} } } - { \chemmacros_chemformula:n { {}_{#4} } } + { \chemmacros_formula:n { {}^{#4} } } + { \chemmacros_formula:n { {}_{#4} } } } \bool_if:nT {#1} @@ -2127,13 +2202,6 @@ \skip_new:N \l__chemmacros_iupac_break_skip \skip_set:Nn \l__chemmacros_iupac_break_skip { .03em plus .07em } -\chemmacros_define_keys:nn {nomenclature} - { - hyphen-pre-space .dim_set:N = \l__chemmacros_iupac_hyphen_pre_dim , - hyphen-post-space .dim_set:N = \l__chemmacros_iupac_hyphen_post_dim , - break-space .skip_set:N = \l__chemmacros_iupac_break_skip - } - \cs_new_protected:Npn \chemmacros_break_point_hyphen: { \__chemmacros_break_point_insert:nnn @@ -2255,17 +2323,8 @@ \NewDocumentCommand \RemoveChemIUPACShorthand {m} { \chemmacros_remove_shorthand:N #1 } -\NewChemIUPACShorthand ^ \chemmacros_superscript:n -\NewChemIUPACShorthand | \chemmacros_break_point: -\NewChemIUPACShorthand - \chemmacros_break_point_hyphen: -\NewChemIUPACShorthand ( \chemmacros_break_point_opening_paren: -\NewChemIUPACShorthand ) \chemmacros_break_point_closing_paren: -\NewChemIUPACShorthand [ \chemmacros_break_point_opening_bracket: -\NewChemIUPACShorthand ] \chemmacros_break_point_closing_bracket: -\NewChemIUPAC \chemprime { \ensuremath {{}^{\prime}} } -\NewChemIUPACShorthand ' \chemprime -\NewChemIUPAC \nonbreakinghyphen { \mbox{-} \nobreak \hspace{0pt} } -\NewChemIUPACShorthand = \nonbreakinghyphen +% -------------------------------------------------------------------------- +\tl_new:N \l__chemmacros_iupac_format_tl \cs_new_protected:Npn \chemmacros_iupac:nn #1#2 { @@ -2278,7 +2337,7 @@ \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \chemmacros_activate_all_iupac_shorthands: } {#2} - \l__chemmacros_tmpa_tl + \l__chemmacros_iupac_format_tl { \l__chemmacros_tmpa_tl } \group_end: } @@ -2288,6 +2347,18 @@ \NewDocumentCommand \iupac {O{}m} { \chemmacros_iupac:nn {#1} {#2} } % -------------------------------------------------------------------------- +\NewChemIUPACShorthand ^ \chemmacros_superscript:n +\NewChemIUPACShorthand | \chemmacros_break_point: +\NewChemIUPACShorthand - \chemmacros_break_point_hyphen: +\NewChemIUPACShorthand ( \chemmacros_break_point_opening_paren: +\NewChemIUPACShorthand ) \chemmacros_break_point_closing_paren: +\NewChemIUPACShorthand [ \chemmacros_break_point_opening_bracket: +\NewChemIUPACShorthand ] \chemmacros_break_point_closing_bracket: +\NewChemIUPAC \chemprime { \ensuremath {{}^{\prime}} } +\NewChemIUPACShorthand ' \chemprime +\NewChemIUPAC \nonbreakinghyphen { \mbox{-} \nobreak \hspace{0pt} } +\NewChemIUPACShorthand = \nonbreakinghyphen + % R(ectus)/S(inister): \NewChemIUPAC \rectus { \cip {R} } \NewChemIUPAC \sinister { \cip {S} } @@ -2371,12 +2442,6 @@ \NewChemMacroset {Latin} {mm} { \chemmacros_define_latin:Nn #1 {#2} } - -\chemmacros_define_keys:nn {nomenclature} - { - format .tl_set:N = \l__chemmacros_latin_format_tl , - format .initial:n = \emph , - } \cs_new_protected:Npn \chemmacros_write_latin:n #1 { @@ -2404,6 +2469,43 @@ \NewChemLatin \abinitio {ab~initio} \NewChemLatin \insitu {in~situ} +% -------------------------------------------------------------------------- +\chemmacros_define_keys:nn {nomenclature} + { + iupac .choice: , + iupac / restricted .code:n = + \bool_set_true:N \l__chemmacros_iupac_restricted_bool + \bool_set_false:N \l__chemmacros_iupac_strict_bool , + iupac / auto .code:n = + \bool_set_false:N \l__chemmacros_iupac_restricted_bool + \bool_set_false:N \l__chemmacros_iupac_strict_bool , + iupac / strict .code:n = + \bool_set_false:N \l__chemmacros_iupac_restricted_bool + \bool_set_true:N \l__chemmacros_iupac_strict_bool , + iupac .initial:n = auto , + iupac-format .tl_set:N = \l__chemmacros_iupac_format_tl , + cip-kern .dim_set:N = \l__chemmacros_cip_kern_dim , + cip-inner-format .tl_set:N = \l__chemmacros_cip_inner_tl , + cip-inner-format .initial:n = \itshape , + cip-outer-format .tl_set:N = \l__chemmacros_cip_outer_tl , + cip-outer-format .initial:n = \upshape , + cip-number-format .tl_set:N = \l__chemmacros_cip_number_tl , + cip-number-format .initial:n = \upshape , + bridge-number .choice: , + bridge-number / sub .code:n = + \bool_set_false:N \l__chemmacros_bridge_super_bool , + bridge-number / super .code:n = + \bool_set_true:N \l__chemmacros_bridge_super_bool , + coord-use-hyphen .bool_set:N = \l__chemmacros_coord_use_hyphen_bool , + coord-use-hyphen .initial:n = true , + hyphen-pre-space .dim_set:N = \l__chemmacros_iupac_hyphen_pre_dim , + hyphen-post-space .dim_set:N = \l__chemmacros_iupac_hyphen_post_dim , + break-space .skip_set:N = \l__chemmacros_iupac_break_skip , + latin-format .tl_set:N = \l__chemmacros_latin_format_tl , + latin-format .initial:n = \emph , + format .code:n = \chemmacros_deprecate_option:n {latin-format} + } + % -------------------------------------------------------------------------- % hyperref support % ?? unsure about adding IUPAC commands @@ -2453,7 +2555,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{tikz}{2020/11/29 upright greek symbols} +\ChemModule{tikz}{2020/11/29 ease usage of TikZ in chemmacros} \ExplSyntaxOff \RequirePackage{tikz} @@ -2485,7 +2587,7 @@ \dim_new:N \l__chemmacros_el_length_dim % full tip for pairs -\pgfarrowsdeclare { el } { el } +\pgfarrowsdeclare {el} {el} { \dim_set:Nn \l__chemmacros_el_length_dim { 2.5pt + 2.5\pgflinewidth } @@ -2495,10 +2597,10 @@ { \dim_set:Nn \l__chemmacros_el_length_dim { 2.5pt + 2.5\pgflinewidth } - \pgfsetdash {} { 0pt } + \pgfsetdash {} {0pt} \pgfsetroundjoin \pgfsetroundcap - \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } } + \pgfpathmoveto { \pgfpoint {0pt} {0pt} } \pgfpathlineto { \pgfpoint @@ -2506,19 +2608,19 @@ { .3\l__chemmacros_el_length_dim } } \pgfpathlineto - { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } } + { \pgfpoint { -.5\l__chemmacros_el_length_dim } {0pt} } \pgfpathlineto { \pgfpoint { -\l__chemmacros_el_length_dim } { -.3\l__chemmacros_el_length_dim } } - \pgfpathlineto { \pgfpoint { 0pt } { 0pt } } + \pgfpathlineto { \pgfpoint {0pt} {0pt} } \pgfusepathqfillstroke } % half tip on the left -\pgfarrowsdeclare { left~el } { left~el } +\pgfarrowsdeclare {left~ el} {left~ el} { \dim_set:Nn \l__chemmacros_el_length_dim { 2.5pt + 2.5\pgflinewidth } @@ -2528,23 +2630,23 @@ { \dim_set:Nn \l__chemmacros_el_length_dim { 2.5pt + 2.5\pgflinewidth } - \pgfsetdash {} { 0pt } + \pgfsetdash {} {0pt} \pgfsetroundjoin \pgfsetroundcap - \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } } + \pgfpathmoveto { \pgfpoint {0pt} {0pt} } \pgfpathlineto { \pgfpoint { -\l__chemmacros_el_length_dim } { .3\l__chemmacros_el_length_dim } } - \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } } - \pgfpathlineto { \pgfpoint { 0pt } { 0pt } } + \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } {0pt} } + \pgfpathlineto { \pgfpoint {0pt} {0pt} } \pgfusepathqfillstroke } % half tip in the right -\pgfarrowsdeclare { right~el } { right~el } +\pgfarrowsdeclare {right~ el} {right~ el} { \dim_set:Nn \l__chemmacros_el_length_dim { 2.5pt + 2.5\pgflinewidth } @@ -2554,18 +2656,18 @@ { \dim_set:Nn \l__chemmacros_el_length_dim { 2.5pt + 2.5\pgflinewidth } - \pgfsetdash {} { 0pt } + \pgfsetdash {} {0pt} \pgfsetroundjoin \pgfsetroundcap - \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } } + \pgfpathmoveto { \pgfpoint {0pt} {0pt} } \pgfpathlineto { \pgfpoint { -\l__chemmacros_el_length_dim } { -.3\l__chemmacros_el_length_dim } } - \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } } - \pgfpathlineto { \pgfpoint { 0pt } { 0pt } } + \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } {0pt} } + \pgfpathlineto { \pgfpoint {0pt} {0pt} } \pgfusepathqfillstroke } % -------------------------------------------------------------------------- @@ -2609,7 +2711,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{isotopes}{2020/11/29 a macro to easily print element isotopes} +\ChemModule{isotopes}{2022/01/29 a macro to easily print element isotopes} \RequirePackage{elements} @@ -2802,9 +2904,9 @@ \cs_new_protected:Npn \chemmacros_isotope_write:nnn #1#2#3 { \bool_if:NTF \l__chemmacros_isotope_super_bool - { \chemmacros_chemformula:n { ^{#1}_{#2}#3 } } + { \chemmacros_formula:n { ^{#1}_{#2}#3 } } { - \chemmacros_chemformula:n {#3} + \chemmacros_formula:n {#3} \tl_use:N \l__chemmacros_isotope_side_connect_tl #1 } @@ -3818,11 +3920,38 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{reactions}{2022/01/13 reaction environments} +\ChemModule{reactions}{2022/02/05 reaction environments} -\RequirePackage{mathtools} +\newcounter {reaction} +\hook_gput_code:nnn {package/hyperref/after} {chemmacros} + { + \cs_if_exist:NTF \chapter + { \cs_set:Npn \theHreaction { \theHchapter . \thereaction } } + { \cs_set:Npn \theHreaction { \theHsection . \thereaction } } + } + +\bool_new:N \l__chemmacros_reactions_counter_bool +\bool_new:N \l__chemmacros_reactions_tocbasic_bool + +\cs_new_eq:NN \l@reaction \l@figure +\cs_if_exist:NT \KOMAClassName + { \bool_set_true:N \l__chemmacros_reactions_tocbasic_bool } + +\tl_new:N \g__chemmacros_reaction_description_tl +\tl_new:N \l__chemmacros_reactions_tag_open_tl +\tl_new:N \l__chemmacros_reactions_tag_close_tl +\tl_new:N \l__chemmacros_reactions_before_tag_tl +\tl_new:N \l__chemmacros_reaction_lorname_tl +\tl_new:N \reactionlistname +\tl_new:N \reactionautorefname +\tl_new:N \l__chemmacros_reactions_args_tl % -------------------------------------------------------------------------- +\RequirePackage{mathtools} +% 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... + \cs_new_protected:Npn \__chemmacros_record_for_lor:nnnnn #1#2#3#4#5 { \tl_if_eq:nnT {#1} {reaction} @@ -3844,9 +3973,6 @@ } } -% 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... \hook_gput_code:nnn {package/mathtools/after} {chemmacros} { \cs_set_protected:Npn \MT_define_tagform:nwnn #1[#2]#3#4 @@ -3855,15 +3981,21 @@ { % this is the original part: \maketag@@@{#3\ignorespaces#2{##1}\unskip\@@italiccorr#4} - % this is added => this disturbs hyperref: + % this is added (but disturbs hyperref): \__chemmacros_record_for_lor:nnnnn {#1} {#3} {#2} {##1} {#4} } } } -\tl_new:N \g__chemmacros_reaction_description_tl +% -------------------------------------------------------------------------- +% create new tagform +\newtagform {reaction} + [\l__chemmacros_reactions_before_tag_tl] + {\l__chemmacros_reactions_tag_open_tl} + {\l__chemmacros_reactions_tag_close_tl} +% -------------------------------------------------------------------------- \cs_new_protected:Npn \chemmacros_add_reaction_description:n #1 { \tl_if_blank:nF {#1} @@ -3873,31 +4005,10 @@ \NewDocumentCommand \AddRxnDesc {m} { \chemmacros_add_reaction_description:n {#1} } +% -------------------------------------------------------------------------- % define \listofreactions -\tl_new:N \l__chemmacros_reaction_lorname_tl -\tl_new:N \reactionlistname -\tl_new:N \l__chemmacros_reaction_heading_tl - -\cs_new:Npn \__chemmacros_reaction_heading:n #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} } - -\tl_set:Nn \reactionlistname { \chemmacros_translate:n {list-of-reactions} } - -\chemmacros_define_keys:nn {reactions} - { - list-name .tl_set:N = \reactionlistname , - list-entry .tl_set:N = \l__chemmacros_reaction_lorname_tl , - list-heading-cmd .code:n = - \cs_set_protected:Npn \__chemmacros_reaction_heading:n ##1 {#1} - } - -\cs_if_exist:NTF \chapter - { \chemmacros_set_keys:nn {reactions} { list-heading-cmd = \chapter* {#1} } } - { \chemmacros_set_keys:nn {reactions} { list-heading-cmd = \section* {#1} } } +\cs_new_protected:Npn \__chemmacros_reaction_heading:n #1 {#1} +\cs_generate_variant:Nn \__chemmacros_reaction_heading:n {V} \cs_new_protected:Npn \listofreactions { @@ -3905,39 +4016,15 @@ \@starttoc {lor} } -\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 } - -\tl_new:N \l__chemmacros_reactions_tag_open_tl -\tl_new:N \l__chemmacros_reactions_tag_close_tl -\tl_new:N \l__chemmacros_reactions_before_tag_tl - -\chemmacros_define_keys:nn {reactions} - { - tocbasic .bool_set:N = \l__chemmacros_reactions_tocbasic_bool , - tag-open .tl_set:N = \l__chemmacros_reactions_tag_open_tl , - tag-open .initial:n = \{ , - tag-close .tl_set:N = \l__chemmacros_reactions_tag_close_tl , - tag-close .initial:n = \} , - before-tag .tl_set:N = \l__chemmacros_reactions_before_tag_tl - } - \hook_gput_code:nnn {package/tocbasic/after} {chemmacros} { - \bool_lazy_or:nnT - { \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 } - } + \addtotoclist [float] {lor} + \cs_set_protected:Npn \listofreactions { \listoftoc {lor} } + \cs_new:Npn \listoflorname { \reactionlistname } } +% -------------------------------------------------------------------------- +% cleveref: \ChemCleverefSupport {reaction} { \chemmacros_translate:n {reaction} } [ \chemmacros_translate:n {Reaction} ] @@ -3948,84 +4035,106 @@ { \creflabelformat {reaction} { - #2 \l__chemmacros_reactions_tag_open_tl - #1 + #2 #1 #3 \l__chemmacros_reactions_tag_close_tl - #3 } } -\ChemFancyrefSupport {rct} - { \chemmacros_translate:n {reaction} } - [ \chemmacros_translate:n {Reaction} ] - -% create new tagform -\newtagform {reaction} - [\l__chemmacros_reactions_before_tag_tl] - {\l__chemmacros_reactions_tag_open_tl} - {\l__chemmacros_reactions_tag_close_tl} - -\newcounter {chemmacros_save_reaction} -\newcounter {reaction} - -\cs_new_protected:Npn \__chemmacros_begin_reaction: +% fancyref: +\hook_gput_code:nnn {package/fancyref/after} {chemmacros} { - \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} + \cs_set:Npn \fancyrefrctlabelprefix {rct} + \cs_set:Npn \frefrctname { \chemmacros_translate:n {reaction} } + \cs_set:Npn \Frefrctname { \chemmacros_translate:n {Reaction} } + \frefformat {vario} { \fancyrefrctlabelprefix } + { + \frefrctname \fancyrefdefaultspacing + \textup { + \l__chemmacros_reactions_tag_open_tl + #1 + \l__chemmacros_reactions_tag_close_tl + } + #3 + } + \Frefformat {vario} { \fancyrefrctlabelprefix } + { + \Frefrctname \fancyrefdefaultspacing + \textup { + \l__chemmacros_reactions_tag_open_tl + #1 + \l__chemmacros_reactions_tag_close_tl + } + #3 + } + \frefformat {plain} { \fancyrefrctlabelprefix } + { \frefrctname \fancyrefdefaultspacing #1 } + \Frefformat {plain} { \fancyrefrctlabelprefix } + { \Frefrctname \fancyrefdefaultspacing #1 } } -% switch back to equation tags -\cs_new_protected:Npn \__chemmacros_end_reaction: +% -------------------------------------------------------------------------- +% begin and end reaction environments: switch to reaction counter: +\cs_new_protected:Npn \__chemmacros_begin_reaction: { - \setcounter {reaction} { \value {equation} } - \setcounter {equation} { \value {chemmacros_save_reaction} } + \bool_if:NT \l__chemmacros_reactions_counter_bool + { + \cs_set_eq:NN \r@equation \r@reaction + \cs_set_eq:NN \p@equation \p@reaction + \cs_set_eq:NN \c@equation \c@reaction + \chemmacros_patch_cmd:Nnn \thereaction {reaction} {equation} + \chemmacros_if_package_loaded:nT {cleveref} + { \crefalias {equation} {reaction} } + % this only works if nobody steps counters inside reactions: + \bool_if:NT \l__chemmacros_hyperref_bool + { + \chemmacros_patch_cmd:Nnn \hyper@refstepcounter + { \This@name } + { \This@name {reaction} \@gobble } + \chemmacros_patch_cmd:Nnn \hyper@refstepcounter + { \hyper@makecurrent } + { \hyper@makecurrent {reaction} \@gobble } + } + \usetagform {reaction} + } } -\tl_new:N \l__chemmacros_reactions_args_tl +\cs_new_protected:Npn \__chemmacros_end_reaction: + { } +% -------------------------------------------------------------------------- \cs_new_protected:Npn \__chemmacros_reactions_build_args:n #1 { \tl_put_right:Nn \l__chemmacros_reactions_args_tl { {## #1} } } \cs_new_protected:Npn \chemmacros_define_reaction:nnn #1#2#3 { + \tl_clear:N \l__chemmacros_reactions_args_tl \int_compare:nNnT {#3+0} > {0} - { - \tl_clear:N \l__chemmacros_reactions_args_tl - \int_step_function:nnnN {2} {1} {#3+1} \__chemmacros_reactions_build_args:n - } - \chemmacros_declare_reaction_env:nnnV {#1} {#2} {#3} \l__chemmacros_reactions_args_tl + { \int_step_function:nnnN {2} {1} {#3+1} \__chemmacros_reactions_build_args:n } + \__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_declare_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} { \int_compare:nT { #3+0 = 0 } {!} O{} \prg_replicate:nn {#3+0} {m} } { \chemmacros_add_reaction_description:n {##1} \__chemmacros_begin_reaction: - \chemmacros_reaction_read:nnw {#2} {#4} + \__chemmacros_reaction_read:nnw {#2} {#4} } { \__chemmacros_end_reaction: \ignorespacesafterend } } -\cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV} +\cs_generate_variant:Nn \__chemmacros_declare_reaction_env:nnnn {nnnV} -\cs_new_protected:Npn \chemmacros_reaction_read:nnw #1#2#3 \end +\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 @@ -4049,17 +4158,40 @@ { \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 + \__chemmacros_reaction_write:nnV {#1} {#2} \l__chemmacros_tmpa_tl \end } -\cs_new_protected:Npn \chemmacros_reaction_write:nnn #1#2#3 +\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 } +\cs_generate_variant:Nn \__chemmacros_reaction_write:nnn { nnV } + +\chemmacros_define_keys:nn {reactions} + { + list-name .tl_set:N = \reactionlistname , + list-name .initial:n = \chemmacros_translate:n {list-of-reactions} , + autoref-name .tl_set:N = \reactionautorefname , + autoref-name .initial:n = \chemmacros_translate:n {Reaction} , + list-entry .tl_set:N = \l__chemmacros_reaction_lorname_tl , + list-entry .initial:n = \chemmacros_translate:n {Reaction} , + list-heading-cmd .cs_set:Np = \__chemmacros_reaction_heading:n #1 , + tocbasic .code:n = \chemmacros_deprecate_option: , + own-counter .bool_set:N = \l__chemmacros_reactions_counter_bool , + own-counter .initial:n = true , + tag-open .tl_set:N = \l__chemmacros_reactions_tag_open_tl , + tag-open .initial:n = \{ , + tag-close .tl_set:N = \l__chemmacros_reactions_tag_close_tl , + tag-close .initial:n = \} , + before-tag .tl_set:N = \l__chemmacros_reactions_before_tag_tl + } + +\cs_if_exist:NTF \chapter + { \chemmacros_set_keys:nn {reactions} { list-heading-cmd = \chapter* {#1} } } + { \chemmacros_set_keys:nn {reactions} { list-heading-cmd = \section* {#1} } } \NewChemMacroset* {Reaction} {mO{}m} { \chemmacros_define_reaction:nnn {#1} {#3} {#2} } @@ -4068,10 +4200,10 @@ \NewChemReaction {reaction*} {equation*} \NewChemReaction {reactions} {align} \NewChemReaction {reactions*} {align*} - + % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{redox}{2020/11/29 oxidation numbers, redox reactions} +\ChemModule{redox}{2022/01/29 oxidation numbers, redox reactions} \RequirePackage{mathtools,relsize} @@ -4215,7 +4347,7 @@ { \relsize {-3} \__chemmacros_ox_process_number:n {#1} } } } - \hbox_set:Nn \l__chemmacros_tmpb_box { \chemmacros_chemformula:n {#2} } + \hbox_set:Nn \l__chemmacros_tmpb_box { \chemmacros_formula:n {#2} } \chemmacros_math:n { \bool_if:NT \l__chemmacros_ox_super_bool @@ -4573,17 +4705,11 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{scheme}{2022/01/13 a scheme floating environment} +\ChemModule{scheme}{2022/02/05 a scheme floating environment} \RequirePackage {chemnum} \RequirePackage {etoolbox} -\msg_new:nnn {chemmacros} {patch-failed} - { - Patching~ \token_to_str:N #1 \c_space_tl failed.~ - Please~ inform~ the~ chemmacros~ package~ authors. - } - \bool_new:N \l__chemmacros_float_def_bool \tl_new:N \l__chemmacros_float_method_tl \seq_new:N \l__chemmacros_float_methods_seq @@ -4591,17 +4717,27 @@ \prop_new:N \l__chemmacros_float_definitions_prop \msg_new:nnn {chemmacros} {float-method} - { Detected~ float~ defining~ method~ `#1'. } + { Using~ float~ defining~ method~ `#1'. } + +\msg_new:nnn {chemmacros} {unknown-method} + { + The~ float~ method~ `#1'~ is~ not~ known~ \msg_line_contect: .~ Ckeck~ + for~ a~ typo. + } % -------------------------------------------------------------------------- % #1: name % #2: check +% #3: code \cs_new_protected:Npn \chemmacros_define_float_method:nnn #1#2#3 { \seq_put_right:Nn \l__chemmacros_float_methods_seq {#1} \prop_put:Nnn \l__chemmacros_float_methods_prop {#1} {#2} \prop_put:Nnn \l__chemmacros_float_definitions_prop {#1} - { \cs_set_protected:Npn \__chemmacros_define_float:nn ##1##2 {#3} } + { + \cs_set_protected:Npn \__chemmacros_define_float:nn ##1##2 + { \msg_info:nnn {chemmacros} {float-method} {#1} #3 } + } } % the order in which the methods are defined determines in which order the @@ -4692,30 +4828,111 @@ { \listof {#1} {\chemmacros_translate:n {#1-list}} } } +\chemmacros_define_float_method:nnn {traditional} + { \c_false_bool } + { + \bool_lazy_or:nnTF + { \chemmacros_if_class_loaded_p:n {book} } + { \chemmacros_if_class_loaded_p:n {report} } + { + \newcounter {#1} [chapter] + \cs_set:cpn {the#1} + { \ifnum \c@chapter>\z@ \thechapter.\fi \arabic {#1} } + } + { + \newcounter {#1} + \cs_set:cpn {the#1} { \arabic {#1} } + } + \cs_new:cpn {fps@#1} {tbp} + \cs_new:cpn {ftype@#1} {8} + \cs_new:cpn {ext@#1} {#2} + \cs_new:cpx {fnum@#1} { + \exp_not:c {#1name} + \exp_not:N \nobreakspace + \exp_not:c {the#1}} + \cs_new:cpn {#1name} {\chemmacros_translate:n {#1-name}} + \cs_new:cpn {list#1name} {\chemmacros_translate:n {#1-list}} + \newenvironment {#1} + {\@float{#1}} + {\end@float} + \newenvironment {#1*} + {\@dblfloat{#1}} + {\end@dblfloat} + \bool_lazy_or:nnTF + { \chemmacros_if_class_loaded_p:n {book} } + { \chemmacros_if_class_loaded_p:n {report} } + { + \cs_new_protected:cpn {listof#1s} + { + \legacy_if:nTF {@twocolumn} + { \@restonecoltrue\onecolumn } + { \@restonecolfalse } + \chapter* { \use:c {list#1name} } + \use:x + { + \exp_not:N \@mkboth + { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } + { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } + } + \@starttoc {#2} + \legacy_if:nT {@restonecol} { \twocolumn } + } + \chemmacros_patch_cmd:Nnn \@chapter + { \addtocontents } + { \addtocontents {#2} { \protect \addvspace {10\p@} } \addtocontents } + } + { + \cs_new_protected:cpn {listof#1s} + { + \section* {\use:c {list#1name}} + \use:x + { + \exp_not:N \@mkboth + { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } + { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } + } + \@starttoc {#2} + } + } + \cs_new_eq:cN {l@#1} \l@figure + } + +% -------------------------------------------------------------------------- +\chemmacros_define_keys:nn {scheme} + { + float-method .code:n = + \seq_if_in:NnTF \l__chemmacros_float_methods_seq {#1} + { + \bool_set_true:N \l__chemmacros_float_def_bool + \tl_set:Nn \l__chemmacros_float_method_tl {#1} + } + { \msg_error:nnn {chemmacros} {unknown-method} {#1} } + } + % -------------------------------------------------------------------------- % checks if one of the above defined methods is active. The first one found -% will be used. +% will be used. \cs_new_protected:Npn \chemmacros_check_float_method:n #1 { \prop_get:NnNT \l__chemmacros_float_methods_prop {#1} \l__chemmacros_tmpa_tl { - \bool_lazy_and:nnT - { !\l__chemmacros_float_def_bool } - { \l__chemmacros_tmpa_tl } + \bool_if:nT { \l__chemmacros_tmpa_tl } { \bool_set_true:N \l__chemmacros_float_def_bool \tl_set:Nn \l__chemmacros_float_method_tl {#1} - \msg_info:nnn {chemmacros} {float-method} {#1} } } } \cs_new_protected:Npn \chemmacros_check_float_methods: { - \seq_map_function:NN - \l__chemmacros_float_methods_seq - \chemmacros_check_float_method:n + \bool_if:NF \l__chemmacros_float_def_bool + { + \seq_map_function:NN + \l__chemmacros_float_methods_seq + \chemmacros_check_float_method:n + } } \hook_gput_code:nnn {begindocument/before} {chemmacros} @@ -4727,19 +4944,8 @@ } } -% -------------------------------------------------------------------------- -\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} ] - -% -------------------------------------------------------------------------- % #1: env name +% #2: file ending \cs_new_protected:Npn \chemmacros_define_float:nn #1#2 { \bool_lazy_and:nnT @@ -4755,81 +4961,31 @@ \__chemmacros_define_float:nn {#1} {#2} } { - \bool_lazy_or:nnTF - { \chemmacros_if_class_loaded_p:n {book} } - { \chemmacros_if_class_loaded_p:n {report} } - { - \newcounter {#1} [chapter] - \cs_set:cpn {the#1} - { \ifnum \c@chapter>\z@ \thechapter.\fi \arabic {#1} } - } - { - \newcounter {#1} - \cs_set:cpn {the#1} { \arabic {#1} } - } - \cs_new:cpn {fps@#1} {tbp} - \cs_new:cpn {ftype@#1} {8} - \cs_new:cpn {ext@#1} {#2} - \cs_new:cpx {fnum@#1} { - \exp_not:c {#1name} - \exp_not:N \nobreakspace - \exp_not:c {the#1}} - \cs_new:cpn {#1name} {\chemmacros_translate:n {#1-name}} - \cs_new:cpn {list#1name} {\chemmacros_translate:n {#1-list}} - \newenvironment {#1} - {\@float{#1}} - {\end@float} - \newenvironment {#1*} - {\@dblfloat{#1}} - {\end@dblfloat} - \bool_lazy_or:nnTF - { \chemmacros_if_class_loaded_p:n {book} } - { \chemmacros_if_class_loaded_p:n {report} } - { - \cs_new_protected:cpn {listof#1s} - { - \legacy_if:nTF {@twocolumn} - { \@restonecoltrue\onecolumn } - { \@restonecolfalse } - \chapter* { \use:c {list#1name} } - \use:x - { - \exp_not:N \@mkboth - { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } - { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } - } - \@starttoc {#2} - \legacy_if:nT {@restonecol} { \twocolumn } - } - \patchcmd \@chapter - { \addtocontents } - { \addtocontents {#2} { \protect \addvspace {10\p@} } \addtocontents } - {} - { \msg_warning:nnn {chemmacros} {patch-failed} { \@chapter } } - } - { - \cs_new_protected:cpn {listof#1s} - { - \section* {\use:c {list#1name}} - \use:x - { - \exp_not:N \@mkboth - { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } - { \exp_not:N \MakeUppercase \exp_not:c {list#1name} } - } - \@starttoc {#2} - } - } - \cs_new_eq:cN {l@#1} \l@figure + \prop_get:NnN \l__chemmacros_float_definitions_prop + {traditional} + \l__chemmacros_tmpa_tl + \tl_use:N \l__chemmacros_tmpa_tl + \__chemmacros_define_float:nn {#1} {#2} } + \cs_set:cpn {#1name} {\chemmacros_translate:n {#1-name}} + \cs_set:cpn {list#1name} {\chemmacros_translate:n {#1-list}} } - \cs_set:cpn {#1name} {\chemmacros_translate:n {#1-name}} - \cs_set:cpn {list#1name} {\chemmacros_translate:n {#1-list}} } + +% -------------------------------------------------------------------------- +\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} ] % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{spectroscopy}{2021/07/24 environment for spectroscopic data} +\ChemModule{spectroscopy}{2022/01/29 environment for spectroscopic data} \RequirePackage{siunitx} @@ -4939,11 +5095,11 @@ \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} } } \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2} - \chemmacros_chemformula:n { ^{#1} } + \chemmacros_formula:n { ^{#1} } \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl { \bool_if:NTF \l__chemmacros_nmr_parse_bool - { \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl } + { \chemmacros_formula:V \g__chemmacros_nmr_element_coupled_tl } { \g__chemmacros_nmr_element_coupled_tl } } \tl_use:N \l__chemmacros_nmr_element_method_connector_tl @@ -5090,7 +5246,7 @@ \bool_if:NT \l__chemmacros_nmr_comma_bool { , ~ } \bool_if:NT \l__chemmacros_nmr_solvent_bool - { \chemmacros_chemformula:n {#4} } + { \chemmacros_formula:n {#4} } \bool_if:NT \l__chemmacros_nmr_delimiters_bool { ) } \tl_if_blank:nT {#1} {:~} @@ -5118,7 +5274,7 @@ \bool_if:NT \l__chemmacros_nmr_solvent_bool { \bool_if:NTF \l__chemmacros_nmr_parse_bool - { \chemmacros_chemformula:n {#4} } + { \chemmacros_formula:n {#4} } {#4} } \bool_if:NT \l__chemmacros_nmr_delimiters_bool @@ -5184,12 +5340,12 @@ { \__chemmacros_nmr_number:n {#1} \chemmacros_skip_nobreak:N \l__chemmacros_nmr_space_skip - \chemmacros_chemformula:V \g__chemmacros_nmr_element_tl + \chemmacros_formula:V \g__chemmacros_nmr_element_tl } \cs_new_protected:Npn \chemmacros_nmr_position:n #1 { - \chemmacros_chemformula:x + \chemmacros_formula:e { \exp_not:V \g__chemmacros_nmr_element_tl \bool_if:NF \l__chemmacros_nmr_position_side_bool @@ -5229,7 +5385,7 @@ \c_math_subscript_token { \l__chemmacros_nmr_coupling_nuclei_pre_tl - \chemmacros_chemformula:n {#2} + \chemmacros_formula:n {#2} \l__chemmacros_nmr_coupling_nuclei_post_tl } } @@ -5238,7 +5394,7 @@ \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl { \l__chemmacros_nmr_coupling_nuclei_pre_tl - \chemmacros_chemformula:n {#2} + \chemmacros_formula:n {#2} \l__chemmacros_nmr_coupling_nuclei_post_tl } } @@ -5321,16 +5477,17 @@ unit .groups:n = {variables} } -\cs_new_protected:Npn \chemmacros_state:nn #1#2 +\cs_new_protected:Npn \chemmacros_state:nnnnnn #1#2#3#4#5#6 { - % pre (\Delta) - % post - % superscript-left - % superscript-right (\standardstate) - % subscript-left - % subscript-right \group_begin: - \chemmacros_set_keys:nn {thermodynamics} {#1} + \chemmacros_set_keys:ne {thermodynamics} + { + \exp_not:n {#1} , + \tl_if_novalue:nF {#2} { subscript-left = \exp_not:n {#2} , } + \tl_if_novalue:nF {#3} { superscript-left = \exp_not:n {#3} , } + \tl_if_novalue:nF {#5} { subscript-right = \exp_not:n {#5} , } + \tl_if_novalue:nF {#6} { superscript-right = \exp_not:n {#6} } + } \ensuremath { \chemmacros_text:V \l__chemmacros_state_pre_tl @@ -5338,7 +5495,7 @@ { \chemmacros_text:V \l__chemmacros_state_sp_left_tl } \c_math_subscript_token { \chemmacros_text:V \l__chemmacros_state_sb_left_tl } - #2 + #4 \c_math_superscript_token { \chemmacros_text:V \l__chemmacros_state_sp_right_tl } \c_math_subscript_token @@ -5347,10 +5504,11 @@ } \group_end: } -\cs_generate_variant:Nn \chemmacros_state:nn { nV } +\cs_generate_variant:Nn \chemmacros_state:nnnnnn { nVVVVV } -\DeclareDocumentCommand \state { O{}m } - { \chemmacros_state:nn {#1} {#2} } +\exp_args:NNe +\NewDocumentCommand \state { O{}e{\char_generate:nn {`_}{8}^}me{\char_generate:nn {`_}{8}^} } + { \use:c {chemmacros_state:nnnnnn} {#1} {#2} {#3} {#4} {#5} {#6} } \cs_new_protected:Npn \chemmacros_declare_state:Nn #1#2 { @@ -5374,17 +5532,23 @@ \DeclareDocumentCommand #1 { sO{}D(){}m } { \group_begin: - \chemmacros_set_keys:xn + \chemmacros_set_keys:en {thermodynamics/\chemmacros_remove_backslash:N #1} {#2} \tl_if_blank:nF {##3} { - \chemmacros_set_keys:nx {thermodynamics} + \chemmacros_set_keys:ne {thermodynamics} { subscript-\l__chemmacros_state_sb_pos_tl = \exp_not:n {##3} } } \ensuremath { - \chemmacros_state:nV {##2} \l__chemmacros_state_symbol_tl + \chemmacros_state:nVVVVV + {##2} + \c_novalue_tl + \c_novalue_tl + \l__chemmacros_state_symbol_tl + \c_novalue_tl + \c_novalue_tl \chemmacros_set_keys_groups:nnn {thermodynamics} {variables} {##2} \IfBooleanF {##1} { = \qty {##4} { \l__chemmacros_state_unit_tl } } } @@ -6452,8 +6616,8 @@ % #1: star: include ID in table \NewDocumentCommand \printreactants {s} { - \group_begin: - \chemmacros_set_keys:nn {reactants} { switch = false } + \group_begin: + \chemmacros_set_keys:nn {reactants} { switch = false } \int_step_variable:nNn { \seq_count:N \g_chemnum_initiated_compounds_seq } \l__chemmacros_reactants_tmpa_tl @@ -6509,60 +6673,54 @@ \chemmacros_if_package_loaded:nTF {xltabular} { \bool_if:nTF {#1} - { - \begin - {xltabular} - { \textwidth } - { @{}ll>{\raggedright\arraybackslash}X@{} } - } - { - \begin - {xltabular} - { \textwidth } - { @{}l>{\raggedright\arraybackslash}X@{} } - } - \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { } - \end{xltabular} - } - { + { + \begin {xltabular} + { \textwidth } + { @{}ll>{\raggedright\arraybackslash}X@{} } + } + { + \begin {xltabular} + { \textwidth } + { @{}l>{\raggedright\arraybackslash}X@{} } + } + \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { } + \end{xltabular} + } + { \msg_expandable_error:nnnn {chemmacros} {package-not-loaded} { \printreactants } {xltabular} - } - } + } + } {longtable} { \chemmacros_if_package_loaded:nTF {longtable} { \bool_if:nTF {#1} - { - \begin - {longtable}[l] - { @{}ll>{\raggedright\arraybackslash}p{0.6\textwidth}@{} } - } - { - \begin - {longtable}[l] + { + \begin {longtable}[l] + { @{}ll>{\raggedright\arraybackslash}p{0.6\textwidth}@{} } + } + { + \begin {longtable}[l] { @{}l>{\raggedright\arraybackslash}p{0.9\textwidth}@{} } - } - \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { } - \end{longtable} - } - { + } + \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { } + \end{longtable} + } + { \msg_expandable_error:nnnn {chemmacros} {package-not-loaded} { \printreactants } {longtable} - } - } - } - } - { - \msg_warning:nn {chemmacros} {missing-printreactants-style} - } + } + } + } + } + { \msg_warning:nn {chemmacros} {missing-printreactants-style} } \group_end: } @@ -6615,7 +6773,7 @@ % -------------------------------------------------------------------------- \ChemModuleEnd -\ChemModule{translations}{2022/01/16 translations for defined keys at one place} +\ChemModule{translations}{2022/01/26 translations for defined keys at one place} % -------------------------------------------------------------------------- \chemmacros_declare_translations:nn {K-acid} @@ -6625,7 +6783,7 @@ Dutch = \mathrm {z} } -\chemmacros_declare_translations:nn {K-acid} +\chemmacros_declare_translations:nn {K-water} { Danish = \mathrm {v} } % -------------------------------------------------------------------------- -- cgit v1.2.3