diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-11 23:29:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-11 23:29:17 +0000 |
commit | 6d1e02f252c44d2e43c13d9d0608e628812a8a90 (patch) | |
tree | f069efd7bed73d7d7b2d234e06268a7f4e3a8e94 /Master/texmf-dist/tex | |
parent | cf39bc3c8563ac5eefb8ade651c535d4e6028017 (diff) |
fnpct 0.2d (7jul12)
git-svn-id: svn://tug.org/texlive/trunk@27001 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/fnpct/fnpct.sty | 125 |
1 files changed, 84 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty index b7ba77d68c1..3d9a4a0aafe 100644 --- a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty +++ b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty @@ -3,7 +3,6 @@ % % footnote kerning % -% 2012/06/01 % -------------------------------------------------------------------------- % Clemens Niederberger % Web: https://bitbucket.org/cgnieder/fnpct/ @@ -32,8 +31,8 @@ \RequirePackage { xparse , l3keys2e , scrlfile } \ProvidesExplPackage {fnpct} - {2012/06/01} - {0.2a} + {2012/07/07} + {0.2d} {footnote kerning} % -------------------------------------------------------------------------- @@ -70,22 +69,22 @@ } % rigid lengths: -\dim_new:N \l_fnpct_after_comma_dim -\dim_set:Nn \l_fnpct_after_comma_dim { -.06em } -\dim_new:N \l_fnpct_after_dot_dim -\dim_set:Nn \l_fnpct_after_dot_dim { -.06em } -\dim_new:N \l_fnpct_before_comma_dim -\dim_set:Nn \l_fnpct_before_comma_dim { -.16em } -\dim_new:N \l_fnpct_before_dot_dim -\dim_set:Nn \l_fnpct_before_dot_dim { -.16em } -\dim_new:N \l_fnpct_before_footnote_dim -\dim_set:Nn \l_fnpct_before_footnote_dim { .06em } -\dim_new:N \l_fnpct_normal_mark_width_dim +\dim_new:N \l_fnpct_after_comma_dim +\dim_set:Nn \l_fnpct_after_comma_dim { -.06em } +\dim_new:N \l_fnpct_after_dot_dim +\dim_set:Nn \l_fnpct_after_dot_dim { -.06em } +\dim_new:N \l_fnpct_before_comma_dim +\dim_set:Nn \l_fnpct_before_comma_dim { -.16em } +\dim_new:N \l_fnpct_before_dot_dim +\dim_set:Nn \l_fnpct_before_dot_dim { -.16em } +\dim_new:N \l_fnpct_before_footnote_dim +\dim_set:Nn \l_fnpct_before_footnote_dim { .06em } +\dim_new:N \l_fnpct_normal_mark_width_dim \dim_set:Nn \l_fnpct_normal_mark_width_dim { 1em } -\dim_new:N \l_fnpct_normal_indent_dim -\dim_set:Nn \l_fnpct_normal_indent_dim { 1.5em } -\dim_new:N \l_fnpct_normal_parindent_dim -\dim_set:Nn \l_fnpct_normal_parindent_dim { 1em } +\dim_new:N \l_fnpct_normal_indent_dim +\dim_set:Nn \l_fnpct_normal_indent_dim { 1.5em } +\dim_new:N \l_fnpct_normal_parindent_dim +\dim_set:Nn \l_fnpct_normal_parindent_dim { 1em } % multiple footnote input and output variables: \tl_new:N \l_fnpct_multiple_footnotes_delimiter_tl @@ -106,12 +105,12 @@ \bool_new:N \l_fnpct_normal_marks_bool % default punctuation marks for switching: -\tl_new:N \l_fnpct_punctuation_marks_tl -\tl_set:Nn \l_fnpct_punctuation_marks_tl { ., } -\prop_new:N \l_fnpct_punctuation_marks_after_prop -\prop_new:N \l_fnpct_punctuation_marks_before_prop +\tl_new:N \l_fnpct_punctuation_marks_tl +\tl_set:Nn \l_fnpct_punctuation_marks_tl { ., } +\prop_new:N \l_fnpct_punctuation_marks_after_prop +\prop_new:N \l_fnpct_punctuation_marks_before_prop \prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { . } { \l_fnpct_after_dot_dim } -\prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { , } { \l_fnpct_after_comma_dim } +\prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { , } { \l_fnpct_after_comma_dim } \prop_put:Nnn \l_fnpct_punctuation_marks_before_prop { . } { \l_fnpct_before_dot_dim } \prop_put:Nnn \l_fnpct_punctuation_marks_before_prop { , } { \l_fnpct_before_comma_dim } @@ -194,10 +193,14 @@ { strict .bool_set:N = \l_fnpct_strict_bool , strict .default:n = true , - after-comma-space .dim_set:N = \l_fnpct_after_comma_dim , - after-dot-space .dim_set:N = \l_fnpct_after_dot_dim , - before-comma-space .dim_set:N = \l_fnpct_before_comma_dim , - before-dot-space .dim_set:N = \l_fnpct_before_dot_dim , + after-comma-space .code:n = + \prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { , } { #1 } , + after-dot-space .code:n = + \prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { . } { #1 } , + before-comma-space .code:n = + \prop_put:Nnn \l_fnpct_punctuation_marks_before_prop { , } { #1 } , + before-dot-space .code:n = + \prop_put:Nnn \l_fnpct_punctuation_marks_before_prop { , } { #1 } , after-punct-space .code:n = \prop_map_inline:Nn \l_fnpct_punctuation_marks_after_prop { \prop_put:Nnn \l_fnpct_punctuation_marks_after_prop { ##1 } { #1 } } , @@ -282,6 +285,35 @@ \cs_generate_variant:Nn \fnpct_check_punctuation_auxi:nTF { V } \cs_generate_variant:Nn \peek_meaning_remove:NTF { V } +% check for multiple notes: +\tl_new:N \l_fnpct_multiple_true_tl +\tl_new:N \l_fnpct_multiple_false_tl + +\cs_new:Npn \fnpct_check_multiple:TF #1#2 + { + \tl_set:Nn \l_fnpct_multiple_true_tl { #1 } + \tl_set:Nn \l_fnpct_multiple_false_tl { #2 } + \peek_after:Nw \fnpct_check_multiple_aux: + } + +\cs_new:Npn \fnpct_check_multiple_aux: + { + \prop_map_inline:Nn \g_fnpct_adapted_notes_prop + { + \prop_get:NnN \g_fnpct_adapted_notes_prop { ##1 } \l_tmpb_tl + \exp_after:wN + \token_if_eq_meaning:NNTF \l_tmpb_tl \l_peek_token + { + \bool_set_true:N \l_fnpct_multiple_footnotes_bool + \prop_map_break: + } + { \bool_set_false:N \l_fnpct_multiple_footnotes_bool } + } + \bool_if:NTF \l_fnpct_multiple_footnotes_bool + { \tl_use:N \l_fnpct_multiple_true_tl } + { \tl_use:N \l_fnpct_multiple_false_tl } + } + % check which mode is active: \cs_new:Npn \fnpct_punct_if_after:TF #1#2 { @@ -350,10 +382,7 @@ % what about multiple footnotes? (their usage is discouraged with % this package, but anyway...) % this check should probably/maybe be removed (?!) - \tl_set:Nx \l_tmpa_tl { \cs_to_str:N #1 } - \prop_get:NVN \g_fnpct_adapted_notes_prop \l_tmpa_tl \l_tmpb_tl - \exp_args:No - \peek_meaning:NTF \l_tmpb_tl + \fnpct_check_multiple:TF { \bool_set_true:N \l_fnpct_multiple_footnotes_bool % else insert space and then note @@ -419,10 +448,7 @@ } { % else insert space and notes: - \tl_set:Nx \l_tmpa_tl { \cs_to_str:N #1 } - \prop_get:NVN \g_fnpct_adapted_notes_prop \l_tmpa_tl \l_tmpb_tl - \exp_args:No - \peek_meaning:NTF \l_tmpb_tl + \fnpct_check_multiple:TF { \bool_set_true:N \l_fnpct_multiple_footnotes_bool \fnpct_no_break: \skip_horizontal:N \l_fnpct_before_footnote_dim @@ -452,7 +478,7 @@ } } -% this shouldn't be a document command but is an really easy way to make +% this shouldn't be a document command but is a really easy way to make % biblatex's \footcite et.al. compatible with the `multiple' option % #1: optional star => only invoke \footnotetext % #2: optional argument to original note command @@ -548,17 +574,25 @@ % -------------------------------------------------------------------------- % MANUAL KERNING: +% TODO: add nobreak and ensure that \l_fnpct_after_comma_dim et.al match the current +% definition \cs_new:Npn \kfp { + \fnpct_no_break: + \prop_get:NnN \l_fnpct_punctuation_marks_before_prop { . } \l_tmpa_dim + \prop_get:NnN \l_fnpct_punctuation_marks_after_prop { . } \l_tmpb_dim \bool_if:NTF \l_fnpct_punct_after_bool - { \skip_horizontal:N \l_fnpct_before_dot_dim } - { \skip_horizontal:N \l_fnpct_after_dot_dim } + { \skip_horizontal:N \l_tmpa_dim } + { \skip_horizontal:N \l_tmpb_dim } } \cs_new:Npn \kfc { + \fnpct_no_break: + \prop_get:NnN \l_fnpct_punctuation_marks_before_prop { , } \l_tmpa_dim + \prop_get:NnN \l_fnpct_punctuation_marks_after_prop { , } \l_tmpb_dim \bool_if:NTF \l_fnpct_punct_after_bool - { \skip_horizontal:N \l_fnpct_before_comma_dim } - { \skip_horizontal:N \l_fnpct_after_comma_dim } + { \skip_horizontal:N \l_tmpa_dim } + { \skip_horizontal:N \l_tmpb_dim } } % -------------------------------------------------------------------------- @@ -792,10 +826,13 @@ { fnpct_orig_footnote#2:w } { multfootnote#2 } \fnpct_renew_mark:cc { footnotemark#2 } { fnpct_orig_footnotemark#2:w } } + \prop_if_in:NnT \l_fnpct_footnote_class_prop { default } + { % re-set basics: \cs_set_eq:NN \footnote \footnotedefault \cs_set_eq:NN \footnotemark \footnotemarkdefault \cs_set_eq:NN \multfootnote \multfootnotedefault + } } %% the `fixfoot' package: \fnpct_treatment:nn { fixfoot } @@ -928,7 +965,13 @@ switching/kerning mechansim (or remove them) 2012/06/01 v0.2a - * switches behaviour also with `punct-after=true' - `dont-mess-around' disables * - +2012/06/07 v0.2b - bugfix: \kfp and \kfc now get the updated values if + add-punctuation was added. They also won't allow line + breaks any more +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 + % -------------------------------------------------------------------------- % NOTES: - `footnote' package => not compatible => see todo |