summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-10-15 21:18:08 +0000
committerKarl Berry <karl@freefriends.org>2015-10-15 21:18:08 +0000
commit1a53ed5fef3415d75bf09d6c089f10085113434a (patch)
treee16e66c5b79962741c8d456729c4bedd8d4c19d5 /Master/texmf-dist/tex/latex/chemmacros
parent4018267c3c2e5466bff0abae9561a686d05da81e (diff)
chemmacros (15oct15)
git-svn-id: svn://tug.org/texlive/trunk@38649 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.all.code.tex18
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex41
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex107
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.errorcheck.code.tex115
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex149
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex36
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex40
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.units.code.tex8
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty70
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros5.sty45
10 files changed, 537 insertions, 92 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.all.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.all.code.tex
index 53226a9aa90..d9b655351ee 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.all.code.tex
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.all.code.tex
@@ -25,11 +25,21 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{all}{2015/06/09 load all libraries}
+\ChemModule{all}{2015/10/14 load all libraries}
+
+\msg_new:nnn {chemmacros} {all-modules}
+ {
+ You~ are~ loading~ *all*~ of~ chemmacros'~ module~ through~ the~ `all'~
+ module!~ This~ is~ fine~ but~ not~ really~ encouraged.~ Do~ really~ need~
+ all~ of~ `isotopes' ,~ `mechanisms' ,~ `newman' ,~ `nomenclature' ,~
+ `orbital' ,~ `particles' ,~ `phases' ,~ `reactions' ,~ `redox' ,~ `scheme'
+ ,~ `spectroscopy' ,~ `symbols' ,~ `thermodynamics' ,~ `units' ...?
+ }
\chemmacros_load_modules:n
{
base ,
+ errorcheck ,
lang ,
greek ,
chemformula ,
@@ -53,4 +63,10 @@
xfrac
}
+\msg_info:nn {chemmacros} {all-modules}
+
% --------------------------------------------------------------------------
+\tex_endinput:D
+
+2015/10/14 - add info message discouraging the usage of this module
+ - add `errorcheck' 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 d8a65a0096a..3bb594156c2 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,12 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{base}{2015/07/25 basic chemmacros module}
+\ChemModule{base}{2015/10/14 basic chemmacros module}
+
+% for the document hooks
+\ChemCompatibilityFrom{5.1}
+\RequirePackage {etoolbox}
+\EndChemCompatibility
% --------------------------------------------------------------------------
\msg_new:nnn {chemmacros} {command-deprecated}
@@ -171,14 +176,36 @@
{ \prg_return_false: }
}
+\ChemCompatibilityFrom{5.2}
+% this is still true \AtBeginDocument:
+\prg_new_conditional:Npnn \chemmacros_if_preamble: {p,T,F,TF}
+ {
+ \cs_if_eq:NNTF \@onlypreamble \@notprerr
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+
+% this is still false \AtBeginDocument:
+\prg_new_conditional:Npnn \chemmacros_if_document: {p,T,F,TF}
+ {
+ \bool_if:NTF \l__chemmacros_in_document_bool
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+\EndChemCompatibility
+
% --------------------------------------------------------------------------
% some checks at begin document:
\bool_new:N \l__chemmacros_in_document_bool
\bool_new:N \l__chemmacros_chemstyle_bool
+\chemmacros_if_compatiblity:nnTF {>=} {5.2}
+ { \AfterEndPreamble }
+ { \AtBeginDocument }
+ { \bool_set_true:N \l__chemmacros_in_document_bool }
+
\AtBeginDocument
{
- \bool_set_true:N \l__chemmacros_in_document_bool
\@ifpackageloaded { chemstyle }
{ \bool_set_true:N \l__chemmacros_chemstyle_bool }
{ \bool_set_false:N \l__chemmacros_chemstyle_bool }
@@ -270,3 +297,13 @@
% --------------------------------------------------------------------------
+\chemmacros_if_compatiblity:nnT {>=} {5.2}
+ { \chemmacros_load_module:n {errorcheck} }
+
+% --------------------------------------------------------------------------
+
+\tex_endinput:D
+
+2015/09/23 - new conditionals \chemmacros_if_preamble:TF and
+ \chemmacros_if_document:TF
+2015/10/14 - load `errorcheck' module
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 d785ce6c795..7ab4116182b 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,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{chemformula}{2015/09/19 integration of chemical formulas}
+\ChemModule{chemformula}{2015/10/13 integration of chemical formulas}
\RequirePackage{amstext}
\chemmacros_load_module:n {charges}
@@ -37,6 +37,19 @@
I'm~ falling~ back~ to~ `chemformula'~ now.
}
+\msg_new:nnn {chemmacros} {default-formula-method}
+ {
+ You~ haven't~ chosen~ a~ formula~ method~ so~ I'm~ assuming~ the~ default~
+ method~ `chemformula'.
+ }
+
+\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'.
+ }
+
\bool_new:N \l__chemmacros_formula_method_set_bool
\tl_new:N \g_chemmacros_formula_method_tl
@@ -44,31 +57,34 @@
\cs_new_protected:Npn \chemmacros_set_formula_method:n #1
{
- \str_case:nnTF {#1}
+ \bool_if:NF \l__chemmacros_formula_method_set_bool
{
- {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} }
+ \str_case:nnTF {#1}
+ {
+ {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}
}
- \tl_gset:Nn \g_chemmacros_formula_method_tl {mhchem}
- }
+ }
+ { \bool_set_true:N \l__chemmacros_formula_method_set_bool }
+ { \bool_set_false:N \l__chemmacros_formula_method_set_bool }
}
- { \bool_set_true:N \l__chemmacros_formula_method_set_bool }
- { \bool_set_false:N \l__chemmacros_formula_method_set_bool }
}
\cs_generate_variant:Nn \chemmacros_set_formula_method:n {V}
@@ -81,11 +97,15 @@
\cs_new_protected:Npn \chemmacros_reaction:n #1
{ \chemformula_ch:nn {} {#1} }
-% for module writes prefering traditional 2e programming:
+% 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} }
% --------------------------------------------------------------------------
+\ChemCompatibilityTo{5.0}
+\chemmacros_set_formula_method:n {chemformula}
+\EndChemCompatibility
+
\ChemCompatibilityFrom{5.1}
\keys_define:nn {chemmacros}
{
@@ -98,10 +118,43 @@
}
\EndChemCompatibility
+\cs_new_protected:Npn \chemmacros_check_formula_method:
+ {
+ \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}
+ }
+ }
+ {
+ \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}
+ }
+ }
+ }
+
\AtEndPreamble
{
\bool_if:NF \l__chemmacros_formula_method_set_bool
- { \chemmacros_set_formula_method:V \g_chemmacros_formula_method_tl }
+ {
+ \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
+ }
+ }
}
% --------------------------------------------------------------------------
@@ -109,4 +162,6 @@
2015/09/22 - new general option `method' which allows a choice between
`chemformula' and `mhchem'
-
+2015/10/13 - add missing compatibility definitions
+ - check for `mhchem' and `chemformula' and set method accordingly
+ if possible
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.errorcheck.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.errorcheck.code.tex
new file mode 100644
index 00000000000..70879c15e24
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.errorcheck.code.tex
@@ -0,0 +1,115 @@
+% --------------------------------------------------------------------------
+%
+% the CHEMMACROS package -- module: `errorcheck'
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% --------------------------------------------------------------------------
+% https://github.org/cgnieder/chemmacros/
+% contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+% Copyright 2011-2015 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% --------------------------------------------------------------------------
+\ChemModule{errorcheck}{2015/10/14 error checking for unloaded modules}[5.2]
+
+\msg_new:nnn {chemmacros} {undefined}
+ { The~ #1~ `#2'~ is~ undefined.~ You~ need~ to~ load~ the~ `#3'~ module. }
+
+\cs_generate_variant:Nn \msg_error:nnnnn {nnnx}
+
+\cs_new_protected:Npn \chemmacros_command_requires_module:Nn #1#2
+ {
+ \chemmacros_if_module_loaded:nF {#2}
+ {
+ \cs_set:Npn #1
+ {
+ \msg_error:nnnxn {chemmacros} {undefined}
+ {command}
+ { \token_to_str:N #1 }
+ {#2}
+ }
+ }
+ \chemmacros_before_module:nn {#2} { \cs_undefine:N #1 }
+ }
+
+\cs_new_protected:Npn \chemmacros_environment_requires_module:nn #1#2
+ {
+ \chemmacros_if_module_loaded:nF {#2}
+ {
+ \cs_set:cpn {#1}
+ {
+ \msg_error:nnnnn {chemmacros} {undefined}
+ {environment}
+ {#1}
+ {#2}
+ }
+ }
+ \chemmacros_before_module:nn {#2} { \cs_undefine:c {#1} }
+ }
+
+% --------------------------------------------------------------------------
+% add checking for the most common user commands and environments:
+% isotopes module
+\chemmacros_command_requires_module:Nn \isotope {isotopes}
+
+% mechanisms module
+\chemmacros_command_requires_module:Nn \mech {mechanisms}
+
+% newman module
+\chemmacros_command_requires_module:Nn \newman {newman}
+
+% orbital module
+\chemmacros_command_requires_module:Nn \orbital {orbital}
+
+% reactions module
+\chemmacros_environment_requires_module:nn {reaction} {reactions}
+\chemmacros_environment_requires_module:nn {reaction*} {reactions}
+\chemmacros_environment_requires_module:nn {reactions} {reactions}
+\chemmacros_environment_requires_module:nn {reactions*} {reactions}
+\chemmacros_command_requires_module:Nn \listofreactions {reactions}
+\chemmacros_command_requires_module:Nn \AddRxnDesc {reactions}
+
+% redox module
+\chemmacros_command_requires_module:Nn \ox {redox}
+\chemmacros_command_requires_module:Nn \OX {redox}
+\chemmacros_command_requires_module:Nn \redox {redox}
+
+% scheme module
+\chemmacros_environment_requires_module:nn {scheme} {scheme}
+\chemmacros_command_requires_module:Nn \listschemename {scheme}
+\chemmacros_command_requires_module:Nn \schemename {scheme}
+\chemmacros_command_requires_module:Nn \listofschemes {scheme}
+
+% spectroscopy module
+\chemmacros_command_requires_module:Nn \NMR {spectroscopy}
+\chemmacros_environment_requires_module:nn {experimental} {spectroscopy}
+
+% thermodynamics module
+\chemmacros_command_requires_module:Nn \state {thermodynamics}
+\chemmacros_command_requires_module:Nn \enthalpy {thermodynamics}
+\chemmacros_command_requires_module:Nn \entropy {thermodynamics}
+\chemmacros_command_requires_module:Nn \gibbs {thermodynamics}
+
+% xfrac module
+\chemmacros_command_requires_module:Nn \chemfrac {xfrac}
+
+% --------------------------------------------------------------------------
+
+\tex_endinput:D
+
+2015/10/14 - first version
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 c13f3b10ded..ec941e31bd2 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
@@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{nomenclature}{2015/09/09 chemical names}
+\ChemModule{nomenclature}{2015/09/23 chemical names}
\RequirePackage{scrlfile}
@@ -141,6 +141,7 @@
\chemmacros_make_iupac:
}
+\ChemCompatibilityTo{5.1}
\cs_new_protected:Npn \chemmacros_make_iupac:
{
\bool_if:NT \l__chemmacros_in_document_bool
@@ -169,8 +170,40 @@
}
}
}
-
\AtBeginDocument { \chemmacros_make_iupac: }
+\EndChemCompatibility
+
+\ChemCompatibilityFrom{5.2}
+\cs_new_protected:Npn \chemmacros_make_iupac:
+ {
+ \chemmacros_if_document:T
+ {
+ \bool_if:NTF \l__chemmacros_inside_iupac_bool
+ {
+ \prop_map_inline:Nn \l__chemmacros_iupac_prop
+ { \cs_set_protected:cpn {##1} {##2} }
+ }
+ {
+ \bool_if:NF \l__chemmacros_iupac_restricted_bool
+ {
+ \bool_if:NTF \l__chemmacros_iupac_strict_bool
+ {
+ \prop_map_inline:Nn \l__chemmacros_iupac_prop
+ { \cs_set_protected:cpn {##1} {##2} }
+ }
+ {
+ \prop_map_inline:Nn \l__chemmacros_iupac_prop
+ {
+ \cs_if_exist:cF {##1}
+ { \cs_set_protected:cpn {##1} {##2} }
+ }
+ }
+ }
+ }
+ }
+ }
+\AfterEndPreamble { \chemmacros_make_iupac: }
+\EndChemCompatibility
\NewDocumentCommand \DeclareChemIUPAC { mm }
{ \chemmacros_define_iupac:Nn #1 { #2 } }
@@ -209,11 +242,33 @@
\keys_define:nn {chemmacros/nomenclature}
{ cip-kern .dim_set:N = \l__chemmacros_cip_kern_dim }
+\ChemCompatibilityTo{5.1}
+\cs_new_protected:Npn \chemmacros_cip:n #1
+ { \textit{#1} \tex_kern:D \l__chemmacros_cip_kern_dim }
+
\NewDocumentCommand \cip { m }
{ \chemmacros_cip:n { #1 } }
+\EndChemCompatibility
+\ChemCompatibilityFrom{5.2}
\cs_new_protected:Npn \chemmacros_cip:n #1
- { ( \textit{#1} \tex_kern:D \l__chemmacros_cip_kern_dim ) }
+ {
+ \int_zero:N \l__chemmacros_tmpa_int
+ \textup{(}
+ \clist_map_inline:nn
+ {#1}
+ {
+ \int_incr:N \l__chemmacros_tmpa_int
+ \textit{##1}
+ \int_compare:nT
+ { \l__chemmacros_tmpa_int < \clist_count:n {#1} }
+ { \textup{,} }
+ }
+ \textup{)}
+ \tex_kern:D \l__chemmacros_cip_kern_dim
+ }
+\DeclareChemIUPAC \cip { \chemmacros_cip:n }
+\EndChemCompatibility
% remember: TikZ needs : to be other
\cs_new_protected:Npn \chemmacros_sconf:n #1
@@ -300,6 +355,32 @@
\skip_horizontal:N \c_zero_dim
}
+% #1: pre break
+% #2: post break
+% #3: no break
+\ChemCompatibilityTo{5.0}
+\cs_new_protected:Npn \__chemmacros_break_point_insert:nnn #1#2#3
+ {
+ \chemmacros_nobreak:
+ \tex_discretionary:D { - } { } {#3}
+ \chemmacros_allow_hyphens:
+ }
+\EndChemCompatibility
+
+\ChemCompatibilityFrom{5.1}
+\cs_new_protected:Npn \__chemmacros_break_point_insert:nnn #1#2#3
+ {
+ \mode_if_math:TF
+ {#3}
+ {
+ \chemmacros_nobreak:
+ \tex_discretionary:D {#1} {#2} {#3}
+ \chemmacros_allow_hyphens:
+ }
+ }
+\EndChemCompatibility
+
+
\dim_new:N \l__chemmacros_iupac_hyphen_pre_dim
\dim_set:Nn \l__chemmacros_iupac_hyphen_pre_dim { .01em }
\dim_new:N \l__chemmacros_iupac_hyphen_post_dim
@@ -314,25 +395,39 @@
break-space .dim_set:N = \l__chemmacros_iupac_break_dim
}
-% #1: pre break
-% #2: post break
-% #3: no break
-\cs_new_protected:Npn \__chemmacros_break_point_insert:nnn #1#2#3
+\ChemCompatibilityTo{5.1}
+\cs_new_protected:Npn \chemmacros_break_point_hyphen:
{
- \mode_if_math:TF
- {#3}
+ \__chemmacros_break_point_insert:nnn
+ {-}
+ { }
{
- \chemmacros_nobreak:
- \tex_discretionary:D {#1} {#2} {#3}
- \chemmacros_allow_hyphens:
+ \tex_kern:D \l__chemmacros_iupac_hyphen_pre_dim
+ -
+ \tex_kern:D \l__chemmacros_iupac_hyphen_post_dim
}
}
-\cs_new_protected:Npn \chemmacros_break_point_hyphen:
+
+\cs_new_protected:Npn \chemmacros_break_point:
{
\__chemmacros_break_point_insert:nnn
{-}
{ }
{
+ \mode_if_math:TF
+ { | }
+ { \tex_kern:D \l__chemmacros_iupac_break_dim }
+ }
+ }
+\EndChemCompatibility
+
+\ChemCompatibilityFrom{5.2}
+\cs_new_protected:Npn \chemmacros_break_point_hyphen:
+ {
+ \__chemmacros_break_point_insert:nnn
+ { \tex_kern:D \l__chemmacros_iupac_hyphen_pre_dim - }
+ { }
+ {
\tex_kern:D \l__chemmacros_iupac_hyphen_pre_dim
-
\tex_kern:D \l__chemmacros_iupac_hyphen_post_dim
@@ -350,6 +445,7 @@
{ \tex_kern:D \l__chemmacros_iupac_break_dim }
}
}
+\EndChemCompatibility
\cs_new_protected:Npn \chemmacros_break_point_opening_paren:
{ \__chemmacros_break_point_insert:nnn { - } { ( } { ( } }
@@ -381,7 +477,7 @@
\cs_new_protected:Npn \chemmacros_remove_shorthand:N #1
{
- \chemmacros_define_iupac_shorthand:Npn #1 {}
+ \chemmacros_define_iupac_shorthand:NN #1 \c_empty_tl
\seq_remove_all:Nn \l__chemmacros_iupac_shorthands_seq {#1}
}
@@ -425,6 +521,16 @@
\NewDocumentCommand \RemoveChemIUPACShorthand {m}
{ \chemmacros_remove_shorthand:N #1 }
+\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
+\NewChemIUPACShorthand ^ \chemmacros_superscript:n
+
\group_begin:
\chemmacros_activate_all_iupac_shorthands:
@@ -444,19 +550,13 @@
}
\group_end:
-\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:
-\NewChemIUPACShorthand ^ \chemmacros_superscript:n
-
% Thanks to Joseph Wright and Enrico Gregorio for the help on the curious
% redefinition of \- and the end of the compilation
% see http://tex.stackexchange.com/q/42405/5049 for reference
+\ChemCompatibilityTo{5.2}
\cs_set_protected:Npx \- { \exp_not:o { \- } }
\cs_set_eq:NN \@dischyph \-
+\EndChemCompatibility
\NewDocumentCommand \iupac {m} { \chemmacros_iupac:n {#1} }
@@ -620,3 +720,8 @@
% --------------------------------------------------------------------------
\tex_endinput:D
+
+2015/10/01 - use new function \chemmacros_if_document:TF for
+ \chemmacros_make_iupac:
+ - \cip only italicizes elements of csv list
+ - fix bug in \RemoveChemIUPACShorthand
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 a3468239f06..8138ca6e7dc 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}{2015/09/15 reaction environments}
+\ChemModule{reactions}{2015/10/14 reaction environments}
\chemmacros_load_module:n {chemformula}
@@ -87,21 +87,40 @@
\tl_new:N \reactionlistname
\tl_new:N \l__chemmacros_reaction_heading_tl
-\cs_if_exist:NTF \chapter
- { \tl_set:Nn \l__chemmacros_reaction_heading_tl { \chapter* } }
- { \tl_set:Nn \l__chemmacros_reaction_heading_tl { \section* } }
+\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} }
-\cs_new:Npn \__chemmacros_reaction_heading:n #1
- { \l__chemmacros_reaction_heading_tl { #1 } }
-\cs_generate_variant:Nn \__chemmacros_reaction_heading:n { V }
+\keys_define:nn {chemmacros/reactions}
+ {
+ list-name .tl_set:N = \reactionlistname ,
+ list-entry .tl_set:N = \l__chemmacros_reaction_lorname_tl ,
+ }
+\ChemCompatibilityFrom{5.2}
+\keys_define:nn {chemmacros/reactions}
+ {
+ list-heading-cmd .code:n =
+ \cs_set_protected:Npn \__chemmacros_reaction_heading:n ##1 {#1}
+ }
+\EndChemCompatibility
+
+\cs_if_exist:NTF \chapter
+ {
+ \keys_set:nn {chemmacros/reactions}
+ { list-heading-cmd = \chapter* {#1} }
+ }
+ {
+ \keys_set:nn {chemmacros/reactions}
+ { list-heading-cmd = \section* {#1} }
+ }
\cs_new_protected:Npn \listofreactions
{
\__chemmacros_reaction_heading:V \reactionlistname
- \@starttoc { lor }
+ \@starttoc {lor}
}
\cs_new_protected:Npn \l@reaction #1#2
@@ -187,3 +206,4 @@
2015/09/15 - adapt to `method' option => do not use chemformula's macros
directly
+2015/10/14 - new option `list-heading-cmd'
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 1b9ace3108a..11980accdcb 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
@@ -41,6 +41,9 @@
\bool_new:N \l__chemmacros_ox_sign_bool
\bool_new:N \l__chemmacros_ox_integer_bool
\bool_new:N \l__chemmacros_ox_explicit_sign_bool
+\ChemCompatibilityFrom{5.2}
+\bool_new:N \l__chemmacros_ox_explicit_zero_sign_bool
+\EndChemCompatibility
\bool_new:N \l__chemmacros_ox_format_roman_bool
\bool_new:N \l__chemmacros_ox_decimal_marker_comma_bool
\bool_new:N \l__chemmacros_ox_parse_bool
@@ -79,6 +82,7 @@
\group_end:
}
+\ChemCompatibilityTo{5.1}
\cs_new_protected:Npn \__chemmacros_ox_sign:n #1
{
\bool_if:nT
@@ -87,15 +91,36 @@
\l__chemmacros_ox_explicit_sign_bool
}
{ \c_math_toggle_token + \c_math_toggle_token }
+ \bool_if:nT
+ {
+ \fp_compare_p:n { #1 = 0 } &&
+ \l__chemmacros_ox_explicit_sign_bool
+ }
+ { \c_math_toggle_token \pm \c_math_toggle_token }
+ \fp_compare:nT { #1 < 0 }
+ { \c_math_toggle_token - \c_math_toggle_token }
+ }
+\EndChemCompatibility
+\ChemCompatibilityFrom{5.2}
+\cs_new_protected:Npn \__chemmacros_ox_sign:n #1
+ {
\bool_if:nT
{
- \fp_compare_p:n { #1 = 0 } &&
+ \fp_compare_p:n { #1 > 0 } &&
\l__chemmacros_ox_explicit_sign_bool
}
- { \c_math_toggle_token \pm \c_math_toggle_token }
+ { \c_math_toggle_token + \c_math_toggle_token }
+ \bool_if:nT
+ {
+ \fp_compare_p:n { #1 = 0 } &&
+ \l__chemmacros_ox_explicit_sign_bool &&
+ \l__chemmacros_ox_explicit_zero_sign_bool
+ }
+ { \c_math_toggle_token \pm \c_math_toggle_token }
\fp_compare:nT { #1 < 0 }
{ \c_math_toggle_token - \c_math_toggle_token }
}
+\EndChemCompatibility
\cs_new_protected:Npn \__chemmacros_ox_value:n #1
{
@@ -258,6 +283,14 @@
align .initial:n = center
}
+\ChemCompatibilityFrom{5.4}
+\keys_define:nn {chemmacros/redox}
+ {
+ explicit-zero-sign .bool_set:N \l__chemmacros_ox_explicit_zero_sign_bool ,
+ explicit-zero-sign .default:n = true
+ }
+\EndChemCompatibility
+
% \ox[<keyval>]{<num>,<atom>}
% \ox*[<keyval>]{<num>,<atom>} => always number on the top
\cs_new_protected:Npn \chemmacros_ox:nnnn #1#2#3#4
@@ -401,3 +434,6 @@
}
% --------------------------------------------------------------------------
+\tex_endinput:D
+2015/09/30 - new option `explicit-zero-sign'
+
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.units.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.units.code.tex
index b6bbe6776ef..0ecf2b7407f 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.units.code.tex
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.units.code.tex
@@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{units}{2015/07/22 chemical units}
+\ChemModule{units}{2015/09/28 chemical units}
\RequirePackage{siunitx}
@@ -39,7 +39,7 @@
\DeclareSIUnit {\normal } {\textsc{n}}
\DeclareSIUnit {\torr } {torr}
-\AtBeginDocument
+\AtEndPreamble
{
\chemmacros_if_package_loaded:nF {chemstyle}
{
@@ -50,3 +50,7 @@
}
% --------------------------------------------------------------------------
+\tex_endinput:D
+
+2015/09/28 - change \AtBeginDocument into \AtEndPreamble
+
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index b2907ec4e2f..2843bf1e83a 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 {2015/09/23}
+\tl_const:Nn \c_chemmacros_date_tl {2015/10/14}
\tl_const:Nn \c_chemmacros_version_major_number_tl {5}
-\tl_const:Nn \c_chemmacros_version_minor_number_tl {1}
+\tl_const:Nn \c_chemmacros_version_minor_number_tl {2}
\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}
@@ -49,29 +49,24 @@
{\c_chemmacros_info_tl \c_space_tl (CN)}
% --------------------------------------------------------------------------
-% messages:
-\msg_new:nnn {chemmacros} {too-low-compatibility}
- {
- Compatibility~ for~ versions~ below~ v4.7~ is~ not~ supported!~ You~
- requested~ version~ v #1.~ Loading~ v4.7~ instead.
- }
-
-\msg_new:nnn {chemmacros} {low-compatibility}
- {
- You~ requested~ compatibility~ mode~ v #1~ while~ the~ current~ version~
- of~ chemmacros~ is~ v \c_chemmacros_version_number_tl .~ Not~ all~ features~
- will~ be~ available!
- }
-
-% --------------------------------------------------------------------------
-% compatibility
+% set compatibility
\fp_new:N \l__chemmacros_compatibility_version_fp
\fp_set:Nn \l__chemmacros_compatibility_version_fp {\c_chemmacros_version_number_tl}
\keys_define:nn {chemmacros/compatibility}
{
- compatibility .fp_set:N = \l__chemmacros_compatibility_version_fp ,
- unknown .code:n =
+ compatibility .code:n =
+ \str_case:nnTF {#1}
+ {
+ {newest} {}
+ {latest} {}
+ }
+ {
+ \fp_set:Nn \l__chemmacros_compatibility_version_fp
+ { \c_chemmacros_version_number_tl }
+ }
+ { \fp_set:Nn \l__chemmacros_compatibility_version_fp {#1} } ,
+ unknown .code:n =
\PassOptionsToPackage{\CurrentOption}{chemmacros4}
\PassOptionsToPackage{\CurrentOption}{chemmacros5}
}
@@ -154,6 +149,29 @@
{#3}
}
+% --------------------------------------------------------------------------
+% messages:
+\msg_new:nnn {chemmacros} {too-low-compatibility}
+ {
+ Compatibility~ for~ versions~ below~ v4.7~ is~ not~ supported!~ You~
+ requested~ version~ v #1.~ Loading~ v4.7~ instead.
+ }
+
+\msg_new:nnn {chemmacros} {too-high-compatibility}
+ {
+ You~ requested~ compatibility~ mode~ v #1~ while~ the~ current~ version~
+ of~ chemmacros~ is~ v \c_chemmacros_version_number_tl .~ Falling~ back~
+ to~ v \c_chemmacros_version_number_tl !
+ }
+
+\msg_new:nnn {chemmacros} {low-compatibility}
+ {
+ You~ requested~ compatibility~ mode~ v #1~ while~ the~ current~ version~
+ of~ chemmacros~ is~ v \c_chemmacros_version_number_tl .~ Not~ all~ features~
+ will~ be~ available!
+ }
+
+% --------------------------------------------------------------------------
% let's see that the max number is the newest (=current) version
\chemmacros_if_compatiblity:nnT {>} { \c_chemmacros_version_number_tl }
{
@@ -460,3 +478,15 @@ Version history
2015/09/23 - version 5.1 - add option `method' to `chemformula' module
- make module `scheme' compatible with `floatrow'
- add module hooks `before' and `after'
+2015/10/14 - version 5.2 - warn if compatibility version requested is higher
+ than the current version number
+ - enable to specify a minimal compatibility version
+ for a module
+ - add info message to `all' module
+ - add values `newest' and `latest' to the
+ compatibility option
+ - check for mhchem and chemformula and choose the
+ formula method accordingly
+ - fixes in the module hook mechanism
+ - fix in \chemmacros_if_module_loaded:n
+ - new internal module `errorcheck'
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros5.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros5.sty
index e8fa9be35f1..c4757bd6e43 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros5.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros5.sty
@@ -50,6 +50,13 @@
Unknown~ option~ `#1'!~ Since~ v5.0~ chemmacros~ has~ no~ package~
options~ any~ more!
}
+
+\msg_new:nnn {chemmacros} {module-not-available}
+ {
+ The~ module~ `#1'~ is~ only~ available~ in~ compatibility~ mode~ #2~ or~
+ higher.
+ }
+
\cs_generate_variant:Nn \msg_warning:nnn { nnV }
\keys_define:nn {chemmacros/package-options}
@@ -128,6 +135,9 @@
\tl_const:Nn \c__chemmacros_module_extension_tl {code.tex}
\tl_const:Nn \c__chemmacros_module_prefix_tl {chemmacros.module}
+\seq_new:N \g__chemmacros_loaded_modules_seq
+\prop_new:N \g__chemmacros_loaded_modules_prop
+
\cs_new_protected:Npn \chemmacros_load_modules:n #1
{ \clist_map_inline:nn {#1} { \chemmacros_load_module:n {##1} } }
@@ -143,12 +153,12 @@
{
\chemmacros_if_module_exist:nTF {#1}
{
- \__chemmacros_use_module_hook:nn {before} {#1}
+ \__chemmacros_use_module_hook:nn {#1} {before}
\msg_log:nnn {chemmacros} {loading-module} {#1}
\@onefilewithoptions
{\c__chemmacros_module_prefix_tl.#1}[][]
\c__chemmacros_module_extension_tl
- \__chemmacros_use_module_hook:nn {after} {#1}
+ \__chemmacros_use_module_hook:nn {#1} {after}
}
{ \msg_error:nnn {chemmacros} {module-missing} {#1} }
}
@@ -157,7 +167,7 @@
\prg_new_conditional:Npnn \chemmacros_if_module_loaded:n #1 {p,T,F,TF}
{
- \cs_if_exist:cTF {chemmacros-module-#1-loaded}
+ \seq_if_in:NnTF \g__chemmacros_loaded_modules_seq {#1}
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -171,10 +181,10 @@
}
% --------------------------------------------------------------------------
+\ChemCompatibilityFrom{5.1}
% module hooks:
% #1: module
% #2: code
-\ChemCompatibilityFrom{5.1}
\cs_new_protected:Npn \chemmacros_after_module:nn #1#2
{
\chemmacros_if_module_loaded:nTF {#1}
@@ -204,6 +214,8 @@
}
}
+% #1: module
+% #2: hook name
\cs_new_protected:Npn \__chemmacros_use_module_hook:nn #1#2
{
\tl_if_exist:cT {g__chemmacros_module_#1_#2_hook_tl}
@@ -214,9 +226,15 @@
}
% --------------------------------------------------------------------------
-\cs_new_protected:Npn \chemmacros_module:nnn #1#2#3
+\cs_new_protected:Npn \__chemmacros_module:nnnn #1#2#3#4
{
- \cs_new:cpn {chemmacros-module-#2-loaded} {chemmacros:~module~`#2'}
+ \chemmacros_if_compatiblity:nnF {>=} {#4}
+ {
+ \msg_warning:nnnn {chemmacros} {module-not-available} {#2} {#4}
+ \tex_endinput:D
+ }
+ \seq_gput_right:Nn \g__chemmacros_loaded_modules_seq {#2}
+ \prop_gput:Nnn \g__chemmacros_loaded_modules_prop {#2} {#3}
\ProvidesFile
{\c__chemmacros_module_prefix_tl.#2.\c__chemmacros_module_extension_tl}
[
@@ -236,8 +254,8 @@
% #1: boolean
% #2: name
% #3: description
-\NewDocumentCommand \ChemModule {smm}
- { \chemmacros_module:nnn {#1} {#2} {#3} }
+\NewDocumentCommand \ChemModule {smmO{5.0}}
+ { \__chemmacros_module:nnnn {#1} {#2} {#3} {#4} }
% --------------------------------------------------------------------------
% command for loading modules:
@@ -247,7 +265,7 @@
% load default modules:
\chemmacros_load_modules:n
{
- base, lang, greek, chemformula, % <= those need to be present for all modules
+ base, errorcheck, lang, greek, chemformula, % <= those need to be present for all modules
acid-base, symbols, charges, particles, phases , nomenclature
}
@@ -258,6 +276,7 @@
Modules: (* = preloaded)
- internal modules:
- base *
+ - errorcheck *
- lang *
- greek *
- chemformula *
@@ -286,3 +305,11 @@ Modules: (* = preloaded)
Version history
2015/08/29 - initial release v5.0
2015/09/23 - add module hooks `before' and `after'
+ - allow to give minimal compatibility version to a module: this
+ should be the first version when a module is published and
+ shouldn't be changed any more; loading the corresponding module
+ will abort when compatibility is too low
+ - store loaded modules in a seq and in a prop
+2015/10/14 - bug fix in the module hook mechanism
+ - bug fix in \chemmacros_if_module_loaded:n
+ - new `errorcheck' module