summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-02 23:39:18 +0000
committerKarl Berry <karl@freefriends.org>2011-12-02 23:39:18 +0000
commit396e2cc2fa5d8e4b6f6c9e739131f32720e845bb (patch)
treec3a8abdd4377cd6314275516cc0986a43908dd0d /Master/texmf-dist/tex/latex/chemnum/chemnum.sty
parentb7e22d5720b65bafa6dba2f4282093cca3f26c00 (diff)
chemnum (2dec11)
git-svn-id: svn://tug.org/texlive/trunk@24724 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemnum/chemnum.sty')
-rw-r--r--Master/texmf-dist/tex/latex/chemnum/chemnum.sty400
1 files changed, 259 insertions, 141 deletions
diff --git a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
index f543c8c883c..e14348008b3 100644
--- a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
+++ b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
@@ -1,9 +1,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - chemnum - chemnum.sty - %
-% - a comprehensive numbering method for chemical compounds - %
+% - a comprehensive approach for the numbering of chemical compounds - %
% --------------------------------------------------------------------------- %
% - Clemens NIEDERBERGER - %
-% - 2011/11/08 - %
+% - 2011/12/01 - %
% --------------------------------------------------------------------------- %
% - http://www.mychemistry.eu/ - %
% - contact@mychemistry.eu - %
@@ -26,12 +26,13 @@
% - The Current Maintainer of this work is Clemens Niederberger. - %
% - - %
% - This work consists of the files chemnum.sty, chemnum_doc_de.tex, - %
-% - chemnum_doc_en.tex, bsp.tex, scheme-tmp.eps, scheme-bla.eps README and - %
-% - the derived files chemnum_doc_de.pdf and chemnum_doc_en.pdf - %
+% - chemnum_doc_en.tex, chemnum-codehelper.tex, scheme-tmp.eps, - %
+% - scheme-bla.eps, README and the derived files chemnum_doc_de.pdf and - %
+% - chemnum_doc_en.pdf - %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\RequirePackage { expl3 , xparse , etoolbox , psfrag }
+\RequirePackage { expl3 , xparse , l3keys2e , etoolbox , psfrag }
-\ProvidesExplPackage {chemnum} {2011/11/08} {0.3c} {Numbering chemical compounds}
+\ProvidesExplPackage {chemnum} {2011/12/01} {0.3e} {Numbering chemical compounds}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CHECK FOR SUPPORT
@@ -79,39 +80,34 @@
% warning, if textgreek has already been loaded AND option
% "textgreek = <value>" is used
-\msg_set:nnnn { chemnum } { package-loaded }
- { Package~#1~already~loaded. }
+\msg_set:nnnn { chemnum } { textgreek-loaded }
{
- The~package~#1~has~already~been~loaded. \\
- \tl_if_blank:nF { #2 } { Option~#2~will~not~be~used. }
+ The~package~textgreek~has~already~been~loaded. \\
+ \tl_if_blank:nF { #1 } { Option~#1~will~not~be~used. }
+ }
+ {
+ The~package~textgreek~has~already~been~loaded. \\
+ \tl_if_blank:nF { #1 } { Option~#1~will~not~be~used. }
}
% textgreek support and package options:
\bool_new:N \l_chemnum_textgreek_bool
+\bool_set_false:N \l_chemnum_textgreek_bool
-\cs_new:Npn \chemnum_load_package:nn #1#2
+\cs_new_nopar:Npn \chemnum_load_textgreek:n #1
{
- \bool_if:cT { l_chemnum_#2_bool }
+ \AtEndPreamble
{
- \AtEndPreamble
+ \exp_args:No \file_if_exist:nTF { textgreek . sty }
{
- \exp_args:No \file_if_exist:nTF { #2 . sty }
- {
- \tl_if_blank:nTF { #1 }
- { \RequirePackage { #2 } }
- {
- \@ifpackageloaded { #2 }
- {
- \msg_warning:nnxx
- { chemnum } { package-loaded } { #2 } { #1 }
- }
- { \RequirePackage [ #1 ] { #2 } }
- }
- }
- {
- \msg_warning:nnx { chemnum } { support-missing } { #2 }
- \bool_set_false:c { l_chemnum_#2_bool }
- }
+ \@ifpackageloaded { textgreek }
+ { \msg_warning:nnx { chemnum } { textgreek-loaded } { #1 } }
+ { \RequirePackage [ #1 ] { textgreek } }
+ \bool_set_true:N \l_chemnum_textgreek_bool
+ }
+ {
+ \msg_warning:nnx { chemnum } { support-missing } { textgreek }
+ \bool_set_false:N \l_chemnum_textgreek_bool
}
}
}
@@ -121,37 +117,126 @@
\keys_define:nn { chemnum / package } {
textgreek .choice: ,
- textgreek .choice_code:n =
- \chemnum_load_package:nn \l_keys_choice_tl { textgreek } ,
- textgreek .generate_choices:n = { artemisia , cbgreek , euler } ,
- textgreek .default:n = cbgreek
+ textgreek / artemisia .code:n = \chemnum_load_textgreek:n { #1 } ,
+ textgreek / cbgreek .code:n = \chemnum_load_textgreek:n { #1 } ,
+ textgreek / euler .code:n = \chemnum_load_textgreek:n { #1 } ,
+ textgreek / false .code:n =
+ { \bool_set_false:N \l_chemnum_textgreek_bool } ,
+ textgreek .default:n = cbgreek
}
-\DeclareOption { textgreek }
- {
- \bool_set_true:N \l_chemnum_textgreek_bool
- \chemnum_package_options:n { textgreek }
- }
-\DeclareOption { textgreek = artemisia }
- {
- \bool_set_true:N \l_chemnum_textgreek_bool
- \chemnum_package_options:n { textgreek = artemisia }
- }
-\DeclareOption { textgreek = cbgreek }
+\ProcessKeysOptions { chemnum / package }
+
+\AtBeginDocument{
+\bool_if:NTF \l_chemnum_textgreek_bool
{
- \bool_set_true:N \l_chemnum_textgreek_bool
- \chemnum_package_options:n { textgreek = cbgreek }
+ \cs_new_eq:NN \chemnum_alpha \textalpha
+ \cs_new_eq:NN \chemnum_beta \textbeta
+ \cs_new_eq:NN \chemnum_gamma \textgamma
+ \cs_new_eq:NN \chemnum_delta \textdelta
+ \cs_new_eq:NN \chemnum_epsilon \textepsilon
+ \cs_new_eq:NN \chemnum_zeta \textzeta
+ \cs_new_eq:NN \chemnum_eta \texteta
+ \cs_new_eq:NN \chemnum_theta \texttheta
+ \cs_new_eq:NN \chemnum_iota \textiota
+ \cs_new_eq:NN \chemnum_kappa \textkappa
+ \cs_new_eq:NN \chemnum_lambda \textlambda
+ \cs_new_eq:NN \chemnum_mu \textmugreek
+ \cs_new_eq:NN \chemnum_nu \textnu
+ \cs_new_eq:NN \chemnum_xi \textxi
+ \cs_new_eq:NN \chemnum_omikron \textomikron
+ \cs_new_eq:NN \chemnum_pi \textpi
+ \cs_new_eq:NN \chemnum_rho \textrho
+ \cs_new_eq:NN \chemnum_sigma \textsigma
+ \cs_new_eq:NN \chemnum_tau \texttau
+ \cs_new_eq:NN \chemnum_upsilon \textupsilon
+ \cs_new_eq:NN \chemnum_phi \textphi
+ \cs_new_eq:NN \chemnum_chi \textchi
+ \cs_new_eq:NN \chemnum_psi \textpsi
+ \cs_new_eq:NN \chemnum_omega \textomega
+ \cs_new_eq:NN \chemnum_Alpha \textAlpha
+ \cs_new_eq:NN \chemnum_Beta \textBeta
+ \cs_new_eq:NN \chemnum_Gamma \textGamma
+ \cs_new_eq:NN \chemnum_Delta \textDelta
+ \cs_new_eq:NN \chemnum_Epsilon \textEpsilon
+ \cs_new_eq:NN \chemnum_Zeta \textZeta
+ \cs_new_eq:NN \chemnum_Eta \textEta
+ \cs_new_eq:NN \chemnum_Theta \textTheta
+ \cs_new_eq:NN \chemnum_Iota \textIota
+ \cs_new_eq:NN \chemnum_Kappa \textKappa
+ \cs_new_eq:NN \chemnum_Lambda \textLambda
+ \cs_new_eq:NN \chemnum_Mu \textMugreek
+ \cs_new_eq:NN \chemnum_Nu \textNu
+ \cs_new_eq:NN \chemnum_Xi \textXi
+ \cs_new_eq:NN \chemnum_Omikron \textOmikron
+ \cs_new_eq:NN \chemnum_Pi \textPi
+ \cs_new_eq:NN \chemnum_Rho \textRho
+ \cs_new_eq:NN \chemnum_Sigma \textSigma
+ \cs_new_eq:NN \chemnum_Tau \textTau
+ \cs_new_eq:NN \chemnum_Upsilon \textUpsilon
+ \cs_new_eq:NN \chemnum_Phi \textPhi
+ \cs_new_eq:NN \chemnum_Chi \textChi
+ \cs_new_eq:NN \chemnum_Psi \textPsi
+ \cs_new_eq:NN \chemnum_Omega \textOmega
}
-\DeclareOption { textgreek = euler }
{
- \bool_set_true:N \l_chemnum_textgreek_bool
- \chemnum_package_options:n { textgreek = euler }
+ \RequirePackage { bm }% abhängig machen von textoption bold
+ \cs_new_nopar:Npn \chemnum_bm:n #1
+ {
+ \bool_if:NTF \l_chemnum_cmpd_bold_bool
+ { \bm { #1 } }
+ { #1 }
+ }
+ \cs_new_nopar:Npn \chemnum_alpha { \ensuremath { \chemnum_bm:n { \mathrm { \alpha } } } }
+ \cs_new_nopar:Npn \chemnum_beta { \ensuremath { \chemnum_bm:n { \mathrm { \beta } } } }
+ \cs_new_nopar:Npn \chemnum_gamma { \ensuremath { \chemnum_bm:n { \mathrm { \gamma } } } }
+ \cs_new_nopar:Npn \chemnum_delta { \ensuremath { \chemnum_bm:n { \mathrm { \delta } } } }
+ \cs_new_nopar:Npn \chemnum_epsilon { \ensuremath { \chemnum_bm:n { \mathrm { \varepsilon } } } }
+ \cs_new_nopar:Npn \chemnum_zeta { \ensuremath { \chemnum_bm:n { \mathrm { \zeta } } } }
+ \cs_new_nopar:Npn \chemnum_eta { \ensuremath { \chemnum_bm:n { \mathrm { \eta } } } }
+ \cs_new_nopar:Npn \chemnum_theta { \ensuremath { \chemnum_bm:n { \mathrm { \theta } } } }
+ \cs_new_nopar:Npn \chemnum_iota { \ensuremath { \chemnum_bm:n { \mathrm { \iota } } } }
+ \cs_new_nopar:Npn \chemnum_kappa { \ensuremath { \chemnum_bm:n { \mathrm { \kappa } } } }
+ \cs_new_nopar:Npn \chemnum_lambda { \ensuremath { \chemnum_bm:n { \mathrm { \lampda } } } }
+ \cs_new_nopar:Npn \chemnum_mu { \ensuremath { \chemnum_bm:n { \mathrm { \mu } } } }
+ \cs_new_nopar:Npn \chemnum_nu { \ensuremath { \chemnum_bm:n { \mathrm { \nu } } } }
+ \cs_new_nopar:Npn \chemnum_xi { \ensuremath { \chemnum_bm:n { \mathrm { \xi } } } }
+ \cs_new_nopar:Npn \chemnum_omikron { \ensuremath { \chemnum_bm:n { \mathrm { o } } } }
+ \cs_new_nopar:Npn \chemnum_pi { \ensuremath { \chemnum_bm:n { \mathrm { \pi } } } }
+ \cs_new_nopar:Npn \chemnum_rho { \ensuremath { \chemnum_bm:n { \mathrm { \rho } } } }
+ \cs_new_nopar:Npn \chemnum_sigma { \ensuremath { \chemnum_bm:n { \mathrm { \sigma } } } }
+ \cs_new_nopar:Npn \chemnum_tau { \ensuremath { \chemnum_bm:n { \mathrm { \tau } } } }
+ \cs_new_nopar:Npn \chemnum_upsilon { \ensuremath { \chemnum_bm:n { \mathrm { \upsilon } } } }
+ \cs_new_nopar:Npn \chemnum_phi { \ensuremath { \chemnum_bm:n { \mathrm { \varphi } } } }
+ \cs_new_nopar:Npn \chemnum_chi { \ensuremath { \chemnum_bm:n { \mathrm { \chi } } } }
+ \cs_new_nopar:Npn \chemnum_psi { \ensuremath { \chemnum_bm:n { \mathrm { \psi } } } }
+ \cs_new_nopar:Npn \chemnum_omega { \ensuremath { \chemnum_bm:n { \mathrm { \omega } } } }
+ \cs_new_nopar:Npn \chemnum_Alpha { \ensuremath { \chemnum_bm:n { \mathrm { A } } } }
+ \cs_new_nopar:Npn \chemnum_Beta { \ensuremath { \chemnum_bm:n { \mathrm { B } } } }
+ \cs_new_nopar:Npn \chemnum_Gamma { \ensuremath { \chemnum_bm:n { \mathrm { \Gamma } } } }
+ \cs_new_nopar:Npn \chemnum_Delta { \ensuremath { \chemnum_bm:n { \mathrm { \Delta } } } }
+ \cs_new_nopar:Npn \chemnum_Epsilon { \ensuremath { \chemnum_bm:n { \mathrm { E } } } }
+ \cs_new_nopar:Npn \chemnum_Zeta { \ensuremath { \chemnum_bm:n { \mathrm { Z } } } }
+ \cs_new_nopar:Npn \chemnum_Eta { \ensuremath { \chemnum_bm:n { \mathrm { H } } } }
+ \cs_new_nopar:Npn \chemnum_Theta { \ensuremath { \chemnum_bm:n { \mathrm { \Theta } } } }
+ \cs_new_nopar:Npn \chemnum_Iota { \ensuremath { \chemnum_bm:n { \mathrm { I } } } }
+ \cs_new_nopar:Npn \chemnum_Kappa { \ensuremath { \chemnum_bm:n { \mathrm { K } } } }
+ \cs_new_nopar:Npn \chemnum_Lambda { \ensuremath { \chemnum_bm:n { \mathrm { \Lambda } } } }
+ \cs_new_nopar:Npn \chemnum_Mu { \ensuremath { \chemnum_bm:n { \mathrm { M } } } }
+ \cs_new_nopar:Npn \chemnum_Nu { \ensuremath { \chemnum_bm:n { \mathrm { N } } } }
+ \cs_new_nopar:Npn \chemnum_Xi { \ensuremath { \chemnum_bm:n { \mathrm { \Xi } } } }
+ \cs_new_nopar:Npn \chemnum_Omikron { \ensuremath { \chemnum_bm:n { \mathrm { O } } } }
+ \cs_new_nopar:Npn \chemnum_Pi { \ensuremath { \chemnum_bm:n { \mathrm { \Pi } } } }
+ \cs_new_nopar:Npn \chemnum_Rho { \ensuremath { \chemnum_bm:n { \mathrm { P } } } }
+ \cs_new_nopar:Npn \chemnum_Sigma { \ensuremath { \chemnum_bm:n { \mathrm { \Sigma } } } }
+ \cs_new_nopar:Npn \chemnum_Tau { \ensuremath { \chemnum_bm:n { \mathrm { T } } } }
+ \cs_new_nopar:Npn \chemnum_Upsilon { \ensuremath { \chemnum_bm:n { \mathrm { \Upsilon } } } }
+ \cs_new_nopar:Npn \chemnum_Phi { \ensuremath { \chemnum_bm:n { \mathrm { \Phi } } } }
+ \cs_new_nopar:Npn \chemnum_Chi { \ensuremath { \chemnum_bm:n { \mathrm { X } } } }
+ \cs_new_nopar:Npn \chemnum_Psi { \ensuremath { \chemnum_bm:n { \mathrm { \Psi } } } }
+ \cs_new_nopar:Npn \chemnum_Omega { \ensuremath { \chemnum_bm:n { \mathrm { \Omega } } } }
}
-\DeclareOption { textgreek = false }
- { \bool_set_false:N \l_chemnum_textgreek_bool }
-
-\ExecuteOptions { textgreek }
-\ProcessOptions \scan_stop:
+}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TOOLS
@@ -166,7 +251,7 @@
% READ FROM PREVIOUS RUN, SAVE FOR NEXT RUN
% save all labels in a clist
\cs_new:Npn \chemnum_cmpd_save:n #1
- { \clist_gput_right:Nn \g_chemnum_cmpd_save_clist { #1 } }
+ { \clist_gput_right:Nn \g_chemnum_cmpd_save_clist { { #1 } } }
\msg_set:nnn { chemnum } { missing-cmpd-file }
{
@@ -217,7 +302,7 @@
\bool_new:N \l_chemnum_cmpd_style_is_macro_bool
% default style
-\cs_new_nopar:Npn \chemnum_cmpd_style_value:n { \bfseries }
+\cs_new_nopar:Npn \chemnum_cmpd_style_value:n { }
% error message
\msg_set:nnn { chemnum } { cmpd-style } { The~value~of~"cmpd-style~=~<style>"~needs~to~be~a~(or~more)~macro~\msg_line_context: . }
@@ -238,8 +323,17 @@
% }
% use style
+\bool_new:N \l_chemnum_cmpd_bold_bool
+\bool_set_true:N \l_chemnum_cmpd_bold_bool
+
\cs_new_nopar:Npn \chemnum_cmpd_use_style:n #1
- { \group_begin: \chemnum_cmpd_style_value:n { #1 } \group_end: }
+ {
+ \group_begin:
+ \bool_if:NT \l_chemnum_cmpd_bold_bool
+ { \bfseries }
+ \chemnum_cmpd_style_value:n { #1 }
+ \group_end:
+ }
%-----------------------------------------------------------------------------%
% prefix, suffix, delimiters, format and separator of compound label
@@ -289,7 +383,7 @@
% format of sub-numbering
\cs_new_nopar:Npn \chemnum_cmpd_sub_kind:nn #1#2
- { \cs:w int_to_#1:n \cs_end: #2 }
+ { \cs:w int_to_ #1 :n \cs_end: #2 }
\cs_generate_variant:Nn \chemnum_cmpd_sub_kind:nn { Nc }
% default format
@@ -300,42 +394,42 @@
% add greek letters and symbols as numbering format
% define \int_to_greek function
\cs_new:Npn \int_to_greek:n { }
-\bool_if:NTF \l_chemnum_textgreek_bool
- {
+% \bool_if:NTF \l_chemnum_textgreek_bool
+% {
\cs_set:Npn \int_to_greek:n #1
{
\int_convert_to_symbols:nnn {#1} { 24 }
{
- { 1 } { \exp_not:o \textalpha }
- { 2 } { \exp_not:o \textbeta }
- { 3 } { \exp_not:o \textgamma }
- { 4 } { \exp_not:o \textdelta }
- { 5 } { \exp_not:o \textepsilon }
- { 6 } { \exp_not:o \textzeta }
- { 7 } { \exp_not:o \texteta }
- { 8 } { \exp_not:o \texttheta }
- { 9 } { \exp_not:o \textiota }
- { 10 } { \exp_not:o \textkappa }
- { 11 } { \exp_not:o \textlambda }
- { 12 } { \exp_not:o \textmugreek }
- { 13 } { \exp_not:o \textnu }
- { 14 } { \exp_not:o \textxi }
- { 15 } { \exp_not:o \textomikron }
- { 16 } { \exp_not:o \textpi }
- { 17 } { \exp_not:o \textrho }
- { 18 } { \exp_not:o \textsigma }
- { 19 } { \exp_not:o \texttau }
- { 20 } { \exp_not:o \textupsilon }
- { 21 } { \exp_not:o \textphi }
- { 22 } { \exp_not:o \textchi }
- { 23 } { \exp_not:o \textpsi }
- { 24 } { \exp_not:o \textomega }
+ { 1 } { \exp_not:o \chemnum_alpha }
+ { 2 } { \exp_not:o \chemnum_beta }
+ { 3 } { \exp_not:o \chemnum_gamma }
+ { 4 } { \exp_not:o \chemnum_delta }
+ { 5 } { \exp_not:o \chemnum_epsilon }
+ { 6 } { \exp_not:o \chemnum_zeta }
+ { 7 } { \exp_not:o \chemnum_eta }
+ { 8 } { \exp_not:o \chemnum_theta }
+ { 9 } { \exp_not:o \chemnum_iota }
+ { 10 } { \exp_not:o \chemnum_kappa }
+ { 11 } { \exp_not:o \chemnum_lambda }
+ { 12 } { \exp_not:o \chemnum_mu }
+ { 13 } { \exp_not:o \chemnum_nu }
+ { 14 } { \exp_not:o \chemnum_xi }
+ { 15 } { \exp_not:o \chemnum_omikron }
+ { 16 } { \exp_not:o \chemnum_pi }
+ { 17 } { \exp_not:o \chemnum_rho }
+ { 18 } { \exp_not:o \chemnum_sigma }
+ { 19 } { \exp_not:o \chemnum_tau }
+ { 20 } { \exp_not:o \chemnum_upsilon }
+ { 21 } { \exp_not:o \chemnum_phi }
+ { 22 } { \exp_not:o \chemnum_chi }
+ { 23 } { \exp_not:o \chemnum_psi }
+ { 24 } { \exp_not:o \chemnum_omega }
}
}
- }
- {
- \cs_set_eq:NN \int_to_greek:n \int_to_alph:n
- }
+% }
+% {
+% \cs_set_eq:NN \int_to_greek:n \int_to_alph:n
+% }
% define \int_to_Greek function
\cs_new:Npn \int_to_Greek:n { }
@@ -345,30 +439,30 @@
{
\int_convert_to_symbols:nnn { #1 } { 24 }
{
- { 1 } { \exp_not:o \textAlpha }
- { 2 } { \exp_not:o \textBeta }
- { 3 } { \exp_not:o \textGamma }
- { 4 } { \exp_not:o \textDelta }
- { 5 } { \exp_not:o \textEpsilon }
- { 6 } { \exp_not:o \textZeta }
- { 7 } { \exp_not:o \textEta }
- { 8 } { \exp_not:o \textTheta }
- { 9 } { \exp_not:o \textIota }
- { 10 } { \exp_not:o \textKappa }
- { 11 } { \exp_not:o \textLambda }
- { 12 } { \exp_not:o \textMu }
- { 13 } { \exp_not:o \textNu }
- { 14 } { \exp_not:o \textXi }
- { 15 } { \exp_not:o \textOmikron }
- { 16 } { \exp_not:o \textPi }
- { 17 } { \exp_not:o \textRho }
- { 18 } { \exp_not:o \textSigma }
- { 19 } { \exp_not:o \textTau }
- { 20 } { \exp_not:o \textUpsilon }
- { 21 } { \exp_not:o \textPhi }
- { 22 } { \exp_not:o \textChi }
- { 23 } { \exp_not:o \textPsi }
- { 24 } { \exp_not:o \textOmega }
+ { 1 } { \exp_not:o \chemnum_Alpha }
+ { 2 } { \exp_not:o \chemnum_Beta }
+ { 3 } { \exp_not:o \chemnum_Gamma }
+ { 4 } { \exp_not:o \chemnum_Delta }
+ { 5 } { \exp_not:o \chemnum_Epsilon }
+ { 6 } { \exp_not:o \chemnum_Zeta }
+ { 7 } { \exp_not:o \chemnum_Eta }
+ { 8 } { \exp_not:o \chemnum_Theta }
+ { 9 } { \exp_not:o \chemnum_Iota }
+ { 10 } { \exp_not:o \chemnum_Kappa }
+ { 11 } { \exp_not:o \chemnum_Lambda }
+ { 12 } { \exp_not:o \chemnum_Mu }
+ { 13 } { \exp_not:o \chemnum_Nu }
+ { 14 } { \exp_not:o \chemnum_Xi }
+ { 15 } { \exp_not:o \chemnum_Omikron }
+ { 16 } { \exp_not:o \chemnum_Pi }
+ { 17 } { \exp_not:o \chemnum_Rho }
+ { 18 } { \exp_not:o \chemnum_Sigma }
+ { 19 } { \exp_not:o \chemnum_Tau }
+ { 20 } { \exp_not:o \chemnum_Upsilon }
+ { 21 } { \exp_not:o \chemnum_Phi }
+ { 22 } { \exp_not:o \chemnum_Chi }
+ { 23 } { \exp_not:o \chemnum_Psi }
+ { 24 } { \exp_not:o \chemnum_Omega }
}
}
}
@@ -451,7 +545,7 @@
% \catcode 58 = 11 \relax
\tl_new:N \l_chemnum_sub_range_sep_tl
-\tl_set:Nn \l_chemnum_sub_range_sep_tl { - }
+\tl_set:Nn \l_chemnum_sub_range_sep_tl { -- }
\bool_new:N \l_chemnum_sub_label_only_bool
\bool_set_false:N \l_chemnum_sub_label_only_bool
@@ -460,7 +554,9 @@
% property keys for compounds
\keys_define:nn { chemnum } {
cmpd-style .code:n = \chemnum_cmpd_set_style:n { #1 } ,
- cmpd-style .default:n = \textbf ,
+ cmpd-weight .choice: ,
+ cmpd-weight / bold .code:n = \bool_set_true:N \l_chemnum_cmpd_bold_bool ,
+ cmpd-weight / normal .code:n = \bool_set_false:N \l_chemnum_cmpd_bold_bool ,
cmpd-label .code:n =
{
\bool_set_true:N \l_chemnum_cmpd_name_bool
@@ -500,7 +596,7 @@
\chemnum_sublabel_range_marker:n { #1 } ,
sub-range-marker .default:n = { .. } ,
sub-range-sep .tl_set:N = \l_chemnum_sub_range_sep_tl ,
- sub-range-sep .default:n = { - } ,
+ sub-range-sep .default:n = { -- } ,
sub-list .code:n =
{
\tl_set:Nn \l_chemnum_cmpd_sublabel_list_tl { #1 }
@@ -512,9 +608,11 @@
%-----------------------------------------------------------------------------%
% list separators, delimiters, prefix and suffix
-\bool_new:N \l_chemnum_serial_comma_bool
-\bool_set_true:N \l_chemnum_serial_comma_bool
+\bool_new:N \l_chemnum_no_serial_comma_bool
+\bool_set_false:N \l_chemnum_no_serial_comma_bool
+\tl_new:N \l_chemnum_input_separator_tl
+\tl_set:Nn \l_chemnum_input_separator_tl { , }
\tl_new:N \l_chemnum_list_separator_tl
\tl_set:Nn \l_chemnum_list_separator_tl { , }
@@ -565,41 +663,45 @@
list-cdelim .default:n = { } ,
list-space .tl_set:N = \l_chemnum_list_space_tl ,
list-space .default:n = { \penalty\@m\ } ,
- list-sep .tl_set:N = \l_chemnum_list_separator_tl ,
- list-sep .default:n = { , },
+ list-input-sep .tl_set:N = \l_chemnum_input_separator_tl ,
+ list-input-sep .default:n = { , } ,
+ list-output-sep .tl_set:N = \l_chemnum_list_separator_tl ,
+ list-output-sep .default:n = { , } ,
list-last-sep .tl_set:N = \l_chemnum_list_last_separator_tl ,
list-last-sep .default:n = \l_chemnum_list_last_separator_lang_tl ,
- list-serial-comma .bool_set:N = \l_chemnum_serial_comma_bool ,
+ list-serial-comma .choice: ,
+ list-serial-comma / true .code:n = \bool_set_false:N \l_chemnum_no_serial_comma_bool ,
+ list-serial-comma / false .code:n = \bool_set_true:N \l_chemnum_no_serial_comma_bool ,
list-serial-comma .default:n = true ,
list-lang .choice: ,
list-lang / US .code:n =
{
- \bool_set_true:N \l_chemnum_serial_comma_bool
+ \bool_set_false:N \l_chemnum_no_serial_comma_bool
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { and }
} ,
list-lang / GB .code:n =
{
- \bool_set_false:N \l_chemnum_serial_comma_bool
+ \bool_set_true:N \l_chemnum_no_serial_comma_bool
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { and }
} ,
list-lang / DE .code:n =
{
- \bool_set_false:N \l_chemnum_serial_comma_bool
+ \bool_set_true:N \l_chemnum_no_serial_comma_bool
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { und }
} ,
list-lang / FR .code:n =
{
- \bool_set_false:N \l_chemnum_serial_comma_bool
+ \bool_set_true:N \l_chemnum_no_serial_comma_bool
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { et }
} ,
list-lang / IT .code:n =
{
- \bool_set_false:N \l_chemnum_serial_comma_bool
+ \bool_set_true:N \l_chemnum_no_serial_comma_bool
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { e }
} ,
list-lang / ES .code:n =
{
- \bool_set_false:N \l_chemnum_serial_comma_bool
+ \bool_set_true:N \l_chemnum_no_serial_comma_bool
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { y }
} ,
list-lang .default:n = US
@@ -637,7 +739,9 @@
\chemnum_cmpd_save:n { #1 _ #2 }
\cs_new_nopar:cpx { chemnum_cmpd_#1_#2: } { }
\int_gincr:c { g_chemnum_cmpd_#1_int }
- \cs_gset_nopar:cx { chemnum_cmpd_#1_#2: }
+ % why is the next line working when \cs_gset_nopar:cpx doesn't?
+ % (in case ":" is part of #1)
+ \exp_after:wN \cs_gset_nopar:Npx \cs:w chemnum_cmpd_#1_#2: \cs_end:
{
\chemnum_cmpd_sub_kind:Nc
\l_chemnum_cmpd_sub_kind_value_tl
@@ -901,6 +1005,10 @@
% MAIN COMMAND
% \cmpd*+-[<key-value-list>]{<(possibly comma separated list of) compound
% label(s)>}
+\NewDocumentCommand \chemnum_input_separator:n
+ { > { \exp_args:No \SplitList { \l_chemnum_input_separator_tl } } m }
+ { \tl_set:Nn \l_tmpa_tl { #1 } }
+
\NewDocumentCommand \cmpd { s t+ t- o m }
{
\IfBooleanT #2
@@ -915,12 +1023,13 @@
\int_zero:N \l_chemnum_list_separate_int
\IfNoValueF { #4 }
{ \keys_set:nn { chemnum } { #4 } }
- \clist_map_variable:nNn { #5 } \l_chemnum_tmpa_tl
+ \chemnum_input_separator:n { #5 }
+ \tl_map_variable:NNn \l_tmpa_tl \l_chemnum_tmpa_tl
{
\tl_if_blank:VF \l_chemnum_tmpa_tl
{ \int_incr:N \l_chemnum_list_items_int }
}
- \clist_map_variable:nNn { #5 } \l_chemnum_tmpa_tl
+ \tl_map_variable:NNn \l_tmpa_tl \l_chemnum_tmpa_tl
{
\tl_remove_all:Nn \l_chemnum_tmpa_tl { ~ }
\tl_if_blank:VF \l_chemnum_tmpa_tl
@@ -990,7 +1099,7 @@
{
\int_compare:nNnF { \l_chemnum_list_separate_int } = { 1 }
{
- \bool_if:NT \l_chemnum_serial_comma_bool
+ \bool_if:NF \l_chemnum_no_serial_comma_bool
{ \l_chemnum_list_separator_tl }
}
\tl_if_blank:VF \l_chemnum_list_last_separator_tl
@@ -1099,7 +1208,8 @@
{ \bool_set_false:N \l_chemnum_cmpd_init_declare_bool }
{ \bool_set_true:N \l_chemnum_cmpd_init_declare_bool }
\IfNoValueF { #2 } { \keys_set:nn { chemnum / init } { #2 } }
- \clist_map_function:nN { #3 } \chemnum_cmpd_init:n
+ \chemnum_input_separator:n { #3 }
+ \tl_map_function:NN \l_tmpa_tl \chemnum_cmpd_init:n
}
%-----------------------------------------------------------------------------%
@@ -1197,15 +1307,15 @@
\@ifpackageloaded { babel }
{
\iflanguage { american }
- { \bool_set_true:N \l_chemnum_serial_comma_bool }
- { \bool_set_false:N \l_chemnum_serial_comma_bool }
+ { \bool_set_false:N \l_chemnum_no_serial_comma_bool }
+ { \bool_set_true:N \l_chemnum_no_serial_comma_bool }
\cs_new_eq:NN \chemnum_selectlanguage:n \selectlanguage
\cs_set_nopar:Npn \selectlanguage #1
{
\chemnum_selectlanguage:n { #1 }
\iflanguage { american }
- { \bool_set_true:N \l_chemnum_serial_comma_bool }
- { \bool_set_false:N \l_chemnum_serial_comma_bool }
+ { \bool_set_false:N \l_chemnum_no_serial_comma_bool }
+ { \bool_set_true:N \l_chemnum_no_serial_comma_bool }
}
}
{}
@@ -1252,14 +1362,22 @@ HISTORY:
http://www.arkat-usa.org/get-file/29257/ or scheme 4
at http://www.arkat-usa.org/get-file/27301/ for
reasons, why
- 2011/11/08 version 0.3c - localization via babel is now supported with the help
- of the translator package
+ 2011/11/08 version 0.3c - localization via babel is now supported with the
+ help of the translator package
- key "list-serial-comma" added
+ 2011/12/01 version 0.3d - greek letters without textgreek package
+ - new key cmpd-weight = bold/normal
+ - bugfix: sublabels are now possible, when main label
+ name contains a colon
+ - it is now possible to change the list input
+ separator; this means the comma may be part of the
+ label name
+ 2011/12/01 version 0.3e - bugfix: labels have been saved in a wrong way, when
+ list-input-sep had been changed. this is fixed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
- - Bug: wenn als "sub-marker" ":" von einer anderen Datei gesetzt wird, wird
- der Key nicht erkannt -> catcode Problem: entweder temporär catcode von ":"
- wieder auf 12 setzen oder den Marker prinzipiell auf 11?
+ - natürliche Unterstützung für hyperref
+ - polyglossia: localization of us-variant of english
- alphabetische Sortierung für sub-list
- Bug: Key "cmpd-style" wenn zB \color{<farbe>} eingegeben: Fehler beim Test
auf Makro; Test entfernen?