summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-08-21 20:21:01 +0000
committerKarl Berry <karl@freefriends.org>2023-08-21 20:21:01 +0000
commitffbf60a0694a1a3abba057446f69983dbd04bfd5 (patch)
tree6d828b5e8e81aeedc075be74e400c50601844a6b /Master/texmf-dist/source
parent78f128f37a962971eb0071ac427c974dce850ef9 (diff)
postnotes (21aug23)
git-svn-id: svn://tug.org/texlive/trunk@68006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/postnotes/postnotes.dtx62
1 files changed, 42 insertions, 20 deletions
diff --git a/Master/texmf-dist/source/latex/postnotes/postnotes.dtx b/Master/texmf-dist/source/latex/postnotes/postnotes.dtx
index cb7998fbea0..5a32a179630 100644
--- a/Master/texmf-dist/source/latex/postnotes/postnotes.dtx
+++ b/Master/texmf-dist/source/latex/postnotes/postnotes.dtx
@@ -138,23 +138,22 @@
% kernel or newer.
%
% \begin{macrocode}
-\NeedsTeXFormat{LaTeX2e}
+\def\postnotes@required@kernel{2022-06-01}
+\NeedsTeXFormat{LaTeX2e}[\postnotes@required@kernel]
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
-\IfFormatAtLeastTF{2022-06-01}
+\IfFormatAtLeastTF{\postnotes@required@kernel}
{}
{%
\PackageError{postnotes}{LaTeX kernel too old}
{%
- 'postnotes' requires a LaTeX kernel 2022-06-01 or newer.%
- \MessageBreak Loading will abort!%
+ 'postnotes' requires a LaTeX kernel \postnotes@required@kernel\space or newer.%
}%
- \endinput
}%
% \end{macrocode}
%
%
% \begin{macrocode}
-\ProvidesExplPackage {postnotes} {2023-06-16} {0.2.5}
+\ProvidesExplPackage {postnotes} {2023-08-21} {0.2.6}
{Endnotes for LaTeX}
% \end{macrocode}
%
@@ -296,9 +295,32 @@
% \end{macrocode}
% \end{macro}
%
+% And ensure \cs{post@note} is defined in the \file{.aux} file. The hooks are
+% the same used by \pkg{hyperref} for similar purpose.
+%
+% \begin{macrocode}
+\AddToHook { begindocument }
+ {
+ \legacy_if:nT { @filesw }
+ {
+ \iow_now:Nx \@mainaux
+ { \token_to_str:N \providecommand \token_to_str:N \post@note [2]{} }
+ }
+ }
+\AddToHook { include/before }
+ {
+ \legacy_if:nT { @filesw }
+ {
+ \iow_now:Nx \@partaux
+ { \token_to_str:N \providecommand \token_to_str:N \post@note [2]{} }
+ }
+ }
+% \end{macrocode}
+%
%
% \begin{macro}
% {
+% \@@_set_label:nn ,
% \@@_set_mark_page_label:n ,
% \@@_set_text_page_label:n ,
% \@@_set_print_page_label:n ,
@@ -307,28 +329,28 @@
% \cs{iow_shipout_x:Nn}, since the main information we are interested in is
% the \texttt{page}.
% \begin{syntax}
-% \cs{@@_set_mark_page_label:n} \Arg{label name}
-% \cs{@@_set_text_page_label:n} \Arg{label name}
-% \cs{@@_set_print_page_label:n} \Arg{label name}
+% \cs{@@_set_label:nn} \Arg{label name} \Arg{value}
+% \cs{@@_set_mark_page_label:n} \Arg{note id}
+% \cs{@@_set_text_page_label:n} \Arg{note id}
+% \cs{@@_set_print_page_label:n} \Arg{note id}
% \end{syntax}
% \begin{macrocode}
-\cs_new_protected:Npn \@@_set_mark_page_label:n #1
+\cs_new_protected:Npn \@@_set_label:nn #1#2
{
- \iow_shipout_x:Nn \@auxout
- { \token_to_str:N \post@note { mark@ #1 } { \thepage } }
+ \legacy_if:nT { @filesw }
+ {
+ \iow_shipout_x:Nn \@auxout
+ { \token_to_str:N \post@note { #1 } { #2 } }
+ }
}
+\cs_new_protected:Npn \@@_set_mark_page_label:n #1
+ { \@@_set_label:nn { mark@ #1 } { \thepage } }
\cs_generate_variant:Nn \@@_set_mark_page_label:n { x }
\cs_new_protected:Npn \@@_set_text_page_label:n #1
- {
- \iow_shipout_x:Nn \@auxout
- { \token_to_str:N \post@note { text@ #1 } { \int_use:N \c@page } }
- }
+ { \@@_set_label:nn { text@ #1 } { \int_use:N \c@page } }
\cs_generate_variant:Nn \@@_set_text_page_label:n { x }
\cs_new_protected:Npn \@@_set_print_page_label:n #1
- {
- \iow_shipout_x:Nn \@auxout
- { \token_to_str:N \post@note { print@ #1 } { \int_use:N \c@page } }
- }
+ { \@@_set_label:nn { print@ #1 } { \int_use:N \c@page } }
\cs_generate_variant:Nn \@@_set_print_page_label:n { x }
% \end{macrocode}
% \end{macro}