From 0cdd25363b3389884e080e1a50d2c2abede4c05b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 1 Jun 2012 22:08:46 +0000 Subject: fnpct 0.2a (1jun12) git-svn-id: svn://tug.org/texlive/trunk@26790 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/fnpct/fnpct.sty | 73 +++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 19 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 69c64889915..b7ba77d68c1 100644 --- a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty +++ b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty @@ -3,7 +3,7 @@ % % footnote kerning % -% 2012/05/26 +% 2012/06/01 % -------------------------------------------------------------------------- % Clemens Niederberger % Web: https://bitbucket.org/cgnieder/fnpct/ @@ -32,8 +32,8 @@ \RequirePackage { xparse , l3keys2e , scrlfile } \ProvidesExplPackage {fnpct} - {2012/05/26} - {0.2} + {2012/06/01} + {0.2a} {footnote kerning} % -------------------------------------------------------------------------- @@ -98,9 +98,10 @@ % basic booleans for punctuation order switch and multiple footnotes \bool_new:N \l_fnpct_punct_after_bool +\bool_new:N \l_fnpct_dont_mess_around_bool \bool_new:N \l_fnpct_multiple_default_bool \bool_new:N \l_fnpct_multiple_footnotes_bool -\bool_new:N \l_fnpct_dont_switch_bool +\bool_new:N \l_fnpct_reverse_switch_bool \bool_new:N \l_fnpct_bigfoot_default_top_bool \bool_new:N \l_fnpct_normal_marks_bool @@ -213,6 +214,7 @@ { \prop_put:Nnn \l_fnpct_punctuation_marks_before_prop { ##1 } { 0pt } } \dim_zero:N \l_fnpct_before_footnote_dim \bool_set_true:N \l_fnpct_punct_after_bool + \bool_set_true:N \l_fnpct_dont_mess_around_bool \fnpct_dont_mess_around: , mult-fn-delim .tl_set:N = \l_fnpct_multiple_footnotes_delimiter_tl , mult-fn-sep .tl_set:N = \l_fnpct_multiple_footnote_separator_tl , @@ -280,6 +282,30 @@ \cs_generate_variant:Nn \fnpct_check_punctuation_auxi:nTF { V } \cs_generate_variant:Nn \peek_meaning_remove:NTF { V } +% check which mode is active: +\cs_new:Npn \fnpct_punct_if_after:TF #1#2 + { + \bool_if:nTF + { + \bool_xor_p:nn + { \l_fnpct_punct_after_bool } + { \l_fnpct_reverse_switch_bool } + } + { #1 } + { #2 } + } + +\cs_new:Npn \fnpct_punct_if_after:T #1 + { + \bool_if:nT + { + \bool_xor_p:nn + { \l_fnpct_punct_after_bool } + { \l_fnpct_reverse_switch_bool } + } + { #1 } + } + % this is where the magic happens: % #1: original command % #2: optional argument of original command @@ -291,10 +317,15 @@ % if a punctuation mark follows remove it, insert dot, skip back % and then insert footnote \fnpct_no_break: - \IfBooleanT { #5 } { \bool_set_true:N \l_fnpct_dont_switch_bool } + \bool_if:NF \l_fnpct_dont_mess_around_bool + { \IfBooleanT { #5 } { \bool_set_true:N \l_fnpct_reverse_switch_bool } } \fnpct_check_punctuation:TF { - \bool_if:nTF { \l_fnpct_punct_after_bool || \l_fnpct_dont_switch_bool } + % A: after=1 && reverse=0 + % after=0 && reverse=1 + % B: after=1 && reverse=1 + % after=0 && reverse=0 + \fnpct_punct_if_after:TF { \fnpct_no_break: \skip_horizontal:N \l_fnpct_before_footnote_dim } { \tl_use:N \l_fnpct_current_punct_mark_tl @@ -305,7 +336,7 @@ } \fnpct_write_note:Nnnn #1 { #2 } { #3 } { #4 } \fnpct_write_inner:N #1 - \bool_if:nT { \l_fnpct_punct_after_bool || \l_fnpct_dont_switch_bool } + \fnpct_punct_if_after:T { \prop_get:NVNT \l_fnpct_punctuation_marks_before_prop \l_fnpct_current_punct_mark_tl \l_tmpa_dim @@ -313,7 +344,7 @@ \fnpct_no_break: \tl_use:N \l_fnpct_current_punct_mark_tl } - \bool_set_false:N \l_fnpct_dont_switch_bool + \bool_set_false:N \l_fnpct_reverse_switch_bool } { % what about multiple footnotes? (their usage is discouraged with @@ -331,7 +362,7 @@ \fnpct_write_inner:N #1 \fnpct_no_break: \textsuperscript { \l_fnpct_multiple_footnote_separator_tl } - % \bool_set_false:N \l_fnpct_dont_switch_bool + % \bool_set_false:N \l_fnpct_reverse_switch_bool } { % else insert space and then note @@ -340,7 +371,7 @@ { \fnpct_no_break: \skip_horizontal:N \l_fnpct_before_footnote_dim } \fnpct_write_note:Nnnn #1 { #2 } { #3 } { #4 } \fnpct_write_inner:N #1 - \bool_set_false:N \l_fnpct_dont_switch_bool + \bool_set_false:N \l_fnpct_reverse_switch_bool } } } @@ -356,7 +387,8 @@ % #3: multiple notes separated by \l_fnpct_multiple_footnotes_delimiter_tl \cs_new_protected:Npn \fnpct_mult_note:Nnn #1#2#3 { - \IfBooleanT { #2 } { \bool_set_true:N \l_fnpct_dont_switch_bool } + \bool_if:NF \l_fnpct_dont_mess_around_bool + { \IfBooleanT { #2 } { \bool_set_true:N \l_fnpct_reverse_switch_bool } } % split input: \seq_set_split:NVn \l_fnpct_multiple_footnotes_seq \l_fnpct_multiple_footnotes_delimiter_tl @@ -365,7 +397,7 @@ % look for punctuation mark and do magic: \fnpct_check_punctuation:TF { - \bool_if:nTF { \l_fnpct_punct_after_bool || \l_fnpct_dont_switch_bool } + \fnpct_punct_if_after:TF { \fnpct_no_break: \skip_horizontal:N \l_fnpct_before_footnote_dim } { \tl_use:N \l_fnpct_current_punct_mark_tl @@ -375,7 +407,7 @@ { \skip_horizontal:N \l_tmpa_dim } } \fnpct_write_notes:N #1 - \bool_if:nT { \l_fnpct_punct_after_bool || \l_fnpct_dont_switch_bool } + \fnpct_punct_if_after:T { \prop_get:NVNT \l_fnpct_punctuation_marks_before_prop \l_fnpct_current_punct_mark_tl \l_tmpa_dim @@ -383,7 +415,7 @@ \fnpct_no_break: \tl_use:N \l_fnpct_current_punct_mark_tl } - \bool_set_false:N \l_fnpct_dont_switch_bool + \bool_set_false:N \l_fnpct_reverse_switch_bool } { % else insert space and notes: @@ -395,7 +427,7 @@ \bool_set_true:N \l_fnpct_multiple_footnotes_bool \fnpct_no_break: \skip_horizontal:N \l_fnpct_before_footnote_dim \fnpct_write_notes:N #1 - \bool_set_false:N \l_fnpct_dont_switch_bool + \bool_set_false:N \l_fnpct_reverse_switch_bool \textsuperscript { \l_fnpct_multiple_footnote_separator_tl } } { @@ -403,7 +435,7 @@ { \bool_set_false:N \l_fnpct_multiple_footnotes_bool } { \fnpct_no_break: \skip_horizontal:N \l_fnpct_before_footnote_dim } \fnpct_write_notes:N #1 - \bool_set_false:N \l_fnpct_dont_switch_bool + \bool_set_false:N \l_fnpct_reverse_switch_bool } } } @@ -469,7 +501,7 @@ \IfNoValueTF { #1 } { % TODO: maybe detect what type of note we're in and use the appropriate mark? - % Ot provide a user interface to choose the appropriate mark? + % Or provide a user interface to choose the appropriate mark? \fnpct_orig_footnotemark:w \prop_gput:Nxn \g_fnpct_inner_footnote_prop { \thefootnote } { #2 } \bool_if:NT \l_fnpct_hyperref_bool @@ -890,10 +922,12 @@ 2012/05/23 v0.1a - \AdaptNoteNoMult, \AdaptNoteOpt, \AdaptNoteOptNoMult - support `sidenotes' package - better support for citing commands - - error checking in the \Adapt commands + - error checking in the \AdaptNote commands - package option `strict' 2012/05/26 v0.2 - added possibility to add punctuation marks to the switching/kerning mechansim (or remove them) +2012/06/01 v0.2a - * switches behaviour also with `punct-after=true' + - `dont-mess-around' disables * % -------------------------------------------------------------------------- % NOTES: @@ -902,4 +936,5 @@ % -------------------------------------------------------------------------- % TODO: -- solve incompatibility with the `footnote' package \ No newline at end of file +- solve incompatibility with the `footnote' package +- get this working (??) => http://tex.stackexchange.com/questions/54288/nested-endnotes \ No newline at end of file -- cgit v1.2.3