From 28c1ee71d4aff12fb6ecc265a01679aea2ca776d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 26 Jul 2012 22:43:03 +0000 Subject: fnpct (25jul12) git-svn-id: svn://tug.org/texlive/trunk@27180 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/fnpct/fnpct.sty | 60 ++++++++++++++++++----------- 1 file changed, 38 insertions(+), 22 deletions(-) (limited to 'Master/texmf-dist/tex/latex/fnpct') diff --git a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty index 3d9a4a0aafe..4db1e4d3518 100644 --- a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty +++ b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty @@ -31,8 +31,8 @@ \RequirePackage { xparse , l3keys2e , scrlfile } \ProvidesExplPackage {fnpct} - {2012/07/07} - {0.2d} + {2012/07/24} + {0.2e} {footnote kerning} % -------------------------------------------------------------------------- @@ -161,7 +161,7 @@ \tl_map_inline:nn { #1 } { \tl_put_right:Nn \l_fnpct_punctuation_marks_tl { ##1 } - \int_compare:nTF { \l_tmpa_int < ( \tl_length:n { #1 } - 1 ) } + \int_compare:nTF { \l_tmpa_int < ( \tl_count:n { #1 } - 1 ) } { \prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { ##1 } { 0pt } \prop_put:Nnn \l_fnpct_punctuation_marks_before_prop { ##1 } { 0pt } @@ -241,12 +241,18 @@ % -------------------------------------------------------------------------- % MAIN INTERNAL FOOTNOTE FUNCTION: % write the notes: +\cs_new:Npn \fnpct_no_value_or_quark_no_value:nTF #1#2#3 + { + \IfNoValueTF { #1 } { #2 } + { \quark_if_no_value:nTF { #1 } { #2 } { #3 } } + } + \cs_new:Npn \fnpct_write_note:Nnnn #1#2#3#4 { - \IfNoValueTF { #2 } + \fnpct_no_value_or_quark_no_value:nTF { #2 } { #1 { #4 } } { - \IfNoValueTF { #3 } + \fnpct_no_value_or_quark_no_value:nTF { #3 } { #1 [ #2 ] { #4 } } { #1 [ #2 ] [ #3 ] { #4 } } } @@ -258,8 +264,9 @@ \cs_new:Npn \fnpct_check_punctuation_auxi:nTF #1#2#3 { - \tl_set:Nx \l_fnpct_current_punct_mark_tl - { \tl_head:N \l_fnpct_punctuation_marks_tl } + \fnpct_get_head:NN + \l_fnpct_current_punct_mark_tl + \l_fnpct_punctuation_marks_tl \peek_meaning_remove:VTF \l_fnpct_current_punct_mark_tl { #2 } { @@ -274,16 +281,23 @@ \int_set:Nn \l_tmpa_int { #1 } \int_incr:N \l_tmpa_int \tl_set:Nx \l_tmpb_tl { \int_to_arabic:n { \l_tmpa_int } } - \tl_set:Nx \l_fnpct_punctuation_marks_tl - { \tl_tail:N \l_fnpct_punctuation_marks_tl } - \tl_put_right:Nx \l_fnpct_punctuation_marks_tl - { \l_fnpct_current_punct_mark_tl } - \int_compare:nTF { \l_tmpa_int < \tl_length:V \l_fnpct_punctuation_marks_tl } + \tl_remove_all:NV \l_fnpct_punctuation_marks_tl + \l_fnpct_current_punct_mark_tl + \tl_put_right:NV \l_fnpct_punctuation_marks_tl + \l_fnpct_current_punct_mark_tl + \int_compare:nTF { \l_tmpa_int < \tl_count:V \l_fnpct_punctuation_marks_tl } { #2 } { #3 } } \cs_generate_variant:Nn \fnpct_check_punctuation_auxi:nTF { V } \cs_generate_variant:Nn \peek_meaning_remove:NTF { V } +\cs_generate_variant:Nn \tl_remove_all:Nn { NV } +\cs_generate_variant:Nn \tl_put_right:Nn { NV } + +\cs_new:Npn \fnpct_get_head:NN #1#2 + { \exp_after:wN \fnpct_get_head_aux:Nw \exp_after:wN #1#2 \q_stop } +\cs_new:Npn \fnpct_get_head_aux:Nw #1#2#3 \q_stop + { \tl_set:Nn #1 { #2 } } % check for multiple notes: \tl_new:N \l_fnpct_multiple_true_tl @@ -488,12 +502,12 @@ \bool_new:N \g_fnpct_only_text_bool \NewDocumentCommand \fnpct_read_note_with_option:w { soo+u{\q_stop}m } { - % FIXME: change \seq_length into \seq_count when it has been renamed \bool_if:nT { \int_compare_p:n { \l_tmpa_int > 0 } && - \int_compare_p:n { \l_tmpa_int < \seq_length:N \l_fnpct_multiple_footnotes_seq } + \int_compare_p:n + { \l_tmpa_int < \seq_count:N \l_fnpct_multiple_footnotes_seq } } { \IfBooleanTF { #1 } @@ -632,7 +646,7 @@ { \cs_set_eq:NN #1 #3 } { \RenewDocumentCommand #1 { so+m } - { \fnpct_handle_note:Nnnnn #2 { ##2 } { \NoValue } { ##3 } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { ##2 } { \q_no_value } { ##3 } { ##1 } } } } \cs_generate_variant:Nn \fnpct_renew_and_mult:NNN { ccc , NcN } @@ -646,7 +660,7 @@ { \cs_set_eq:NN #1 #3 } { \RenewDocumentCommand #1 { s+m } - { \fnpct_handle_note:Nnnnn #2 { \NoValue } { \NoValue } { ##2 } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { \q_no_value } { \q_no_value } { ##2 } { ##1 } } } } \cs_generate_variant:Nn \fnpct_renew_and_mult_no_opt:NNN { ccc } @@ -657,7 +671,7 @@ \prop_gput:Nxn \g_fnpct_adapted_notes_prop { \cs_to_str:N #2 } { #1 } \cs_new_eq:NN #2 #1 \RenewDocumentCommand #1 { so+m } - { \fnpct_handle_note:Nnnnn #2 { ##2 } { \NoValue } { ##3 } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { ##2 } { \q_no_value } { ##3 } { ##1 } } } \cs_generate_variant:Nn \fnpct_renew:NN { cc ,Nc } @@ -666,7 +680,7 @@ { \prop_gput:Nxn \g_fnpct_adapted_notes_prop { \cs_to_str:N #2 } { #1 } \NewDocumentCommand #1 { so+m } - { \fnpct_handle_note:Nnnnn #2 { ##2 } { \NoValue } { ##3 } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { ##2 } { \q_no_value } { ##3 } { ##1 } } } \cs_generate_variant:Nn \fnpct_new:NN { cc , Nc } @@ -700,7 +714,7 @@ \prop_gput:Nxn \g_fnpct_adapted_notes_prop { \cs_to_str:N #2 } { #1 } \cs_new_eq:NN #2 #1 \RenewDocumentCommand #1 { s+m } - { \fnpct_handle_note:Nnnnn #2 { \NoValue } { \NoValue } { ##2 } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { \q_no_value } { \q_no_value } { ##2 } { ##1 } } } \cs_generate_variant:Nn \fnpct_renew_no_opt:NN { cc ,Nc } @@ -710,7 +724,7 @@ \prop_gput:Nxn \g_fnpct_adapted_notes_prop { \cs_to_str:N #2 } { #1 } \cs_new_eq:NN #2 #1 \RenewDocumentCommand #1 { s } - { \fnpct_handle_note:Nnnnn #2 { \NoValue } { \NoValue } { } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { \q_no_value } { \q_no_value } { } { ##1 } } } \cs_generate_variant:Nn \fnpct_renew_no_arg:NN { cc } @@ -727,7 +741,7 @@ \prop_gput:Nxn \g_fnpct_adapted_notes_prop { \cs_to_str:N #2 } { #1 } \cs_new_eq:NN #2 #1 \RenewDocumentCommand #1 { so } - { \fnpct_handle_note:Nnnnn #2 { ##2 } { \NoValue } { } { ##1 } } + { \fnpct_handle_note:Nnnnn #2 { ##2 } { \q_no_value } { } { ##1 } } } \cs_generate_variant:Nn \fnpct_renew_mark:NN { cc , Nc } @@ -878,7 +892,7 @@ { \IfNoValueTF { #3 } { \fnpct_new_footnote:w [ #1 ] { #2 } } - { \fnpct_new_footnote:w [ #1 ]{ #2 } [ #3 ] } + { \fnpct_new_footnote:w [ #1 ] { #2 } [ #3 ] } } } \bool_if:NT \l_fnpct_bigfoot_default_top_bool @@ -971,6 +985,8 @@ 2012/06/28 v0.2c - bugfix: works now flawless together with `bigfoot' 2012/07/07 v0.2d - check for all sorts of following footnotes to insert \l_fnpct_multiple_footnote_separator_tl +2012/07/24 v0.2e - improved scanning ahead for punctuation marks, adapted + to deprecated functions in l3kernel and l3packages % -------------------------------------------------------------------------- % NOTES: -- cgit v1.2.3