summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-01-29 22:39:05 +0000
committerKarl Berry <karl@freefriends.org>2014-01-29 22:39:05 +0000
commit6d56f935e68d3edbe7afc8613d516999443019fb (patch)
tree48ca7bbde8aba3a5440b7004a9b558ec16d0f6ad /Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
parent8e2a55a7bd017271f6e865ccf545c1c810e75c7d (diff)
chemmacros (29jan14)
git-svn-id: svn://tug.org/texlive/trunk@32817 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty148
1 files changed, 114 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index fd13bbf4440..5c95c03bf23 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
@@ -26,8 +26,8 @@
% - The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
\RequirePackage{ expl3 , xparse , l3keys2e }
-\def\chemmacros@version{4.3}
-\def\chemmacros@date{2014/01/24}
+\def\chemmacros@version{4.4}
+\def\chemmacros@date{2014/01/29}
\ProvidesExplPackage
{chemmacros}
@@ -836,7 +836,7 @@
{
\mbox {
\l__chemmacros_partial_charge_format_tl
- \( \delta \chemmacros_minus: \)
+ \c_math_toggle_token \delta \chemmacros_minus: \c_math_toggle_token
}
\chemmacros_xspace:
}
@@ -844,7 +844,7 @@
{
\mbox {
\l__chemmacros_partial_charge_format_tl
- \( \delta \chemmacros_plus: \)
+ \c_math_toggle_token \delta \chemmacros_plus: \c_math_toggle_token
}
\chemmacros_xspace:
}
@@ -852,7 +852,7 @@
{
\mbox {
\l__chemmacros_partial_charge_format_tl
- \( \delta \chemmacros_formal_minus: \)
+ \c_math_toggle_token \delta \chemmacros_formal_minus: \c_math_toggle_token
}
\chemmacros_xspace:
}
@@ -860,7 +860,7 @@
{
\mbox {
\l__chemmacros_partial_charge_format_tl
- \( \delta \chemmacros_formal_plus: \)
+ \c_math_toggle_token \delta \chemmacros_formal_plus: \c_math_toggle_token
}
\chemmacros_xspace:
}
@@ -1544,43 +1544,75 @@
type / .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {N} } \) }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {N} }
+ \c_math_toggle_token
+ }
{ }
} ,
type / 1 .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {N} } \) 1 }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {N} }
+ \c_math_toggle_token
+ 1
+ }
{ }
} ,
type / 2 .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {N} } \) 2 }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {N} }
+ \c_math_toggle_token
+ 2
+ }
{ }
} ,
type / se .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {E} } \) }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {E} }
+ \c_math_toggle_token
+ }
{ }
} ,
type / 1e .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {E} } \) 1 }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {E} }
+ \c_math_toggle_token
+ 1
+ }
{ }
} ,
type / 2e .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {E} } \) 2 }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {E} }
+ \c_math_toggle_token
+ 2
+ }
{ }
} ,
type / ar .code:n =
{
\__chemmacros_set_mech:nnn { S }
- { \( \c_math_subscript_token { \text {E} } \) }
+ {
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {E} }
+ \c_math_toggle_token
+ }
{ Ar - }
} ,
type / e .code:n =
@@ -1592,7 +1624,12 @@
type / cb .code:n =
{
\__chemmacros_set_mech:nnn { E }
- { 1 \( \c_math_subscript_token { \text {cb} } \) }
+ {
+ 1
+ \c_math_toggle_token
+ \c_math_subscript_token { \text {cb} }
+ \c_math_toggle_token
+ }
{ }
} ,
type .default:n =
@@ -1681,11 +1718,17 @@
\cs_new_protected:Npn \__chemmacros_ox_sign:n #1
{
\fp_compare:nNnT { #1 } > { 0 }
- { \bool_if:NT \l__chemmacros_ox_explicit_sign_bool { $+$ } }
+ {
+ \bool_if:NT \l__chemmacros_ox_explicit_sign_bool
+ { \c_math_toggle_token + \c_math_toggle_token }
+ }
\fp_compare:nNnT { #1 } = { 0 }
- { \bool_if:NT \l__chemmacros_ox_explicit_sign_bool { $\pm$ } }
+ {
+ \bool_if:NT \l__chemmacros_ox_explicit_sign_bool
+ { \c_math_toggle_token \pm \c_math_toggle_token }
+ }
\fp_compare:nNnT { #1 } < { 0 }
- { $-$ }
+ { \c_math_toggle_token - \c_math_toggle_token }
}
\cs_new_protected:Npn \__chemmacros_ox_value:n #1
@@ -1696,8 +1739,16 @@
{ \__chemmacros_fp_to_Roman:V \l__chemmacros_ox_number_fp }
{
\bool_if:NTF \l__chemmacros_ox_integer_bool
- { $ \__chemmacros_fp_to_arabic:V \l__chemmacros_ox_number_fp $ }
- { $ \__chemmacros_fp_show:V \l__chemmacros_ox_number_fp $ }
+ {
+ \c_math_toggle_token
+ \__chemmacros_fp_to_arabic:V \l__chemmacros_ox_number_fp
+ \c_math_toggle_token
+ }
+ {
+ \c_math_toggle_token
+ \__chemmacros_fp_show:V \l__chemmacros_ox_number_fp
+ \c_math_toggle_token
+ }
}
}
@@ -1768,7 +1819,10 @@
\chemmacros_text:n
{
#2
- $ ^ { \text { \tiny \__chemmacros_ox_process_number:n { #1 } } } $
+ \c_math_toggle_token
+ \c_math_superscript_token
+ { \text { \tiny \__chemmacros_ox_process_number:n { #1 } } }
+ \c_math_toggle_token
}
}
\bool_if:NT \l__chemmacros_ox_side_bool
@@ -1998,7 +2052,7 @@
\tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_post_tl { ) }
\tl_new:N \l__chemmacros_nmr_coupling_bonds_tl
\tl_new:N \l__chemmacros_nmr_coupling_bonds_pre_tl
-\tl_set:Nn \l__chemmacros_nmr_coupling_bonds_pre_tl { ( }
+\tl_set:Nn \l__chemmacros_nmr_coupling_bonds_pre_tl { }
\tl_set:Nn \l__chemmacros_nmr_coupling_bonds_post_tl { \! }
\tl_new:N \l__chemmacros_nmr_coupling_symbol_tl
\tl_set:Nn \l__chemmacros_nmr_coupling_symbol_tl { J }
@@ -2087,6 +2141,9 @@
\cs_new_protected:Npn \__chemmacros_nmr_frequency_aux_ii:n #1
{ \SI { #1 } { \tl_use:N \l__chemmacros_nmr_unit_tl } }
+\cs_new_eq:NN \__chemmacros_nmr_number:n \use:n
+\cs_new_eq:NN \__chemmacros_nmr_position:n \use:n
+
\keys_define:nn { chemmacros / nmr }
{
unit .tl_set:N = \l__chemmacros_nmr_unit_tl ,
@@ -2121,6 +2178,10 @@
\l__chemmacros_nmr_coupling_bonds_post_tl ,
coupling-symbol .tl_set:N =
\l__chemmacros_nmr_coupling_symbol_tl ,
+ atom-number-cs .code:n =
+ \cs_set_eq:NN \__chemmacros_nmr_number:n #1 ,
+ coupling-pos-cs .code:n =
+ \cs_set_eq:NN \__chemmacros_nmr_position:n #1 ,
parse .bool_set:N = \l__chemmacros_nmr_parse_bool ,
delta .code:n =
\tl_set:Nn \l__chemmacros_nmr_delta_tl { \, #1 } ,
@@ -2284,7 +2345,10 @@
\group_end:
\tl_if_blank:nT { #1 }
{
- \tl_use:N \c_space_tl $ \delta $
+ \tl_use:N \c_space_tl
+ \c_math_toggle_token
+ \delta
+ \c_math_toggle_token
\l__chemmacros_nmr_delta_tl
\bool_if:NT \l__chemmacros_nmr_use_equal_bool { ~ = }
}
@@ -2337,7 +2401,10 @@
}
\cs_new_protected:Npn \chemmacros_nmr_number:n #1
- { #1 \, \chemmacros_atom:V \g__chemmacros_nmr_element_tl }
+ {
+ \__chemmacros_nmr_number:n { #1 } \,
+ \chemmacros_atom:V \g__chemmacros_nmr_element_tl
+ }
\cs_new_protected:Npn \chemmacros_nmr_position:n #1
{
@@ -2351,7 +2418,10 @@
}
}
\bool_if:NT \l__chemmacros_nmr_position_side_bool
- { \tl_use:N \l__chemmacros_nmr_position_tl #1 }
+ {
+ \tl_use:N \l__chemmacros_nmr_position_tl
+ \__chemmacros_nmr_position:n { #1 }
+ }
}
\cs_new_protected:Npn \chemmacros_nmr_coupling:w
@@ -2406,11 +2476,11 @@
list-pair-separator={,~},
list-units=single
}
- \(
+ \c_math_toggle_token
^{ \l__chemmacros_nmr_coupling_bonds_tl }
\l__chemmacros_nmr_coupling_symbol_tl
\l__chemmacros_nmr_coupling_nuclei_tl = \SIlist{#2}{#1}
- \)
+ \c_math_toggle_token
\group_end:
}
@@ -2423,11 +2493,12 @@
list-pair-separator={,~},
list-units=single
}
- \(
- ^{ \l__chemmacros_nmr_coupling_bonds_tl } J
+ \c_math_toggle_token
+ ^{ \l__chemmacros_nmr_coupling_bonds_tl }
+ \l__chemmacros_nmr_coupling_symbol_tl
\l__chemmacros_nmr_coupling_nuclei_tl
= \exp_args:Nno \SIlist { #1 } { \l__chemmacros_nmr_coupling_unit_tl }
- \)
+ \c_math_toggle_token
\group_end:
}
@@ -2458,7 +2529,8 @@
{ \chemmacros_remove_backslash:N #1 }
\cs_if_free:NF #1
{ \msg_error:nnn { chemmacros } { new-phase } { #1 } }
- \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 }
+ \exp_args:Nx \DeclareTranslationFallback
+ { phase-\l__chemmacros_tmpa_tl } { #2 }
\__chemmacros_define_phase:Nx #1
{
\exp_not:N \chemmacros_translate:n
@@ -2470,7 +2542,8 @@
{
\tl_set:Nx \l__chemmacros_tmpa_tl
{ \chemmacros_remove_backslash:N #1 }
- \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 }
+ \exp_args:Nx \DeclareTranslationFallback
+ { phase-\l__chemmacros_tmpa_tl } { #2 }
\__chemmacros_define_phase:Nx #1
{
\exp_not:N \chemmacros_translate:n
@@ -2484,7 +2557,8 @@
{ \chemmacros_remove_backslash:N #1 }
\cs_if_free:NT #1
{ \msg_error:nnn { chemmacros } { renew-phase } { #1 } }
- \DeclareTranslationFallback { phase-\l__chemmacros_tmpa_tl } { #2 }
+ \exp_args:Nx \DeclareTranslationFallback
+ { phase-\l__chemmacros_tmpa_tl } { #2 }
\__chemmacros_define_phase:Nx #1
{
\exp_not:N \chemmacros_translate:n
@@ -2503,6 +2577,7 @@
\cs_new_protected:Npn \__chemmacros_define_phase:Nn #1#2
{
+ \cs_if_free:NT #1 { \cs_new:Npn #1 {} }
\cs_set_protected:Npn #1
{
\bool_if:NTF \l__chemmacros_phases_sub_bool
@@ -2761,11 +2836,11 @@
\ooalign
{
\tex_hfil:D
- $#1-$
+ \c_math_toggle_token #1- \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
}
@@ -4211,6 +4286,11 @@ Version history
backwards compatibility for version 1 has been
dropped
- drop command \mhName
+2014/01/29 - version 4.4 - bug fix in the display of the coupling constant
+ - bug fix in phase definitions (need to adapt to
+ changes in `translations'
+ - new option `nmr/atom-number-cs'
+ - new option `nmr/coupling-pos-cs'
% --------------------------------------------------------------------------- %
% TODO: