summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-03-05 00:55:20 +0000
committerKarl Berry <karl@freefriends.org>2012-03-05 00:55:20 +0000
commit6151df96e3052187573221b5851211dd5bae6657 (patch)
treeaa6e4d34d5cc0b520fdf3b0a9deb1aec099c4bb6 /Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
parent1480574d9087a43f46a3013758228cf555693b6e (diff)
chemmacros 3.1b (4mar12)
git-svn-id: svn://tug.org/texlive/trunk@25561 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.sty155
1 files changed, 102 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index 9f0569be67f..c12b04033ca 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/26 - %
+% - 2012/03/03 - %
% --------------------------------------------------------------------------- %
% - https://bitbucket.org/cgnieder/chemmacros/ - %
% - contact@mychemistry.eu - %
@@ -33,8 +33,8 @@
\ProvidesExplPackage
{chemmacros}
- {2012/02/26}
- {3.1a}
+ {2012/03/03}
+ {3.1b}
{macros and commands for chemists}
\@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } }
@@ -82,24 +82,28 @@
% --------------------------------------------------------------------------- %
% package options
-% xspace => add an \xspace after a whole bunch of macros
% bpchem => use \IUPAC inside for \NMR command
% circled => circle charges
% detect-bold => behaviour when font series bold
% EZ => cool or chemmacros version of \E
% german => change pKA => pKS etc
+% iupac => behaviour of nomenclature commands
% ngerman => an alias :)
% ghsystem => load ghsystem or don't
% method => use `chemformula' or `mhchem'
% strict => errors or warnings
% synchronize => let particles et.al. adapt chemformula's font selection
-% iupac => behaviour of nomenclature commands
+% ugreek => behaviour of \ChemDelta, \Chemalpha, ...
% version=1 => compatibility for documents set with v1.*
+% xspace => add an \xspace after a whole bunch of macros
\bool_new:N \l_chemmacros_strict_bool
\bool_new:N \l_chemmacros_detect_bold_bool
\bool_set_true:N \l_chemmacros_detect_bold_bool
+\bool_new:N \l_chemmacros_use_upgreek_bool
+\bool_new:N \l_chemmacros_use_textgreek_bool
+
\cs_new:Nn \chemmacros_inner_font: {}
\keys_define:nn { chemmacros / option }
@@ -137,6 +141,16 @@
german .default:n = true ,
ghsystem .bool_set:N = \l_chemmacros_ghsystem_bool ,
ghsystem .default:n = true ,
+ iupac .choice: ,
+ iupac / restricted .code:n =
+ \bool_set_true:N \l_chemmacros_iupac_restricted_bool
+ \bool_set_false:N \l_chemmacros_iupac_strict_bool ,
+ iupac / auto .code:n =
+ \bool_set_false:N \l_chemmacros_iupac_restricted_bool
+ \bool_set_false:N \l_chemmacros_iupac_strict_bool ,
+ iupac / strict .code:n =
+ \bool_set_false:N \l_chemmacros_iupac_restricted_bool
+ \bool_set_true:N \l_chemmacros_iupac_strict_bool ,
method .choice: ,
method / chemformula .code:n =
\bool_set_false:N \l_chemmacros_use_mhchem_bool ,
@@ -152,29 +166,30 @@
strict .bool_set:N = \l_chemmacros_strict_bool ,
strict .default:n = true ,
synchronize .choice: ,
- synchronize / true .code:n =
+ synchronize / true .code:n =
\cs_set_eq:NN \chemmacros_inner_font: \chemformula_font_inner: ,
synchronize / false .code:n = \cs_set:Nn \chemmacros_inner_font: {} ,
synchronize .default:n = true ,
- iupac .choice: ,
- iupac / restricted .code:n =
- \bool_set_true:N \l_chemmacros_iupac_restricted_bool
- \bool_set_false:N \l_chemmacros_iupac_strict_bool ,
- iupac / auto .code:n =
- \bool_set_false:N \l_chemmacros_iupac_restricted_bool
- \bool_set_false:N \l_chemmacros_iupac_strict_bool ,
- iupac / strict .code:n =
- \bool_set_false:N \l_chemmacros_iupac_restricted_bool
- \bool_set_true:N \l_chemmacros_iupac_strict_bool ,
- xspace .bool_set:N = \l_chemmacros_xspace_bool ,
- xspace .default:n = true ,
+ upgreek .choice: ,
+ upgreek / upgreek .code:n =
+ \bool_set_true:N \l_chemmacros_use_upgreek_bool
+ \bool_set_false:N \l_chemmacros_use_textgreek_bool ,
+ upgreek / textgreek .code:n =
+ \bool_set_false:N \l_chemmacros_use_upgreek_bool
+ \bool_set_true:N \l_chemmacros_use_textgreek_bool ,
+ upgreek / none .code:n =
+ \bool_set_false:N \l_chemmacros_use_upgreek_bool
+ \bool_set_false:N \l_chemmacros_use_textgreek_bool ,
+ upgreek .default:n = upgreek ,
version .choice: ,
version / 1 .code:n =
{ \bool_set_true:N \l_chemmacros_version_one_bool } ,
version / 2 .code:n =
{ \bool_set_false:N \l_chemmacros_version_one_bool } ,
version / bundle .code:n =
- { \bool_set_false:N \l_chemmacros_version_one_bool }
+ { \bool_set_false:N \l_chemmacros_version_one_bool } ,
+ xspace .bool_set:N = \l_chemmacros_xspace_bool ,
+ xspace .default:n = true
}
\ProcessKeysOptions { chemmacros / option }
@@ -190,7 +205,47 @@
{ \RequirePackage { xspace } }
\bool_if:NT \l_chemmacros_use_mhchem_bool
{ \RequirePackage[ version=3 ]{ mhchem } }
- }
+ \@ifpackageloaded { upgreek }
+ { \bool_set_true:N \l_chemmacros_use_upgreek_bool }
+ {
+ \@ifpackageloaded { textgreek }
+ { \bool_set_true:N \l_chemmacros_use_textgreek_bool }
+ {}
+ }
+ \bool_if:NTF \l_chemmacros_use_upgreek_bool
+ {
+ \cs_set_nopar:Npn \Chemalpha { \ensuremath { \upalpha } }
+ \cs_set_nopar:Npn \Chembeta { \ensuremath { \upbeta } }
+ \cs_set_nopar:Npn \Chemgamma { \ensuremath { \upgamma } }
+ \cs_set_nopar:Npn \Chemdelta { \ensuremath { \updelta } }
+ \cs_set_nopar:Npn \Chemomega { \ensuremath { \upomega } }
+ \cs_set_nopar:Npn \ChemDelta { \ensuremath { \Updelta } }
+ }
+ {
+ \bool_if:NT \l_chemmacros_use_textgreek_bool
+ {
+ \cs_set_nopar:Npn \Chemalpha
+ { \ensuremath { \text { \textalpha } } }
+ \cs_set_nopar:Npn \Chembeta
+ { \ensuremath { \text { \textbeta } } }
+ \cs_set_nopar:Npn \Chemgamma
+ { \ensuremath { \text { \textgamma } } }
+ \cs_set_nopar:Npn \Chemdelta
+ { \ensuremath { \text { \textdelta } } }
+ \cs_set_nopar:Npn \Chemomega
+ { \ensuremath { \text { \textomega } } }
+ \cs_set_nopar:Npn \ChemDelta
+ { \ensuremath { \text { \textDelta } } }
+ }
+ }
+ }
+
+\cs_new_nopar:Npn \Chemalpha { \ensuremath { \alpha } }
+\cs_new_nopar:Npn \Chembeta { \ensuremath { \beta } }
+\cs_new_nopar:Npn \Chemgamma { \ensuremath { \gamma } }
+\cs_new_nopar:Npn \Chemdelta { \ensuremath { \delta } }
+\cs_new_nopar:Npn \Chemomega { \ensuremath { \omega } }
+\cs_new_nopar:Npn \ChemDelta { \ensuremath { \Delta } }
\cs_new_nopar:Npn \chemmacros_xspace:
{
@@ -226,6 +281,9 @@
\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.
@@ -582,6 +640,13 @@
{ #1 }
}
+\NewDocumentCommand \Rad { O{}G{} }
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-dropped }
+ { \Rad } { }
+ #1#2
+ }
+
% charges
\cs_new_nopar:Npn \chemmacros_charge:n #1
{
@@ -873,6 +938,20 @@
\DeclareChemIUPAC \syn { \textit { syn } }
\DeclareChemIUPAC \anti { \textit { anti } }
+% attachments to heteroatoms / added hydrogen
+\DeclareChemIUPAC \H { \textit { H } }
+\DeclareChemIUPAC \O { \textit { O } }
+\DeclareChemIUPAC \N { \textit { N } }
+\DeclareChemIUPAC \Sf { \textit { S } }
+\DeclareChemIUPAC \P { \textit { P } }
+
+% greek letters
+\DeclareChemIUPAC\a{\Chemalpha}
+\DeclareChemIUPAC\b{\Chembeta}
+\DeclareChemIUPAC\g{\Chemgamma}
+\DeclareChemIUPAC\d{\Chemdelta}
+\DeclareChemIUPAC\w{\Chemomega}
+
% \iupac (basically the same as bpchem's \IUPAC)
% - allows multiple breaking points as compound names can get really long and
% especially in multicolumn documents can span more than two lines
@@ -899,7 +978,7 @@
\tex_ignorespaces:D
\cs_set_eq:NN \- \chemmacros_break_point_hyphen:
\cs_set_eq:NN \| \chemmacros_break_point:
- \cs_set_eq:NN \^ \chemformula_supscript:n
+ \cs_set_eq:NN \^ \chemformula_superscript:n
#1
\group_end:
}
@@ -1006,36 +1085,6 @@
\chemmacros_xspace:
}
-\char_set_catcode_letter:N \@
-
-% --------------------------------------------------------------------------- %
-% substituents
-% \Rad[<sign>]{<subscript>}
-
-\char_set_catcode_math_subscript:N \@
-\NewDocumentCommand \Rad { o g }
- {
- \chemmacros_atom:n
- {
- R
- $
- \IfNoValueF { #2 } { @ { \mathrm { #2 } } }
- ^ {
- \IfNoValueF { #1 }
- {
- \tl_if_eq:nnTF { #1 } { + }
- { \chemmacros_plus: }
- {
- \tl_if_eq:nnT { #1 } { - }
- { \chemmacros_minus: }
- }
- }
- }
- $
- }
- }
-\char_set_catcode_letter:N \@
-
% --------------------------------------------------------------------------- %
% units
\DeclareSIUnit { \atm } { atm }
@@ -1138,9 +1187,7 @@
\fp_new:N \l_chemmacros_ox_number_fp
\bool_new:N \l_chemmacros_ox_side_bool
-\bool_set_false:N \l_chemmacros_ox_side_bool
\bool_new:N \l_chemmacros_ox_super_bool
-\bool_set_false:N \l_chemmacros_ox_super_bool
\bool_new:N \l_chemmacros_ox_top_bool
\bool_set_true:N \l_chemmacros_ox_top_bool
@@ -3208,6 +3255,8 @@ Version history
recommendations
- new option "acid-base/p-style"
- deprecated option: "option/detect-bold"
+2012/03/03 - version 3.1b - changes in the chemformula package
+ - IUPAC compliance for \Delta and \ox
% --------------------------------------------------------------------------- %
% TODO: