summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemnum
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-05 00:16:09 +0000
committerKarl Berry <karl@freefriends.org>2011-09-05 00:16:09 +0000
commitf5b4e2827c52206834b8c921b5a037c615b24f3a (patch)
tree6d63b57e789ca438eb428611c52fd797dc7d1e83 /Master/texmf-dist/tex/latex/chemnum
parentb16b1651b5d296cd70188fe4ff2f1a72f81c4993 (diff)
chemnum (4sep11)
git-svn-id: svn://tug.org/texlive/trunk@23814 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemnum')
-rw-r--r--Master/texmf-dist/tex/latex/chemnum/chemnum.sty404
1 files changed, 278 insertions, 126 deletions
diff --git a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
index dbc7ac73681..8030717e8c3 100644
--- a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
+++ b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty
@@ -3,7 +3,7 @@
% - a comprehensive numbering method for chemical compounds - %
% --------------------------------------------------------------------------- %
% - Clemens NIEDERBERGER - %
-% - 2011/08/02 - %
+% - 2011/09/03 - %
% --------------------------------------------------------------------------- %
% - http://www.mychemistry.eu/ - %
% - contact@mychemistry.eu - %
@@ -31,7 +31,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage { expl3 , xparse , etoolbox , psfrag }
-\ProvidesExplPackage {chemnum} {2011/08/02} {0.3} {Numbering chemical compounds}
+\ProvidesExplPackage {chemnum} {2011/09/03} {0.3a} {Numbering chemical compounds}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CHECK FOR SUPPORT
@@ -77,7 +77,8 @@
Please~install~an~up~to~date~version~of~#1. \\
}
-% warning, if textgreek has already been loaded AND option "textgreek = <value>" is used
+% warning, if textgreek has already been loaded AND option
+% "textgreek = <value>" is used
\msg_set:nnnn { chemnum } { package-loaded }
{ Package~#1~already~loaded. }
{
@@ -100,7 +101,10 @@
{ \RequirePackage { #2 } }
{
\@ifpackageloaded { #2 }
- { \msg_warning:nnxx { chemnum } { package-loaded } { #2 } { #1 } }
+ {
+ \msg_warning:nnxx
+ { chemnum } { package-loaded } { #2 } { #1 }
+ }
{ \RequirePackage [ #1 ] { #2 } }
}
}
@@ -117,16 +121,35 @@
\keys_define:nn { chemnum / package } {
textgreek .choice: ,
- textgreek .choice_code:n = \chemnum_load_package:nn \l_keys_choice_tl { textgreek } ,
+ textgreek .choice_code:n =
+ \chemnum_load_package:nn \l_keys_choice_tl { textgreek } ,
textgreek .generate_choices:n = { artemisia , cbgreek , euler } ,
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 } { \bool_set_true:N \l_chemnum_textgreek_bool \chemnum_package_options:n { textgreek = cbgreek } }
-\DeclareOption { textgreek = euler } { \bool_set_true:N \l_chemnum_textgreek_bool \chemnum_package_options:n { textgreek = euler } }
-\DeclareOption { textgreek = false } { \bool_set_false:N \l_chemnum_textgreek_bool }
+\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 }
+ {
+ \bool_set_true:N \l_chemnum_textgreek_bool
+ \chemnum_package_options:n { textgreek = cbgreek }
+ }
+\DeclareOption { textgreek = euler }
+ {
+ \bool_set_true:N \l_chemnum_textgreek_bool
+ \chemnum_package_options:n { textgreek = euler }
+ }
+\DeclareOption { textgreek = false }
+ { \bool_set_false:N \l_chemnum_textgreek_bool }
+
\ExecuteOptions { textgreek }
\ProcessOptions \scan_stop:
@@ -142,7 +165,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 } }
+\cs_new:Npn \chemnum_cmpd_save:n #1
+ { \clist_gput_right:Nn \g_chemnum_cmpd_save_clist { #1 } }
\msg_set:nnn { chemnum } { missing-cmpd-file }
{
@@ -154,7 +178,8 @@
{ \file_input:n { ./ \c_job_name_tl . cmpd } }
{ \msg_warning:nn { chemnum }{ missing-cmpd-file } }
-% write ref commands for all labels in <jobname>.cmpd file to make them available at the next run
+% write ref commands for all labels in <jobname>.cmpd file to make them
+% available at the next run
\AtEndDocument
{
\iow_open:Nn \chemnum_aux_file { ./ \c_job_name_tl . cmpd }
@@ -232,7 +257,8 @@
% error message for wrong argument length of delim-keys
\msg_set:nnn { chemnum } { delimiters }
{
- "#1-delim~=~<odelim><cdelim>"~needs~two~tokens~or~token~groups~as~a~value~\msg_line_context: .
+ "#1-delim~=~<odelim><cdelim>"~needs~two~tokens~or~token~groups~as~a~value~
+ \msg_line_context: .
}
% set compound delimiters
@@ -393,7 +419,12 @@
\tl_use:N \l_chemnum_sub_range_sep_tl
\use:c { chemnum_cmpd_#1_ \l_chemnum_cmpd_sub_two_label_tl _ref: }
}
- \int_compare:nT { \l_chemnum_sublabel_list_current_int < \l_chemnum_sublabel_list_length_int }
+ \int_compare:nT
+ {
+ \l_chemnum_sublabel_list_current_int
+ <
+ \l_chemnum_sublabel_list_length_int
+ }
{ \tl_use:N \l_chemnum_sublabel_list_sep_tl }
}
}
@@ -449,16 +480,21 @@
cmpd-all .bool_set:N = \l_chemnum_cmpd_all_bool ,
cmpd-all .default:n = true ,
cmpd-counter .choice: ,
- cmpd-counter .choice_code:n = \tl_set_eq:NN \l_chemnum_cmpd_kind_value_tl \l_keys_choice_tl ,
- cmpd-counter .generate_choices:n = { arabic , alph , Alph , greek, Greek , roman , Roman , Symbol } ,
+ cmpd-counter .choice_code:n =
+ \tl_set_eq:NN \l_chemnum_cmpd_kind_value_tl \l_keys_choice_tl ,
+ cmpd-counter .generate_choices:n =
+ { arabic , alph , Alph , greek, Greek , roman , Roman , Symbol } ,
cmpd-counter .default:n = arabic ,
sub-counter .choice: ,
- sub-counter .choice_code:n = \tl_set_eq:NN \l_chemnum_cmpd_sub_kind_value_tl \l_keys_choice_tl ,
- sub-counter .generate_choices:n = { arabic , alph , Alph , greek , Greek , roman , Roman , Symbol } ,
+ sub-counter .choice_code:n =
+ \tl_set_eq:NN \l_chemnum_cmpd_sub_kind_value_tl \l_keys_choice_tl ,
+ sub-counter .generate_choices:n =
+ { arabic , alph , Alph , greek , Greek , roman , Roman , Symbol } ,
sub-counter .default:n = alph ,
sub-marker .code:n = \chemnum_subcmpdsep:n { #1 } ,
sub-marker .default:n = . ,
- sub-range-marker .code:n = \chemnum_sublabel_range_marker:n { #1 } ,
+ sub-range-marker .code:n =
+ \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 = { - } ,
@@ -484,7 +520,8 @@
\tl_set:Nn \l_chemnum_list_last_separator_lang_tl { and }
\tl_new:N \l_chemnum_list_last_separator_tl
-\tl_set:Nn \l_chemnum_list_last_separator_tl { \tl_use:N \l_chemnum_list_last_separator_lang_tl }
+\tl_set:Nn \l_chemnum_list_last_separator_tl
+ { \tl_use:N \l_chemnum_list_last_separator_lang_tl }
\tl_new:N \l_chemnum_list_prefix_tl { }
\tl_set:Nn \l_chemnum_list_prefix_tl { }
@@ -567,7 +604,9 @@
\cs_if_exist:cF { chemnum_cmpd_#1: }
{
\int_gincr:N \g_chemnum_cmpd_main_int
- \prop_gput:Nnx \g_chemnum_label_prop { #1 } { \int_use:N \g_chemnum_cmpd_main_int }
+ \prop_gput:Nnx \g_chemnum_label_prop
+ { #1 }
+ { \int_use:N \g_chemnum_cmpd_main_int }
\chemnum_cmpd_save:n { #1 }
\bool_if:NF \l_chemnum_cmpd_name_bool
{ \int_gincr:N \g_chemnum_cmpd_int }
@@ -617,8 +656,14 @@
\cs_if_exist:cF { chemnum_cmpd_ #1 _ #2 _init: }
{
\bool_if:NTF \l_chemnum_cmpd_init_strict_bool
- { \msg_error:nnx { chemnum } { cmpd-sub-init } { #1 \l_chemnum_cmpd_labelsep_tl #2 } }
- { \msg_warning:nnx { chemnum } { cmpd-sub-init } { #1 \l_chemnum_cmpd_labelsep_tl #2 } }
+ {
+ \msg_error:nnx { chemnum } { cmpd-sub-init }
+ { #1 \l_chemnum_cmpd_labelsep_tl #2 }
+ }
+ {
+ \msg_warning:nnx { chemnum } { cmpd-sub-init }
+ { #1 \l_chemnum_cmpd_labelsep_tl #2 }
+ }
}
}
}
@@ -635,10 +680,12 @@
% error message if no separator is chosen
\msg_set:nnnn { chemnum } { sub-label-separator }
{
- Missing~separator~token~as~value~for~the~key~sub-cmpd-sep \c_space_tl \msg_line_context: !
+ Missing~separator~token~as~value~for~the~key~sub-cmpd-sep \c_space_tl
+ \msg_line_context: !
}
{
- You~used~the~key~sub-cmpd-sep \c_space_tl \msg_line_context: ~but~left~the~argument~empty.\\
+ You~used~the~key~sub-cmpd-sep \c_space_tl \msg_line_context: ~but~left~the~
+ argument~empty.\\
This~can't~work.~Please~select~a~token~as~separator.
}
@@ -662,21 +709,26 @@
\exp_args:Noo \tl_if_in:nnTF { #1 } { \l_chemnum_cmpd_labelsep_tl }
{
\tl_set:Nn \l_chemnum_labelsep_tmp_tl { #1 }
- \exp_args:NNo \tl_replace_once:Nnn \l_chemnum_labelsep_tmp_tl { \l_chemnum_cmpd_labelsep_tl } { \q_nil }
- \exp_after:wN \chemnum_cmpd_labelsep_aux_ii:n \l_chemnum_labelsep_tmp_tl \q_stop
+ \exp_args:NNo \tl_replace_once:Nnn \l_chemnum_labelsep_tmp_tl
+ { \l_chemnum_cmpd_labelsep_tl }
+ { \q_nil }
+ \exp_after:wN \chemnum_cmpd_labelsep_aux_ii:n
+ \l_chemnum_labelsep_tmp_tl \q_stop
}
{ \chemnum_cmpd_labelsep_aux_i:n { #1 } }
}
-\cs_new_nopar:Npn \chemnum_cmpd_labelsep_aux_i:n #1 {
- \tl_set:Nn \l_chemnum_cmpd_main_label_tl { #1 }
- \tl_clear:N \l_chemnum_cmpd_sub_label_tl
-}
+\cs_new_nopar:Npn \chemnum_cmpd_labelsep_aux_i:n #1
+ {
+ \tl_set:Nn \l_chemnum_cmpd_main_label_tl { #1 }
+ \tl_clear:N \l_chemnum_cmpd_sub_label_tl
+ }
-\cs_new_nopar:Npn \chemnum_cmpd_labelsep_aux_ii:n #1 \q_nil #2 \q_stop {
- \tl_set:Nn \l_chemnum_cmpd_main_label_tl { #1 }
- \tl_set:Nn \l_chemnum_cmpd_sub_label_tl { #2 }
-}
+\cs_new_nopar:Npn \chemnum_cmpd_labelsep_aux_ii:n #1 \q_nil #2 \q_stop
+ {
+ \tl_set:Nn \l_chemnum_cmpd_main_label_tl { #1 }
+ \tl_set:Nn \l_chemnum_cmpd_sub_label_tl { #2 }
+ }
% sublabel separating to display a range
\cs_new_nopar:Npn \chemnum_sublabel_range_marker:n #1 {
@@ -690,8 +742,11 @@
\exp_args:Noo \tl_if_in:nnTF { #1 } { \l_chemnum_sublabel_range_marker_tl }
{
\tl_set:Nn \l_chemnum_sublabelsep_tmp_tl { #1 }
- \exp_args:NNo \tl_replace_once:Nnn \l_chemnum_sublabelsep_tmp_tl { \l_chemnum_sublabel_range_marker_tl } { \q_nil }
- \exp_after:wN \chemnum_cmpd_sublabelsep_aux_ii:n \l_chemnum_sublabelsep_tmp_tl \q_stop
+ \exp_args:NNo \tl_replace_once:Nnn \l_chemnum_sublabelsep_tmp_tl
+ { \l_chemnum_sublabel_range_marker_tl }
+ { \q_nil }
+ \exp_after:wN \chemnum_cmpd_sublabelsep_aux_ii:n
+ \l_chemnum_sublabelsep_tmp_tl \q_stop
}
{ \chemnum_cmpd_sublabelsep_aux_i:n { #1 } }
}
@@ -731,57 +786,65 @@
%-----------------------------------------------------------------------------%
% main internal compound label command
% #1: <main label> #2: <sub label> #3: <invisible> #4: <no delim>
-\cs_new_nopar:Npn \chemnum_cmpd_aux_i:nnnn #1#2#3#4 {
- \bool_if:NT \l_chemnum_cmpd_initiated_bool
- { \chemnum_cmpd_initiate:nn { #1 } { #2 } }
- \bool_if:NF \l_chemnum_cmpd_ref_bool
- { \chemnum_cmpd_declare:n { #1 } }
- \tl_if_blank:nF { #2 } {
- \cs_if_exist:cF { g_chemnum_cmpd_#1_int }
- { \int_new:c { g_chemnum_cmpd_#1_int } }
+\cs_new_nopar:Npn \chemnum_cmpd_aux_i:nnnn #1#2#3#4
+ {
+ \bool_if:NT \l_chemnum_cmpd_initiated_bool
+ { \chemnum_cmpd_initiate:nn { #1 } { #2 } }
\bool_if:NF \l_chemnum_cmpd_ref_bool
- { \chemnum_cmpd_sub_declare:nn { #1 } { #2 } }
- }
- \bool_if:NTF #3
- { \mode_if_horizontal:T { \tex_unskip:D } }
- {
- \bool_if:NT #4 {
- \tl_clear:N \l_chemnum_cmpd_odelim_tl
- \tl_clear:N \l_chemnum_cmpd_cdelim_tl
+ { \chemnum_cmpd_declare:n { #1 } }
+ \tl_if_blank:nF { #2 }
+ {
+ \cs_if_exist:cF { g_chemnum_cmpd_#1_int }
+ { \int_new:c { g_chemnum_cmpd_#1_int } }
+ \bool_if:NF \l_chemnum_cmpd_ref_bool
+ { \chemnum_cmpd_sub_declare:nn { #1 } { #2 } }
}
- \chemnum_cmpd_print:n
- {
- \bool_if:NTF \l_chemnum_cmpd_ref_bool
- { \use:c { chemnum_cmpd_ #1 _ref: } }
- { \use:c { chemnum_cmpd_ #1 : } }
- \bool_if:NTF \l_chemnum_cmpd_all_bool
- {
- \tl_use:N \l_chemnum_cmpd_separator_tl
- \use:c { chemnum_cmpd_ #1 _min_ref: }
- \cs_if_eq:ccF { chemnum_cmpd_ #1 _min_ref: } { chemnum_cmpd_ #1 _max_ref: }
- {
- \tl_use:N \l_chemnum_sub_range_sep_tl
- \use:c { chemnum_cmpd_ #1 _max_ref: }
- }
- }
- {
- \bool_if:NTF \l_chemnum_sublabel_list_bool
- {
- \chemnum_cmpd_sublabel_list:nn { #1 } { \l_chemnum_cmpd_sublabel_list_tl }
- }
- {
- \tl_if_blank:nF { #2 }
- {
- \tl_use:N \l_chemnum_cmpd_separator_tl
- \bool_if:NTF \l_chemnum_cmpd_ref_bool
- { \use:c { chemnum_cmpd_ #1 _ #2 _ref: } }
- { \use:c { chemnum_cmpd_ #1 _ #2 : } }
- }
- }
- }
- }
- }
-}
+ \bool_if:NTF #3
+ { \mode_if_horizontal:T { \tex_unskip:D } }
+ {
+ \bool_if:NT #4
+ {
+ \tl_clear:N \l_chemnum_cmpd_odelim_tl
+ \tl_clear:N \l_chemnum_cmpd_cdelim_tl
+ }
+ \chemnum_cmpd_print:n
+ {
+ \bool_if:NTF \l_chemnum_cmpd_ref_bool
+ { \use:c { chemnum_cmpd_ #1 _ref: } }
+ { \use:c { chemnum_cmpd_ #1 : } }
+ \bool_if:NTF \l_chemnum_cmpd_all_bool
+ {
+ \tl_use:N \l_chemnum_cmpd_separator_tl
+ \use:c { chemnum_cmpd_ #1 _min_ref: }
+ \cs_if_eq:ccF
+ { chemnum_cmpd_ #1 _min_ref: }
+ { chemnum_cmpd_ #1 _max_ref: }
+ {
+ \tl_use:N \l_chemnum_sub_range_sep_tl
+ \use:c { chemnum_cmpd_ #1 _max_ref: }
+ }
+ }
+ {
+ \bool_if:NTF \l_chemnum_sublabel_list_bool
+ {
+ \chemnum_cmpd_sublabel_list:nn { #1 }
+ { \l_chemnum_cmpd_sublabel_list_tl }
+ }
+ {
+ \tl_if_blank:nF { #2 }
+ {
+ \tl_use:N \l_chemnum_cmpd_separator_tl
+ \bool_if:NTF \l_chemnum_cmpd_ref_bool
+ { \use:c { chemnum_cmpd_ #1 _ #2 _ref: } }
+ { \use:c { chemnum_cmpd_ #1 _ #2 : } }
+ }
+ }
+ }
+ }
+ }
+ }
+
+\cs_generate_variant:Nn \chemnum_cmpd_aux_i:nnnn { oonn }
%-----------------------------------------------------------------------------%
% create compound label
@@ -791,10 +854,16 @@
\tl_clear:N \l_chemnum_cmpd_main_label_tl
\tl_clear:N \l_chemnum_cmpd_sub_label_tl
\chemnum_cmpd_labelsep:n #1 \q_stop
- \exp_args:Noo \chemnum_cmpd_aux_i:nnnn { \l_chemnum_cmpd_main_label_tl } { \l_chemnum_cmpd_sub_label_tl } { #2 } { #3 }
+ \chemnum_cmpd_aux_i:oonn
+ { \l_chemnum_cmpd_main_label_tl }
+ { \l_chemnum_cmpd_sub_label_tl }
+ { #2 }
+ { #3 }
\group_end:
}
+\cs_generate_variant:Nn \chemnum_cmpd:nnn { onn }
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DOCUMENT COMMANDS
% variables:
@@ -806,12 +875,29 @@
\bool_new:N \l_chemnum_cmpd_ref_bool
+\msg_set:nnnn { chemnum } { fatal-combination }
+ {
+ You~can't~use \c_space_tl \token_to_str:N \cmpd \c_space_tl
+ with~star~and~#1 \c_space_tl \msg_line_context: .
+ }
+ {
+ You~used \c_space_tl \token_to_str:N \cmpd \c_space_tl
+ with~both~star~and~#1 \c_space_tl \msg_line_context: .\\
+ ~This~is~not~possible~since~it~doesn't~make~any~sense.
+ }
+
%-----------------------------------------------------------------------------%
% MAIN COMMAND
-% \cmpd*+-[<key-value-list>]{<(possibly comma separated list of) compound label(s)>}
+% \cmpd*+-[<key-value-list>]{<(possibly comma separated list of) compound
+% label(s)>}
\NewDocumentCommand \cmpd { s t+ t- o m }
{
- \IfBooleanT #2 { \bool_set_true:N \l_chemnum_cmpd_ref_bool }
+ \IfBooleanT #2
+ {
+ \bool_set_true:N \l_chemnum_cmpd_ref_bool
+ \IfBooleanT #1
+ { \msg_error:nnx { chemnum } { fatal-combination } { plus } }
+ }
\tl_clear:N \l_chemnum_tmpa_tl
\group_begin:
\int_zero:N \l_chemnum_list_items_int
@@ -832,38 +918,74 @@
\IfBooleanF #1
{
\if_int_compare:w \l_chemnum_list_separate_int = 1
- \if_int_compare:w \l_chemnum_list_items_int = 1 \else:
+ \if_int_compare:w \l_chemnum_list_items_int = 1
+ \else:
\tl_use:N \l_chemnum_list_prefix_tl
- \tl_if_blank:VF { \l_chemnum_list_prefix_tl } { \l_chemnum_list_space_tl }
+ \tl_if_blank:VF { \l_chemnum_list_prefix_tl }
+ { \l_chemnum_list_space_tl }
\tl_use:N \l_chemnum_list_odelim_tl
\fi:
\fi:
}
\IfBooleanTF #1
- { \exp_args:No \chemnum_cmpd:nnn { \l_chemnum_tmpa_tl } { \BooleanTrue } { \BooleanFalse } }
+ {
+ \chemnum_cmpd:onn
+ { \l_chemnum_tmpa_tl }
+ { \BooleanTrue }
+ { \BooleanFalse }
+ \IfBooleanT #3
+ {
+ \msg_error:nnx { chemnum }
+ { fatal-combination } { minus }
+ }
+ }
{
\IfBooleanTF #3
- { \exp_args:No \chemnum_cmpd:nnn { \l_chemnum_tmpa_tl } { \BooleanFalse } { \BooleanTrue } }
- { \exp_args:No \chemnum_cmpd:nnn { \l_chemnum_tmpa_tl } { \BooleanFalse } { \BooleanFalse } }
- \if_int_compare:w \l_chemnum_list_separate_int = \l_chemnum_list_items_int
+ {
+ \chemnum_cmpd:onn
+ { \l_chemnum_tmpa_tl }
+ { \BooleanFalse }
+ { \BooleanTrue }
+ }
+ {
+ \chemnum_cmpd:onn
+ { \l_chemnum_tmpa_tl }
+ { \BooleanFalse }
+ { \BooleanFalse }
+ }
+ \if_int_compare:w
+ \l_chemnum_list_separate_int = \l_chemnum_list_items_int
\if_int_compare:w \l_chemnum_list_items_int = 1 \else:
\tl_use:N \l_chemnum_list_cdelim_tl
- \tl_if_blank:VF { \l_chemnum_list_suffix_tl } { \l_chemnum_list_space_tl }
+ \tl_if_blank:VF
+ { \l_chemnum_list_suffix_tl }
+ { \l_chemnum_list_space_tl }
\tl_use:N \l_chemnum_list_suffix_tl
\fi:
\else:
- \if_int_compare:w \l_chemnum_list_separate_int = \int_eval:n { \l_chemnum_list_items_int - 1 }
- \tl_if_eq:NNTF \l_chemnum_list_last_separator_tl \l_chemnum_list_last_sep_empty_tl
- { \tl_use:N \l_chemnum_list_separator_tl \l_chemnum_list_space_tl }
+ \if_int_compare:w \l_chemnum_list_separate_int =
+ \int_eval:n { \l_chemnum_list_items_int - 1 }
+ \tl_if_eq:NNTF
+ \l_chemnum_list_last_separator_tl
+ \l_chemnum_list_last_sep_empty_tl
+ {
+ \tl_use:N \l_chemnum_list_separator_tl
+ \l_chemnum_list_space_tl
+ }
{
- \if_int_compare:w \l_chemnum_list_separate_int = 1 \else:
- \bool_if:NT \l_chemnum_list_last_sep_US_bool { \l_chemnum_list_separator_tl }
+ \if_int_compare:w \l_chemnum_list_separate_int = 1
+ \else:
+ \bool_if:NT \l_chemnum_list_last_sep_US_bool
+ { \l_chemnum_list_separator_tl }
\fi:
- \tl_if_blank:VF \l_chemnum_list_last_separator_tl { \l_chemnum_list_space_tl }
- \tl_use:N \l_chemnum_list_last_separator_tl \l_chemnum_list_space_tl
+ \tl_if_blank:VF \l_chemnum_list_last_separator_tl
+ { \l_chemnum_list_space_tl }
+ \tl_use:N \l_chemnum_list_last_separator_tl
+ \l_chemnum_list_space_tl
}
\else:
- \tl_use:N \l_chemnum_list_separator_tl \l_chemnum_list_space_tl
+ \tl_use:N \l_chemnum_list_separator_tl
+ \l_chemnum_list_space_tl
\fi:
\fi:
}
@@ -893,12 +1015,14 @@
% warning/error messages
\msg_set:nnn { chemnum } { cmpd-init }
{
- You~used~\token_to_str:N \cmpdinit \c_space_tl but~didn't~initiate~compound~"#1"~\msg_line_context: .
+ You~used~\token_to_str:N \cmpdinit \c_space_tl but~didn't~initiate~
+ compound~"#1"~\msg_line_context: .
}
\msg_set:nnn { chemnum } { cmpd-sub-init }
{
- You~used~\token_to_str:N \cmpdinit \c_space_tl and~"sub-init~=~true"~but~didn't~initiate~sub-compound~"#1"~\msg_line_context: .
+ You~used~\token_to_str:N \cmpdinit \c_space_tl and~"sub-init~=~true"~
+ but~didn't~initiate~sub-compound~"#1"~\msg_line_context: .
}
% initialize (and maybe declare) labels
@@ -912,21 +1036,41 @@
\exp_after:wN \chemnum_cmpd_labelsep:n \l_chemnum_tmpa_tl \q_stop
\cs_if_exist:cF { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _init: }
{
- \cs_new_nopar:cpn { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _init: } { }
+ \cs_new_nopar:cpn
+ { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _init: }
+ { }
}
\bool_if:NT \l_chemnum_cmpd_sub_init_bool
{
\tl_if_blank:VF \l_chemnum_cmpd_sub_label_tl
{
- \cs_if_exist:cF { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _ \l_chemnum_cmpd_sub_label_tl _init: }
+ \cs_if_exist:cF
+ {
+ chemnum_cmpd_
+ \l_chemnum_cmpd_main_label_tl
+ _
+ \l_chemnum_cmpd_sub_label_tl
+ _init:
+ }
{
- \cs_new_nopar:cpn { chemnum_cmpd_ \l_chemnum_cmpd_main_label_tl _ \l_chemnum_cmpd_sub_label_tl _init: } { }
+ \cs_new_nopar:cpn
+ {
+ chemnum_cmpd_
+ \l_chemnum_cmpd_main_label_tl
+ _
+ \l_chemnum_cmpd_sub_label_tl
+ _init:
+ }
+ { }
}
}
}
\bool_if:NT \l_chemnum_cmpd_init_declare_bool
{
- \exp_args:No \chemnum_cmpd:nnn { \l_chemnum_tmpa_tl } { \BooleanTrue } { \BooleanFalse }
+ \chemnum_cmpd:onn
+ { \l_chemnum_tmpa_tl }
+ { \BooleanTrue }
+ { \BooleanFalse }
}
}
@@ -956,7 +1100,7 @@
% CHEMNUM SETUP COMMAND
% \cmpdsetup{<key-value-list>}
\NewDocumentCommand \cmpdsetup { m }
- { \keys_set:nn { chemnum } { #1 } }
+ { \keys_set:nn { chemnum } { #1 } \tex_ignorespaces:D }
%-----------------------------------------------------------------------------%
% REPLACE TAG IN EPS PICTURE WITH LABEL
@@ -1012,31 +1156,39 @@ HISTORY:
one (\cmpd) for both tasks
- setup with a keyval system
- possibility to initiate sublabels
- - choices "greek" and "Greek" for the cmpd-counter keys,
- choice "symbol" changed to "Symbol"
- - package option "textgreek = <value>" to control usage
- of the textgreek package
+ - choices "greek" and "Greek" for the cmpd-counter
+ keys, choice "symbol" changed to "Symbol"
+ - package option "textgreek = <value>" to control
+ usage of the textgreek package
- former \cmpd+ is now \cmpd-
- - new \cmpd+ added which reads label from <jobname>.cmpd
- - bugfix: wrong declaration in \cmpdinit and \cmpd when
- used with line break fixed
- - bugfix: error when \cmpd was used in vertical mode fixed
+ - new \cmpd+ added which reads label from
+ <jobname>.cmpd
+ - bugfix: wrong declaration in \cmpdinit and \cmpd
+ when used with line break fixed
+ - bugfix: error when \cmpd was used in vertical mode
+ fixed
- bugfix: corrected up to date support test
- bugfix: wrong output in \cmpd* list removed
- commented and cleaned up code
2011/08/02 version 0.3 - keys "cmpd-all", "sub-list", "sub-range-sep" and
- "sub-range-marker" added, key "cmpd-sub-counter" renamed
- into "sub-counter", key "sub-cmpd-sep" renamed into
- "sub-marker"
+ "sub-range-marker" added, key "cmpd-sub-counter"
+ renamed into "sub-counter", key "sub-cmpd-sep"
+ renamed into "sub-marker"
- \cmpdref-[<keyval>][<tag>]{<label name>} added
- key "ref-tag" added
- cleaned up code
+ 2011/09/03 version 0.3a - it is now impossible to use the (conflicting or
+ better: senseless) \cmpd*+ and \cmpd*- command
+ versions. An error message is produced.
+ - made sure code has no more than 80 tokens per line
+ to improve readability on small screens
+ - bug (unwanted whitespace) in \cmpdsetup fixed
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TODO:
- - Warnung/Fehler ausgeben, wenn \cmpd*+ oder \cmpd*- verwendet werden?
- - Bug: wenn als "sub-marker" ":" von einer anderen Datei gesetzt wird, wird der
- Key nicht erkannt -> catcode Problem: entweder temporär catcode von ":"
+ - 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?
- einen Key "hide-main" oder "sub-only" hinzufügen?
- Bug: Key "cmpd-style" wenn zB \color{<farbe>} eingegeben: Fehler beim Test
- auf Makro; Test entfernen? \ No newline at end of file
+ auf Makro; Test entfernen?
+ - \cmpdref: Reihenfolge der optionalen Argumente vertauschen? \ No newline at end of file