diff options
author | Karl Berry <karl@freefriends.org> | 2012-09-11 23:05:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-09-11 23:05:31 +0000 |
commit | 4ccf8917dd7207bd3f86aae8bc3531661080bc23 (patch) | |
tree | c4e1e811422d5a0542cbc2d2b41dabed68c591a2 /Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | |
parent | 143da46fa7d10716180d8883ac3eef1d7b758992 (diff) |
chemmacros (11sep12)
git-svn-id: svn://tug.org/texlive/trunk@27649 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.sty | 116 |
1 files changed, 70 insertions, 46 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index d1cbaf00c3a..3baaced86cc 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -29,8 +29,8 @@ \RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx } \RequirePackage{ tikz , mathtools , environ , scrlfile , etoolbox , bm } \usetikzlibrary{calc,arrows} -\def\chemmacros@version{3.3e} -\def\chemmacros@date{2012/08/21} +\def\chemmacros@version{3.4} +\def\chemmacros@date{2012/09/11} \ProvidesExplPackage {chemmacros} @@ -264,6 +264,12 @@ } % --------------------------------------------------------------------------- % +% scratch variables +\tl_new:N \l_chemmacros_tmpa_tl +\tl_new:N \l_chemmacros_tmpb_tl +\int_new:N \l_chemmacros_tmpa_int + +% --------------------------------------------------------------------------- % % package options % bpchem => use \IUPAC inside for \NMR command % circled => circle charges @@ -293,7 +299,7 @@ \tl_new:N \l_chemmacros_current_language_tl \tl_set:Nn \l_chemmacros_current_language_tl { english } -\cs_new:Nn \chemmacros_inner_font: {} +\cs_new:Npn \chemmacros_inner_font: {} \keys_define:nn { chemmacros / option } { @@ -673,13 +679,13 @@ } \cs_generate_variant:Nn \chemmacros_atom:n { o,f,x,V } -\cs_new:Nn \chemmacros_text:n +\cs_new:Npn \chemmacros_text:n #1 { \mode_if_math:TF { \text { #1 } } { #1 } } % add a possibility to let chemformula use the chemformula % with method=chemformula, too \tl_new:N \l_chemmacros_chemformula_tl -\cs_new:Nn \chemmacros_chemformula:n +\cs_new:Npn \chemmacros_chemformula:n #1 { \bool_if:NTF \l_chemmacros_use_mhchem_bool { \ce { #1 } } @@ -753,10 +759,10 @@ { \group_begin: \chemformula_input:n { #2 } - \tl_set_rescan:Nno \l_tmpa_tl + \tl_set_rescan:Nno \l_chemmacros_tmpa_tl { \ExplSyntaxOn } { \l_chemformula_input_tl } - \chemformula_write:V \l_tmpa_tl + \chemformula_write:V \l_chemmacros_tmpa_tl \group_end: \chemmacros_xspace: } @@ -975,20 +981,20 @@ \NewDocumentCommand \DeclareChemIUPAC { mm } { - \tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } - \tl_set:Nf \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } - \prop_if_in:NoTF \l_chemmacros_iupac_prop { \l_tmpa_tl } + \tl_set_rescan:Nnn \l_chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } + \tl_set:Nf \l_chemmacros_tmpa_tl { \tl_tail:V \l_chemmacros_tmpa_tl } + \prop_if_in:NoTF \l_chemmacros_iupac_prop { \l_chemmacros_tmpa_tl } { \chemmacros_msg:nnxx { chemmacros } { declare-iupac } { #1 } { } } - { \prop_put:Non \l_chemmacros_iupac_prop { \l_tmpa_tl } { #2 } } + { \prop_put:Non \l_chemmacros_iupac_prop { \l_chemmacros_tmpa_tl } { #2 } } \chemmacros_make_iupac: } \NewDocumentCommand \RenewChemIUPAC { mm } { - \tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } - \tl_set:Nf \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } - \prop_if_in:NoTF \l_chemmacros_iupac_prop { \l_tmpa_tl } - { \prop_put:Non \l_chemmacros_iupac_prop { \l_tmpa_tl } { #2 } } + \tl_set_rescan:Nnn \l_chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } + \tl_set:Nf \l_chemmacros_tmpa_tl { \tl_tail:V \l_chemmacros_tmpa_tl } + \prop_if_in:NoTF \l_chemmacros_iupac_prop { \l_chemmacros_tmpa_tl } + { \prop_put:Non \l_chemmacros_iupac_prop { \l_chemmacros_tmpa_tl } { #2 } } { \chemmacros_msg:nnxx { chemmacros } { renew-iupac } { #1 } { } } \chemmacros_make_iupac: } @@ -1567,11 +1573,11 @@ \cs_new_nopar:Npn \chemmacros_ox_is_integer:n #1 { - \fp_set:Nn \l_tmpa_tl { #1 } - \fp_add:Nn \l_tmpa_tl { 1 } - \fp_round_places:Nn \l_tmpa_tl { 0 } - \fp_sub:Nn \l_tmpa_tl { 1 } - \fp_compare:nNnTF { \l_tmpa_tl } = { #1 } + \fp_set:Nn \l_chemmacros_tmpa_tl { #1 } + \fp_add:Nn \l_chemmacros_tmpa_tl { 1 } + \fp_round_places:Nn \l_chemmacros_tmpa_tl { 0 } + \fp_sub:Nn \l_chemmacros_tmpa_tl { 1 } + \fp_compare:nNnTF { \l_chemmacros_tmpa_tl } = { #1 } { \bool_set_true:N \l_chemmacros_ox_integer_bool } { \bool_set_false:N \l_chemmacros_ox_integer_bool @@ -1583,12 +1589,12 @@ \cs_new_nopar:Npn \chemmacros_fp_to_Roman:n #1 { \group_begin: - \fp_set:Nn \l_tmpa_tl { #1 } - \fp_round_places:Nn \l_tmpa_tl { 0 } - \int_set:Nn \l_tmpa_int { \fp_to_tl:N \l_tmpa_tl } - \int_compare:nTF { \l_tmpa_int = 0 } + \fp_set:Nn \l_chemmacros_tmpa_tl { #1 } + \fp_round_places:Nn \l_chemmacros_tmpa_tl { 0 } + \int_set:Nn \l_chemmacros_tmpa_int { \fp_to_tl:N \l_chemmacros_tmpa_tl } + \int_compare:nTF { \l_chemmacros_tmpa_int = 0 } { 0 } - { \int_to_Roman:n { \int_use:N \l_tmpa_int } } + { \int_to_Roman:n { \int_use:N \l_chemmacros_tmpa_int } } \group_end: } \cs_generate_variant:Nn \chemmacros_fp_to_Roman:n { N } @@ -1596,8 +1602,8 @@ \cs_new_nopar:Npn \chemmacros_fp_to_arabic:n #1 { \group_begin: - \fp_set:Nn \l_tmpa_tl { #1 } - \fp_to_tl:N \l_tmpa_tl + \fp_set:Nn \l_chemmacros_tmpa_tl { #1 } + \fp_to_tl:N \l_chemmacros_tmpa_tl \group_end: } \cs_generate_variant:Nn \chemmacros_fp_to_arabic:n { N } @@ -1605,14 +1611,14 @@ \cs_new_nopar:Npn \chemmacros_fp_show:n #1 { \group_begin: - \fp_set:Nn \l_tmpa_tl { #1 } + \fp_set:Nn \l_chemmacros_tmpa_tl { #1 } \bool_if:NTF \l_chemmacros_ox_decimal_marker_comma_bool { - \tl_set:Nx \l_tmpb_tl { \fp_to_tl:N \l_tmpa_tl } - \tl_replace_once:Nnn \l_tmpb_tl { . } { {,} } - \tl_use:N \l_tmpb_tl + \tl_set:Nx \l_chemmacros_tmpb_tl { \fp_to_tl:N \l_chemmacros_tmpa_tl } + \tl_replace_once:Nnn \l_chemmacros_tmpb_tl { . } { {,} } + \tl_use:N \l_chemmacros_tmpb_tl } - { \fp_to_tl:N \l_tmpa_tl } + { \fp_to_tl:N \l_chemmacros_tmpa_tl } \group_end: } \cs_generate_variant:Nn \chemmacros_fp_show:n { N } @@ -2296,28 +2302,28 @@ \NewDocumentCommand \DeclareChemPhase { mom } { - \tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } - \tl_set:Nf \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } + \tl_set_rescan:Nnn \l_chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } + \tl_set:Nf \l_chemmacros_tmpa_tl { \tl_tail:V \l_chemmacros_tmpa_tl } \cs_if_free:NTF #1 { \cs_new_nopar:Npn #1 {} } { \chemmacros_msg:nnxx { chemmacros } { declare-phase } { #1 } {} } \IfNoValueTF { #2 } - { \prop_put:Non \l_chemmacros_phases_german_prop { \l_tmpa_tl } { #3 } } - { \prop_put:Non \l_chemmacros_phases_german_prop { \l_tmpa_tl } { #2 } } - \prop_put:Non \l_chemmacros_phases_prop { \l_tmpa_tl } { #3 } + { \prop_put:Non \l_chemmacros_phases_german_prop { \l_chemmacros_tmpa_tl } { #3 } } + { \prop_put:Non \l_chemmacros_phases_german_prop { \l_chemmacros_tmpa_tl } { #2 } } + \prop_put:Non \l_chemmacros_phases_prop { \l_chemmacros_tmpa_tl } { #3 } \chemmacros_make_phases: } \NewDocumentCommand \RenewChemPhase { mom } { - \tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } - \tl_set:Nf \l_tmpa_tl { \tl_tail:V \l_tmpa_tl } + \tl_set_rescan:Nnn \l_chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } + \tl_set:Nf \l_chemmacros_tmpa_tl { \tl_tail:V \l_chemmacros_tmpa_tl } \cs_if_free:NT #1 { \chemmacros_msg:nnxx { chemmacros } { renew-phase } { #1 } {} } \IfNoValueTF { #2 } - { \prop_put:Non \l_chemmacros_phases_german_prop { \l_tmpa_tl } { #3 } } - { \prop_put:Non \l_chemmacros_phases_german_prop { \l_tmpa_tl } { #2 } } - \prop_put:Non \l_chemmacros_phases_prop { \l_tmpa_tl } { #3 } + { \prop_put:Non \l_chemmacros_phases_german_prop { \l_chemmacros_tmpa_tl } { #3 } } + { \prop_put:Non \l_chemmacros_phases_german_prop { \l_chemmacros_tmpa_tl } { #2 } } + \prop_put:Non \l_chemmacros_phases_prop { \l_chemmacros_tmpa_tl } { #3 } \chemmacros_make_phases: } @@ -3813,6 +3819,7 @@ Version history \phase - changed default behaviour of phases - removed optional argument from \sld and \lqd + - new arrow type <> 2012/02/19 - version 3.1 - new commands \DeclareChemIUPAC and \RenewChemIUPAC - new option "option/iupac" - deprecated option: "option/EZ" @@ -3824,17 +3831,27 @@ Version history \Scip => \S \Dfi => \D \Lfi => \L - - new arrow types in the chemformula package + - new arrow types -/>, </- and <o> + - new commands \DeclareChemArrow, \RenewChemArrow and + \ShowChemArrow 2012/02/26 - version 3.1a - "operator" p rewritten to follow IUPAC recommendations - new option "acid-base/p-style" - deprecated option: "option/detect-bold" -2012/03/03 - version 3.1b - changes in the chemformula package +2012/03/03 - version 3.1b - arrow types are stored in a sequence to automate the + search and replace in the right order + - new arrow type == + - IUPAC compliance for stoichiometric factors + - new handling of super- and subscripts to correct + various flaws: clear distinction between isotope and + formula + - new option charge-vshift - IUPAC compliance for \Delta and \ox 2012/03/14 - version 3.1c - compatibility with KOMA's global option "version = <value>" - bugfix in the list of reactions -2012/03/20 - version 3.2 - new feature in chemformula + - improved arrow labels +2012/03/20 - version 3.2 - new: option input via @{<options>} - improved list of reactions: resetting the "reaction" counter now doesn't cause errors any more - \AddRxnDesc added which allows to add descriptions @@ -3843,7 +3860,7 @@ Version history formatting for the for displaying of measurement results - more greek letters for the \iupac command - - new features in chemformula.sty + - \ch now bypasses \ref{}, \label{}, and \intertext{} - small adjustments of the iupac commands \| and \- - bug fix: option `upgreek' is now working and was renamed to `greek' @@ -3861,6 +3878,13 @@ Version history options 2012/08/21 - version 3.3e - new option ox/align=center|right - a new option to \NMR and to \J +2012/09/11 - version 3.4 - cleaned a little, minor bug fixes + - switched to internal scratch variables + - new command \bond, more bond types + - new commands \DeclareChemBond, \DeclareChemBondAlias, + \RenewChemBond and \ShowChemBond + - radical point thicker, new options `radical-style' + and `radical-radius' % --------------------------------------------------------------------------- % % TODO: |