diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 396 |
1 files changed, 217 insertions, 179 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 806515e9b58..306df5dfbb9 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -5,7 +5,6 @@ % - macros and commands for chemists - % % --------------------------------------------------------------------------- % % - Clemens Niederberger - % -% - 2012/05/18 - % % --------------------------------------------------------------------------- % % - https://bitbucket.org/cgnieder/chemmacros/ - % % - contact@mychemistry.eu - % @@ -33,8 +32,8 @@ \ProvidesExplPackage {chemmacros} - {2012/05/18} - {3.3b} + {2012/07/24} + {3.3d} {macros and commands for chemists} \@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } } @@ -80,6 +79,189 @@ } % --------------------------------------------------------------------------- % +% warning / error messages +\cs_new:Npn \chemmacros_msg:nnxx #1#2#3#4 + { + \bool_if:NTF \l_chemmacros_strict_bool + { \msg_error:nnxx { #1 } { #2 } { #3 } { #4 } } + { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } + } + +\msg_set:nnnn { chemmacros } { language-not-defined } + { + The~language~#1~is~not~defined~by~chemmacros. + } + { + You~chose~the~language~`#1'~which~is~not~defined~by~chemmacros.~`english'~is + ~used~instead.~If~you~just~mistyped~try~again!~Otherwise~contact~the~author~ + and~he'll~probably~add~your~language. + } + +\msg_set:nnnn { chemmacros } { already-defined } + { + The~command~#1~has~also~been~defined~by~another~package. + } + { + The~command~#1~has~also~been~defined~by~another~package.~ + chemmacros~provides~an~alternative~definition.~ + See~the~documentation~for~more~information. + } + +\msg_set:nnnn { chemmacros } { option-deprecated } + { The~option~#1~is~deprecated.~I~will~ignore~it. } + { + The~package~option~#1~is~deprecated~and~not~used~by~chemmacros~any~more. + ~It~will~therefore~simply~be~ignored. + } + +\msg_set:nnnn { chemmacros } { command-deprecated } + { + The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ + \token_to_str:N #2 \c_space_tl instead. + } + { + The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ + \token_to_str:N #2 \c_space_tl instead. + } + +\msg_set:nnnn { chemmacros } { command-dropped } + { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } + { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } + +\msg_set:nnnn { chemmacros } { declare-particle } + { + The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + } + { + You've~tried~to~define~a~particle~with~\token_to_str:N \DeclareChemParticle, + ~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists. + ~Please~choose~another~name. + } + +\msg_set:nnnn { chemmacros } { renew-particle } + { The~particle~ \token_to_str:N #1 \c_space_tl is~not~defined. } + { + You've~tried~to~renew~the~particle~\token_to_str:N #1 ,~but~it~doesn't~ + exist. + } + +\msg_set:nnnn { chemmacros } { declare-latin } + { + The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + } + { + You've~tried~to~define~a~latin~phrase~with~\token_to_str:N + \DeclareChemLatin,~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl + already~exists.~Please~choose~another~name. + } + +\msg_set:nnnn { chemmacros } { renew-latin } + { The~latin~phrase \token_to_str:N #1 \c_space_tl is~not~defined. } + { + You've~tried~to~renew~the~latin~phrase~\token_to_str:N #1 ,~but~it~doesn't~ + exist. + } + +\msg_set:nnnn { chemmacros } { declare-nmr } + { + The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + } + { + You've~tried~to~define~a~NMR~command~with~\token_to_str:N + \DeclareChemParticle, ~but~the~command~sequence~ \token_to_str:N #1 + \c_space_tl already~exists.~Please~choose~another~name. + } + +\msg_set:nnnn { chemmacros } { renew-nmr } + { The~NMR~command~ \token_to_str:N #1 \c_space_tl is~not~defined. } + { + You've~tried~to~renew~the~NMR~command~\token_to_str:N #1 ,~but~it~doesn't~ + exist. + } + +\msg_set:nnnn { chemmacros } { declare-phase } + { + The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. + } + { + You've~tried~to~define~a~particle~with~\token_to_str:N \DeclareChemPhase , + ~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists. + ~Please~choose~another~name. + } + +\msg_set:nnnn { chemmacros } { renew-phase } + { The~phase~ \token_to_str:N #1 \c_space_tl is~not~defined. } + { + You've~tried~to~renew~the~phase~\token_to_str:N #1 ,~but~it~doesn't~ + exist. + } + +\msg_set:nnnn { chemmacros } { declare-iupac } + { + The~iupac~naming~command~ \token_to_str:N #1 \c_space_tl is~already~defined. + } + { + You've~tried~to~define~a~iupac~naming~command~with~\token_to_str:N + \DeclareChemIUPAC,~but~the~iupac~command~ \token_to_str:N #1 \c_space_tl + already~exists.~Choose~another~name~or~use~\token_to_str:N \RenewChemIUPAC . + } + +\msg_set:nnnn { chemmacros } { renew-iupac } + { The~iupac~naming~command~ \token_to_str:N #1 \c_space_tl is~not~defined. } + { + You've~tried~to~renew~the~iupac~command~\token_to_str:N #1 ,~but~it~doesn't~ + exist.~Use~\token_to_str:N \DeclareChemIUPAC \c_space_tl instead . + } + +\msg_set:nnnn { chemmacros } { ox } + { \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . } + { \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . } + +\msg_set:nnnn { chemmacros } { OX } + { \token_to_str:N \OX \c_space_tl : ~ #1 ~ \msg_line_context: . } + { \token_to_str:N \OX \c_space_tl : ~ #1 ~ \msg_line_context: . } + +\msg_set:nnnn { chemmacros } { redox } + { \token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: . } + { \token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: . } + +\msg_set:nnnn { chemmacros } { chemfig } + { + You~need~to~load~the~chemfig~package~in~order~to~make~ + \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl + work~properly~\msg_line_context: . + } + { + You~need~to~load~the~chemfig~package~in~order~to~make~ + \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl + work~properly~\msg_line_context: . + } + +\msg_set:nnnn { chemmacros } { DeclareChemState } + { + The~state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: + \c_space_tl already~exists.~You~need~to~use~ + \token_to_str:N \RenewChemState \c_space_tl to~alter~it. + } + { + The~state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: + \c_space_tl already~exists.~You~need~to~use~ + \token_to_str:N \RenewChemState \c_space_tl to~alter~it. + } + +\msg_set:nnnn { chemmacros } { RenewChemState } + { + The~state~\exp_after:wN \token_to_str:N \cs:w #1 \cs_end: + \c_space_tl isn't~set~up~yet.~You~need~to~use~ + \token_to_str:N \DeclareChemState \c_space_tl to~create~it. + } + { + The~state~\exp_after:wN \token_to_str:N \cs:w #1 \cs_end: + \c_space_tl isn't~set~up~yet.~You~need~to~use~ + \token_to_str:N \DeclareChemState \c_space_tl to~create~it. + } + +% --------------------------------------------------------------------------- % % package options % bpchem => use \IUPAC inside for \NMR command % circled => circle charges @@ -143,11 +325,9 @@ EZ .code:n = \chemmacros_msg:nnxx { chemmacros } { option-deprecated } { EZ } {} , german .code:n = - \chemmacros_msg:nnxx { chemmacros } { option-deprecated } - { german } {} , + \tl_set:Nn \l_chemmacros_language_tl { german } , ngerman .code:n = - \chemmacros_msg:nnxx { chemmacros } { option-deprecated } - { ngerman } {} , + \tl_set:Nn \l_chemmacros_language_tl { ngerman } , ghsystem .bool_set:N = \l_chemmacros_ghsystem_bool , ghsystem .default:n = true , iupac .choice: , @@ -216,13 +396,13 @@ % --------------------------------------------------------------------------- % % language settings: \prop_new:N \l_chemmacros_language_prop -\prop_put:Nnn \l_chemmacros_language_prop { english } { english } +\prop_put:Nnn \l_chemmacros_language_prop { english } { english } \prop_put:Nnn \l_chemmacros_language_prop { american } { english } -\prop_put:Nnn \l_chemmacros_language_prop { british } { english } -\prop_put:Nnn \l_chemmacros_language_prop { german } { german } -\prop_put:Nnn \l_chemmacros_language_prop { ngerman } { german } -\prop_put:Nnn \l_chemmacros_language_prop { italian } { italian } -\prop_put:Nnn \l_chemmacros_language_prop { french } { french } +\prop_put:Nnn \l_chemmacros_language_prop { british } { english } +\prop_put:Nnn \l_chemmacros_language_prop { german } { german } +\prop_put:Nnn \l_chemmacros_language_prop { ngerman } { german } +\prop_put:Nnn \l_chemmacros_language_prop { italian } { italian } +\prop_put:Nnn \l_chemmacros_language_prop { french } { french } \prop_map_inline:Nn \l_chemmacros_language_prop { @@ -342,168 +522,6 @@ } % --------------------------------------------------------------------------- % -% warning / error messages -\cs_new:Npn \chemmacros_msg:nnxx #1#2#3#4 - { - \bool_if:NTF \l_chemmacros_strict_bool - { \msg_error:nnxx { #1 } { #2 } { #3 } { #4 } } - { \msg_warning:nnxx { #1 } { #2 } { #3 } { #4 } } - } - -\msg_set:nnnn { chemmacros } { language-not-defined } - { - The~language~#1~is~not~defined~by~chemmacros. - } - { - You~chose~the~language~`#1'~which~is~not~defined~by~chemmacros.~`english'~is - ~used~instead.~If~you~just~mistyped~try~again!~Otherwise~contact~the~author~ - and~he'll~probably~add~your~language. - } - -\msg_set:nnnn { chemmacros } { already-defined } - { - The~command~#1~has~also~been~defined~by~another~package. - } - { - The~command~#1~has~also~been~defined~by~another~package.~ - chemmacros~provides~an~alternative~definition.~ - See~the~documentation~for~more~information. - } - -\msg_set:nnn { chemmacros } { option-deprecated } - { The~option~#1~is~deprecated.~I~will~ignore~it. } - -\msg_set:nnn { chemmacros } { command-deprecated } - { - The~command~\token_to_str:N #1 \c_space_tl is~deprecated.~Use~ - \token_to_str:N #2 \c_space_tl instead. - } - -\msg_set:nnn { chemmacros } { command-dropped } - { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } - -\msg_set:nnnn { chemmacros } { declare-particle } - { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. - } - { - You've~tried~to~define~a~particle~with~\token_to_str:N \DeclareChemParticle, - ~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists. - ~Please~choose~another~name. - } - -\msg_set:nnnn { chemmacros } { renew-particle } - { The~particle~ \token_to_str:N #1 \c_space_tl is~not~defined. } - { - You've~tried~to~renew~the~particle~\token_to_str:N #1 ,~but~it~doesn't~ - exist. - } - -\msg_set:nnnn { chemmacros } { declare-latin } - { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. - } - { - You've~tried~to~define~a~latin~phrase~with~\token_to_str:N - \DeclareChemLatin,~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl - already~exists.~Please~choose~another~name. - } - -\msg_set:nnnn { chemmacros } { renew-latin } - { The~latin~phrase \token_to_str:N #1 \c_space_tl is~not~defined. } - { - You've~tried~to~renew~the~latin~phrase~\token_to_str:N #1 ,~but~it~doesn't~ - exist. - } - -\msg_set:nnnn { chemmacros } { declare-nmr } - { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. - } - { - You've~tried~to~define~a~NMR~command~with~\token_to_str:N - \DeclareChemParticle, ~but~the~command~sequence~ \token_to_str:N #1 - \c_space_tl already~exists.~Please~choose~another~name. - } - -\msg_set:nnnn { chemmacros } { renew-nmr } - { The~NMR~command~ \token_to_str:N #1 \c_space_tl is~not~defined. } - { - You've~tried~to~renew~the~NMR~command~\token_to_str:N #1 ,~but~it~doesn't~ - exist. - } - -\msg_set:nnnn { chemmacros } { declare-phase } - { - The~command~sequence~ \token_to_str:N #1 \c_space_tl is~already~defined. - } - { - You've~tried~to~define~a~particle~with~\token_to_str:N \DeclareChemPhase , - ~but~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists. - ~Please~choose~another~name. - } - -\msg_set:nnnn { chemmacros } { renew-phase } - { The~phase~ \token_to_str:N #1 \c_space_tl is~not~defined. } - { - You've~tried~to~renew~the~phase~\token_to_str:N #1 ,~but~it~doesn't~ - exist. - } - -\msg_set:nnnn { chemmacros } { declare-iupac } - { - The~iupac~naming~command~ \token_to_str:N #1 \c_space_tl is~already~defined. - } - { - You've~tried~to~define~a~iupac~naming~command~with~\token_to_str:N - \DeclareChemIUPAC,~but~the~iupac~command~ \token_to_str:N #1 \c_space_tl - already~exists.~Choose~another~name~or~use~\token_to_str:N \RenewChemIUPAC . - } - -\msg_set:nnnn { chemmacros } { renew-iupac } - { The~iupac~naming~command~ \token_to_str:N #1 \c_space_tl is~not~defined. } - { - You've~tried~to~renew~the~iupac~command~\token_to_str:N #1 ,~but~it~doesn't~ - exist.~Use~\token_to_str:N \DeclareChemIUPAC \c_space_tl instead . - } - -\msg_set:nnn { chemmacros } { ox } - { - \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . - } - -\msg_set:nnn { chemmacros } { OX } - { - \token_to_str:N \OX \c_space_tl : ~ #1 ~ \msg_line_context: . - } - -\msg_set:nnn { chemmacros } { redox } - { - \token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: . - } - -\msg_set:nnn { chemmacros } { chemfig } - { - You~need~to~load~the~chemfig~package~in~order~to~make~ - \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: \c_space_tl - work~properly~\msg_line_context: . - } - -\msg_set:nnn { chemmacros } { DeclareChemState } - { - The~state~ \exp_after:wN \token_to_str:N \cs:w #1 \cs_end: - \c_space_tl already~exists.~You~need~to~use~ - \token_to_str:N \RenewChemState \c_space_tl to~alter~it. - } - -\msg_set:nnn { chemmacros } { RenewChemState } - { - The~state~\exp_after:wN \token_to_str:N \cs:w #1 \cs_end: - \c_space_tl isn't~set~up~yet.~You~need~to~use~ - \token_to_str:N \DeclareChemState \c_space_tl to~create~it. - } - -% --------------------------------------------------------------------------- % % TikZ drawings \cs_new_nopar:Npn \chemmacros_tikz_picture:nn #1#2 { \tikzpicture[#1] #2 \endtikzpicture } @@ -1006,7 +1024,18 @@ % stereo descriptors and other nomenclature commands % Cahn-Ingold-Prelog -\NewDocumentCommand \cip { m } { \textit { (#1) } } +\dim_new:N \l_chemmacros_cip_kern_dim +\dim_set:Nn \l_chemmacros_cip_kern_dim { .05ex } +\keys_define:nn { chemmacros / iupac } + { cip-kern .dim_set:N = \l_chemmacros_cip_kern_dim } + +\NewDocumentCommand \cip { m } + { + \cs_if_exist:NTF \EmbracOff + { \textit* { (#1) } } + { \textit { (#1) } } + \tex_kern:D \l_chemmacros_cip_kern_dim + } \cs_new_protected_nopar:Npn \Rcip { @@ -1045,8 +1074,8 @@ \ExplSyntaxOn % E(ntgegen)/Z(usammen) -\DeclareChemIUPAC \E { \textit { (E) } } -\DeclareChemIUPAC \Z { \textit { (Z) } } +\DeclareChemIUPAC \E { \cip { E } } +\DeclareChemIUPAC \Z { \cip { Z } } % cis/trans & tert \DeclareChemIUPAC \cis { \textit{ cis } } @@ -3773,8 +3802,17 @@ Version history 2012/05/13 - version 3.3a - Italian translations of the H, EUH and P statements - \hapto and \bridge 2012/05/18 - version 3.3b - compatibility with MiKTeX +2012/05/18 - version 3.3c - fix in the `ghsystem/language' option +2012/07/24 - version 3.3d - additional picture file type `pdf' + - default bond length set to 1.1667ex + - bug fix in the bonds + - added kerning to cip commands, new option + `iupac/cip-kern' + - bug fix: messages needed to be defined before the + options % --------------------------------------------------------------------------- % % TODO: - ox-option xfrac vs math? -- drop option `bpchem'
\ No newline at end of file +- drop option `bpchem' +- add d-orbitals
\ No newline at end of file |