summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-03 21:46:25 +0000
committerKarl Berry <karl@freefriends.org>2022-02-03 21:46:25 +0000
commit55b8d0cfd04a4842389bc9323599878990a9646d (patch)
treef1482f3d8e7005e61f0a9c94c378768b9a8f3a68 /Master/texmf-dist/tex
parentc0edec065c4e45697e1690cd6d2472b19d57530a (diff)
fnpct (3feb22)
git-svn-id: svn://tug.org/texlive/trunk@61866 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/fnpct/fnpct.sty103
1 files changed, 68 insertions, 35 deletions
diff --git a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty
index 9236dcfdde6..175aa7c43f5 100644
--- a/Master/texmf-dist/tex/latex/fnpct/fnpct.sty
+++ b/Master/texmf-dist/tex/latex/fnpct/fnpct.sty
@@ -27,10 +27,10 @@
\DeclareHookRule {begindocument} {fnpct} {after} {hyperref}
-\tl_const:Nn \c_fnpct_date_tl {2022/01/29}
+\tl_const:Nn \c_fnpct_date_tl {2022/02/03}
\tl_const:Nn \c_fnpct_version_major_number_tl {1}
-\tl_const:Nn \c_fnpct_version_minor_number_tl {0}
-\tl_const:Nn \c_fnpct_version_subrelease_tl {b}
+\tl_const:Nn \c_fnpct_version_minor_number_tl {1}
+\tl_const:Nn \c_fnpct_version_subrelease_tl {}
\tl_const:Nx \c_fnpct_version_number_tl
{
\c_fnpct_version_major_number_tl .
@@ -85,6 +85,7 @@
\bool_new:N \g__fnpct_multiple_bool
\bool_new:N \g__fnpct_text_bool
\bool_new:N \l__fnpct_debug_bool
+\bool_new:N \l__fnpct_unspace_bool
\tl_new:N \l_fnpct_action_tl
\tl_new:N \l_fnpct_last_action_tl
@@ -93,7 +94,7 @@
\tl_new:N \l__fnpct_range_tl
\tl_new:N \l__fnpct_separate_tl
\tl_new:N \l__fnpct_multiple_footnotes_delimiter_tl
-\tl_set:Nn \l__fnpct_multiple_footnotes_delimiter_tl {;}
+\tl_new:N \l__fnpct_mult_variant_prefix_tl
\tl_new:N \g__fnpct_this_note_tl
\prop_new:N \l__fnpct_trailing_tokens_prop
@@ -123,11 +124,12 @@
You~ need~ to~ use~ \token_to_str:N \usepackage [#1] {fnpct} .
}
-\msg_new:nnn {fnpct} {unknown-option}
+\msg_new:nnn {fnpct} {unknown-load-time-option}
{
Unknown~ option~ `#1'! \\
I~ don't~ know~ the~ option~ `#1'.~ Please~ make~ sure~ there~ is~ no~
- typo.~ Check~ the~ manual~ for~ help.
+ typo.~ Check~ the~ manual~ for~ help.~ Did~ you~ mean~ to~ use~ it~ in~
+ \token_to_str:N \setfnpct ?
}
\msg_new:nnn {fnpct} {dont-mess-around}
@@ -198,7 +200,7 @@
\cs_new_protected:Npn \__fnpct_loadtime_warning:n #1
{ \msg_warning:nnV {fnpct} {#1} \l_keys_key_str }
-\keys_define:nn {fnpct/package}
+\keys_define:nn {fnpct/load-time}
{
multiple .bool_gset:N = \g__fnpct_multiple_bool ,
multiple .initial:n = false ,
@@ -213,12 +215,12 @@
dont-mess-around .default:n = true ,
dont-mess-around .initial:n = false ,
unknown .code:n =
- \__fnpct_loadtime_warning:n {unknown-option}
+ \__fnpct_loadtime_warning:n {unknown-load-time-option}
}
-\ProcessKeysPackageOptions {fnpct/package}
+\ProcessKeysPackageOptions {fnpct/load-time}
-\keys_define:nn {fnpct/package}
+\keys_define:nn {fnpct/load-time}
{
multiple .code:n = \__fnpct_loadtime_error:n {load-time-option} ,
debug .code:n = \__fnpct_loadtime_error:n {load-time-option} ,
@@ -277,7 +279,7 @@
\cs_generate_variant:Nn \fnpct_skip_nobreak:N {c}
% --------------------------------------------------------------------------
-% checking for trailing tokens - reuse an idea from acro
+% checking for trailing tokens - reuse an idea from `acro'
% #1: name
\cs_new_protected:Npn \fnpct_new_class:n #1
{
@@ -294,14 +296,14 @@
% #1: name
% #2: code
-\cs_new_protected:Npn \fnpct_do_action:nnw #1#2 \fnpct_end:
+\cs_new_protected:Npn \__fnpct_do_action:nnw #1#2 \fnpct_end:
{
\prop_if_in:NnTF \g__fnpct_actions_prop {#1}
{ \fnpct_end: \prop_item:Nn \g__fnpct_actions_prop {#1} }
{ \fnpct_end: \use:n }
{#2}
}
-\cs_generate_variant:Nn \fnpct_do_action:nnw {V}
+\cs_generate_variant:Nn \__fnpct_do_action:nnw {V}
% #1: name
% #2: class
@@ -678,9 +680,37 @@
\cs_new_protected:Npn \__fnpct_execute: {}
+\hook_gput_code:nnn {begindocument} {fnpct}
+ {
+ \bool_lazy_or:nnTF
+ { \fnpct_if_package_loaded_p:n {biblatex} }
+ { \fnpct_if_package_loaded_p:n {csquotes} }
+ {
+ \cs_new_protected:Npn \fnpct_unspace:
+ { \bool_if:NT \l__fnpct_unspace_bool { \unspace } }
+ }
+ {
+ \cs_new_protected:Npn \fnpct_unspace:
+ {
+ \bool_if:NT \l__fnpct_unspace_bool
+ {
+ \mode_if_horizontal:T
+ {
+ \dim_compare:nNnTF \lastskip > {0pt}
+ { \unskip \fnpct_unspace: }
+ {
+ \int_compare:nNnT \lastpenalty > {0pt}
+ { \unpenalty \fnpct_unspace: }
+ }
+ }
+ }
+ }
+ }
+ }
+
% #1: boolean
\cs_new_protected:Npn \fnpct_begin:
- { \__fnpct_check_after_end:w }
+ { \fnpct_unspace: \__fnpct_check_after_end:w }
% #1: code
\cs_new_protected:Npn \__fnpct_check_after_end:w #1 \fnpct_end:
@@ -692,7 +722,7 @@
\prop_get:NVN \l__fnpct_trailing_actions_prop
\l_fnpct_trailing_token_tl
\l_fnpct_action_tl
- \fnpct_do_action:Vnw \l_fnpct_action_tl {#1}
+ \__fnpct_do_action:Vnw \l_fnpct_action_tl {#1}
}
{
% no trailing punctuation
@@ -716,8 +746,7 @@
{
\bool_if:NF \l__fnpct_dont_mess_around_bool
{
- \fnpct_if_switched:F
- { \fnpct_add_punctuation_space:n {after} }
+ \fnpct_if_switched:F { \fnpct_add_punctuation_space:n {after} }
\bool_if:NF \l_fnpct_trailing_action_bool
{ % no punctiation following
\bool_if:NF \l__fnpct_end_collection_bool
@@ -758,7 +787,6 @@
% #1: command
% #2: argument spec
% #3: code where #NOTE refers to the original note
-
\cs_new_protected:Npn \fnpct_adapt_note:Nnn #1#2#3
{
\fnpct_if_adapted:NF #1
@@ -804,7 +832,7 @@
{
\bool_if:NTF \l__fnpct_reverse_bool
{ \bool_if:nF }
- { \bool_if:NT }
+ { \bool_if:nT }
{#1} { \bool_set_true:N \l__fnpct_switched_bool }
}
@@ -834,22 +862,17 @@
\NewDocumentCommand \AdaptNote {mmom}
{
\fnpct_adapt_note:Nnn #1 {#2} {#4}
- \IfNoValueF {#3}
- { \fnpct_set_counter_name:Nn #1 {#3} }
+ \IfNoValueF {#3} { \fnpct_set_counter_name:Nn #1 {#3} }
}
\NewDocumentCommand \AdaptNoteName {mmom}
{
\fnpct_adapt_note:cnn {#1} {#2} {#4}
- \IfNoValueF {#3}
- { \fnpct_set_counter_name:cn {#1} {#3} }
+ \IfNoValueF {#3} { \fnpct_set_counter_name:cn {#1} {#3} }
}
\NewDocumentCommand \AdaptText {mmm}
- {
- \fnpct_adapt_note:Nnn #1 {#2}
- { \fnpct_text: #3 }
- }
+ { \fnpct_adapt_note:Nnn #1 {#2} { \fnpct_text: #3 } }
\NewDocumentCommand \innernote {+m}
{ \msg_warning:nn {fnpct} {command-removed} \use:n {#1} }
@@ -890,17 +913,20 @@
keep-ranges .initial:n = false ,
dont-mess-around .bool_set:N = \l__fnpct_dont_mess_around_bool ,
dont-mess-around .initial:n = false ,
- mult-fn-delim .code:n =
- \tl_set:Nn \l__fnpct_multiple_footnotes_delimiter_tl {#1} ,
- separation-symbol .code:n =
- \renewcommand* \multfootsep {#1} ,
- range-symbol .code:n =
- \renewcommand* \multfootrange {#1} ,
+ unspace .bool_set:N = \l__fnpct_unspace_bool ,
+ unspace .initial:n = true ,
+ mult-fn-delim .tl_set:N = \l__fnpct_multiple_footnotes_delimiter_tl ,
+ mult-fn-delim .initial:n = {;} ,
+ mult-variant-prefix .tl_set:N = \l__fnpct_mult_variant_prefix_tl ,
+ mult-variant-prefix .initial:n = mult ,
+ separation-symbol .code:n = \renewcommand* \multfootsep {#1} ,
+ range-symbol .code:n = \renewcommand* \multfootrange {#1} ,
print-separation .tl_set:N = \l__fnpct_separate_tl ,
print-separation .initial:n = \textsuperscript { \multfootsep } ,
print-range .tl_set:N = \l__fnpct_range_tl ,
print-range .initial:n = \textsuperscript { \multfootrange } ,
reverse .bool_set:N = \l__fnpct_reverse_bool ,
+ punct-after .code:n = \fnpct_deprecate_option:n {reverse} ,
after-punct-space .code:n =
\fnpct_foreach_action:nn {punctuation}
{ \keys_set:nn {fnpct} { after-##1-space = #1 } } ,
@@ -946,7 +972,7 @@
\cs_new_protected:Npn \fnpct_create_mult_variant:N #1
{
\exp_args:Nc \NewDocumentCommand
- { mult \__fnpct_remove_backslash:N #1 }
+ { \l__fnpct_mult_variant_prefix_tl \__fnpct_remove_backslash:N #1 }
{ sm }
{
\seq_set_split:NVn \l__fnpct_tmpa_seq
@@ -1056,6 +1082,7 @@
{ \bool_set_true:N \l__fnpct_makepagenote_bool }
}
+% `sepfootnotes' package:
\fnpct_special_treatment:nn {sepfootnotes}
{
\cs_new_eq:NN \fnpct_sepfootnote_new:n \sep@new
@@ -1123,7 +1150,7 @@
{ \IfNoValueTF {#1} {#NOTE} {#NOTE[#1]} }
\fnpct_if_multiple:T { \MultVariant \sidenote }
}
- % sidenotes:
+ %% sidenotes:
\fnpct_treatment:nn {sidenotes}
{
% `sidenotes' implements its \sidenote in terms of the user
@@ -1131,6 +1158,7 @@
% difficult if not impossible to adapt its commands
\msg_warning:nnn {fnpct} {cannot-adapt} {sidenotes}
}
+ %% tufte-latex:
\bool_lazy_or:nnT
{ \fnpct_if_class_loaded_p:n {tufte-handout} }
{ \fnpct_if_class_loaded_p:n {tufte-book} }
@@ -1302,6 +1330,7 @@
}
}
}
+
\file_input_stop:
% --------------------------------------------------------------------------
@@ -1396,3 +1425,7 @@ tablefootnote
future versions, depending on user feedback)
2022/01/04 v1.0a - correct file hooks
2022/01/29 v1.0b - remove erroneously inserted horizontal skip
+2022/02/03 v1.1 - add \fnpct_unspace: (similar/equal to biblatex's \unspace),
+ see https://tex.stackexchange.com/questions/467561/
+ - new option `mult-variant-prefix'
+ - new option `unspace'