summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/postnotes/postnotes.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/postnotes/postnotes.dtx')
-rw-r--r--macros/latex/contrib/postnotes/postnotes.dtx97
1 files changed, 58 insertions, 39 deletions
diff --git a/macros/latex/contrib/postnotes/postnotes.dtx b/macros/latex/contrib/postnotes/postnotes.dtx
index f4cbdfe7a2..aa53abda40 100644
--- a/macros/latex/contrib/postnotes/postnotes.dtx
+++ b/macros/latex/contrib/postnotes/postnotes.dtx
@@ -147,7 +147,7 @@
%
%
% \begin{macrocode}
-\ProvidesExplPackage {postnotes} {2022-07-07} {0.1.5}
+\ProvidesExplPackage {postnotes} {2022-08-01} {0.1.6}
{Endnotes for LaTeX}
% \end{macrocode}
%
@@ -2014,18 +2014,55 @@
% Thanks \contributor{Moritz Wemheuer}:
% \url{https://tex.stackexchange.com/q/597359#comment1594585_597389}.
%
-% We can make \pkg{biblatex}'s \texttt{refsegment}s and \texttt{refcontext}s
-% work, but \texttt{refsection}s are more complicated. Currently,
-% \texttt{refsection}s are only supported if \cs{printpostnotes} is called
-% within each \texttt{refsection}, one cannot ``accumulate'' the notes from
-% all \texttt{refsection}s and print them at the end. Well, one can, but they
-% will be considered part of the current \texttt{refsection} of wherever
-% \cs{printpostnotes} is placed (unless they were also cited in the original
-% \texttt{refsection} out of a \cs{postnote} which, of course, is not
-% something to rely on).
%
-% Note that support for these features of \pkg{biblatex} is
-% \emph{experimental}.
+% \begin{macrocode}
+\AddToHook { package/biblatex/after }
+ {
+% \end{macrocode}
+% Let \pkg{biblatex} know we are in a ``notes'' context. See
+% \url{https://tex.stackexchange.com/a/304464}, including comments.
+% \begin{macrocode}
+ \AddToHook { postnotes/print/begin } [ postnotes ]
+ { \toggletrue { blx@footnote } }
+% \end{macrocode}
+% Make \pkg{biblatex}'s \cs{mkbibendnote} use \cs{postnote}. This is very
+% likely desired in most cases, but may occasionally not be, so we add it to
+% an individually labeled hook, which can be disabled with
+% \texttt{\textbackslash{}RemoveFromHook\{begindocument/before\}[postnotes/mkbibendnote]}
+% in the preamble.
+% \begin{macrocode}
+ \AddToHook { begindocument/before } [ postnotes/mkbibendnote ]
+ {
+ \cs_set:Npn \blx@theendnote { \postnote }
+ \cs_set:Npn \blx@theendnotetext
+ { \blx@err@endnote \footnotetext }
+ }
+ }
+% \end{macrocode}
+%
+%
+% \begin{macrocode}
+%<*gobble>
+% \end{macrocode}
+%
+% I had made an initial experimental attempt to support \pkg{biblatex}'s
+% \texttt{refsegment}s, \texttt{refcontext}s and \texttt{refsection}s.
+% However, this attempt was rash. Even if I could get many example files to
+% work for \texttt{refsegment}s and \texttt{refcontext}s, I could not do so
+% for \texttt{refsection}s. More importantly, with this partial
+% implementation, I could also generate documents which confused
+% \pkg{biblatex} more than it helped. Things I couldn't understand well, or
+% fix. All in all, I don't think this partial implementation is tenable, and
+% I could not take it further. Hence, \pkg{postnotes} support for this
+% feature set of \pkg{biblatex} will depend, as it should, on proper upstream
+% support for ``saving'' and ``restoring'' citation ``context'' information.
+%
+% I have made a feature request at \pkg{biblatex} for this
+% (\url{https://github.com/plk/biblatex/issues/1226}), which was
+% (understandably) classified as ``long term, no promises''.
+%
+%
+% The attempt was the following (currently ``gobbled'' from the package):
%
% \begin{macrocode}
\AddToHook { package/biblatex/after }
@@ -2052,11 +2089,6 @@
{
\@@_biblatex_endrefcontext_local:
\@@_biblatex_citereset_local:
-% \end{macrocode}
-% Let \pkg{biblatex} know we are in a ``notes'' context. See
-% \url{https://tex.stackexchange.com/a/304464}, including comments.
-% \begin{macrocode}
- \toggletrue { blx@footnote }
}
% \end{macrocode}
% Restore \pkg{biblatex} variables for each note.
@@ -2077,19 +2109,6 @@
\blx@edef@refcontext { \l_@@_restore_tmp_tl }
}
% \end{macrocode}
-% Make \pkg{biblatex}'s \cs{mkbibendnote} use \cs{postnote}. This is very
-% likely desired in most cases, but may occasionally not be, so we add it to
-% an individually labeled hook, which can be disabled with
-% \texttt{\textbackslash{}RemoveFromHook\{begindocument/before\}[postnotes/mkbibendnote]}
-% in the preamble.
-% \begin{macrocode}
- \AddToHook { begindocument/before } [ postnotes/mkbibendnote ]
- {
- \cs_set_nopar:Npn \blx@theendnote { \postnote }
- \cs_set_nopar:Npn \blx@theendnotetext
- { \blx@err@endnote \footnotetext }
- }
-% \end{macrocode}
% Auxiliary functions.
%
% \begin{macro}{\@@_biblatex_endrefcontext_local:}
@@ -2176,9 +2195,7 @@
% corresponding citation data written to the \file{.bcf} file. And the way
% \cs{refsection} is implemented presumes each section is only ever begun once
% (fair\dots{}), thus making it difficult to ``reopen'' it, or append new
-% citations to it later on, when the notes are printed. Given the complexity
-% of this machinery, it would be madness not to use \pkg{biblatex}'s
-% infrastructure directly, and try to ``emulate'' it. The start of a
+% citations to it later on, when the notes are printed. The start of a
% \texttt{refsection} must be registered on the \file{.bcf} file, and this is
% done by \cs{refsection} (and its auxiliary functions). However, a number of
% its characteristics make things particularly difficult for the purpose at
@@ -2187,14 +2204,13 @@
% environment (which receives the \meta{resources}) is used to set a local
% assignment to \cs{blx@bibfiles}, based on which the relevant information is
% written to the \file{.bcf} file, and when the group closes the information
-% is gone. My best attempt is below (excluded from the package) but it is not
-% good. It feels a wrong approach to ``go around'' the intended use of
-% \cs{refsection} so much, and it can't handle at all its optional argument,
-% for the reasons above. It's also incomplete, since it does not handle
-% restoring \cs{l_@@_biblatex_orig_refsection_tl}.
+% is gone. My best attempt is below but it is not good. It feels a wrong
+% approach to ``go around'' the intended use of \cs{refsection} so much, and
+% it can't handle at all its optional argument, for the reasons above. It's
+% also incomplete, since it does not handle restoring
+% \cs{l_@@_biblatex_orig_refsection_tl}.
%
% \begin{macrocode}
-%<*gobble>
\AddToHook { package/biblatex/after }
{
\tl_new:N \l_@@_biblatex_orig_refsection_tl
@@ -2227,6 +2243,9 @@
}
}
}
+% \end{macrocode}
+%
+% \begin{macrocode}
%</gobble>
% \end{macrocode}
%