summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemformula
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-03-16 20:44:58 +0000
committerKarl Berry <karl@freefriends.org>2015-03-16 20:44:58 +0000
commitf68a09e627785569930a286e3881dd8c91a09cad (patch)
treed8ee1e0f8f35431a1860f9c8ff2eb9ced2e6296e /Master/texmf-dist/tex/latex/chemformula
parent5a733479ae03b83c05785b4661c4c3738ad412ab (diff)
chemformula (16mar15)
git-svn-id: svn://tug.org/texlive/trunk@36529 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemformula')
-rw-r--r--Master/texmf-dist/tex/latex/chemformula/chemformula.sty107
1 files changed, 69 insertions, 38 deletions
diff --git a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
index 4bf964e34b0..692f90e5963 100644
--- a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
+++ b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
@@ -12,7 +12,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2014 Clemens Niederberger
+% 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
@@ -28,8 +28,8 @@
% --------------------------------------------------------------------------
\RequirePackage{ expl3 , xparse , l3keys2e , tikz , amsmath , xfrac , nicefrac , scrlfile }
\usetikzlibrary{arrows.meta}
-\def\chemformula@version{4.9}
-\def\chemformula@date{2014/10/07}
+\def\chemformula@version{4.10}
+\def\chemformula@date{2015/03/16}
\ProvidesExplPackage
{chemformula}
@@ -289,6 +289,7 @@
% token lists:
\tl_new:N \l__chemformula_compound_sep_tl
\tl_set:Nn \l__chemformula_compound_sep_tl { .5em }
+\tl_new:N \l__chemformula_compound_tl
\tl_new:N \l__chemformula_arrow_ratio_tl
\tl_set:Nn \l__chemformula_arrow_ratio_tl { .6 }
\tl_new:N \l__chemformula_radical_style_tl
@@ -1210,7 +1211,6 @@
\NewDocumentCommand \ch { O{}m }
{ \chemformula_ch:nn { #1 } { #2 } }
-\tl_new:N \l__chemformula_compound_tl
\cs_new_protected:Npn \chemformula_chcpd:nn #1#2
{
\group_begin:
@@ -1272,9 +1272,7 @@
\cs_new:Npn \chemformula_chwritebelow:nn #1#2
{
-% \group_begin:
-% \__chemformula_reset:Nn \l__chemformula_tmpa_tl { #1 }
- \c_math_toggle_token
+ \c_math_toggle_token
\underset
{
\bool_if:NF \l__chemformula_name_width_bool
@@ -1287,8 +1285,7 @@
{ \l__chemformula_name_format_tl #1 }
}
{ \text { \strut #2 } }
- \c_math_toggle_token
-% \group_end:
+ \c_math_toggle_token
}
\cs_new_protected:Npn \__chemformula_generate_name:Nn #1#2
@@ -1314,22 +1311,50 @@
% --------------------------------------------------------------------------
% parsing input
-\prop_put:Nnn \l__chemformula_cmpd_prop { 0 } { \chemformula_subscript:n { 0 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 1 } { \chemformula_subscript:n { 1 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 2 } { \chemformula_subscript:n { 2 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 3 } { \chemformula_subscript:n { 3 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 4 } { \chemformula_subscript:n { 4 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 5 } { \chemformula_subscript:n { 5 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 6 } { \chemformula_subscript:n { 6 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 7 } { \chemformula_subscript:n { 7 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 8 } { \chemformula_subscript:n { 8 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { 9 } { \chemformula_subscript:n { 9 } }
-\prop_put:Nnn \l__chemformula_cmpd_prop { * } { \chemformula_star_adduct: }
-\prop_put:Nnn \l__chemformula_cmpd_prop { . } { \chemformula_adduct: }
-\prop_put:Nnn \l__chemformula_cmpd_prop { - } { \chemformula_single_bond: }
-\prop_put:Nnn \l__chemformula_cmpd_prop { = } { \chemformula_double_bond: }
-\prop_put:Nnn \l__chemformula_cmpd_prop { + } { \chemformula_triple_bond: }
-\prop_put:Nnn \l__chemformula_cmpd_prop { ' } { \chemformula_prime: }
+% compounds:
+\cs_new_protected:Npn \chemformula_new_compound_property:nn #1#2
+ { \prop_put_if_new:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
+
+\cs_new_protected:Npn \chemformula_renew_compound_property:nn #1#2
+ {
+ \prop_if_in:NnT \l__chemformula_cmpd_prop {#1}
+ { \prop_put:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
+ }
+
+\cs_new_protected:Npn \chemformula_declare_compound_property:nn #1#2
+ { \prop_put:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
+
+\cs_new_protected:Npn \chemformula_remove_compound_property:n #1
+ { \prop_remove:Nn \l__chemformula_cmpd_prop {#1} }
+
+\NewDocumentCommand \NewChemCompoundProperty { mm }
+ { \chemformula_new_compound_property:nn {#1} {#2} }
+
+\NewDocumentCommand \RenewChemCompoundProperty { mm }
+ { \chemformula_renew_compound_property:nn {#1} {#2} }
+
+\NewDocumentCommand \DeclareChemCompoundProperty { mm }
+ { \chemformula_declare_compound_property:nn {#1} {#2} }
+
+\NewDocumentCommand \RemoveChemCompoundProperty { m}
+ { \chemformula_remove_compound_property:n {#1} }
+
+\chemformula_new_compound_property:nn { 0 } { \chemformula_subscript:n { 0 } }
+\chemformula_new_compound_property:nn { 1 } { \chemformula_subscript:n { 1 } }
+\chemformula_new_compound_property:nn { 2 } { \chemformula_subscript:n { 2 } }
+\chemformula_new_compound_property:nn { 3 } { \chemformula_subscript:n { 3 } }
+\chemformula_new_compound_property:nn { 4 } { \chemformula_subscript:n { 4 } }
+\chemformula_new_compound_property:nn { 5 } { \chemformula_subscript:n { 5 } }
+\chemformula_new_compound_property:nn { 6 } { \chemformula_subscript:n { 6 } }
+\chemformula_new_compound_property:nn { 7 } { \chemformula_subscript:n { 7 } }
+\chemformula_new_compound_property:nn { 8 } { \chemformula_subscript:n { 8 } }
+\chemformula_new_compound_property:nn { 9 } { \chemformula_subscript:n { 9 } }
+\chemformula_new_compound_property:nn { * } { \chemformula_star_adduct: }
+\chemformula_new_compound_property:nn { . } { \chemformula_adduct: }
+\chemformula_new_compound_property:nn { - } { \chemformula_single_bond: }
+\chemformula_new_compound_property:nn { = } { \chemformula_double_bond: }
+\chemformula_new_compound_property:nn { + } { \chemformula_triple_bond: }
+\chemformula_new_compound_property:nn { ' } { \chemformula_prime: }
% numbers
\prop_put:Nnn \l__chemformula_numbers_prop { 0 } { 0 }
@@ -1975,24 +2000,26 @@
{
\bool_set_true:N \l__chemformula_stoich_bool
% the factor consists only of a parenthesis or a decimal marcer:
- \bool_set_true:N \l__chemformula_no_stoich_bool
+ % \bool_set_true:N \l__chemformula_no_stoich_bool
+ % \tl_map_inline:nn { #1 }
+ % {
+ % \prop_if_in:NnF \l__chemformula_no_stoich_prop { ##1 }
+ % { \bool_set_false:N \l__chemformula_no_stoich_bool }
+ % }
+ % \bool_if:NF \l__chemformula_no_stoich_bool
+ % {
\tl_map_inline:nn { #1 }
{
- \prop_get:NnNF \l__chemformula_no_stoich_prop { ##1 } \l__chemformula_tmpa_tl
- { \bool_set_false:N \l__chemformula_no_stoich_bool }
- }
- \bool_if:NF \l__chemformula_no_stoich_bool
- {
- \tl_map_inline:nn { #1 }
+ \prop_get:NnNTF \l__chemformula_stoich_prop { ##1 } \l__chemformula_tmpa_tl
{
- \prop_get:NnNTF \l__chemformula_stoich_prop { ##1 } \l__chemformula_tmpa_tl
- {
- \bool_if:NT \l__chemformula_stoich_bool
- { \tl_put_right:NV \l__chemformula_stoich_tl \l__chemformula_tmpa_tl }
- }
- { \bool_set_false:N \l__chemformula_stoich_bool }
+ % \bool_if:NT \l__chemformula_stoich_bool
+ % {
+ \tl_put_right:NV \l__chemformula_stoich_tl \l__chemformula_tmpa_tl
+ % }
}
+ { \bool_set_false:N \l__chemformula_stoich_bool }
}
+ % }
\bool_if:NTF \l__chemformula_stoich_bool
{
\tl_if_blank:VF \l__chemformula_stoich_tl
@@ -3122,6 +3149,10 @@ VERSION HISTORY
package
2014/10/07 - version 4.9 - new options: `minus-space', `minus-penalty',
`plus-output-symbol' and `minus-output-symbol'
+2015/03/16 - version 4.10 - new macros \NewChemCompoundProperty,
+ \RenewChemCompoundProperty,
+ \DeclareChemCompoundProperty,
+ \RemoveChemCompoundProperty
% --------------------------------------------------------------------------
% TODO