diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-03 21:46:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-03 21:46:25 +0000 |
commit | 55b8d0cfd04a4842389bc9323599878990a9646d (patch) | |
tree | f1482f3d8e7005e61f0a9c94c378768b9a8f3a68 | |
parent | c0edec065c4e45697e1690cd6d2472b19d57530a (diff) |
fnpct (3feb22)
git-svn-id: svn://tug.org/texlive/trunk@61866 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/fnpct/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fnpct/fnpct-manual.cls | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fnpct/fnpct-manual.pdf | bin | 489507 -> 509779 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fnpct/fnpct-manual.tex | 29 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fnpct/fnpct.sty | 103 |
5 files changed, 101 insertions, 38 deletions
diff --git a/Master/texmf-dist/doc/latex/fnpct/README b/Master/texmf-dist/doc/latex/fnpct/README index a8674542217..88d9dc33eff 100644 --- a/Master/texmf-dist/doc/latex/fnpct/README +++ b/Master/texmf-dist/doc/latex/fnpct/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the FNPCT package v1.0b 2022/01/29 +the FNPCT package v1.1 2022/02/03 footnotes' interaction with punctuation diff --git a/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.cls b/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.cls index 6b3aa776989..95cfab1a772 100644 --- a/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.cls +++ b/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.cls @@ -23,7 +23,7 @@ % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- \RequirePackage[multiple]{fnpct} -\ProvidesClass{fnpct-manual}[2021/01/17] +\ProvidesClass{fnpct-manual}[2022/02/03] \LoadClass[load-preamble,add-index]{cnltx-doc} \RequirePackage{imakeidx} @@ -327,5 +327,8 @@ \fnpct@add@version{2019-10-05}{0.5} \fnpct@add@version{2020-01-12}{0.5a} \fnpct@add@version{2021-01-21}{1.0} +\fnpct@add@version{2022-01-04}{1.0a} +\fnpct@add@version{2022-01-29}{1.0b} +\fnpct@add@version{2022-02-03}{1.1} \endinput diff --git a/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.pdf b/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.pdf Binary files differindex 9f60e1b59ab..bd6098e43f8 100644 --- a/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.pdf +++ b/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.pdf diff --git a/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.tex b/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.tex index ceebe632fca..99968777c73 100644 --- a/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.tex +++ b/Master/texmf-dist/doc/latex/fnpct/fnpct-manual.tex @@ -105,7 +105,8 @@ full stop. Additional punctuation marks can be added to the switching behavior and the amount of kerning can be set for each punctuation mark individually. This behavior can also be turned off. -\subsection{Basics} +\subsection{New Behavior of \cs*{footnote}} +\subsubsection{Interaction With Punctuation} The \fnpct\ package basically does two things to footnotes: \begin{itemize} \item if footnote marks are followed by a comma or a full stop\footnote{More @@ -163,6 +164,20 @@ amount specified with the option \option{before-punct-space}. \caption{The effect of \fnpct.}\label{fig:effects} \end{figure} +\subsubsection{Space Before Footnotes}\label{sec:space-before} +\fnpct\sinceversion{1.1} tries to help you in one more way: it removes a +possible space before a footnote command: + +\begin{example} + The three little pigs built their houses out of straw \footnote{not to be + confused with hay}, sticks \footnote{or lumber according to some sources} + and bricks \footnote{probably fired clay bricks}. +\end{example} + +For this behavior it uses \pkg{biblatex}'s (or \pkg{csquotes}') command +\cs{unspace} if available. Otherwise it defines the command for itself. This +behavior can be turned off by an option. + \subsection{Temporarily disable (or enable) switching -- new syntax of the \cs*{footnote} command} One maybe want to put some footnote marks \emph{before} the punctuation and @@ -209,6 +224,9 @@ In case you set \keyis{reverse}{true} the \sarg\ argument temporarily Switches of \fnpct's mechanism. \keybool{reverse}\Default{false} This option reverses the behavior of starred and un-starred footnotes. + \keybool{unspace}\Default{true} + \sinceversion{1.1}This option turns the behavior described in + section~\ref{sec:space-before} off or on. \keybool{ranges}\Default{false} Activates ranges for multiple footnotes. This is not compatible with \pkg{hyperref} and does not work for the marks of some packages. @@ -356,6 +374,14 @@ reliable as it is now. For that reason it defined the following command: confused with hay}, sticks\footnote{or lumber according to some sources} and bricks\multfootnote{probably fired clay bricks;or something else}. \end{example} +\begin{options} + \keyval{mult-variant-prefix}{letters}\Default{mult} + \sinceversion{1.1}Determines how the variant commands created by the + \option{multiple} option are named. Choosing + \keyis{mult-variant-prefix}{m} would create \cs*{mfootnote} etc.\@ instead + of \cs{multfootnote}. +\end{options} + This command splits its content at every occurrence of \code{;} and creates a footnote for each. This delimiter can be changed: \begin{options} @@ -591,6 +617,7 @@ You could use another token for the star, though, if needed: \IfNoValueTF{#2} {#NOTE*{#4}} {\IfNoValueTF{#3}{#NOTE*[#2]{#4}}{#NOTE*[#2][#3]{#4}}}% + }% } \end{sourcecode} Testing showed no problems whatsoever but \fnpct\ does not adapt the command 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' |