diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 197 |
1 files changed, 118 insertions, 79 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 3adb8505858..f53fbd5bbe8 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/01 - % +% - 2012/02/05 - % % --------------------------------------------------------------------------- % % - http://www.mychemistry.eu/ - % % - contact@mychemistry.eu - % @@ -30,43 +30,30 @@ \RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx , tikz , mathtools , environ , scrlfile , etoolbox , bm } \usetikzlibrary{calc,arrows} -\ProvidesExplPackage {chemmacros} {2012/02/01} {3.0a} {macros and commands for chemists} +\ProvidesExplPackage {chemmacros} {2012/02/05} {3.0c} {macros and commands for chemists} \@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } } \bool_new:N \l_chemmacros_version_one_bool -\bool_set_false:N \l_chemmacros_version_one_bool - \bool_new:N \l_chemmacros_german_bool -\bool_set_false:N \l_chemmacros_german_bool - \bool_new:N \l_chemmacros_xspace_bool -\bool_set_true:N \l_chemmacros_xspace_bool - + \bool_set_true:N \l_chemmacros_xspace_bool \bool_new:N \l_chemmacros_bpchem_bool -\bool_set_false:N \l_chemmacros_bpchem_bool - \bool_new:N \l_chemmacros_circled_bool -\bool_set_true:N \l_chemmacros_circled_bool - + \bool_set_true:N \l_chemmacros_circled_bool \bool_new:N \l_chemmacros_circled_formal_bool -\bool_set_true:N \l_chemmacros_circled_formal_bool - + \bool_set_true:N \l_chemmacros_circled_formal_bool \bool_new:N \l_chemmacros_circled_chem_bool -\bool_set_true:N \l_chemmacros_circled_chem_bool - + \bool_set_true:N \l_chemmacros_circled_chem_bool \bool_new:N \l_chemmacros_EZ_cool_bool -\bool_set_false:N \l_chemmacros_EZ_cool_bool - +\bool_new:N \l_chemmacros_Nu_mathspec_bool \bool_new:N \l_chemmacros_use_mhchem_bool -\bool_set_false:N \l_chemmacros_use_mhchem_bool - \bool_new:N \l_chemmacros_chemstyle_bool \bool_new:N \l_chemmacros_hyperref_bool \bool_new:N \l_chemmacros_varioref_bool \bool_new:N \l_chemmacros_chemfig_bool \bool_new:N \l_chemmacros_ghsystem_bool -\bool_set_true:N \l_chemmacros_ghsystem_bool + \bool_set_true:N \l_chemmacros_ghsystem_bool \AtBeginDocument { @@ -152,6 +139,12 @@ method / mhchem .code:n = \bool_set_true:N \l_chemmacros_use_mhchem_bool , method .default:n = chemformula , + Nu .choice: , + Nu / mathspec .code:n = + \bool_set_true:N \l_chemmacros_Nu_mathspec_bool , + Nu / chemmacros .code:n = + \bool_set_false:N \l_chemmacros_Nu_mathspec_bool , + Nu .default:n = chemmacros , strict .bool_set:N = \l_chemmacros_strict_bool , strict .default:n = true , synchronize .choice: , @@ -209,6 +202,16 @@ See~the~documentation~for~more~information. } +\msg_set:nnnn { chemmacros } { 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 \DeclareParticle ,~but + ~the~command~sequence~ \token_to_str:N #1 \c_space_tl already~exists.~Choose~ + another~name. + } + \msg_set:nnn { chemmacros } { ox } { \token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: . @@ -421,20 +424,44 @@ % --------------------------------------------------------------------------- % % particles, charges -% electron \bool_new:N \l_chemmacros_charge_append_bool \bool_set_false:N \l_chemmacros_charge_append_bool \bool_if:NTF \l_chemmacros_use_mhchem_bool { + \NewDocumentCommand \DeclareParticle { mm } + { + \cs_if_free:NTF #1 + { + \cs_set_nopar:Npn #1 + { \chemmacros_atom:n { #2 } \chemmacros_xspace: } + } + { \chemmacros_msg:nnxx { chemmacros } { particle } { #1 } {} } + } + } + { + \NewDocumentCommand \DeclareParticle { mm } + { + \cs_if_free:NTF #1 + { + \cs_set_nopar:Npn #1 + { \chemmacros_chemformula:n { #2 } \chemmacros_xspace: } + } + { \chemmacros_msg:nnxx { chemmacros } { particle } { #1 } {} } + } + } + +\bool_if:NTF \l_chemmacros_use_mhchem_bool + { \cs_new_nopar:Npn \el { \chemmacros_atom:n { e } \mch \chemmacros_xspace: } \cs_new_nopar:Npn \prt { \chemmacros_atom:n { p } \pch \chemmacros_xspace: } } { - \cs_new_nopar:Npn \el { \chemmacros_chemformula:n { e- } \chemmacros_xspace: } - \cs_new_nopar:Npn \prt { \chemmacros_chemformula:n { p+ } \chemmacros_xspace: } + \DeclareParticle \el { e- } + \DeclareParticle \prt { p+ } } -\cs_new_nopar:Npn \ntr { \chemmacros_chemformula:n { n^0 } \chemmacros_xspace: } + +\DeclareParticle \ntr { n^0 } \cs_new_nopar:Npn \chemmacros_bm:n #1 { @@ -543,16 +570,15 @@ \cs_new_nopar:Npn \El { \chemmacros_atom:n { E } \pch \chemmacros_xspace: } } { - \cs_new_nopar:Npn \Hpl { \chemmacros_chemformula:n { H+ } \chemmacros_xspace: } - \cs_new_nopar:Npn \Hyd { \chemmacros_chemformula:n { OH- } \chemmacros_xspace: } - \cs_new_nopar:Npn \HtO { \chemmacros_chemformula:n { H3O+ } \chemmacros_xspace: } - \cs_new_nopar:Npn \El { \chemmacros_chemformula:n { E+ } \chemmacros_xspace: } + \DeclareParticle \Hpl { H+ } + \DeclareParticle \Hyd { OH- } + \DeclareParticle \HtO { H3O+ } + \DeclareParticle \El { E+ } } -\cs_new_nopar:Npn \water - { \chemmacros_chemformula:n { H2O } \chemmacros_xspace: } -% TODO: \Nu konflikt mit `mathspec' -\NewDocumentCommand \Nu { o } +\DeclareParticle \water { H2O } + +\NewDocumentCommand \chemmacros_Nu:w { o } { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } } \bool_if:NTF \l_chemmacros_particle_elpair_bool @@ -565,6 +591,13 @@ \chemmacros_xspace: } +\AtBeginDocument + { + \bool_if:NTF \l_chemmacros_Nu_mathspec_bool + { \cs_set_eq:NN \Nuc \chemmacros_Nu:w } + { \cs_set_eq:NN \Nu \chemmacros_Nu:w } + } + \NewDocumentCommand \ba { o } { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } } @@ -1646,7 +1679,6 @@ \tl_set:Nn \l_chemmacros_reaction_lorname_tl { #1 ~ } } -% TODO: define new reactions with optional Argument for lor-entry % \newreaction[<keyval>]{<name>}{<type>} \bool_if:NF \l_chemmacros_version_one_bool { @@ -2907,51 +2939,58 @@ % --------------------------------------------------------------------------- % Version history -2011/05/15 version 1.0 - CTAN release -2011/06/22 version 1.1 - "LaTeXified" whole package for safer usage - - less user work required (like loading package after - another) - - more particle macros - - latin phrases - - extra units - - acid/base commands - - \mech - - \NMR - - \mhName, \setmhName, \newreaction, phases - - \renewstate, \setstatesubscript - - improved orbitals - - simpler package options, option german, bpchem - - bug fixes -2011/10/28 version 2.0 - rewritten in expl3 - - customization via \chemsetup - - new commands \p, \fplus, \fminus, \fpch, \fmch, \fscrp, - \fsrcm, \fdelp, \fdelm, \orbital, \chemsetup - - various commands have a new syntax - - removed: \setmhName, \setredoxdist, \setstatesubscript, - \porb, \phorb, \pxorb, \pyorb, \pzorb, \setorbheight, - \solid, \liquid - - reaction environments work with hyperref and varioref -2011/11/03 version 2.0a - minor bug fixes - - new feature for \Nu - - new command \ba -2012/01/28 version 3.0 - bundled with packages `formula' and `ghs' - - new commands \Ka, \Kb, \Kw - - commands can detect if font series is bold - - new package option "detect-bold" - - new package option "method" => choose between `mhchem' - and `formula' for internal uses. - - new package option "ghs" => load `ghs' or don't - - new package option "synchronize" - - new package option "strict" - - new command \iupac - - new command \listofreactions, reaction environments - with optional argument - - \cis, \trans, \tert without \xspace -2012/01/30 version 3.0a - bugfix in formula.sty - - renamed formula => chemformula - and ghs => ghsystem to make the names unique - (following a request by Karl Berry) +2011/05/15 - version 1.0 - CTAN release +2011/06/22 - version 1.1 - "LaTeXified" whole package for safer usage + - less user work required (like loading package + after another) + - more particle macros + - latin phrases + - extra units + - acid/base commands + - \mech + - \NMR + - \mhName, \setmhName, \newreaction, phases + - \renewstate, \setstatesubscript + - improved orbitals + - simpler package options, option german, bpchem + - bug fixes +2011/10/28 - version 2.0 - rewritten in expl3 + - customization via \chemsetup + - new commands \p, \fplus, \fminus, \fpch, \fmch, + \fscrp, \fsrcm, \fdelp, \fdelm, \orbital, \chemsetup + - various commands have a new syntax + - removed: \setmhName, \setredoxdist, \setstatesubscript, + \porb, \phorb, \pxorb, \pyorb, \pzorb, \setorbheight, + \solid, \liquid + - reaction environments work with hyperref and varioref +2011/11/03 - version 2.0a - minor bug fixes + - new feature for \Nu + - new command \ba +2012/01/28 - version 3.0 - bundled with packages `formula' and `ghs' + - new commands \Ka, \Kb, \Kw + - commands can detect if font series is bold + - new package option "detect-bold" + - new package option "method" => choose between + `mhchem' and `formula' for internal uses. + - new package option "ghs" => load `ghs' or don't + - new package option "synchronize" + - new package option "strict" + - new command \iupac + - new command \listofreactions, reaction environments + with optional argument + - \cis, \trans, \tert without \xspace +2012/01/30 - version 3.0a - bugfix in formula.sty + - renamed formula => chemformula + and ghs => ghsystem to make the names unique + (following a request by Karl Berry for TeXlive) +2012/02/03 - version 3.0b - new command \DeclareParticle, updated documentation +2012/02/05 - version 3.0c - renamed pictogram files (following a request by + Karl Berry for TeXlive) + - new package option "Nu" + % --------------------------------------------------------------------------- % % TODO: - ox-option xfrac vs math? -- Option „side“ for Phasen-Befehle?
\ No newline at end of file +- Option „side“ for Phasen-Befehle? +- \Nu konflikt mit `mathspec' +- resolve conflict with \listofreactions and \setcounter{reaction}{<int>}
\ No newline at end of file |