summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-11-04 23:16:57 +0000
committerKarl Berry <karl@freefriends.org>2011-11-04 23:16:57 +0000
commitcb33be94e6d58477c394350360dc7b482612c18c (patch)
tree825fb385c3e4d804c52a2ed48936fae62b48f1fa /Master/texmf-dist/tex
parentfd9207757778f50d33798ab934b0c2da5d1849a1 (diff)
chemmacros (4nov11)
git-svn-id: svn://tug.org/texlive/trunk@24494 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg2
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty261
2 files changed, 174 insertions, 89 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg b/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg
index 7aa9dbcfb5b..a7dd522d55f 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros-version1.cfg
@@ -4,7 +4,7 @@
% - macros and commands for chemists - %
% --------------------------------------------------------------------------- %
% - Clemens Niederberger - %
-% - 2011/10/28 - %
+% - 2011/11/03 - %
% --------------------------------------------------------------------------- %
% - http://www.mychemistry.eu/ - %
% - contact@mychemistry.eu - %
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index 659757ef0cd..0aeffae3755 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
@@ -4,7 +4,7 @@
% - macros and commands for chemists - %
% --------------------------------------------------------------------------- %
% - Clemens Niederberger - %
-% - 2011/10/28 - %
+% - 2011/11/03 - %
% --------------------------------------------------------------------------- %
% - http://www.mychemistry.eu/ - %
% - contact@mychemistry.eu - %
@@ -36,7 +36,7 @@
{
\@ifpackageloaded{mhchem}{} { \RequirePackage[ version=3 ]{ mhchem } }
}
-\ProvidesExplPackage {chemmacros} {2011/10/27} {2.0} {macros and commands for chemists}
+\ProvidesExplPackage {chemmacros} {2011/11/03} {2.0a} {macros and commands for chemists}
\bool_new:N \l_chemmacros_version_one_bool
\bool_set_false:N \l_chemmacros_version_one_bool
@@ -65,6 +65,7 @@
\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
\AtBeginDocument
{
@@ -77,6 +78,9 @@
\@ifpackageloaded { hyperref }
{ \bool_set_true:N \l_chemmacros_hyperref_bool }
{ \bool_set_false:N \l_chemmacros_hyperref_bool }
+ \@ifpackageloaded { chemfig }
+ { \bool_set_true:N \l_chemmacros_chemfig_bool }
+ { \bool_set_false:N \l_chemmacros_chemfig_bool }
}
% --------------------------------------------------------------------------- %
@@ -160,12 +164,6 @@
See~the~documentation~for~more~information.
}
-\msg_set:nnn { chemmacros } { circled=chemfig }
- {
- You~used~the~option~"circled~=~chemfig"~but~did~not~load~the~package~
- chemfig.~Option~"circled~=~formal"~will~be~used~instead.
- }
-
\msg_set:nnn { chemmacros } { ox }
{
\token_to_str:N \ox \c_space_tl : ~ #1 ~ \msg_line_context: .
@@ -181,29 +179,25 @@
\token_to_str:N \redox \c_space_tl : ~ #1 ~ \msg_line_context: .
}
-\msg_set:nnn { chemmacros } { already-defined }
+\msg_set:nnn { chemmacros } { chemfig }
{
- The~command/environment ~ #1 ~ \msg_line_context: \c_space_tl
- is~already~defined.
- }
-
-\msg_set:nnnn { chemmacros } { outside-MOdiagram }
- { You~can't~use~#1~outside~the~MOdiagram~environment. }
- {
- The~command~#1~can~only~be~used~inside~the~MOdiagram~
- environment~\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:nnn { chemmacros } { setnewstate }
{
- The~state~\tl_to_str:n { \ #1 } \c_space_tl already~exists.~You~need~to~
- use~\token_to_str:N \renewstate \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 \renewstate \c_space_tl to~alter~it.
}
\msg_set:nnn { chemmacros } { renewstate }
{
- The~state~\tl_to_str:n { \ #1 } \c_space_tl isn't~set~up~yet.~You~need~to~
- use~\token_to_str:N \setnewstate \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 \setnewstate \c_space_tl to~create~it.
}
% --------------------------------------------------------------------------- %
@@ -234,26 +228,65 @@
% --------------------------------------------------------------------------- %
% circled charge signs
-\cs_new_nopar:Npn \chemmacros_fplus_aux:
- {
- \raise.1ex\hbox{\scalebox{.65}{\textcircled{\lower.1ex\hbox{$+$}}}}
- }
+% Definition inspired by chemstyle's definition of \standarsstate
+% \cs_new_nopar:Npn \chemmacros_fplus_aux:
+% {
+% \raise.1ex\hbox{\scalebox{.65}{\textcircled{\lower.1ex\hbox{$+$}}}}
+% }
+% \cs_new_nopar:Npn \chemmacros_fplus:
+% {
+% \mode_if_math:TF
+% { \text { \chemmacros_fplus_aux: } }
+% { \chemmacros_fplus_aux: }
+% }
+
\cs_new_nopar:Npn \chemmacros_fplus:
- {
- \mode_if_math:TF
- { \text { \chemmacros_fplus_aux: } }
- { \chemmacros_fplus_aux: }
+ { \ensuremath { \chemmacros_fplus_aux_i: } }
+\cs_new_nopar:Npn \chemmacros_fplus_aux_i:
+ { \mathpalette \chemmacros_fplus_aux_ii: \bigcirc }
+\cs_new_nopar:Npn \chemmacros_fplus_aux_ii: #1#2
+ {
+ \ooalign
+ {
+ \tex_hfil:D
+ $#1+$
+ \tex_hfil:D
+ \tex_cr:D
+ \tex_hfil:D
+ $#1#2$
+ \tex_hfil:D
+ \tex_cr:D
+ }
}
-\cs_new_nopar:Npn \chemmacros_fminus_aux:
- {
- \raise.1ex\hbox{\scalebox{.65}{\textcircled{\lower.1ex\hbox{$-$}}}}
- }
+% \cs_new_nopar:Npn \chemmacros_fminus_aux:
+% {
+% \raise.1ex\hbox{\scalebox{.65}{\textcircled{\lower.1ex\hbox{$-$}}}}
+% }
+% \cs_new_nopar:Npn \chemmacros_fminus:
+% {
+% \mode_if_math:TF
+% { \text { \chemmacros_fminus_aux: } }
+% { \chemmacros_fminus_aux: }
+% }
+
\cs_new_nopar:Npn \chemmacros_fminus:
- {
- \mode_if_math:TF
- { \text { \chemmacros_fminus_aux: } }
- { \chemmacros_fminus_aux: }
+ { \ensuremath { \chemmacros_fminus_aux_i: } }
+\cs_new_nopar:Npn \chemmacros_fminus_aux_i:
+ { \mathpalette \chemmacros_fminus_aux_aux_ii: \bigcirc }
+\cs_new_nopar:Npn \chemmacros_fminus_aux_aux_ii: #1#2
+ {
+ \ooalign
+ {
+ \tex_hfil:D
+ $#1-$
+ \tex_hfil:D
+ \tex_cr:D
+ \tex_hfil:D
+ $#1#2$
+ \tex_hfil:D
+ \tex_cr:D
+ }
}
% use directly:
@@ -419,6 +452,10 @@
{ \ensuremath { \scriptstyle \chemmacros_formal_minus: } }
\cs_new_nopar:Npn \fscrp
{ \ensuremath { \scriptstyle \chemmacros_formal_plus: } }
+\cs_new_nopar:Npn \fsscrm
+ { \ensuremath { \scriptscriptstyle \chemmacros_formal_minus: } }
+\cs_new_nopar:Npn \fsscrp
+ { \ensuremath { \scriptscriptstyle \chemmacros_formal_plus: } }
% --------------------------------------------------------------------------- %
% ions, molecules
@@ -431,11 +468,63 @@
{ \chemmacros_atom:n { H3O } \pch \chemmacros_xspace: }
\cs_new_nopar:Npn \water
{ \chemmacros_atom:n { H2O } \chemmacros_xspace: }
-\cs_new_nopar:Npn \Nu
- { \chemmacros_atom:n { Nu } \mch \chemmacros_xspace: }
+
+\NewDocumentCommand \Nu { o }
+ {
+ \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } }
+ \bool_if:NTF \l_chemmacros_particle_elpair_bool
+ { \chemmacros_elpair:n { Nu } }
+ { \chemmacros_atom:n { Nu } }
+ \mch \chemmacros_xspace:
+ }
+
\cs_new_nopar:Npn \El
{ \chemmacros_atom:n { E } \pch \chemmacros_xspace: }
+\NewDocumentCommand \ba { o }
+ {
+ \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } }
+ \bool_if:NTF \l_chemmacros_particle_elpair_bool
+ { \chemmacros_elpair:n { ba } }
+ { \chemmacros_atom:n { ba } }
+ \mch \chemmacros_xspace:
+ }
+
+\cs_new_nopar:Npn \chemmacros_elpair:n #1
+ {
+ \bool_if:NTF \l_chemmacros_chemfig_bool
+ {
+ \bool_if:NTF \l_chemmacros_elpair_dots_bool
+ { \Lewis { 0: , #1 } }
+ { \Lewis { 0 , #1 } }
+ }
+ {
+ \msg_warning:nnx { chemmacros } { chemfig } { #1 }
+ \chemmacros_atom:n { #1 }
+ }
+ }
+
+\bool_new:N \l_chemmacros_particle_elpair_bool
+\bool_new:N \l_chemmacros_elpair_dots_bool
+
+\keys_define:nn { chemmacros / particle }
+ {
+ elpair .choice: ,
+ elpair / false .code:n =
+ { \bool_set_false:N \l_chemmacros_particle_elpair_bool } ,
+ elpair / dots .code:n =
+ {
+ \bool_set_true:N \l_chemmacros_particle_elpair_bool
+ \bool_set_true:N \l_chemmacros_elpair_dots_bool
+ } ,
+ elpair / dash .code:n =
+ {
+ \bool_set_true:N \l_chemmacros_particle_elpair_bool
+ \bool_set_false:N \l_chemmacros_elpair_dots_bool
+ } ,
+ elpair .default:n = dots
+ }
+
% --------------------------------------------------------------------------- %
% stereo descriptors and sim.
% Cahn-Ingold-Prelog
@@ -1373,34 +1462,27 @@
% --------------------------------------------------------------------------- %
% thermodynamics et.al.
% \standardstate as defined by the chemstyle package. Thanks to Joseph Wright
-% \AtBeginDocument
-% {
- \cs_if_exist:NF \standardstate
+\cs_if_exist:NF \standardstate
+ {
+ \cs_new_nopar:Npn \standardstate
+ { \ensuremath { \chemmacros_standardstate: } }
+ \cs_new_nopar:Npn \chemmacros_standardstate:
+ { \mathpalette \chemmacros_standardstate_aux: \circ }
+ \cs_new_nopar:Npn \chemmacros_standardstate_aux: #1#2
{
- \cs_new_nopar:Npn \standardstate
+ \ooalign
{
- \ensuremath { \chemmacros_standardstate: }
- }
- \cs_new_nopar:Npn \chemmacros_standardstate:
- {
- \mathpalette \chemmacros_standardstate_aux: \circ
- }
- \cs_new_nopar:Npn \chemmacros_standardstate_aux: #1#2
- {
- \ooalign
- {
- \tex_hfil:D
- $#1-$
- \tex_hfil:D
- \tex_cr:D
- \tex_hfil:D
- $#1#2$
- \tex_hfil:D
- \tex_cr:D
- }
+ \tex_hfil:D
+ $#1-$
+ \tex_hfil:D
+ \tex_cr:D
+ \tex_hfil:D
+ $#1#2$
+ \tex_hfil:D
+ \tex_cr:D
}
}
-% }
+ }
% --------------------------------------------------------------------------- %
% \State
@@ -2324,28 +2406,31 @@
% --------------------------------------------------------------------------- %
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/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
% --------------------------------------------------------------------------- % \ No newline at end of file