Skip to content

Commit

Permalink
document \unspace behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Feb 3, 2022
1 parent f25c1c8 commit 9b5a2ba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
Binary file modified fnpct-manual.pdf
Binary file not shown.
20 changes: 19 additions & 1 deletion fnpct-manual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ \subsection{Introduction}
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
Expand Down Expand Up @@ -163,6 +164,20 @@ \subsection{Basics}
\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
Expand Down Expand Up @@ -209,6 +224,9 @@ \section{Options}\label{sec:options}
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.
Expand Down
22 changes: 16 additions & 6 deletions fnpct.sty
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -684,17 +685,23 @@
\bool_lazy_or:nnTF
{ \fnpct_if_package_loaded_p:n {biblatex} }
{ \fnpct_if_package_loaded_p:n {csquotes} }
{ \cs_new_eq:NN \fnpct_unspace: \unspace }
{
\cs_new_protected:Npn \fnpct_unspace:
{ \bool_if:NT \l__fnpct_unspace_bool { \unspace } }
}
{
\cs_new_protected:Npn \fnpct_unspace:
{
\mode_if_horizontal:T
\bool_if:NT \l__fnpct_unspace_bool
{
\dim_compare:nNnTF \lastskip > {0pt}
{ \unskip \fnpct_unspace: }
\mode_if_horizontal:T
{
\int_compare:nNnT \lastpenalty > {0pt}
{ \unpenalty \fnpct_unspace: }
\dim_compare:nNnTF \lastskip > {0pt}
{ \unskip \fnpct_unspace: }
{
\int_compare:nNnT \lastpenalty > {0pt}
{ \unpenalty \fnpct_unspace: }
}
}
}
}
Expand Down Expand Up @@ -906,6 +913,8 @@
keep-ranges .initial:n = false ,
dont-mess-around .bool_set:N = \l__fnpct_dont_mess_around_bool ,
dont-mess-around .initial:n = false ,
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 ,
Expand Down Expand Up @@ -1419,3 +1428,4 @@ tablefootnote
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'

0 comments on commit 9b5a2ba

Please sign in to comment.