summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemformula.sty')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemformula.sty83
1 files changed, 60 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
index cbf29837ede..3774338595f 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
@@ -27,8 +27,8 @@
% --------------------------------------------------------------------------
\RequirePackage{ expl3 , xparse , l3keys2e , tikz , amsmath , xfrac , nicefrac , scrlfile }
\usetikzlibrary{arrows}
-\def\chemformula@version{4.3}
-\def\chemformula@date{2014/01/24}
+\def\chemformula@version{4.4}
+\def\chemformula@date{2014/01/29}
\ProvidesExplPackage
{chemformula}
@@ -433,14 +433,14 @@
\ooalign
{
\tex_hfil:D
- $
+ \c_math_toggle_token
#1
\chemformula_plain_plus:
- $
+ \c_math_toggle_token
\tex_hfil:D
\tex_cr:D
\tex_hfil:D
- $#1#2$
+ \c_math_toggle_token #1#2 \c_math_toggle_token
\tex_hfil:D
\tex_cr:D
}
@@ -457,14 +457,14 @@
\ooalign
{
\tex_hfil:D
- $
+ \c_math_toggle_token
#1
\chemformula_plain_minus:
- $
+ \c_math_toggle_token
\tex_hfil:D
\tex_cr:D
\tex_hfil:D
- $#1#2$
+ \c_math_toggle_token #1#2 \c_math_toggle_token
\tex_hfil:D
\tex_cr:D
}
@@ -495,7 +495,11 @@
{
\bool_if:NTF \l__chemformula_formal_chem_bool
{ \chemformula_fplus: }
- { \mode_if_math:TF { \oplus } { \( \oplus \) } }
+ {
+ \mode_if_math:TF
+ { \oplus }
+ { \c_math_toggle_token \oplus \c_math_toggle_token }
+ }
}
{ \chemformula_plain_plus: }
}
@@ -513,7 +517,11 @@
{
\bool_if:NTF \l__chemformula_formal_chem_bool
{ \chemformula_fminus: }
- { \mode_if_math:TF { \ominus } { \( \ominus \) } }
+ {
+ \mode_if_math:TF
+ { \ominus }
+ { \c_math_toggle_token \ominus \c_math_toggle_token }
+ }
}
{ \chemformula_plain_minus: }
}
@@ -1060,7 +1068,7 @@
{
% \group_begin:
% \__chemformula_reset:Nn \l__chemformula_tmpa_tl { #1 }
- \(
+ \c_math_toggle_token
\underset
{
\bool_if:NF \l__chemformula_name_width_bool
@@ -1073,7 +1081,7 @@
{ \l__chemformula_name_format_tl #1 }
}
{ \text { \strut #2 } }
- \)
+ \c_math_toggle_token
% \group_end:
}
@@ -1423,7 +1431,7 @@
\cs_new_protected:Npn \__chemformula_subscript_raise:N #1
{
\hbox_set:Nn \l__chemformula_tmpa_box
- { \(\scriptstyle Hg\) }
+ { \c_math_toggle_token \scriptstyle Hg \c_math_toggle_token }
\hbox_set:Nn \l__chemformula_tmpb_box { Hg }
\dim_set:Nn #1
{
@@ -1442,13 +1450,13 @@
\__chemformula_subscript_raise:N \l__chemformula_subscript_shift_dim
\hbox:n
{
- \(
+ \c_math_toggle_token
\scriptstyle
\prop_get:NoNTF \l__chemformula_numbers_prop
{ #1 } \l__chemformula_tmpa_tl
{ \__chemformula_number_style:V \l__chemformula_tmpa_tl }
{ \__chemformula_number_style:n { #1 } }
- \)
+ \c_math_toggle_token
}
\group_end:
}
@@ -1522,7 +1530,7 @@
\cs_new_protected:Npn \__chemformula_superscript_raise:N #1
{
\hbox_set:Nn \l__chemformula_tmpa_box
- { \(\scriptstyle Hg\) }
+ { \c_math_toggle_token \scriptstyle Hg \c_math_toggle_token }
\hbox_set:Nn \l__chemformula_tmpb_box { Hg }
\dim_set:Nn #1
{
@@ -1541,13 +1549,13 @@
\__chemformula_superscript_raise:N \l__chemformula_superscript_shift_dim
\hbox:n
{
- \(
+ \c_math_toggle_token
\scriptstyle
\prop_get:NoNTF \l__chemformula_charge_prop
{ #1 } \l__chemformula_tmpa_tl
{ \tl_use:N \l__chemformula_tmpa_tl }
{ \chemformula_charge_style:n { #1 } }
- \)
+ \c_math_toggle_token
}
\group_end:
}
@@ -1820,7 +1828,11 @@
\bool_if:NT \l__chemformula_nicefrac_bool
{ \nicefrac{#1}{#2} }
\bool_if:NT \l__chemformula_mathfrac_bool
- { \( \chemformula_math_frac:nn { \text { #1 } } { \text { #2 } } \) }
+ {
+ \c_math_toggle_token
+ \chemformula_math_frac:nn { \text { #1 } } { \text { #2 } }
+ \c_math_toggle_token
+ }
}
\cs_new:Npn \__chemformula_misc_frac:nnn #1#2#3
@@ -1830,7 +1842,12 @@
\bool_if:NT \l__chemformula_nicefrac_bool
{ #1\nicefrac{#2}{#3} }
\bool_if:NT \l__chemformula_mathfrac_bool
- { #1 \( \chemformula_math_frac:nn { \text { #2 } } { \text { #3 } } \) }
+ {
+ #1
+ \c_math_toggle_token
+ \chemformula_math_frac:nn { \text { #2 } } { \text { #3 } }
+ \c_math_toggle_token
+ }
}
% --------------------------------------------------------------------------
@@ -1841,6 +1858,8 @@
{
\tl_if_eq:nnT { #1 } { + }
{ \bool_set_true:N \l__chemformula_is_plus_bool }
+ \tl_if_eq:nnT { #1 } { - }
+ { \bool_set_true:N \l__chemformula_is_plus_bool }
\tl_if_eq:nnT { #1 } { v }
{ \bool_set_true:N \l__chemformula_is_down_bool }
\tl_if_eq:nnT { #1 } { ^ }
@@ -2060,6 +2079,17 @@
{ \l__chemformula_plus_penalty_tl }
}
}
+ \tl_if_eq:nnT { #1 } { - }
+ {
+ \tl_put_right:Nn \l__chemformula_input_tl
+ {
+ \chemformula_skip_nobreak:N \l__chemformula_plus_space_skip
+ \c_math_toggle_token - \c_math_toggle_token
+ \chemformula_skip_nobreak_penalty:Nn
+ \l__chemformula_plus_space_skip
+ { \l__chemformula_plus_penalty_tl }
+ }
+ }
\bool_set_false:N \l__chemformula_is_plus_bool
}
@@ -2079,7 +2109,10 @@
{
\tl_gclear:N \g__chemformula_input_up_tl
\tl_if_eq:nnT { #1 } { ^ }
- { \tl_gset:Nn \g__chemformula_input_up_tl { \(\uparrow\) } }
+ {
+ \tl_gset:Nn \g__chemformula_input_up_tl
+ { \c_math_toggle_token \uparrow \c_math_toggle_token }
+ }
\group_end:
\tl_put_right:NV \l__chemformula_input_tl \g__chemformula_input_up_tl
\bool_set_false:N \l__chemformula_is_up_bool
@@ -2091,7 +2124,10 @@
\cs_new_protected:Npn \chemformula_input_down:n #1
{
\tl_if_eq:nnT { #1 } { v }
- { \tl_put_right:Nn \l__chemformula_input_tl { \(\downarrow\) } }
+ {
+ \tl_put_right:Nn \l__chemformula_input_tl
+ { \c_math_toggle_token \downarrow \c_math_toggle_token }
+ }
\bool_set_false:N \l__chemformula_is_down_bool
}
@@ -2237,7 +2273,7 @@
\char_set_catcode_letter:N \_
\char_set_catcode_letter:N \:
}
- { \( #1 \) }
+ { \c_math_toggle_token #1 \c_math_toggle_token }
\tl_replace_all:Nnn \l__chemformula_tmpa_tl
{ \_ } { chemformulaplaceholder }
\tl_replace_all:Nnn \l__chemformula_tmpa_tl
@@ -2740,6 +2776,7 @@ VERSION HISTORY
for definitions
- new option stoich-print
- new command \chstoich
+2014/01/29 - version 4.4 - treat a single `-' as a minus sign
% --------------------------------------------------------------------------
% TODO