summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-02-20 23:31:10 +0000
committerKarl Berry <karl@freefriends.org>2012-02-20 23:31:10 +0000
commit96948f06651bb4a4bb0174bb28d9d6d443ada4e4 (patch)
treebc564db764d728bbd08c5726e606e82e95acb5f8 /Master/texmf-dist/tex/latex/chemmacros
parent1c39817dbba19c5ef1e95912dabb3805085871ac (diff)
chemmacros (20feb12)
git-svn-id: svn://tug.org/texlive/trunk@25448 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemformula.sty618
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty404
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty47
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def2
4 files changed, 630 insertions, 441 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
index b5e74df2f90..1c7c0f75735 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
@@ -5,7 +5,7 @@
% - macros and commands for chemists - %
% --------------------------------------------------------------------------- %
% - Clemens Niederberger - %
-% - 2012/02/10 - %
+% - 2012/02/19 - %
% --------------------------------------------------------------------------- %
% - https://bitbucket.org/cgnieder/chemmacros/ - %
% - contact@mychemistry.eu - %
@@ -28,7 +28,11 @@
% - The Current Maintainer of this work is Clemens Niederberger. - %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{ expl3 }
-\ProvidesExplPackage {chemformula} {2012/02/10} {3.0d} {typeset chemical compounds and reactions}
+\ProvidesExplPackage
+ {chemformula}
+ {2012/02/19}
+ {3.1}
+ {typeset chemical compounds and reactions}
%-----------------------------------------------------------------------------%
% WARNING AND ERROR MESSAGES
@@ -52,6 +56,23 @@
\token_to_str:N \usepackage \{ chemmacros \}.
}
+\msg_set:nnnn { chemformula } { declare-arrow }
+ {
+ The~arrow~type~ \tl_to_str:n { #1 } \c_space_tl is~already~defined.
+ }
+ {
+ You've~tried~to~define~the~arrow~type~\tl_to_str:n { #1 } \c_space_tl with
+ ~\token_to_str:N \DeclareChemArrow \c_space_tl but~it~already~exists.
+ ~Choose~another~name.
+ }
+
+\msg_set:nnnn { chemformula } { renew-arrow }
+ { The~arrow~type~ \tl_to_str:n { #1 } \c_space_tl is~not~defined. }
+ {
+ You've~tried~to~renew~the~arrow~type~\tl_to_str:n { #1 } ~but~it~doesn't~
+ exist.
+ }
+
%-----------------------------------------------------------------------------%
% test, if we are loaded without the `chemmacros' package
\cs_if_exist:cF { ver@chemmacros.sty }
@@ -78,7 +99,8 @@
% Some basic internal commands:
\cs_new:Nn \chemformula_plus:
{
- \bool_if:nTF { \l_chemmacros_circled_bool && !\l_chemmacros_circled_formal_bool }
+ \bool_if:nTF
+ { \l_chemmacros_circled_bool && !\l_chemmacros_circled_formal_bool }
{
\bool_if:NTF \l_chemmacros_circled_chem_bool
{ \chemmacros_fplus: }
@@ -93,7 +115,8 @@
\cs_new:Nn \chemformula_minus:
{
- \bool_if:nTF { \l_chemmacros_circled_bool && !\l_chemmacros_circled_formal_bool }
+ \bool_if:nTF
+ { \l_chemmacros_circled_bool && !\l_chemmacros_circled_formal_bool }
{
\bool_if:NTF \l_chemmacros_circled_chem_bool
{ \chemmacros_fminus: }
@@ -264,267 +287,178 @@
\tl_new:N \l_chemformula_arrow_label_style_tl
\tl_set:Nn \l_chemformula_arrow_label_style_tl { \footnotesize }
-% <->
-\NewDocumentCommand \chemformula_arrow_mesomeric:w { O{}O{} }
+\prop_new:N \l_chemformula_arrows_code_prop
+\tl_new:N \l_chemformula_arrow_type_tl
+\tl_new:N \l_chemformula_arrow_arg_i_tl
+\tl_new:N \l_chemformula_arrow_arg_ii_tl
+
+% read optional arguments
+\cs_new_nopar:Npn \l_chemformula_arrow_read_args:w
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nf { inner~sep=0, baseline=(chemformula_arrow_start.base) }
- {
- \chemformula_draw:xn
- { \l_chemformula_arrow_head_tl-\l_chemformula_arrow_head_tl , \l_chemformula_arrow_style_tl }
- {
- coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- above=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #1 }
- node
- [
- pos=.5,
- below=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) ++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
- }
+ \peek_meaning:NTF [
+ { \l_chemformula_arrow_read_args_aux_i:w }
+ { \l_chemformula_arrow_read_args_aux_iii: }
}
-% ->
-\NewDocumentCommand \chemformula_arrow_right:w { O{}O{} }
+\cs_new_nopar:Npn \l_chemformula_arrow_read_args_aux_i:w [#1]
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nn { inner~sep=0, baseline=(chemformula_arrow_start.base) }
- {
- \chemformula_draw:xn { -\l_chemformula_arrow_head_tl , \l_chemformula_arrow_style_tl }
- {
- coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- above=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #1 }
- node
- [
- pos=.5,
- below=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) ++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
- }
+ \tl_set:Nn \l_chemformula_arrow_arg_i_tl { #1 }
+ \peek_meaning:NTF [
+ { \l_chemformula_arrow_read_args_aux_ii:w }
+ { \l_chemformula_arrow_read_args_aux_iii: }
}
-% <-
-\NewDocumentCommand \chemformula_arrow_left:w { O{}O{} }
+\cs_new_nopar:Npn \l_chemformula_arrow_read_args_aux_ii:w [#1]
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nn { inner~sep=0, baseline=(chemformula_arrow_start.base) }
- {
- \chemformula_draw:xn { \l_chemformula_arrow_head_tl- , \l_chemformula_arrow_style_tl }
- {
- coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- above=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #1 }
- node
- [
- pos=.5,
- below=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim)++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
- }
+ \tl_set:Nn \l_chemformula_arrow_arg_ii_tl { #1 }
+ \l_chemformula_arrow_read_args_aux_iii:
}
-% <=>
-\NewDocumentCommand \chemformula_arrow_equilibrium:w { O{}O{} }
+\cs_new_nopar:Npn \l_chemformula_arrow_read_args_aux_iii:
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nn { inner~sep=0, baseline=(chemformula_arrow_start.base) }
- {
- \chemformula_draw:xn { -left~\l_chemformula_arrow_head_tl , \l_chemformula_arrow_style_tl }
- {
- coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim,.429em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- above=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #1 }
- }
- \chemformula_draw:xn { left~\l_chemformula_arrow_head_tl- , \l_chemformula_arrow_style_tl }
- {
- (chemformula_arrow_start) ++
- (\l_chemformula_compound_sep_dim,.2574em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- below=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) ++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
- }
+ % now we have both arguments do the actual drawing:
+ \prop_get:NVN \l_chemformula_arrows_code_prop
+ \l_chemformula_arrow_type_tl
+ \l_tmpb_tl
+ \chemformula_arrow_draw:V \l_tmpb_tl
}
-% <=>>
-\NewDocumentCommand \chemformula_arrow_equilibrium_right:w { O{}O{} }
+% get arrows (for the use in \ch to replace the symbol)
+% #1: symbol
+\cs_new_nopar:Npn \chemformula_arrows_get:n #1
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nn { inner~sep=0, baseline=(chemformula_arrow_start.base) }
- {
- \chemformula_draw:xn { -left~\l_chemformula_arrow_head_tl , \l_chemformula_arrow_style_tl }
- {
- coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim,.429em) ++ (0,\dim_use:N \l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- above=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #1 }
- }
- \chemformula_draw:xn { left~\l_chemformula_arrow_head_tl- , \l_chemformula_arrow_style_tl }
- {
- (chemformula_arrow_start) ++
- (\l_chemformula_compound_sep_dim + \l_chemformula_arrow_shortage_dim,.2574em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim -2*\l_chemformula_arrow_shortage_dim , 0)
- node
- [
- pos=.5,
- below=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) ++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
- }
+ % first clear the arguments
+ \tl_clear:N \l_chemformula_arrow_arg_i_tl
+ \tl_clear:N \l_chemformula_arrow_arg_ii_tl
+ % then get the arrow type
+ \tl_set:Nn \l_chemformula_arrow_type_tl { #1 }
+ \l_chemformula_arrow_read_args:w
}
-% <<=>
-\NewDocumentCommand \chemformula_arrow_equilibrium_left:w { O{}O{} }
+% draw the arrows
+\cs_new_nopar:Npn \chemformula_arrow_draw:n #1
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nn { inner~sep=0, baseline=(chemformula_arrow_start.base) }
+ % prepare arrow code for drawing:
+ % TODO: flexible Pfeilspitzen, TikZ-Keys ermöglichen
+ \tl_set_rescan:Nnn \l_tmpc_tl { \char_set_catcode_letter:N \_ } { #1 }
+ % determine length of the arrow
+ \chemformula_determine_arrow_length:oo
+ { \l_chemformula_arrow_arg_i_tl }
+ { \l_chemformula_arrow_arg_ii_tl }
+ \chemformula_tikz:nf
+ { inner~sep=0, baseline=(chemformula_arrow_start.base) }
{
- \chemformula_draw:xn { -left~\l_chemformula_arrow_head_tl , \l_chemformula_arrow_style_tl }
+ % the coordinates
+ \chemformula_draw:xn
+ { \l_chemformula_arrow_style_tl }
{
coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim + \l_chemformula_arrow_shortage_dim,.429em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim - 2*\l_chemformula_arrow_shortage_dim , 0)
+ ++ (\l_chemformula_compound_sep_dim,.3432em)
+ ++ (0,\l_chemformula_arrow_yshift_dim)
+ coordinate (cf_arrow_start)
+ ++ ( .5 * \dim_use:N \l_chemformula_arrow_length_dim , 0)
+ coordinate (cf_arrow_mid)
+ ++ ( .5 * \dim_use:N \l_chemformula_arrow_length_dim , 0)
+ coordinate (cf_arrow_end)
+ ++ (\l_chemformula_compound_sep_dim,0)
+ (cf_arrow_start) ++ (\l_chemformula_arrow_shortage_dim,0)
+ coordinate (cf_arrow_mid_start)
+ (cf_arrow_end) ++ (-\l_chemformula_arrow_shortage_dim , 0)
+ coordinate (cf_arrow_mid_end)
+ }
+ % the arrow labels:
+ \draw
node
[
- pos=.5,
above=\l_chemformula_arrow_label_offset_dim,
font=\l_chemformula_arrow_label_style_tl,
butt~cap-butt~cap
- ] { #1 }
- }
- \chemformula_draw:xn { left~\l_chemformula_arrow_head_tl- , \l_chemformula_arrow_style_tl }
- {
- (chemformula_arrow_start) ++ (\l_chemformula_compound_sep_dim,.2574em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
+ ] at (cf_arrow_mid) { \l_chemformula_arrow_arg_i_tl }
node
[
- pos=.5,
below=\l_chemformula_arrow_label_offset_dim,
font=\l_chemformula_arrow_label_style_tl,
butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) ++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
+ ] at (cf_arrow_mid) { \l_chemformula_arrow_arg_ii_tl }
+ ;
+ \tl_use:N \l_tmpc_tl
}
}
+\cs_generate_variant:Nn \chemformula_arrow_draw:n { V }
+\cs_generate_variant:Nn \chemformula_determine_arrow_length:nn { oo }
-% <>
-\NewDocumentCommand \chemformula_arrow_both:w { O{}O{} }
+% commands to declare arrows (can also be used by users):
+% #1: symbol, #2: code
+\NewDocumentCommand \DeclareChemArrow { mm }
{
- \chemformula_determine_arrow_length:nn { #1 } { #2 }
- \chemformula_tikz:nn { inner~sep=0, baseline=(chemformula_arrow_start.base) }
- {
- \chemformula_draw:xn { -\l_chemformula_arrow_head_tl , \l_chemformula_arrow_style_tl }
- {
- coordinate (chemformula_arrow_start) (0,0)
- ++ (\l_chemformula_compound_sep_dim,.441em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- above=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #1 }
- }
- \chemformula_draw:xn { \l_chemformula_arrow_head_tl- , \l_chemformula_arrow_style_tl }
- {
- (chemformula_arrow_start) ++
- (\l_chemformula_compound_sep_dim,.2454em) ++ (0,\l_chemformula_arrow_yshift_dim) -- ++
- ( \dim_use:N \l_chemformula_arrow_length_dim , 0)
- node
- [
- pos=.5,
- below=\l_chemformula_arrow_label_offset_dim,
- font=\l_chemformula_arrow_label_style_tl,
- butt~cap-butt~cap
- ] { #2 }
- }
- \chemformula_draw:nn {}
- {
- (\l_chemformula_compound_sep_dim,.3432em) ++ (0,\l_chemformula_arrow_yshift_dim) ++
- ( \l_chemformula_compound_sep_dim + \dim_use:N \l_chemformula_arrow_length_dim , 0)
- }
- }
+ \prop_if_in:NnTF \l_chemformula_arrows_code_prop { #1 }
+ { \chemmacros_msg:nnxx { chemformula } { declare-arrow } { #1 } {} }
+ { \prop_put:Nnn \l_chemformula_arrows_code_prop { #1 } { #2 } }
}
+
+\NewDocumentCommand \RenewChemArrow { mm }
+ {
+ \prop_if_in:NnTF \l_chemformula_arrows_code_prop { #1 }
+ { \prop_put:Nnn \l_chemformula_arrows_code_prop { #1 } { #2 } }
+ { \chemmacros_msg:nnxx { chemformula } { renew-arrow } { #1 } {} }
+ }
+
+\NewDocumentCommand \ShowChemArrow { m }
+ {
+ \prop_get:NnN \l_chemformula_arrows_code_prop { #1 } \l_tmpa_tl
+ \tl_to_str:N \l_tmpa_tl
+ }
+
+% declare arrows:
+\DeclareChemArrow { <-> } { \draw[cf-cf] (cf_arrow_start) -- (cf_arrow_end) ; }
+\DeclareChemArrow { -> } { \draw[-cf] (cf_arrow_start) -- (cf_arrow_end) ; }
+\DeclareChemArrow { <- } { \draw[cf-] (cf_arrow_start) -- (cf_arrow_end) ; }
+\DeclareChemArrow { <> }
+ {
+ \draw[-cf] ([yshift=.2ex]cf_arrow_start) -- ([yshift=.2ex]cf_arrow_end) ;
+ \draw[cf-,] ([yshift=-.2ex]cf_arrow_start) -- ([yshift=-.2ex]cf_arrow_end) ;
+ }
+\DeclareChemArrow { <o> }
+ {
+ \draw[cf-cf] (cf_arrow_start) -- (cf_arrow_end) ;
+ \draw
+ (cf_arrow_mid) .. controls ++(-.9ex,-1.5ex) and
+ ++(.9ex,-1.5ex) .. (cf_arrow_mid) ;
+ }
+\DeclareChemArrow { <=>> }
+ {
+ \draw[-left~cf]
+ ([yshift=.15ex]cf_arrow_start) -- ([yshift=.15ex]cf_arrow_end) ;
+ \draw[left~cf-]
+ ([yshift=-.15ex]cf_arrow_mid_start) -- ([yshift=-.15ex]cf_arrow_mid_end) ;
+ }
+\DeclareChemArrow {<<=>}
+ {
+ \draw[-left~cf]
+ ([yshift=.15ex]cf_arrow_mid_start) -- ([yshift=.15ex]cf_arrow_mid_end) ;
+ \draw[left~cf-]
+ ([yshift=-.15ex]cf_arrow_start) -- ([yshift=-.15ex]cf_arrow_end) ;
+ }
+\DeclareChemArrow { <=> }
+ {
+ \draw[-left~cf]
+ ([yshift=.15ex]cf_arrow_start) -- ([yshift=.15ex]cf_arrow_end) ;
+ \draw[left~cf-]
+ ([yshift=-.15ex]cf_arrow_start) -- ([yshift=-.15ex]cf_arrow_end) ;
+ }
+\DeclareChemArrow { -/> }
+ {
+ \draw[-cf] (cf_arrow_start) -- (cf_arrow_end) ;
+ \draw (cf_arrow_mid) ++ (.2ex,.4ex) -- ++(-.4ex,-.8ex) ;
+ \draw (cf_arrow_mid) ++ (-.2ex,.4ex) -- ++(-.4ex,-.8ex) ;
+ }
+\DeclareChemArrow { </- }
+ {
+ \draw[cf-] (cf_arrow_start) -- (cf_arrow_end) ;
+ \draw (cf_arrow_mid) ++ (.2ex,.4ex) -- ++(-.4ex,-.8ex) ;
+ \draw (cf_arrow_mid) ++ (.6ex,.4ex) -- ++(-.4ex,-.8ex) ;
+ }
+
%-----------------------------------------------------------------------------%
% arrow customization
\keys_define:nn { chemmacros / chemformula }
@@ -534,7 +468,7 @@
arrow-ratio .tl_set:N = \l_chemformula_arrow_ratio_tl ,
label-offset .dim_set:N = \l_chemformula_arrow_label_offset_dim ,
compound-sep .dim_set:N = \l_chemformula_compound_sep_dim ,
- arrow-tips .tl_set:N = \l_chemformula_arrow_head_tl ,
+% arrow-tips .tl_set:N = \l_chemformula_arrow_head_tl ,
arrow-style .tl_set:N = \l_chemformula_arrow_style_tl ,
label-style .tl_set:N = \l_chemformula_arrow_label_style_tl
}
@@ -544,9 +478,15 @@
\NewDocumentCommand \chemformula_ch_aux_iii:w { > { \SplitList { ~ } } m }
{
\group_begin:
+ \cs_set_eq:NN \xspace \scan_stop:
+ \cs_set_nopar:Npn \[ { [ }
+ \cs_set_nopar:Npn \] { ] }
\bool_set_true:N \l_chemformula_inside_ch_bool
\tl_if_blank:oF { \g_chemformula_options_tl }
- { \keys_set:no { chemmacros / chemformula } { \g_chemformula_options_tl } }
+ {
+ \keys_set:no { chemmacros / chemformula }
+ { \g_chemformula_options_tl }
+ }
\tl_map_function:nN { #1 } \chemformula_input:n
\chemformula_generate_arrows:N \l_chemformula_input_tl
\chemformula_generate_name:N \l_chemformula_output_tl
@@ -560,7 +500,6 @@
\cs_new:Nn \chemformula_ch:nn
{
\group_align_safe_begin:
- \cs_set:Npn \xspace {}
\leavevmode
\IfNoValueTF { #1 }
{ \tl_gclear:N \g_chemformula_options_tl }
@@ -583,7 +522,8 @@
\cs_new:Npn \chemformula_ch_aux_ii:w #1 & #2 \q_stop
{
- \tl_gput_right:Nn \g_chemformula_output_tl { \chemformula_ch_aux_iii:w { #1 } }
+ \tl_gput_right:Nn \g_chemformula_output_tl
+ { \chemformula_ch_aux_iii:w { #1 } }
\quark_if_no_value:nF { #2 }
{
\tl_gput_right:Nn \g_chemformula_output_tl { & }
@@ -610,43 +550,49 @@
%-----------------------------------------------------------------------------%
% arrow generation & detection
-\cs_new:Npn \chemformula_generate_arrows:n #1
+% make sure to look for <->, <=>> and <<=> first!
+\cs_set:Npn \chemformula_generate_arrows:n #1
{
\tl_set:No \l_tmpa_tl { #1 }
- \tl_if_in:onT { \l_tmpa_tl } { <-> }
- { \tl_replace_all:Nnn \l_tmpa_tl { <-> } { \chemformula_arrow_mesomeric:w } }
- \tl_if_in:onT { \l_tmpa_tl } { -> }
- { \tl_replace_all:Nnn \l_tmpa_tl { -> } { \chemformula_arrow_right:w } }
- \tl_if_in:onT { \l_tmpa_tl } { <- }
- { \tl_replace_all:Nnn \l_tmpa_tl { <- } { \chemformula_arrow_left:w } }
- \tl_if_in:onT { \l_tmpa_tl } { glgw_l }
- { \tl_replace_all:Nnn \l_tmpa_tl { glgw_l } { \chemformula_arrow_equilibrium_left:w } }
- \tl_if_in:onT { \l_tmpa_tl } { <=>> }
- { \tl_replace_all:Nnn \l_tmpa_tl { <=>> } { \chemformula_arrow_equilibrium_right:w } }
- \tl_if_in:onT { \l_tmpa_tl } { <=> }
- { \tl_replace_all:Nnn \l_tmpa_tl { <=> } { \chemformula_arrow_equilibrium:w } }
- \tl_if_in:onT { \l_tmpa_tl } { <> }
- { \tl_replace_all:Nnn \l_tmpa_tl { <> } { \chemformula_arrow_both:w } }
+ \tl_replace_all:Nnn \l_tmpa_tl { <-> }
+ { \chemformula_arrows_get:n { <-> } }
+ \tl_replace_all:Nnn \l_tmpa_tl { <=>> }
+ { \chemformula_arrows_get:n { <=>> } }
+ \tl_replace_all:Nnn \l_tmpa_tl { <<=> }
+ { \chemformula_arrows_get:n { <<=> } }
+ \prop_map_function:NN \l_chemformula_arrows_code_prop
+ \chemformula_replace_arrows:nn
\tl_set_eq:NN \l_chemformula_output_tl \l_tmpa_tl
}
+
+\bool_new:N \l_chemformula_arrow_already_replaced_bool
+\cs_new:Npn \chemformula_replace_arrows:nn #1#2
+ {
+ \tl_if_eq:nnT { #1 } { <-> }
+ { \bool_set_true:N \l_chemformula_arrow_already_replaced_bool }
+ \tl_if_eq:nnT { #1 } { <=>> }
+ { \bool_set_true:N \l_chemformula_arrow_already_replaced_bool }
+ \tl_if_eq:nnT { #1 } { <<=> }
+ { \bool_set_true:N \l_chemformula_arrow_already_replaced_bool }
+ \bool_if:NF \l_chemformula_arrow_already_replaced_bool
+ {
+ \tl_set_rescan:Nnn \l_tmpb_tl {} { #1 }
+ \exp_args:NNo \tl_replace_all:Nnn \l_tmpa_tl
+ { \l_tmpb_tl } { \chemformula_arrows_get:n { #1 } }
+ }
+ \bool_set_false:N \l_chemformula_arrow_already_replaced_bool
+ }
\cs_generate_variant:Nn \chemformula_generate_arrows:n { N }
\cs_new:Npn \chemformula_detect_arrows:n #1
{
\bool_set_false:N \l_chemformula_is_arrow_bool
- \tl_set:No \l_tmpa_tl { #1 }
- \tl_if_in:onT { \l_tmpa_tl } { <-> }
- { \bool_set_true:N \l_chemformula_is_arrow_bool }
- \tl_if_in:onT { \l_tmpa_tl } { -> }
- { \bool_set_true:N \l_chemformula_is_arrow_bool }
- \tl_if_in:onT { \l_tmpa_tl } { <- }
- { \bool_set_true:N \l_chemformula_is_arrow_bool }
- \tl_if_in:onT { \l_tmpa_tl } { <=>> }
- { \bool_set_true:N \l_chemformula_is_arrow_bool }
- \tl_if_in:onT { \l_tmpa_tl } { glgw_l }
- { \bool_set_true:N \l_chemformula_is_arrow_bool }
- \tl_if_in:onT { \l_tmpa_tl } { <=> }
- { \bool_set_true:N \l_chemformula_is_arrow_bool }
+ \prop_map_inline:Nn \l_chemformula_arrows_code_prop
+ {
+ \tl_set_rescan:Nnn \l_tmpa_tl {} { ##1 }
+ \tl_if_in:noT { #1 } { \l_tmpa_tl }
+ { \bool_set_true:N \l_chemformula_is_arrow_bool }
+ }
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -654,7 +600,7 @@
\dim_new:N \l_chemformula_name_dim
\cs_new:Npn \chemformula_name_cmpd:w
- { \peek_meaning:NTF { ( } { \chemformula_name_cmpd_aux:w } { ! } }
+ { \peek_meaning:NTF ( { \chemformula_name_cmpd_aux:w } { ! } }
\cs_new:Npn \chemformula_name_cmpd_aux:w (#1)(#2)
{
@@ -816,16 +762,26 @@
% behaviour in a charge
\prop_new:N \l_chemformula_charge_prop
-\prop_put:Nnn \l_chemformula_charge_prop { 0 } { \chemformula_charge_style:n { 0 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 1 } { \chemformula_charge_style:n { 1 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 2 } { \chemformula_charge_style:n { 2 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 3 } { \chemformula_charge_style:n { 3 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 4 } { \chemformula_charge_style:n { 4 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 5 } { \chemformula_charge_style:n { 5 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 6 } { \chemformula_charge_style:n { 6 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 7 } { \chemformula_charge_style:n { 7 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 8 } { \chemformula_charge_style:n { 8 } }
-\prop_put:Nnn \l_chemformula_charge_prop { 9 } { \chemformula_charge_style:n { 9 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 0 }
+ { \chemformula_charge_style:n { 0 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 1 }
+ { \chemformula_charge_style:n { 1 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 2 }
+ { \chemformula_charge_style:n { 2 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 3 }
+ { \chemformula_charge_style:n { 3 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 4 }
+ { \chemformula_charge_style:n { 4 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 5 }
+ { \chemformula_charge_style:n { 5 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 6 }
+ { \chemformula_charge_style:n { 6 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 7 }
+ { \chemformula_charge_style:n { 7 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 8 }
+ { \chemformula_charge_style:n { 8 } }
+\prop_put:Nnn \l_chemformula_charge_prop { 9 }
+ { \chemformula_charge_style:n { 9 } }
\prop_put:Nnn \l_chemformula_charge_prop { + } { \chemformula_plus: }
\prop_put:Nnn \l_chemformula_charge_prop { - } { \chemformula_minus: }
\prop_put:Nnn \l_chemformula_charge_prop { . } { \chemformula_radical: }
@@ -842,8 +798,10 @@
\prop_put:Nnn \l_chemformula_stoich_prop { 7 } { 7 }
\prop_put:Nnn \l_chemformula_stoich_prop { 8 } { 8 }
\prop_put:Nnn \l_chemformula_stoich_prop { 9 } { 9 }
-\prop_put:Nnn \l_chemformula_stoich_prop { . } { { \l_chemformula_decimal_output_tl } }
-\prop_put:Nnn \l_chemformula_stoich_prop { , } { { \l_chemformula_decimal_output_tl } }
+\prop_put:Nnn \l_chemformula_stoich_prop { . }
+ { { \l_chemformula_decimal_output_tl } }
+\prop_put:Nnn \l_chemformula_stoich_prop { , }
+ { { \l_chemformula_decimal_output_tl } }
\prop_put:Nnn \l_chemformula_stoich_prop { / } { / }
\prop_put:Nnn \l_chemformula_stoich_prop { _ } { _ }
@@ -868,9 +826,14 @@
{
\chemformula_tikz:nn { inner~sep=0, outer~sep=0 }
{
- \draw node[draw=none,minimum~height=1em,minimum~width=0] (chemformula-double-bond) at (0,0) {} ;
- \draw[butt~cap-butt~cap] (chemformula-double-bond) ++ (0,-.0858em) -- ++( \l_chemformula_bond_dim ,0) ;
- \draw[butt~cap-butt~cap] (chemformula-double-bond) ++ (0,-.2574em) -- ++( \l_chemformula_bond_dim ,0) ;
+ \draw node[draw=none,minimum~height=1em,minimum~width=0]
+ (chemformula-double-bond) at (0,0) {} ;
+ \draw[butt~cap-butt~cap]
+ (chemformula-double-bond) ++ (0,-.0858em) -- ++
+ (\l_chemformula_bond_dim ,0) ;
+ \draw[butt~cap-butt~cap]
+ (chemformula-double-bond) ++ (0,-.2574em) -- ++
+ (\l_chemformula_bond_dim ,0) ;
}
}
@@ -878,10 +841,17 @@
{
\chemformula_tikz:nn { inner~sep=0, outer~sep=0 }
{
- \draw node[draw=none,minimum~height=1em,minimum~width=0] (chemformula-triple-bond) at (0,0) {} ;
- \draw[butt~cap-butt~cap] (chemformula-triple-bond) ++ (0,-.0429em) -- ++( \l_chemformula_bond_dim ,0) ;
- \draw[butt~cap-butt~cap] (chemformula-triple-bond) ++ (0,-.1716em) -- ++( \l_chemformula_bond_dim ,0) ;
- \draw[butt~cap-butt~cap](chemformula-triple-bond) ++ (0,-.3003em) -- ++( \l_chemformula_bond_dim ,0) ;
+ \draw node[draw=none,minimum~height=1em,minimum~width=0]
+ (chemformula-triple-bond) at (0,0) {} ;
+ \draw[butt~cap-butt~cap]
+ (chemformula-triple-bond) ++ (0,-.0429em) -- ++
+ (\l_chemformula_bond_dim ,0) ;
+ \draw[butt~cap-butt~cap]
+ (chemformula-triple-bond) ++ (0,-.1716em) -- ++
+ (\l_chemformula_bond_dim ,0) ;
+ \draw[butt~cap-butt~cap]
+ (chemformula-triple-bond) ++ (0,-.3003em) -- ++
+ (\l_chemformula_bond_dim ,0) ;
}
}
@@ -906,8 +876,10 @@
\bool_set_true:N \l_chemformula_sub_bool
% clean up wrong input
\tl_set:Nn \l_tmpc_tl { #1 }
- \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_single_bond: } { \chemformula_minus: }
- \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_triple_bond: } {\chemformula_plus: }
+ \tl_replace_all:Nnn \l_tmpc_tl
+ { \chemformula_single_bond: } { \chemformula_minus: }
+ \tl_replace_all:Nnn \l_tmpc_tl
+ { \chemformula_triple_bond: } {\chemformula_plus: }
\tl_replace_all:Nnn \l_tmpc_tl { \chemformula_adduct: } { . }
\tl_replace_all:Nnn \l_tmpc_tl { \chemformula_star_adduct: } { * }
% measure width and save it
@@ -924,8 +896,14 @@
}
\dim_set:Nn \l_chemformula_subscript_dim { -\box_wd:N \l_tmpa_box }
\prop_get:NnNTF \l_chemformula_charge_prop { #1 } \l_tmpa_tl
- { \exp_args:NNo \hbox_set:Nn \l_tmpb_box { $ ^ { \chemformula_charge_style:n { \l_tmpa_tl } } $ } }
- { \exp_args:NNo \hbox_set:Nn \l_tmpb_box { $ ^ { \chemformula_charge_style:n { \l_tmpc_tl } } $ } }
+ {
+ \exp_args:NNo \hbox_set:Nn \l_tmpb_box
+ { $ ^ { \chemformula_charge_style:n { \l_tmpa_tl } } $ }
+ }
+ {
+ \exp_args:NNo \hbox_set:Nn \l_tmpb_box
+ { $ ^ { \chemformula_charge_style:n { \l_tmpc_tl } } $ }
+ }
\dim_set:Nn \l_chemformula_subscript_compare_dim { -\box_wd:N \l_tmpb_box }
\box_clear:N \l_tmpa_box
\box_clear:N \l_tmpb_box
@@ -966,17 +944,26 @@
\bool_set_true:N \l_chemformula_sup_bool
% clean up wrong input
\tl_set:Nn \l_tmpc_tl { #1 }
- \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_single_bond: } { \chemformula_minus: }
+ \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_single_bond: }
+ { \chemformula_minus: }
\tl_replace_all:Nnn \l_tmpc_tl { - } { \chemformula_minus: }
- \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_triple_bond: } { \chemformula_plus: }
+ \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_triple_bond: }
+ { \chemformula_plus: }
\tl_replace_all:Nnn \l_tmpc_tl { + } { \chemformula_plus: }
- \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_adduct: } { \chemformula_radical: }
+ \tl_replace_all:Nnn \l_tmpc_tl { \chemformula_adduct: }
+ { \chemformula_radical: }
\tl_replace_all:Nnn \l_tmpc_tl { \chemformula_star_adduct: } { * }
\tl_replace_all:Nnn \l_tmpc_tl { . } { \chemformula_radical: }
% measure width and save it
\prop_get:NnNTF \l_chemformula_charge_prop { #1 } \l_tmpa_tl
- { \exp_args:NNo \hbox_set:Nn \l_tmpa_box { $ ^ { \chemformula_charge_style:n { \l_tmpa_tl } } $ } }
- { \exp_args:NNo \hbox_set:Nn \l_tmpa_box { $ ^ { \chemformula_charge_style:n { \l_tmpc_tl } } $ } }
+ {
+ \exp_args:NNo \hbox_set:Nn \l_tmpa_box
+ { $ ^ { \chemformula_charge_style:n { \l_tmpa_tl } } $ }
+ }
+ {
+ \exp_args:NNo \hbox_set:Nn \l_tmpa_box
+ { $ ^ { \chemformula_charge_style:n { \l_tmpc_tl } } $ }
+ }
\dim_set:Nn \l_chemformula_supscript_dim
{ -\box_wd:N \l_tmpa_box }
\box_clear:N \l_tmpa_box
@@ -1089,7 +1076,6 @@
{
\tl_set_rescan:Nnn \l_chemformula_tmpa_tl
{
-% \char_set_catcode_letter:N \_
\char_set_catcode_letter:N \{
\char_set_catcode_letter:N \}
\char_set_catcode_letter:N \\
@@ -1099,12 +1085,10 @@
\chemformula_input_escape_text:o { \l_chemformula_tmpa_tl }
\chemformula_input_escape_math:n { #1 }
\chemformula_input_stoich:n { #1 }
- % need to take care of <<=> arrow
- \tl_if_in:onT { \l_chemformula_tmpa_tl } { <<=> }
- { \tl_replace_all:Nnn \l_chemformula_tmpa_tl { <<=> } { glgw_l } }
\chemformula_clean_chem_macros:o { \l_chemformula_tmpa_tl }
- \chemformula_input_cmpd:oN { \l_chemformula_tmpa_tl } \l_chemformula_input_tl
- \chemformula_input_arrow:o { \l_chemformula_tmpa_tl }
+ \chemformula_input_cmpd:oN
+ { \l_chemformula_tmpa_tl } \l_chemformula_input_tl
+ \chemformula_input_arrow:n { #1 }
\chemformula_input_name:n { #1 }
\chemformula_input_plus:n { #1 }
\chemformula_input_up:n { #1 }
@@ -1133,7 +1117,8 @@
\tl_set_rescan:Nno \l_chemformula_stoich_tl
{ \ExplSyntaxOn }
{ \l_chemformula_stoich_tl }
- \exp_args:No \chemformula_parse_stoich:n { \l_chemformula_stoich_tl }
+ \exp_args:No \chemformula_parse_stoich:n
+ { \l_chemformula_stoich_tl }
}
}
{ \tl_clear:N \l_chemformula_stoich_tl }
@@ -1159,7 +1144,10 @@
}
\cs_new:Npn \chemformula_parse_stoich_frac:w #1/#2 \q_nil
- { \tl_put_right:Nn \l_chemformula_input_tl { \chemformula_frac:nn { #1 } { #2 } } }
+ {
+ \tl_put_right:Nn \l_chemformula_input_tl
+ { \chemformula_frac:nn { #1 } { #2 } }
+ }
\cs_new:Npn \chemformula_parse_stoich_misc_frac:w #1_#2/#3 \q_nil
{
@@ -1218,7 +1206,8 @@
}
}
{
- \tl_put_right:Nn #2 { \skip_horizontal:N \l_chemformula_stoich_space_dim }
+ \tl_put_right:Nn #2
+ { \skip_horizontal:N \l_chemformula_stoich_space_dim }
\tl_clear:N \l_chemformula_stoich_tl
}
}
@@ -1269,14 +1258,21 @@
\exp_args:Nx \tl_if_in:nnT { \tl_head:V \l_tmpa_tl } { ^ }
{ \bool_set_true:N \l_chemformula_first_is_sup_bool }
\tl_if_in:VnT \l_tmpa_tl { ^ }
- { \tl_replace_all:Nnn \l_tmpa_tl { ^ } { \chemformula_chief_supscript:n } }
+ {
+ \tl_replace_all:Nnn \l_tmpa_tl { ^ }
+ { \chemformula_chief_supscript:n }
+ }
\tl_if_in:VnT \l_tmpa_tl { _ }
- { \tl_replace_all:Nnn \l_tmpa_tl { _ } { \chemformula_chief_subscript:n } }
+ {
+ \tl_replace_all:Nnn \l_tmpa_tl { _ }
+ { \chemformula_chief_subscript:n }
+ }
\int_zero:N \l_chemformula_count_tokens_int
\tl_map_inline:Nn \l_tmpa_tl
{
\int_incr:N \l_chemformula_count_tokens_int
- \int_compare:nTF { \l_chemformula_count_tokens_int = \tl_length:N \l_tmpa_tl }
+ \int_compare:nTF
+ { \l_chemformula_count_tokens_int = \tl_length:N \l_tmpa_tl }
{
\tl_if_eq:nnTF { ##1 } { + }
{
@@ -1528,7 +1524,10 @@
{
\dim_set:Nn \l_chemformula_subscript_shift_additional_dim { #1 }
\dim_set:Nn \l_chemformula_subscript_shift_dim
- { \l_chemformula_subscript_shift_default_dim + \l_chemformula_subscript_shift_additional_dim }
+ {
+ \l_chemformula_subscript_shift_default_dim +
+ \l_chemformula_subscript_shift_additional_dim
+ }
} ,
subscript-vshift .default:n = 0pt ,
subscript-style .choice: ,
@@ -1610,13 +1609,14 @@ VERSION HISTORY
- bugfix: escaped text recognizes space by ~ again
- * in superscript now gives excited state
- new arrow type <>
+2012/02/19 - version 3.1 - new functions in the chemmacros package
+ - new arrow types -/>, </- and <o>
+ - new commands \DeclareChemArrow, \RenewChemArrow and
+ \ShowChemArrow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO
- Addukte: Zahlen nach * und . automatisch erkennen?
- allow fractions in subscripts: _{$\frac{1}{2}$} ?
- optionale argumente von \\ nach außen weiterreichen?
-- vertikaler shift für superskripte?
-- the explicit definition of each arrow on its own is inefficient.
- also these definitions abuse the `xparse' command \NewDocumentCommand
- for internal commands => needs to be taken care of \ No newline at end of file
+- vertikaler shift für superskripte? \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index fcba2944cd4..01888f2ff44 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/10 - %
+% - 2012/02/19 - %
% --------------------------------------------------------------------------- %
% - https://bitbucket.org/cgnieder/chemmacros/ - %
% - contact@mychemistry.eu - %
@@ -27,10 +27,15 @@
% - - %
% - The Current Maintainer of this work is Clemens Niederberger. - %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx , tikz , mathtools , environ , scrlfile , etoolbox , bm }
+\RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx }
+\RequirePackage{ tikz , mathtools , environ , scrlfile , etoolbox , bm }
\usetikzlibrary{calc,arrows}
-\ProvidesExplPackage {chemmacros} {2012/02/10} {3.0d} {macros and commands for chemists}
+\ProvidesExplPackage
+ {chemmacros}
+ {2012/02/19}
+ {3.1}
+ {macros and commands for chemists}
\@ifpackageloaded { chemformula } {} { \RequirePackage { chemformula } }
@@ -54,9 +59,13 @@
\bool_new:N \l_chemmacros_chemfig_bool
\bool_new:N \l_chemmacros_ghsystem_bool
\bool_set_true:N \l_chemmacros_ghsystem_bool
+\bool_new:N \l_chemmacros_iupac_restricted_bool
+\bool_new:N \l_chemmacros_iupac_strict_bool
+\bool_new:N \l_chemmacros_in_document_bool
\AtBeginDocument
{
+ \bool_set_true:N \l_chemmacros_in_document_bool
\@ifpackageloaded { chemstyle }
{ \bool_set_true:N \l_chemmacros_chemstyle_bool }
{ \bool_set_false:N \l_chemmacros_chemstyle_bool }
@@ -84,6 +93,7 @@
% method => use `chemformula' or `mhchem'
% strict => errors or warnings
% synchronize => let particles et.al. adapt chemformula's font selection
+% iupac => behaviour of nomenclature commands
% version=1 => compatibility for documents set with v1.*
\bool_new:N \l_chemmacros_strict_bool
@@ -101,7 +111,6 @@
{ \bool_set_false:N \l_chemmacros_circled_chem_bool } ,
circletype / chem .code:n =
{ \bool_set_true:N \l_chemmacros_circled_chem_bool } ,
- circletype .default:n = chem ,
circled .choice: ,
circled / none .code:n =
{
@@ -118,33 +127,27 @@
\bool_set_true:N \l_chemmacros_circled_bool
\bool_set_false:N \l_chemmacros_circled_formal_bool
} ,
- circled .default:n = formal ,
+ circled .default:n = all ,
detect-bold .bool_set:N = \l_chemmacros_detect_bold_bool ,
detect-bold .default:n = true ,
- EZ .choice: ,
- EZ / cool .code:n =
- { \bool_set_true:N \l_chemmacros_EZ_cool_bool } ,
- EZ / chemmacros .code:n =
- { \bool_set_false:N \l_chemmacros_EZ_cool_bool } ,
- EZ .default:n = chemmacros ,
+ EZ .code:n =
+ \chemmacros_msg:nnxx { chemmacros } { option-deprecated } { EZ } {} ,
german .bool_set:N = \l_chemmacros_german_bool ,
german .default:n = true ,
ghsystem .bool_set:N = \l_chemmacros_ghsystem_bool ,
ghsystem .default:n = true ,
- ngerman .bool_set:N = \l_chemmacros_german_bool ,
- ngerman .default:n = true ,
method .choice: ,
method / chemformula .code:n =
\bool_set_false:N \l_chemmacros_use_mhchem_bool ,
method / mhchem .code:n =
\bool_set_true:N \l_chemmacros_use_mhchem_bool ,
- method .default:n = chemformula ,
+ ngerman .bool_set:N = \l_chemmacros_german_bool ,
+ ngerman .default:n = true ,
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: ,
@@ -152,6 +155,16 @@
\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 ,
version .choice: ,
@@ -203,20 +216,29 @@
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: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.~Choose~
- another~name.
+ 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.
+ ~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~
+ You've~tried~to~renew~the~particle~\token_to_str:N #1 ,~but~it~doesn't~
exist.
}
@@ -225,18 +247,35 @@
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.~Choose~
- another~name.
+ 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.
+ ~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~
+ 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: .
@@ -259,18 +298,18 @@
work~properly~\msg_line_context: .
}
-\msg_set:nnn { chemmacros } { setnewstate }
+\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 \renewstate \c_space_tl to~alter~it.
+ \token_to_str:N \RenewChemState \c_space_tl to~alter~it.
}
-\msg_set:nnn { chemmacros } { renewstate }
+\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 \setnewstate \c_space_tl to~create~it.
+ \token_to_str:N \DeclareChemState \c_space_tl to~create~it.
}
% --------------------------------------------------------------------------- %
@@ -382,22 +421,29 @@
% --------------------------------------------------------------------------- %
% transition state symbol
+\cs_new_nopar:Npn \chemmacros_transition_state_aux:
+ {
+ \text
+ {
+ \skip_horizontal:n { .1ex }
+ \hbox_overlap_right:n
+ { \rule { .6ex } { 0pt } \rule { .05ex } { 1.3ex } }
+ \hbox_overlap_right:n { \rule [ .4ex ] { 1.3ex } { .05ex } }
+ \rule [ .85ex ] { 1.3ex } { .05ex }
+ \skip_horizontal:n { .1ex }
+ }
+ }
+
\cs_new_nopar:Npn \transitionstatesymbol
- { \ensuremath { \chemmacros_transitionstatesymbol: } }
-\cs_new_nopar:Npn \chemmacros_transitionstatesymbol:
- { \mathpalette \chemmacros_transitionstatesymbol_aux: = }
-\cs_new_nopar:Npn \chemmacros_transitionstatesymbol_aux: #1#2
{
- \ooalign
+ \ensuremath
{
- \tex_hfil:D
- $#1\mid$
- \tex_hfil:D
- \tex_cr:D
- \tex_hfil:D
- $#1#2$
- \tex_hfil:D
- \tex_cr:D
+ \mathchoice
+ { \displaystyle }
+ { \textstyle }
+ { \scriptstyle }
+ { \scriptscriptstyle }
+ \chemmacros_transition_state_aux:
}
}
@@ -412,7 +458,8 @@
\cs_new:Nn \chemmacros_text:n
{ \mode_if_math:TF { \text { #1 } } { #1 } }
-% add a possibility to let chemformula use the chemformula with method=chemformula, too
+% add a possibility to let chemformula use the chemformula
+% with method=chemformula, too
\tl_new:N \l_chemmacros_chemformula_tl
\cs_new:Nn \chemmacros_chemformula:n
{
@@ -611,8 +658,10 @@
\bool_if:NTF \l_chemmacros_use_mhchem_bool
{
\cs_new_nopar:Npn \Hpl { \chemmacros_atom:n { H } \pch \chemmacros_xspace: }
- \cs_new_nopar:Npn \Hyd { \chemmacros_atom:n { OH } \mch \chemmacros_xspace: }
- \cs_new_nopar:Npn \HtO { \chemmacros_chemformula:n { H3O } \pch \chemmacros_xspace: }
+ \cs_new_nopar:Npn \Hyd
+ { \chemmacros_atom:n { OH } \mch \chemmacros_xspace: }
+ \cs_new_nopar:Npn \HtO
+ { \chemmacros_chemformula:n { H3O } \pch \chemmacros_xspace: }
\cs_new_nopar:Npn \El { \chemmacros_atom:n { E } \pch \chemmacros_xspace: }
}
{
@@ -662,7 +711,9 @@
\bool_if:NTF \l_chemmacros_chemfig_bool
{
\bool_if:NTF \l_chemmacros_elpair_dots_bool
- { { \chemmacros_inner_font: #1 \Lewis { 0: , { \vphantom { #1 } } } } }
+ {
+ { \chemmacros_inner_font: #1 \Lewis { 0: , { \vphantom { #1 } } } }
+ }
{ { \chemmacros_inner_font: #1 \Lewis { 0 , \vphantom { #1 } } } }
}
{
@@ -692,16 +743,83 @@
elpair .default:n = dots
}
-% --------------------------------------------------------------------------- %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% IUPAC
+\prop_new:N \l_chemmacros_iupac_prop
+
+\NewDocumentCommand \DeclareChemIUPAC { mm }
+ {
+ \tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 }
+ \tl_set:Nf \l_tmpa_tl { \tl_tail:V \l_tmpa_tl }
+ \prop_if_in:NoTF \l_chemmacros_iupac_prop { \l_tmpa_tl }
+ { \chemmacros_msg:nnxx { chemmacros } { declare-iupac } { #1 } { } }
+ { \prop_put:Non \l_chemmacros_iupac_prop { \l_tmpa_tl } { #2 } }
+ \chemmacros_make_iupac:
+ }
+
+\NewDocumentCommand \RenewChemIUPAC { mm }
+ {
+ \tl_set_rescan:Nnn \l_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 }
+ \tl_set:Nf \l_tmpa_tl { \tl_tail:V \l_tmpa_tl }
+ \prop_if_in:NoTF \l_chemmacros_iupac_prop { \l_tmpa_tl }
+ { \prop_put:Non \l_chemmacros_iupac_prop { \l_tmpa_tl } { #2 } }
+ { \chemmacros_msg:nnxx { chemmacros } { renew-iupac } { #1 } { } }
+ \chemmacros_make_iupac:
+ }
+
+\cs_new_nopar:Npn \chemmacros_make_iupac:
+ {
+ \bool_if:NT \l_chemmacros_in_document_bool
+ {
+ \bool_if:NTF \l_chemmacros_inside_iupac_bool
+ {
+ \prop_map_inline:Nn \l_chemmacros_iupac_prop
+ { \cs_set_protected_nopar:cpn { ##1 } { ##2 } }
+ }
+ {
+ \bool_if:NF \l_chemmacros_iupac_restricted_bool
+ {
+ \bool_if:NTF \l_chemmacros_iupac_strict_bool
+ {
+ \prop_map_inline:Nn \l_chemmacros_iupac_prop
+ { \cs_set_protected_nopar:cpn { ##1 } { ##2 } }
+ }
+ {
+ \prop_map_inline:Nn \l_chemmacros_iupac_prop
+ {
+ \cs_if_exist:cF { ##1 }
+ { \cs_set_protected_nopar:cpn { ##1 } { ##2 } }
+ }
+ }
+ }
+ }
+ }
+ }
+
+\AtBeginDocument { \chemmacros_make_iupac: }
+
% stereo descriptors and other nomenclature commands
% Cahn-Ingold-Prelog
-\cs_new_protected_nopar:Npn \Rcip { \textit { (R) } }
-\cs_new_protected_nopar:Npn \Scip { \textit { (S) } }
-\cs_new_protected_nopar:Npn \cip #1 { \textit { (#1) } }
+\NewDocumentCommand \cip { m } { \textit { (#1) } }
+
+\cs_new_protected_nopar:Npn \Rcip
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \Rcip } { \R }
+ \cip { R }
+ }
+\cs_new_protected_nopar:Npn \Scip
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \Scip } { \S }
+ \cip { S }
+ }
+\DeclareChemIUPAC \R { \cip { R } }
+\DeclareChemIUPAC \S { \cip { S } }
% TikZ needs : to be other
\ExplSyntaxOff
-\NewDocumentCommand\Sconf { O { S } }%
+\NewDocumentCommand\Sconf{O{S}}
{%
\tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex]
{
@@ -710,61 +828,55 @@
}%
}
-\NewDocumentCommand \Rconf { O { R } }%
+\NewDocumentCommand\Rconf{O{R}}
{%
\tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex]
{
\node(a) {#1} ;
\draw[<-,thick,rotate=90] ($(a.center)+(20:.8em)$) arc (20:340:.8em) ;
}%
- }%
+ }
\ExplSyntaxOn
% E(ntgegen)/Z(usammen)
-\AtBeginDocument
- {
- \bool_if:NTF \l_chemmacros_EZ_cool_bool
- {
- \cs_new_protected_nopar:Npn \Ent { \textit { (E) } }
- \cs_new_protected_nopar:Npn \Zus { \textit { (Z) } }
- }
- {
- \cs_if_free:NTF \E
- { \cs_new_protected_nopar:Npn \E { \textit { (E) } } }
- { \cs_set_protected_nopar:Npn \E { \textit { (E) } } }
- \cs_new_protected_nopar:Npn \Z { \textit { (Z) } }
- }
- }
+\DeclareChemIUPAC \E { \textit { (E) } }
+\DeclareChemIUPAC \Z { \textit { (Z) } }
% cis/trans & tert
-\AtBeginDocument
- {
- \cs_if_free:NTF \cis
- { \cs_new_protected_nopar:Npn \cis { \textit { cis } } }
- { \cs_set_protected_nopar:Npn \cis { \textit { cis } } }
- \cs_if_free:NTF \trans
- { \cs_new_protected_nopar:Npn \trans { \textit { trans } } }
- { \cs_set_protected_nopar:Npn \trans { \textit { trans } } }
- }
-\cs_new_protected_nopar:Npn \tert { \textit { tert } }
+\DeclareChemIUPAC \cis { \textit{ cis } }
+\DeclareChemIUPAC \trans { \textit { trans } }
+\DeclareChemIUPAC \tert { \textit { tert } }
% Fischer
-\cs_new_protected_nopar:Npn \Dfi { \textsc { d } }
-\cs_new_protected_nopar:Npn \Lfi { \textsc { l } }
+\cs_set_protected_nopar:Npn \Dfi
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \Dfi } { \D }
+ \textsc { d }
+ }
+\cs_set_protected_nopar:Npn \Lfi
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \Lfi } { \L }
+ \textsc { l }
+ }
+\DeclareChemIUPAC \D { \textsc { d } }
+\DeclareChemIUPAC \L { \textsc { l } }
% ortho/meta/para
-\cs_new_protected_nopar:Npn \ortho { \textsl { o } }
-\cs_new_protected_nopar:Npn \meta { \textsl { m } }
-\cs_new_protected_nopar:Npn \para { \textsl { p } }
+\DeclareChemIUPAC \ortho { \textsl { o } }
+\DeclareChemIUPAC \meta { \textsl { m } }
+\DeclareChemIUPAC \para { \textsl { p } }
% syn/anti
-\cs_new_protected_nopar:Npn \syn { \textit { syn } }
-\cs_new_protected_nopar:Npn \anti { \textit { anti } }
+\DeclareChemIUPAC \syn { \textit { syn } }
+\DeclareChemIUPAC \anti { \textit { anti } }
% \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
% - add a (very) little space after the hyphen
+% - enables all naming commands regardless if they're definied otherwise or not
\cs_new_protected:Nn \chemmacros_allow_hyphens:
{ \tex_penalty:D \c_ten_thousand \skip_horizontal:n { \c_zero_dim } }
\cs_new_protected:Nn \chemmacros_break_point_hyphen:
@@ -776,9 +888,13 @@
\chemmacros_allow_hyphens:
}
+\bool_new:N \l_chemmacros_inside_iupac_bool
+
\cs_new_protected:Nn \chemmacros_iupac:n
{
\group_begin:
+ \bool_set_true:N \l_chemmacros_inside_iupac_bool
+ \chemmacros_make_iupac:
\tex_ignorespaces:D
\cs_set_eq:NN \- \chemmacros_break_point_hyphen:
\cs_set_eq:NN \| \chemmacros_break_point:
@@ -793,7 +909,7 @@
\cs_set_protected_nopar:Npx \- { \exp_not:o { \- } }
\cs_set_eq:NN \@dischyph \-
-\cs_set_eq:NN \iupac \chemmacros_iupac:n
+\cs_set_eq:NN \iupac \chemmacros_iupac:n
% latin phrases
\AtBeginDocument
@@ -812,9 +928,15 @@
% --------------------------------------------------------------------------- %
% acid/base
\cs_new_nopar:Npn \pH
- { \mbox { \chemmacros_detect_bold:n { \textsl { p } H } } \chemmacros_xspace: }
+ {
+ \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: }
+ {
+ \mbox { \chemmacros_detect_bold:n { \textsl { p } OH } }
+ \chemmacros_xspace:
+ }
\NewDocumentCommand \p { m }
{
\mbox
@@ -924,10 +1046,10 @@
% --------------------------------------------------------------------------- %
% substituents
-% \R[<sign>]{<subscript>}
+% \Rad[<sign>]{<subscript>}
\char_set_catcode_math_subscript:N \@
-\NewDocumentCommand \R { o g }
+\NewDocumentCommand \Rad { o g }
{
\chemmacros_atom:n
{
@@ -1354,11 +1476,17 @@
\tikz[remember~picture,overlay]
{
\chemmacros_tikz_draw:f { \tl_use:N \l_chemmacros_redox_tikz_tl }
- ($(\l_chemmacros_redox_begin_tl . \l_chemmacros_redox_side_tl)+(0,\l_chemmacros_redox_sep_dim)$)
+ ($
+ (\l_chemmacros_redox_begin_tl .
+ \l_chemmacros_redox_side_tl)+(0,\l_chemmacros_redox_sep_dim)
+ $)
--
++(0,\l_chemmacros_redox_shift_tl * \l_chemmacros_redox_dist_dim) -|
node [pos=.25,\l_chemmacros_redox_anchor_tl] { { #4 } }
- ($(\l_chemmacros_redox_end_tl . \l_chemmacros_redox_side_tl)+(0,\l_chemmacros_redox_sep_dim)$) ;
+ ($
+ (\l_chemmacros_redox_end_tl .
+ \l_chemmacros_redox_side_tl)+(0,\l_chemmacros_redox_sep_dim)
+ $) ;
}
}
@@ -1766,10 +1894,10 @@
\tl_set:Nn \l_chemmacros_reaction_lorname_tl { #1 ~ }
}
-% \newreaction[<keyval>]{<name>}{<type>}
+% \DeclareChemReaction[<keyval>]{<name>}{<type>}
\bool_if:NF \l_chemmacros_version_one_bool
{
- \NewDocumentCommand \newreaction { o m m }
+ \NewDocumentCommand \DeclareChemReaction { o m m }
{
\cs_if_exist:cTF { #2 }
{ \msg_error:nnx { chemmacros } { already-defined } { #2 } }
@@ -1834,6 +1962,12 @@
}
\ignorespaces
}
+ \cs_set:Npn \newreaction
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \newreaction } { \DeclareChemReaction }
+ \DeclareChemReaction
+ }
}
\cs_new:Npn \chemmacros_equation_chemformula:n #1
@@ -1847,8 +1981,8 @@
% predefined:
\bool_if:NF \l_chemmacros_version_one_bool
{
- \newreaction [ star ] { reaction } { equation }
- \newreaction [ star ] { reactions } { align }
+ \DeclareChemReaction [ star ] { reaction } { equation }
+ \DeclareChemReaction [ star ] { reactions } { align }
}
% --------------------------------------------------------------------------- %
@@ -1998,10 +2132,10 @@
\l_chemmacros_thermod_delta_default_tl
}
-% \setnewstate[<keyval>]{<name>}{<symbol>}{<unit>}
+% \DeclareChemState[<keyval>]{<name>}{<symbol>}{<unit>}
\bool_if:NF \l_chemmacros_version_one_bool
{
- \cs_new:Npn \setnewstate
+ \cs_new:Npn \DeclareChemState
{
\bool_set_false:N \l_chemmacros_renewstate_bool
\chemmacros_setnewstate_reset:
@@ -2009,8 +2143,8 @@
{ \setnewstate_aux_i:n }
{ \setnewstate_aux_ii:nnn }
}
-% \renewstate[<keyval>]{<name>}{<symbol>}{<unit>}
- \cs_new:Npn \renewstate
+% \RenewChemState[<keyval>]{<name>}{<symbol>}{<unit>}
+ \cs_new:Npn \RenewChemState
{
\bool_set_true:N \l_chemmacros_renewstate_bool
\chemmacros_setnewstate_reset:
@@ -2018,6 +2152,18 @@
{ \setnewstate_aux_i:n }
{ \setnewstate_aux_ii:nnn }
}
+ \cs_set:Npn \setnewstate
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \setnewstate } { \DeclareChemState }
+ \DeclareChemState
+ }
+ \cs_set:Npn \renewstate
+ {
+ \chemmacros_msg:nnxx { chemmacros } { command-deprecated }
+ { \renewstate } { \RenewChemState }
+ \RenewChemState
+ }
}
\cs_new_nopar:Npn \chemmacros_setnewstate_reset:
@@ -2152,10 +2298,10 @@
% predefined:
\bool_if:NF \l_chemmacros_version_one_bool
{
- \setnewstate {Enthalpy} {H} {\kilo\joule\per\mole}
- \setnewstate [ delta=false, subscript-left=false ] {Entropy}
+ \DeclareChemState {Enthalpy} {H} {\kilo\joule\per\mole}
+ \DeclareChemState [ delta=false, subscript-left=false ] {Entropy}
{S} {\joule\per\kelvin\per\mole}
- \setnewstate {Gibbs} {G} {\kilo\joule\per\mole}
+ \DeclareChemState {Gibbs} {G} {\kilo\joule\per\mole}
}
% --------------------------------------------------------------------------- %
@@ -2453,9 +2599,10 @@
\keys_define:nn { chemmacros / orbital / s }
{
phase .choice: ,
- phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_s_phase_bool } ,
- phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_s_phase_bool } ,
- phase .default:n = + ,
+ phase / + .code:n =
+ { \bool_set_true:N \l_chemmacros_orbital_s_phase_bool } ,
+ phase / - .code:n =
+ { \bool_set_false:N \l_chemmacros_orbital_s_phase_bool } ,
scale .tl_set:N = \l_chemmacros_orbital_s_scale_tl ,
color .tl_set:N = \l_chemmacros_orbital_s_color_tl
}
@@ -2501,8 +2648,10 @@
\keys_define:nn { chemmacros / orbital / p }
{
phase .choice: ,
- phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_p_phase_bool } ,
- phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_p_phase_bool } ,
+ phase / + .code:n =
+ { \bool_set_true:N \l_chemmacros_orbital_p_phase_bool } ,
+ phase / - .code:n =
+ { \bool_set_false:N \l_chemmacros_orbital_p_phase_bool } ,
scale .tl_set:N = \l_chemmacros_orbital_p_scale_tl ,
angle .fp_set:N = \l_chemmacros_orbital_angle_fp ,
color .tl_set:N = \l_chemmacros_orbital_p_color_tl ,
@@ -2595,8 +2744,10 @@
\keys_define:nn { chemmacros / orbital / sp }
{
phase .choice: ,
- phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_sp_phase_bool } ,
- phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_sp_phase_bool } ,
+ phase / + .code:n =
+ { \bool_set_true:N \l_chemmacros_orbital_sp_phase_bool } ,
+ phase / - .code:n =
+ { \bool_set_false:N \l_chemmacros_orbital_sp_phase_bool } ,
scale .tl_set:N = \l_chemmacros_orbital_sp_scale_tl ,
angle .fp_set:N = \l_chemmacros_orbital_angle_fp ,
color .tl_set:N = \l_chemmacros_orbital_sp_color_tl
@@ -2684,8 +2835,10 @@
\keys_define:nn { chemmacros / orbital / sp2 }
{
phase .choice: ,
- phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_sptwo_phase_bool } ,
- phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_sptwo_phase_bool } ,
+ phase / + .code:n =
+ { \bool_set_true:N \l_chemmacros_orbital_sptwo_phase_bool } ,
+ phase / - .code:n =
+ { \bool_set_false:N \l_chemmacros_orbital_sptwo_phase_bool } ,
scale .tl_set:N = \l_chemmacros_orbital_sptwo_scale_tl ,
angle .fp_set:N = \l_chemmacros_orbital_angle_fp ,
color .tl_set:N = \l_chemmacros_orbital_sptwo_color_tl
@@ -2773,8 +2926,10 @@
\keys_define:nn { chemmacros / orbital / sp3 }
{
phase .choice: ,
- phase / + .code:n = { \bool_set_true:N \l_chemmacros_orbital_spthree_phase_bool } ,
- phase / - .code:n = { \bool_set_false:N \l_chemmacros_orbital_spthree_phase_bool } ,
+ phase / + .code:n =
+ { \bool_set_true:N \l_chemmacros_orbital_spthree_phase_bool } ,
+ phase / - .code:n =
+ { \bool_set_false:N \l_chemmacros_orbital_spthree_phase_bool } ,
scale .tl_set:N = \l_chemmacros_orbital_spthree_scale_tl ,
angle .fp_set:N = \l_chemmacros_orbital_angle_fp ,
color .tl_set:N = \l_chemmacros_orbital_spthree_color_tl
@@ -3046,10 +3201,11 @@ Version history
- 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
+ - 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
@@ -3070,7 +3226,8 @@ Version history
- 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 \DeclareChemParticle, updated documentation
+2012/02/03 - version 3.0b - new command \DeclareChemParticle, updated
+ documentation
2012/02/05 - version 3.0c - renamed pictogram files (following a request by
Karl Berry for TeXlive)
- new package option "Nu"
@@ -3078,9 +3235,22 @@ Version history
- bugfixes with \DeclareChemParticle
- new command \RenewChemParticle
- new option phases / pos
- - new commands \DeclareChemPhase, \RenewChemPhase, \phase
+ - new commands \DeclareChemPhase, \RenewChemPhase,
+ \phase
- 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
+ - deprecated commands:
+ \newreaction => \DeclareChemReaction
+ \setnewstate => \DeclareChemState
+ \renewstate => \RenewChemState
+ \Rcip => \R
+ \Scip => \S
+ \Dfi => \D
+ \Lfi => \L
+ - new arrow types in the chemformula package
% --------------------------------------------------------------------------- %
% TODO:
diff --git a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
index 8ca91155606..0e729748933 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
@@ -5,7 +5,7 @@
% - macros and commands for chemists - %
% --------------------------------------------------------------------------- %
% - Clemens Niederberger - %
-% - 2012/02/10 - %
+% - 2012/02/19 - %
% --------------------------------------------------------------------------- %
% - https://bitbucket.org/cgnieder/chemmacros/ - %
% - contact@mychemistry.eu - %
@@ -28,7 +28,11 @@
% - The Current Maintainer of this work is Clemens Niederberger. - %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{ expl3 }
-\ProvidesExplPackage {ghsystem} {2012/02/10} {3.0d} {globally harmonised system}
+\ProvidesExplPackage
+ {ghsystem}
+ {2012/02/19}
+ {3.1}
+ {globally harmonised system}
% --------------------------------------------------------------------------- %
% error and warning messages:
@@ -47,8 +51,8 @@
}
{
You've~tried~to~call~statement~#1#2~ \msg_line_context: \c_space_tl but~it~
- it~is~not~defined~in~ghsystem.sty . ~ Are~you~sure~it~exists? ~ If~so~please~send
- ~a~message~to~the~author.~Thanks.
+ it~is~not~defined~in~ghsystem.sty . ~ Are~you~sure~it~exists? ~ If~so~please
+ ~send~a~message~to~the~author.~Thanks.
}
\msg_set:nnnn { ghsystem } { booktabs }
@@ -152,7 +156,8 @@
\bool_set_true:c { l_ghsystem_#1_bool }
\input { language / ghsystem_#1.def } \ExplSyntaxOn ,
% \ghs options:
- hide .bool_set:N = \l_ghsystem_hide_statement_bool ,
+ hide .bool_set:N =
+ \l_ghsystem_hide_statement_bool ,
hide .default:n = true ,
fill-in .bool_set:N = \l_ghsystem_fill_in_bool ,
fill-in .default:n = true ,
@@ -168,8 +173,10 @@
\cs_set:Npn \ghsystem_substance: { ~ #1 } ,
text .code:n =
\cs_set:Npn \ghsystem_text: { ~ #1 } ,
- space .tl_set:N = \l_ghsystem_number_space_tl ,
- C-temperature .tl_set:N = \l_ghsystem_celsius_temperature_tl ,
+ space .tl_set:N =
+ \l_ghsystem_number_space_tl ,
+ C-temperature .tl_set:N =
+ \l_ghsystem_celsius_temperature_tl ,
F-temperature .tl_set:N =
\l_ghsystem_fahrenheit_temperature_tl ,
kg-mass .tl_set:N = \l_ghsystem_kg_mass_tl ,
@@ -185,8 +192,10 @@
% \ghslistall options:
table-head-number .tl_set:N = \l_ghsystem_identifier_tl ,
table-head-text .tl_set:N = \l_ghsystem_table_text_tl ,
- table-next-page .tl_set:N = \l_ghsystem_table_next_page_tl ,
- table-row-sep .dim_set:N = \l_ghsystem_table_line_sep_dim ,
+ table-next-page .tl_set:N =
+ \l_ghsystem_table_next_page_tl ,
+ table-row-sep .dim_set:N =
+ \l_ghsystem_table_line_sep_dim ,
table-head-rule .choice: ,
table-head-rule / default .code:n =
\tl_set:Nn \l_ghsystem_table_head_rule_tl { \hline } ,
@@ -237,7 +246,8 @@
\tl_clear:N \l_ghsystem_table_foot_rule_tl
\tl_clear:N \l_ghsystem_table_last_foot_rule_tl ,
table-caption .tl_set:N = \l_ghsystem_table_caption_tl ,
- table-caption-short .tl_set:N = \l_ghsystem_table_caption_short_tl ,
+ table-caption-short .tl_set:N =
+ \l_ghsystem_table_caption_short_tl ,
table-label .tl_set:N = \l_ghsystem_table_label_tl
}
@@ -349,11 +359,13 @@
\exp_args:No \label { \l_ghsystem_table_label_tl }
} \\
\l_ghsystem_table_top_head_rule_tl
- \textbf { \l_ghsystem_identifier_tl } & \textbf { \l_ghsystem_table_text_tl } \\
+ \textbf { \l_ghsystem_identifier_tl } &
+ \textbf { \l_ghsystem_table_text_tl } \\
\l_ghsystem_table_head_rule_tl
\endfirsthead
\l_ghsystem_table_top_head_rule_tl
- \textbf { \l_ghsystem_identifier_tl } & \textbf { \l_ghsystem_table_text_tl } \\
+ \textbf { \l_ghsystem_identifier_tl } &
+ \textbf { \l_ghsystem_table_text_tl } \\
\l_ghsystem_table_head_rule_tl
\endhead
\l_ghsystem_table_last_foot_rule_tl
@@ -416,7 +428,10 @@
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / ghsystem } { #1 } }
\ghsystem_includegraphics:xn
- { scale=\fp_to_tl:N \l_ghsystem_picture_scale_fp \l_ghsystem_picture_includegraphics_tl }
+ {
+ scale = \fp_to_tl:N \l_ghsystem_picture_scale_fp
+ \l_ghsystem_picture_includegraphics_tl
+ }
{ pictures / ghsystem_ #2 . \l_ghsystem_picture_type_tl }
\group_end:
}
@@ -432,8 +447,12 @@ VERSION HISTORY
2012/01/30 - version 3.0a - bugfix in chemormula.sty, renamed ghs => ghsystem
2012/02/03 - version 3.0b - updated documentation
2012/02/05 - version 3.0c - renamed pictogram files
-2012/02/1ß - version 3.0d - several bugfixes in chemformula, some new commands
+2012/02/10 - version 3.0d - several bugfixes in chemformula, some new commands
and options in chemmacros
+2012/02/19 - version 3.1 - new functions in the chemmacros package
+ - new arrow types and functions in the chemformula
+ package
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
diff --git a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def
index 1b63cd3ca98..58d8f861c98 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def
+++ b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def
@@ -248,7 +248,7 @@
\prop_put:Nnn \l_ghsystem_p_prop { 321 } { Spe~ci\-fic~treat\-ment~(see ~ \l_ghsystem_dots_tl\ on~this~la\-bel). }
\prop_put:Nnn \l_ghsystem_p_prop { 322 } { Spe~ci\-fic~mea\-sures~(see ~ \l_ghsystem_dots_tl\ on~this~la\-bel). }
\prop_put:Nnn \l_ghsystem_p_prop { 330 } { Rinse~mouth. }
-\prop_put:Nnn \l_ghsystem_p_prop { 331 } { Do~NOT~in\-duse~vo\-mitting. }
+\prop_put:Nnn \l_ghsystem_p_prop { 331 } { Do~NOT~in\-duce~vo\-mitting. }
\prop_put:Nnn \l_ghsystem_p_prop { 332 } { If~skin~irri\-tation~occurs : \ghsystem_text: }
\prop_put:Nnn \l_ghsystem_p_prop { 333 } { If~skin~irri\-tation~or~rash~occurs : \ghsystem_text: }
\prop_put:Nnn \l_ghsystem_p_prop { 334 } { Immerse~in~cool~wa\-ter/wrap~in~wet~ban\-da\-ges. }