diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-28 00:37:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-28 00:37:53 +0000 |
commit | 5b656ca29f2da2b3ded1530084c6409a97b3a57b (patch) | |
tree | 1d1ace615f7e8e767334d61724eff31be4e44c62 /Master/texmf-dist/tex/latex | |
parent | 4630e350a1b3dd21fb202645f1cbc37f2d04982a (diff) |
chemmacros (26feb12)
git-svn-id: svn://tug.org/texlive/trunk@25521 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 185 |
1 files changed, 71 insertions, 114 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 01888f2ff44..9f0569be67f 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -5,7 +5,7 @@ % - macros and commands for chemists - % % --------------------------------------------------------------------------- % % - Clemens Niederberger - % -% - 2012/02/19 - % +% - 2012/02/26 - % % --------------------------------------------------------------------------- % % - https://bitbucket.org/cgnieder/chemmacros/ - % % - contact@mychemistry.eu - % @@ -33,8 +33,8 @@ \ProvidesExplPackage {chemmacros} - {2012/02/19} - {3.1} + {2012/02/26} + {3.1a} {macros and commands for chemists} \@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } } @@ -98,7 +98,7 @@ \bool_new:N \l_chemmacros_strict_bool \bool_new:N \l_chemmacros_detect_bold_bool -\bool_set_false:N \l_chemmacros_detect_bold_bool +\bool_set_true:N \l_chemmacros_detect_bold_bool \cs_new:Nn \chemmacros_inner_font: {} @@ -128,8 +128,9 @@ \bool_set_false:N \l_chemmacros_circled_formal_bool } , circled .default:n = all , - detect-bold .bool_set:N = \l_chemmacros_detect_bold_bool , - detect-bold .default:n = true , + detect-bold .code:n = + \chemmacros_msg:nnxx { chemmacros } { option-deprecated } + { detect-bold } {} , EZ .code:n = \chemmacros_msg:nnxx { chemmacros } { option-deprecated } { EZ } {} , german .bool_set:N = \l_chemmacros_german_bool , @@ -927,27 +928,16 @@ % --------------------------------------------------------------------------- % % acid/base -\cs_new_nopar:Npn \pH +\keys_define:nn { chemmacros / acid-base } { - \mbox { \chemmacros_detect_bold:n { \textsl { p } H } } - \chemmacros_xspace: - } -\cs_new_nopar:Npn \pOH - { - \mbox { \chemmacros_detect_bold:n { \textsl { p } OH } } - \chemmacros_xspace: - } -\NewDocumentCommand \p { m } - { - \mbox - { - \chemmacros_detect_bold:n { \textsl { p } } - \ensuremath - { \chemmacros_detect_bold:n { #1 } } - } - \chemmacros_xspace: + p-style .choice: , + p-style / slanted .code:n = \cs_set_eq:NN \chemmacros_p_style:n \textsl , + p-style / italics .code:n = \cs_set_eq:NN \chemmacros_p_style:n \textit , + p-style / upright .code:n = \cs_set_eq:NN \chemmacros_p_style:n \textup } +\cs_new_eq:NN \chemmacros_p_style:n \textup + \cs_new_nopar:Npn \chemmacros_if_bold:TF #1#2 { \ifx\f@series\l_chemmacros_if_bf_tl @@ -957,91 +947,65 @@ \fi { #1 }{ #2 } } + \tl_new:N \l_chemmacros_if_bf_tl \tl_set:Nn \l_chemmacros_if_bf_tl { bx } \char_set_catcode_math_subscript:N \@ -\cs_new_nopar:Npn \Ka + +\cs_new_protected_nopar:Npn \Ka { \mbox - {\( - \chemmacros_if_bold:TF - { - \chemmacros_bm:n - { - K @ \mathrm - { - \bool_if:NTF \l_chemmacros_german_bool - { S } - { A } - } - } - } - { - K @ \mathrm - { - \bool_if:NTF \l_chemmacros_german_bool - { S } - { A } - } - } - \)} + { + \( + \chemmacros_detect_bold:n + { + K @ \mathrm + { \bool_if:NTF \l_chemmacros_german_bool { S } { A } } + } + \) + } \chemmacros_xspace: } -\cs_new_nopar:Npn \Kb +\cs_new_protected_nopar:Npn \Kb { - \mbox - {\( - \chemmacros_if_bold:TF - { - \chemmacros_bm:n { K @ \mathrm { B } } - } - { - K @ \mathrm { B } - } - \)} + \mbox { \( \chemmacros_detect_bold:n { K @ \mathrm { B } } \) } \chemmacros_xspace: } -\cs_new_nopar:Npn \Kw +\cs_new_protected_nopar:Npn \Kw { - \mbox - {\( - \chemmacros_if_bold:TF - { - \chemmacros_bm:n { K @ \mathrm { W } } - } - { - K @ \mathrm { W } - } - \)} + \mbox { \( \chemmacros_detect_bold:n { K @ \mathrm { W } } \) } \chemmacros_xspace: } +\NewDocumentCommand \p { m } + { + \group_begin: + \chemmacros_p_style:n { p } + \ensuremath { #1 } + \group_end: + } + +\cs_new_protected_nopar:Npn \pH + { \p { \chemmacros_chemformula:n { H } } \chemmacros_xspace: } + +\cs_new_protected_nopar:Npn \pOH + { \p { \chemmacros_chemformula:n { OH } } \chemmacros_xspace: } + \NewDocumentCommand \pKa { o } { - \mbox - { - \chemmacros_detect_bold:n { \textsl { p } } - \( - \Ka \IfNoValueF { #1 } { @ #1 } - \) - } + \p { \Ka \IfNoValueF { #1 } { @ { \chemmacros_detect_bold:n { #1 } } } } \chemmacros_xspace: } \NewDocumentCommand \pKb { o } { - \mbox - { - \chemmacros_detect_bold:n { \textsl { p } } - \( - \Kb \IfNoValueF { #1 } { @ #1 } - \) - } + \p { \Kb \IfNoValueF { #1 } { @ { \chemmacros_detect_bold:n { #1 } } } } \chemmacros_xspace: } + \char_set_catcode_letter:N \@ % --------------------------------------------------------------------------- % @@ -1527,13 +1491,13 @@ \tl_new:N \l_chemmacros_nmr_unit_tl \tl_set:Nn \l_chemmacros_nmr_unit_tl { \mega\hertz } -\cs_new_nopar:Npn \chemmacros_nmr_nucleus:n #1,#2 \q_stop +\cs_new_nopar:Npn \chemmacros_nmr_nucleus:w #1,#2 \q_stop { \tl_set:Nn \l_chemmacros_nmr_isotope_tl { #1 } \tl_set:Nn \l_chemmacros_nmr_element_tl { #2 } } -\cs_new:Npn \chemmacros_nmr_default_nucleus:n #1,#2 \q_stop +\cs_new:Npn \chemmacros_nmr_default_nucleus:w #1,#2 \q_stop { \tl_set:Nn \l_chemmacros_nmr_isotope_default_tl { #1 } \tl_set:Nn \l_chemmacros_nmr_element_default_tl { #2 } @@ -1543,16 +1507,17 @@ { \bool_if:NTF \l_chemmacros_bpchem_bool { \IUPAC { \^ { #1 } #2 - NMR } } - { $ ^ { #1 } $ #2 - NMR } + { \iupac { \^ { #1 } } \chemmacros_atom:n { #2 } - NMR } } +\cs_generate_variant:Nn \chemmacros_nmr_base:nn { VV } \cs_new_nopar:Npn \chemmacros_nmr_frequency:n #1 { \tl_if_in:nnTF { #1 } { , } - { \chemmacros_nmr_frequency_aux_i:n #1 \q_stop } + { \chemmacros_nmr_frequency_aux_i:w #1 \q_stop } { \chemmacros_nmr_frequency_aux_ii:n { #1 } } } -\cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_i:n #1,#2 \q_stop +\cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_i:w #1,#2 \q_stop { \SI { #1 } { #2 } } \cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_ii:n #1 { \SI { #1 } { \tl_use:N \l_chemmacros_nmr_unit_tl } } @@ -1561,7 +1526,7 @@ { unit .tl_set:N = \l_chemmacros_nmr_unit_tl , unit .default:n = \mega\hertz , - nucleus .code:n = { \chemmacros_nmr_default_nucleus:n #1 \q_stop } , + nucleus .code:n = { \chemmacros_nmr_default_nucleus:w #1 \q_stop } , nucleus .default:n = { 1,H } } @@ -1594,18 +1559,18 @@ { \bool_set_true:N \l_chemmacros_nmr_comma_bool } \IfNoValueTF { #2 } { - \chemmacros_nmr_nucleus:n + \chemmacros_nmr_nucleus:w \l_chemmacros_nmr_isotope_default_tl , \l_chemmacros_nmr_element_default_tl \q_stop } - { \chemmacros_nmr_nucleus:n #2 \q_stop } + { \chemmacros_nmr_nucleus:w #2 \q_stop } \mode_if_math:TF { \text { - \chemmacros_nmr_base:nn - { \tl_use:N \l_chemmacros_nmr_isotope_tl } - { \tl_use:N \l_chemmacros_nmr_element_tl } + \chemmacros_nmr_base:VV + \l_chemmacros_nmr_isotope_tl + \l_chemmacros_nmr_element_tl \bool_if:NT \l_chemmacros_nmr_delimiters_bool { ~ ( } \bool_if:NT \l_chemmacros_nmr_frequency_bool @@ -1621,9 +1586,9 @@ \IfBooleanF { #1 } { \delta } } { - \chemmacros_nmr_base:nn - { \tl_use:N \l_chemmacros_nmr_isotope_tl } - { \tl_use:N \l_chemmacros_nmr_element_tl } + \chemmacros_nmr_base:VV + \l_chemmacros_nmr_isotope_tl + \l_chemmacros_nmr_element_tl \bool_if:NT \l_chemmacros_nmr_delimiters_bool { ~ ( } \bool_if:NT \l_chemmacros_nmr_frequency_bool @@ -3152,6 +3117,7 @@ % --------------------------------------------------------------------------- % % hyperref support +% ?? unsure about adding IUPAC commands \AfterPackage* { hyperref } { \pdfstringdefDisableCommands @@ -3159,21 +3125,8 @@ \cs_set:Npn \- { - } \cs_set:Npn \| { } \cs_set:Npn \iupac #1 { #1 } - \cs_set:Npn \ortho { o } - \cs_set:Npn \meta { m } - \cs_set:Npn \para { p } - \cs_set:Npn \Dfi { D } - \cs_set:Npn \Lfi { L } - \cs_set:Npn \tert { tert } - \cs_set:Npn \cis { cis } - \cs_set:Npn \trans { trans } - \cs_set:Npn \E { E } - \cs_set:Npn \Z { Z } - \cs_set:Npn \Ent { E } - \cs_set:Npn \Zus { Z } - \cs_set:Npn \Rcip { (R) } - \cs_set:Npn \Scip { (S) } - \cs_set:Npn \cip #1 { (#1) } + \cs_set:Npn \pH { pH } + \cs_set:Npn \pOH { pOH } } } @@ -3240,8 +3193,8 @@ Version history - changed default behaviour of phases - removed optional argument from \sld and \lqd 2012/02/19 - version 3.1 - new commands \DeclareChemIUPAC and \RenewChemIUPAC - - new option iupac - - deprecated option: EZ + - new option "option/iupac" + - deprecated option: "option/EZ" - deprecated commands: \newreaction => \DeclareChemReaction \setnewstate => \DeclareChemState @@ -3251,6 +3204,10 @@ Version history \Dfi => \D \Lfi => \L - new arrow types in the chemformula package +2012/02/26 - version 3.1a - "operator" p rewritten to follow IUPAC + recommendations + - new option "acid-base/p-style" + - deprecated option: "option/detect-bold" % --------------------------------------------------------------------------- % % TODO: |