diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemnum')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemnum/chemnum.sty | 71 |
1 files changed, 55 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/latex/chemnum/chemnum.sty b/Master/texmf-dist/tex/latex/chemnum/chemnum.sty index ce0a076fea1..f4ac6e7a1b5 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 approach for the numbering of chemical compounds % ----------------------------------------------------------------------------- % - Clemens NIEDERBERGER -% - 2012/04/15 +% - 2012/04/20 % - contact@mychemistry.eu % ----------------------------------------------------------------------------- % - If you have any ideas, questions, suggestions or bugs to report, please @@ -31,8 +31,8 @@ \ProvidesExplPackage {chemnum} - {2012/04/15} - {0.4b} + {2012/04/20} + {0.5} {An approach for the numbering of chemical compounds} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1421,28 +1421,52 @@ % works similar to \schemeref command of the chemscheme package % \cmpdref-[<keyval>][<tag>]{<label name>} \tl_new:N \l_chemnum_cmpdref_tl - \tl_new:N \l_chemnum_cmpdref_style_tl \tl_set:Nn \l_chemnum_cmpdref_style_tl { \sffamily } - \tl_new:N \l_chemnum_cmpdref_marker_tl \tl_set:Nn \l_chemnum_cmpdref_marker_tl { TMP } +\tl_new:N \l_chemnum_psfrag_texpos_tl +\tl_new:N \l_chemnum_psfrag_texpos_current_tl +\tl_set:Nn \l_chemnum_psfrag_texpos_tl { b } +\tl_new:N \l_chemnum_psfrag_pspos_tl +\tl_new:N \l_chemnum_psfrag_pspos_current_tl +\tl_set:Nn \l_chemnum_psfrag_pspos_tl { b } \int_new:N \l_chemnum_cmpdref_int +\cs_new_nopar:Npn \chemnum_set_psfrag_pos:nn #1#2 + { + \tl_set:Nn \l_chemnum_psfrag_texpos_tl { #1 } + \tl_set:Nn \l_chemnum_psfrag_pspos_tl { #2 } + } + +\cs_new_nopar:Npn \chemnum_psfrag:nnnn #1#2#3#4 + { \psfrag { #1 } [ #2 ] [ #3 ] { #4 } } +\cs_generate_variant:Nn \chemnum_psfrag:nnnn { VVVn } + +\cs_new:Npn \chemnum_set_psfrag_pos_local:w #1 ref-pos = #2#3 , #4 \q_stop + { + \tl_set_eq:NN \l_chemnum_psfrag_texpos_current_tl \l_chemnum_psfrag_texpos_tl + \tl_set_eq:NN \l_chemnum_psfrag_pspos_current_tl \l_chemnum_psfrag_pspos_tl + \tl_set:Nn \l_chemnum_psfrag_texpos_tl { #2 } + \tl_set:Nn \l_chemnum_psfrag_pspos_tl { #3 } + } + \keys_define:nn { chemnum } { ref-tag .tl_set:N = \l_chemnum_cmpdref_marker_tl , ref-tag .default:n = { TMP } , ref-style .tl_set:N = \l_chemnum_cmpdref_style_tl , ref-style .default:n = { } , + ref-pos .code:n = \chemnum_set_psfrag_pos:nn #1 , + ref-pos .default:n = bb } \NewDocumentCommand \cmpdref { t- o o m } { \IfBooleanT { #1 } { \keys_set:nn { chemnum } { cmpd-delim = } } - \IfNoValueTF { #3 } + \IfNoValueTF { #2 } { \int_incr:N \l_chemnum_cmpdref_int \tl_set:No \l_chemnum_cmpdref_tl @@ -1451,15 +1475,16 @@ \int_use:N \l_chemnum_cmpdref_int } } - { - \tl_set:Nn \l_chemnum_cmpdref_tl { #3 } - } - \IfNoValueTF { #2 } + { \tl_set:Nn \l_chemnum_cmpdref_tl { #2 } } + \IfNoValueTF { #3 } { % need to call it once invisible in case it's the first time the label % is called. Somehow it otherwise “vanishes” inside \psfrag \cmpd_main_command:w * { #4 } - \psfrag { \l_chemnum_cmpdref_tl } [ b ] [ b ] + \chemnum_psfrag:VVVn + \l_chemnum_cmpdref_tl + \l_chemnum_psfrag_texpos_tl + \l_chemnum_psfrag_pspos_tl { \group_begin: \keys_set:nn { chemnum } @@ -1469,15 +1494,28 @@ } } { - \cmpd_main_command:w * [ #2 ] { #4 } - \psfrag { \l_chemnum_cmpdref_tl } [ b ] [ b ] + % TODO: set psfrag positions before \chemnum_psfrag is called + \cmpd_main_command:w * [ #3 ] { #4 } + \tl_if_in:nnT { #3 } { ref-pos } + { \chemnum_set_psfrag_pos_local:w #3 , \q_stop } + \chemnum_psfrag:VVVn + \l_chemnum_cmpdref_tl + \l_chemnum_psfrag_texpos_tl + \l_chemnum_psfrag_pspos_tl { \group_begin: \keys_set:nn { chemnum } { cmpd-style = \l_chemnum_cmpdref_style_tl } - \cmpd_main_command:w [ #2 ] { #4 } + \cmpd_main_command:w [ #3 ] { #4 } \group_end: } + \tl_if_in:nnT { #3 } { ref-pos } + { + \tl_set_eq:NN + \l_chemnum_psfrag_texpos_tl \l_chemnum_psfrag_texpos_current_tl + \tl_set_eq:NN + \l_chemnum_psfrag_pspos_tl \l_chemnum_psfrag_pspos_current_tl + } } } @@ -1607,11 +1645,12 @@ HISTORY: - documentation got an index 2012/02/22 version 0.4a - corrected outdated expl3 function 2012/04/15 version 0.4b - bugfix in \cmpdref + 2012/04/20 version 0.5 - new option "ref-pos" + - switched order of optional arguments of \cmpdref %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: - add a possibility to \ref{} the compounds - (rudimentäre) Unterstützung für hyperref und pdfstrings - polyglossia: localization of us-variant of english - Bug: Key "cmpd-style" wenn zB \color{<farbe>} eingegeben: Fehler beim Test - auf Makro; Test entfernen? - - \cmpdref: Reihenfolge der optionalen Argumente vertauschen?
\ No newline at end of file + auf Makro; Test entfernen?
\ No newline at end of file |