diff options
author | Karl Berry <karl@freefriends.org> | 2022-04-21 20:14:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-04-21 20:14:47 +0000 |
commit | 0def9bdb5e106486c9fae67078b00a5379b5a69a (patch) | |
tree | 5f97f8c7bccf58358d1dc47ded93c1e203099353 /Master/texmf-dist/tex/latex/postnotes/postnotes.sty | |
parent | 44b32b2d63a16a1cea0784e31a91d6acfdd06dcb (diff) |
postnotes (21apr22)
git-svn-id: svn://tug.org/texlive/trunk@63099 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/postnotes/postnotes.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/postnotes/postnotes.sty | 1212 |
1 files changed, 1212 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/postnotes/postnotes.sty b/Master/texmf-dist/tex/latex/postnotes/postnotes.sty new file mode 100644 index 00000000000..9cd8913ae73 --- /dev/null +++ b/Master/texmf-dist/tex/latex/postnotes/postnotes.sty @@ -0,0 +1,1212 @@ +%% +%% This is file `postnotes.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% postnotes.dtx (with options: `package') +%% +%% This file was generated from file(s) of the LaTeX package "postnotes". +%% +%% Copyright (C) 2022 Gustavo Barros +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file: +%% +%% https://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Gustavo Barros. +%% +%% This work consists of the files postnotes.dtx, +%% postnotes.ins, +%% postnotes.tex, +%% postnotes-code.tex, +%% and the files generated from them. +%% +%% The released version of this package is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the package can be found at +%% +%% https://github.com/gusbrs/postnotes +%% +%% for those people who are interested. +%% +%% ----------------------------------------------------------------------- +%% +\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} +\IfFormatAtLeastTF{2021-11-15} + {} + {% + \PackageError{postnotes}{LaTeX kernel too old} + {% + 'postnotes' requires a LaTeX kernel 2021-11-15 or newer.% + \MessageBreak Loading will abort!% + }% + \endinput + }% +\ProvidesExplPackage {postnotes} {2022-04-21} {0.1.1} + {Endnotes for LaTeX} +\cs_new:Npn \__postnotes_data_name:n #1 + { g__postnotes_ #1 _data_prop } +\cs_generate_variant:Nn \__postnotes_data_name:n { e } +\NewHook { postnotes/store/note } +\cs_new_protected:Npn \__postnotes_store:nn #1#2 + { + \prop_new:c { \__postnotes_data_name:e {#1} } + \prop_gput:cnn { \__postnotes_data_name:e {#1} } { type } { note } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { mark } + { \l__postnotes_mark_tl } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { counter } + { \int_use:N \c@postnote } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { sortnum } + { + \bool_if:NTF \l__postnotes_manual_sortnum_bool + { \fp_use:N \l__postnotes_sort_num_fp } + { \int_use:N \c@postnote } + } + \cs_if_exist:cT { chapter } + { + \prop_gput:cnx { \__postnotes_data_name:e {#1} } + { thechapter } { \thechapter } + } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { thesection } + { \thesection } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { pnsectname } + { \g__postnotes_section_name_tl } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { pnsectid } + { \int_use:N \g__postnotes_sectid_int } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { multibool } + { \bool_to_str:N \l__postnotes_maybe_multi_bool } + \prop_gput:cnn { \__postnotes_data_name:e {#1} } { content } {#2} + \UseHook { postnotes/store/note } + } +\cs_new_protected:Npn \__postnotes_store_section:nn #1#2 + { + \prop_new:c { \__postnotes_data_name:e {#1} } + \prop_gput:cnn { \__postnotes_data_name:e {#1} } { type } { section } + \cs_if_exist:cT { chapter } + { + \prop_gput:cnx { \__postnotes_data_name:e {#1} } + { thechapter } { \thechapter } + } + \prop_gput:cnx { \__postnotes_data_name:e {#1} } { thesection } + { \thesection } + \prop_gput:cnn { \__postnotes_data_name:e {#1} } { content } {#2} + } +\cs_new_protected:Npn \__postnotes_prop_get:nnN #1#2#3 + { + \prop_get:cnNF { \__postnotes_data_name:e {#1} } {#2} #3 + { \tl_clear:N #3 } + } +\cs_new:Npn \__postnotes_prop_item:nn #1#2 + { \prop_item:cn { \__postnotes_data_name:e {#1} } {#2} } +\cs_new_protected:Npn \__postnotes_prop_gclear:n #1 + { \prop_gclear:c { \__postnotes_data_name:e {#1} } } +\tl_const:Nn \c__postnotes_ref_prefix_tl { postnote@r } +\cs_new_protected:Npx \post@note #1#2 + { \exp_not:N \@newl@bel { \c__postnotes_ref_prefix_tl } {#1} {#2} } +\cs_new_protected:Npn \__postnotes_set_mark_page_label:n #1 + { + \iow_shipout_x:Nn \@auxout + { \post@note { mark@ #1 } { \thepage } } + } +\cs_generate_variant:Nn \__postnotes_set_mark_page_label:n { x } +\cs_new_protected:Npn \__postnotes_set_text_page_label:n #1 + { + \iow_shipout_x:Nn \@auxout + { \post@note { text@ #1 } { \int_use:N \c@page } } + } +\cs_generate_variant:Nn \__postnotes_set_text_page_label:n { x } +\cs_new_protected:Npn \__postnotes_set_print_page_label:n #1 + { + \iow_shipout_x:Nn \@auxout + { \post@note { print@ #1 } { \int_use:N \c@page } } + } +\cs_generate_variant:Nn \__postnotes_set_print_page_label:n { x } +\cs_new_protected:Npn \__postnotes_get_pageref:Nn #1#2 + { + \cs_if_exist:cTF { \c__postnotes_ref_prefix_tl @ #2 } + { \tl_set:Nv #1 { \c__postnotes_ref_prefix_tl @ #2 } } + { \tl_clear:N #1 } + } +\cs_generate_variant:Nn \__postnotes_get_pageref:Nn { Nx } +\cs_new:Npn \__postnotes_extract_pageref:n #1 + { + \cs_if_exist:cTF { \c__postnotes_ref_prefix_tl @ #1 } + { \exp_not:v { \c__postnotes_ref_prefix_tl @ #1 } } + { \c_empty_tl } + } +\cs_generate_variant:Nn \__postnotes_extract_pageref:n { e } +\keys_define:nn { postnotes/setup } + { + heading .cs_set_protected:Np = \pnheading , + heading .value_required:n = true , + } +\cs_if_exist:cTF { chapter } + { + \cs_new_protected:Npn \pnheading + { + \chapter*{\pntitle} + \@mkboth{\pnheaderdefault}{\pnheaderdefault} + } + } + { + \cs_new_protected:Npn \pnheading + { + \section*{\pntitle} + \@mkboth{\pnheaderdefault}{\pnheaderdefault} + } + } +\tl_new:N \l__postnotes_print_format_tl +\keys_define:nn { postnotes/setup } + { + format .tl_set:N = \l__postnotes_print_format_tl , + format .initial:n = { \small } , + format .value_required:n = true , + } +\tl_new:N \l__postnotes_print_env_tl +\bool_new:N \l__postnotes_print_as_list_bool +\keys_define:nn { postnotes/setup } + { + listenv .code:n = + { + \tl_if_eq:nnTF {#1} { none } + { + \bool_set_false:N \l__postnotes_print_as_list_bool + \tl_set:Nn \l__postnotes_post_printnote_tl { \par } + \tl_set:Nn \l__postnotes_print_env_tl { itemize } + } + { + \bool_set_true:N \l__postnotes_print_as_list_bool + \tl_set:Nn \l__postnotes_print_env_tl {#1} + } + } , + listenv .initial:n = { postnoteslist } , + listenv .value_required:n = true , + } +\NewDocumentEnvironment { postnoteslist } { } + { + \list { } + { + \setlength { \leftmargin } { 0pt } + \setlength { \labelwidth } { 0pt } + \setlength { \itemindent } { .5\parindent } + \cs_set_eq:NN \makelabel \__postnotes_list_makelabel:n + \setlength { \rightmargin } { 0pt } + \setlength { \listparindent } { \parindent } + \setlength { \parsep } { \parskip } + \setlength { \itemsep } { 0pt } + \setlength { \topsep } { .5\topsep } + \setlength { \partopsep } { .5\partopsep } + } + } + { \endlist } +\NewDocumentEnvironment { postnoteslisthang } { } + { + \list { } + { + \setlength { \leftmargin } { 1em } + \setlength { \labelwidth } { -\leftmargin } + \setlength { \itemindent } { -2\leftmargin } + \cs_set_eq:NN \makelabel \__postnotes_list_makelabel:n + \setlength { \rightmargin } { 0pt } + \setlength { \listparindent } { \parindent } + \setlength { \parsep } { \parskip } + \setlength { \itemsep } { 0pt } + \setlength { \topsep } { .5\topsep } + \setlength { \partopsep } { .5\partopsep } + } + } + { \endlist } +\cs_new:Npn \__postnotes_list_makelabel:n #1 + { \hspace { \labelsep } \normalfont ~ #1 } +\keys_define:nn { postnotes/setup } + { + makemark .cs_set:Np = \__postnotes_make_mark:nnn #1#2#3 , + makemark .value_required:n = true , + makemark .initial:n = + { #2 \hbox { \@textsuperscript { \normalfont #1 } } #3 } , + maketextmark .cs_set:Np = \__postnotes_make_text_mark:nnn #1#2#3 , + maketextmark .value_required:n = true , + maketextmark .initial:n = { #2 #1 . #3 } , + } +\tl_new:N \l__postnotes_pre_textmark_tl +\tl_new:N \l__postnotes_post_textmark_tl +\tl_new:N \l__postnotes_post_printnote_tl +\keys_define:nn { postnotes/setup } + { + pretextmark .tl_set:N = \l__postnotes_pre_textmark_tl , + pretextmark .value_required:n = true , + posttextmark .tl_set:N = \l__postnotes_post_textmark_tl , + posttextmark .value_required:n = true , + postprintnote .tl_set:N = \l__postnotes_post_printnote_tl , + postprintnote .value_required:n = true , + } +\bool_new:N \l__postnotes_hyperlink_bool +\bool_new:N \l__postnotes_hyperref_warn_bool +\bool_new:N \l__postnotes_backlink_bool +\keys_define:nn { postnotes/setup } + { + hyperref .choice: , + hyperref / auto .code:n = + { + \bool_set_true:N \l__postnotes_hyperlink_bool + \bool_set_false:N \l__postnotes_hyperref_warn_bool + } , + hyperref / true .code:n = + { + \bool_set_true:N \l__postnotes_hyperlink_bool + \bool_set_true:N \l__postnotes_hyperref_warn_bool + } , + hyperref / false .code:n = + { + \bool_set_false:N \l__postnotes_hyperlink_bool + \bool_set_false:N \l__postnotes_hyperref_warn_bool + } , + hyperref .initial:n = auto , + hyperref .default:n = true , + backlink .bool_set:N = \l__postnotes_backlink_bool , + backlink .initial:n = true , + backlink .default:n = true , + } +\AddToHook { begindocument } + { + \IfPackageLoadedTF { hyperref } + { } + { + \bool_if:NT \l__postnotes_hyperref_warn_bool + { \msg_warning:nn { postnotes } { missing-hyperref } } + \bool_set_false:N \l__postnotes_hyperlink_bool + } + \keys_define:nn { postnotes/setup } + { + hyperref .code:n = + { + \msg_warning:nnn { postnotes } + { option-preamble-only } { hyperref } + } , + backlink .code:n = + { + \msg_warning:nnn { postnotes } + { option-preamble-only } { backlink } + } , + } + } +\msg_new:nnn { postnotes } { option-preamble-only } + { Option~'#1'~only~available~in~the~preamble~\msg_line_context:. } +\msg_new:nnn { postnotes } { missing-hyperref } + { Missing~'hyperref'~package.~Setting~'hyperref=false'. } +\bool_new:N \l__postnotes_sort_bool +\keys_define:nn { postnotes/setup } + { + sort .bool_set:N = \l__postnotes_sort_bool , + sort .initial:n = true , + sort .default:n = true , + } +\keys_define:nn { postnotes/setup } + { + style .choice: , + style / endnotes .meta:n = + { + listenv = none , + format = + { + \footnotesize + \setlength { \rightskip } { 0pt } + \setlength { \leftskip } { 0pt } + \setlength { \parindent } { 1.8em } + } , + pretextmark = { \par } , + maketextmark = + { + \hbox_set:Nn \l_tmpa_box { \@textsuperscript { \normalfont ##1 } } + \skip_horizontal:n { - \box_wd:N \l_tmpa_box } + ##2 \box_use:N \l_tmpa_box ##3 + } , + } , + style / pagenote .meta:n = + { + listenv = none , + format = { } , + pretextmark = { \par\noindent } , + maketextmark = { { \normalfont ##2 ##1 . ##3 } } , + posttextmark = { ~ } , + } , + } +\NewDocumentCommand \postnotesetup { m } + { \keys_set:nn { postnotes/setup } {#1} } +\newcounter { postnote } +\int_new:N \g__postnotes_note_id_int +\tl_new:N \l__postnotes_note_id_tl +\tl_set:Nn \l__postnotes_note_id_tl { \int_use:N \g__postnotes_note_id_int } +\seq_new:N \g__postnotes_queue_seq +\NewDocumentCommand \postnote { O { } +m } + { \__postnotes_note:nn {#1} {#2} } +\NewHook { postnotes/note/begin } +\cs_new_protected:Npn \__postnotes_note:nn #1#2 + { + \group_begin: + \keys_set:nn { postnotes/note } {#1} + \__postnotes_inhibit_note:F + { + \int_gincr:N \g__postnotes_note_id_int + \tl_if_empty:NT \l__postnotes_mark_tl + { + \stepcounter { postnote } + \tl_set:Nx \l__postnotes_mark_tl { \thepostnote } + } + \seq_gput_right:Nx \g__postnotes_queue_seq + { \l__postnotes_note_id_tl } + \UseHook { postnotes/note/begin } + \cs_set:Npn \@currentcounter { postnote } + \cs_set:Npx \@currentlabel { \p@postnote \l__postnotes_mark_tl } + \__postnotes_hyperref_make_currentHref:n + { postnote. \l__postnotes_note_id_tl .mark } + \__postnotes_set_mark_page_label:x { \l__postnotes_note_id_tl } + \__postnotes_set_user_labels: + \bool_if:NTF \l__postnotes_nomark_bool + { + \bool_if:NT \l__postnotes_hyperlink_bool + { + \__postnotes_hyperref_set_anchor:n + { postnote. \l__postnotes_note_id_tl .mark } + } + } + { + \__postnotes_typeset_mark:xV + { \l__postnotes_note_id_tl } \l__postnotes_mark_tl + } + \__postnotes_store:nn { \l__postnotes_note_id_tl } {#2} + } + \group_end: + } +\tl_new:N \l__postnotes_mark_tl +\bool_new:N \l__postnotes_nomark_bool +\fp_new:N \l__postnotes_sort_num_fp +\tl_new:N \l__postnotes_note_label_tl +\bool_new:N \l__postnotes_manual_sortnum_bool +\bool_new:N \l__postnotes_maybe_multi_bool +\keys_define:nn { postnotes/note } + { + mark .tl_set:N = \l__postnotes_mark_tl , + mark .value_required:n = true , + nomark .bool_set:N = \l__postnotes_nomark_bool , + nomark .default:n = true , + sortnum .code:n = + { + \fp_set:Nn \l__postnotes_sort_num_fp {#1} + \bool_set_true:N \l__postnotes_manual_sortnum_bool + } , + sortnum .value_required:n = true , + label .tl_set:N = \l__postnotes_note_label_tl , + label .value_required:n = true , + } +\bool_new:N \l__postnotes_inhibit_note_bool +\bool_new:N \l__postnotes_print_plain_mark_bool +\NewHook { postnotes/note/inhibit } +\prg_new_protected_conditional:Npnn \__postnotes_inhibit_note: { F } + { + \bool_set_false:N \l__postnotes_inhibit_note_bool + \bool_set_false:N \l__postnotes_print_plain_mark_bool + \UseHook { postnotes/note/inhibit } + \bool_if:NT \l__postnotes_print_plain_mark_bool + { + \tl_if_empty:NT \l__postnotes_mark_tl + { + \group_begin: + \int_incr:N \c@postnote + \exp_args:NNNx + \group_end: + \tl_set:Nn \l__postnotes_mark_tl { \thepostnote } + } + \__postnotes_typeset_mark_wrapper:n + { \__postnotes_make_mark:nnn { \l__postnotes_mark_tl } { } { } } + } + \bool_if:NTF \l__postnotes_inhibit_note_bool + { \prg_return_true: } + { \prg_return_false: } + } +\cs_new_protected:Npn \__postnotes_typeset_mark:nn #1#2 + { + \__postnotes_typeset_mark_wrapper:n + { + \bool_if:NTF \l__postnotes_hyperlink_bool + { + \__postnotes_hyperref_set_anchor:n { postnote. #1 .mark } + \__postnotes_make_mark:nnn {#2} + { \hyper@linkstart { link } { postnote. #1 .text } } + { \hyper@linkend } + } + { \__postnotes_make_mark:nnn {#2} { } { } } + } + } +\cs_generate_variant:Nn \__postnotes_typeset_mark:nn { xV } +\tl_new:N \l__postnotes_saved_spacefactor_tl +\cs_new_protected:Npn \__postnotes_typeset_mark_wrapper:n #1 + { + \mode_leave_vertical: + \mode_if_horizontal:T + { + \tl_set:Nx \l__postnotes_saved_spacefactor_tl { \the\spacefactor } + \nobreak + } + #1 + \mode_if_horizontal:T + { \spacefactor \l__postnotes_saved_spacefactor_tl } + \scan_stop: + } +\cs_new_protected:Npn \__postnotes_set_user_labels: + { + \tl_if_empty:NF \l__postnotes_note_label_tl + { \exp_args:NV \label \l__postnotes_note_label_tl } + \tl_if_empty:NF \l__postnotes_note_zlabel_tl + { \exp_args:NV \zlabel \l__postnotes_note_zlabel_tl } + } +\NewDocumentCommand \postnoteref { s m } + { \__postnotes_note_ref:nn {#1} {#2} } +\cs_new_protected:Npn \__postnotes_note_ref:nn #1#2 + { + \group_begin: + \__postnotes_typeset_mark_wrapper:n + { + \bool_lazy_and:nnTF + { ! #1 } + { \l__postnotes_hyperlink_bool } + { + \hyperref [#2] + { \__postnotes_make_mark:nnn { \ref*{#2} } { } { } } + } + { \__postnotes_make_mark:nnn { \__postnotes_ref_star:n {#2} } { } { } } + } + \group_end: + } +\NewDocumentCommand \postnotesection { O { } +m } + { \__postnotes_section:nn {#1} {#2} } +\int_new:N \g__postnotes_sectid_int +\cs_new_protected:Npn \__postnotes_section:nn #1#2 + { + \group_begin: + \int_gincr:N \g__postnotes_sectid_int + \int_gincr:N \g__postnotes_note_id_int + \seq_gput_right:Nx \g__postnotes_queue_seq { \l__postnotes_note_id_tl } + \tl_gclear:N \g__postnotes_section_name_tl + \keys_set:nn { postnotes/section } {#1} + \__postnotes_store_section:nn { \l__postnotes_note_id_tl } {#2} + \group_end: + } +\tl_new:N \g__postnotes_section_name_tl +\keys_define:nn { postnotes/section } + { + name .tl_gset:N = \g__postnotes_section_name_tl , + name .value_required:n = true , + } +\NewDocumentCommand \printpostnotes { } + { \__postnotes_print_notes: } +\tl_new:N \pnthechapter +\tl_new:N \pnthesection +\tl_new:N \pnthechapternextnote +\tl_new:N \pnthesectionnextnote +\tl_new:N \pnthepage +\int_new:N \g__postnotes_print_postnotes_int +\tl_new:N \l__postnotes_print_note_id_tl +\tl_new:N \l__postnotes_print_note_id_next_tl +\tl_new:N \l__postnotes_print_counter_tl +\tl_new:N \l__postnotes_print_mark_tl +\tl_new:N \l__postnotes_print_type_curr_tl +\tl_new:N \l__postnotes_print_type_next_tl +\tl_new:N \l__postnotes_print_type_prev_tl +\tl_new:N \l__postnotes_print_content_tl +\seq_new:N \l__postnotes_clear_queue_seq +\NewHook { postnotes/print/begin } +\NewHook { postnotes/print/eachnote } +\newcounter { postnotetext } +\newcounter { postnotesection } +\setcounter { postnotesection } { 10000 } +\cs_new_protected:Npn \__postnotes_print_notes: + { + \group_begin: + \int_gincr:N \g__postnotes_print_postnotes_int + \seq_if_empty:NTF \g__postnotes_queue_seq + { \msg_warning:nn { postnotes } { empty-printpostnotes } } + { + \pnheading + \UseHook { postnotes/print/begin } + \tl_set:Nn \l__postnotes_print_type_prev_tl { open } + \seq_set_eq:NN \l__postnotes_clear_queue_seq \g__postnotes_queue_seq + \__postnotes_verify_multipass:N \g__postnotes_queue_seq + \bool_if:NT \l__postnotes_sort_bool + { \__postnotes_sort_queue:N \g__postnotes_queue_seq } + \bool_gset_true:N \g__postnotes_header_vars_next_bool + \__postnotes_get_headers_data:N \g__postnotes_queue_seq + \__postnotes_set_headers_vars_first: + \bool_if:NF \l__postnotes_print_as_list_bool + { + \cs_set_eq:NN \@afterindentfalse \@afterindenttrue + \@afterindenttrue + } + \bool_until_do:nn { \seq_if_empty_p:N \g__postnotes_queue_seq } + { + \seq_gpop_left:NN \g__postnotes_queue_seq + \l__postnotes_print_note_id_tl + \__postnotes_prop_get:nnN { \l__postnotes_print_note_id_tl } + { type } \l__postnotes_print_type_curr_tl + \tl_if_eq:NnTF \l__postnotes_print_type_curr_tl { section } + { % type_curr = `section' + \seq_if_empty:NTF \g__postnotes_queue_seq + { + \tl_set:Nn \l__postnotes_print_note_id_next_tl { noid } + \tl_set:Nn \l__postnotes_print_type_next_tl { close } + } + { + \seq_get_left:NN \g__postnotes_queue_seq + \l__postnotes_print_note_id_next_tl + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_next_tl } + { type } \l__postnotes_print_type_next_tl + } + \tl_if_eq:NnT \l__postnotes_print_type_next_tl { note } + { + \stepcounter { postnotesection } + \group_begin: + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_tl } + { thechapter } \pnthechapter + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_tl } + { thesection } \pnthesection + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_next_tl } + { thechapter } \pnthechapternextnote + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_next_tl } + { thesection } \pnthesectionnextnote + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_tl } + { content } \l__postnotes_print_content_tl + \l__postnotes_print_content_tl + \group_end: + \tl_set:NV \l__postnotes_print_type_prev_tl + \l__postnotes_print_type_curr_tl + } + } + { % type_curr = `note' + \tl_if_eq:NnF \l__postnotes_print_type_prev_tl { note } + { + \bool_if:NTF \l__postnotes_print_as_list_bool + { \exp_args:Nx \begin { \l__postnotes_print_env_tl } } + { \group_begin: } + \l__postnotes_print_format_tl + } + \group_begin: + \UseHook { postnotes/print/eachnote } + \__postnotes_get_pageref:Nx \pnthepage + { mark@ \l__postnotes_print_note_id_tl } + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_tl } + { mark } \l__postnotes_print_mark_tl + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_tl } + { counter } \l__postnotes_print_counter_tl + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_tl } + { content } \l__postnotes_print_content_tl + \cs_set:Npn \@currentcounter { postnotetext } + \int_set:Nn \c@postnotetext + { \int_eval:n { \l__postnotes_print_counter_tl } } + \cs_set:Npx \@currentlabel + { \p@postnote \l__postnotes_print_mark_tl } + \__postnotes_hyperref_make_currentHref:n + { postnote. \l__postnotes_print_note_id_tl .text } + \__postnotes_text_mark_wrapper:n + { + \__postnotes_set_text_page_label:x + { \l__postnotes_print_note_id_tl } + \__postnotes_typeset_text_mark:eV + { \l__postnotes_print_note_id_tl } + \l__postnotes_print_mark_tl + } + \l__postnotes_print_content_tl + \l__postnotes_post_printnote_tl + \group_end: + \seq_if_empty:NTF \g__postnotes_queue_seq + { + \tl_set:Nn \l__postnotes_print_note_id_next_tl { noid } + \tl_set:Nn \l__postnotes_print_type_next_tl { close } + } + { + \seq_get_left:NN \g__postnotes_queue_seq + \l__postnotes_print_note_id_next_tl + \__postnotes_prop_get:nnN + { \l__postnotes_print_note_id_next_tl } + { type } \l__postnotes_print_type_next_tl + } + \tl_if_eq:NnF \l__postnotes_print_type_next_tl { note } + { + \bool_if:NTF \l__postnotes_print_as_list_bool + { \exp_args:Nx \end { \l__postnotes_print_env_tl } } + { \group_end: } + } + \tl_set:NV \l__postnotes_print_type_prev_tl + \l__postnotes_print_type_curr_tl + } + } + \AddToHookNext { shipout/after } + { \bool_gset_false:N \g__postnotes_header_vars_next_bool } + \seq_map_inline:Nn \l__postnotes_clear_queue_seq + { \__postnotes_prop_gclear:n { ##1 } } + } + \group_end: + } +\msg_new:nnn { postnotes } { empty-printpostnotes } + { Empty~'\iow_char:N\\printpostnotes'~\msg_line_context:. } +\cs_new_protected:Npn \__postnotes_typeset_text_mark:nn #1#2 + { + \bool_if:NTF \l__postnotes_hyperlink_bool + { + \__postnotes_hyperref_set_anchor:n { postnote. #1 .text } + \bool_if:NTF \l__postnotes_backlink_bool + { + \__postnotes_make_text_mark:nnn {#2} + { \hyper@linkstart { link } { postnote. #1 .mark } } + { \hyper@linkend } + } + { \__postnotes_make_text_mark:nnn {#2} { } { } } + } + { \__postnotes_make_text_mark:nnn {#2} { } { } } + } +\cs_generate_variant:Nn \__postnotes_typeset_text_mark:nn { eV } +\cs_new_protected:Npn \__postnotes_text_mark_wrapper:n #1 + { + \bool_if:NTF \l__postnotes_print_as_list_bool + { + \item + [ \l__postnotes_pre_textmark_tl #1 \l__postnotes_post_textmark_tl ] + } + { \l__postnotes_pre_textmark_tl #1 \l__postnotes_post_textmark_tl } + } +\cs_new_protected:Npn \__postnotes_verify_multipass:N #1 + { + \group_begin: + \seq_clear:N \l_tmpa_seq + \seq_map_inline:Nn #1 + { + \__postnotes_prop_get:nnN {##1} { multibool } \l_tmpa_tl + \tl_if_eq:NnTF \l_tmpa_tl { true } + { + \cs_if_exist:cT + { \c__postnotes_ref_prefix_tl @ mark@ ##1 } + { \seq_put_right:Nn \l_tmpa_seq {##1} } + } + { \seq_put_right:Nn \l_tmpa_seq {##1} } + } + \seq_gset_eq:NN #1 \l_tmpa_seq + \group_end: + } +\cs_new_protected:Npn \__postnotes_sort_queue:N #1 + { + \group_begin: + \seq_gsort:Nn #1 + { + \__postnotes_prop_get:nnN {##1} { pnsectid } \l_tmpa_tl + \__postnotes_prop_get:nnN {##2} { pnsectid } \l_tmpb_tl + \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl + { + \__postnotes_prop_get:nnN {##1} { type } \l_tmpa_tl + \__postnotes_prop_get:nnN {##2} { type } \l_tmpb_tl + \bool_lazy_and:nnTF + { \str_if_eq_p:Vn \l_tmpa_tl { note } } + { \str_if_eq_p:Vn \l_tmpb_tl { note } } + { + \__postnotes_prop_get:nnN {##1} { sortnum } \l_tmpa_tl + \__postnotes_prop_get:nnN {##2} { sortnum } \l_tmpb_tl + \fp_compare:nNnTF { \l_tmpa_tl } > { \l_tmpb_tl } + { \sort_return_swapped: } + { \sort_return_same: } + } + { \sort_return_same: } + } + { \sort_return_same: } + } + \group_end: + } +\tl_new:N \pnhdpagefirst +\tl_new:N \pnhdpagelast +\tl_new:N \pnhdchapfirst +\tl_new:N \pnhdchaplast +\tl_new:N \pnhdsectfirst +\tl_new:N \pnhdsectlast +\tl_new:N \pnhdnamefirst +\tl_new:N \pnhdnamelast +\prop_new:N \g__postnotes_header_page_first_prop +\prop_new:N \g__postnotes_header_page_last_prop +\prop_new:N \g__postnotes_header_chap_first_prop +\prop_new:N \g__postnotes_header_chap_last_prop +\prop_new:N \g__postnotes_header_sect_first_prop +\prop_new:N \g__postnotes_header_sect_last_prop +\prop_new:N \g__postnotes_header_name_first_prop +\prop_new:N \g__postnotes_header_name_last_prop +\tl_new:N \g__postnotes_header_prev_last_page_tl +\tl_new:N \g__postnotes_header_prev_last_chap_tl +\tl_new:N \g__postnotes_header_prev_last_sect_tl +\tl_new:N \g__postnotes_header_prev_last_name_tl +\tl_new:N \l__postnotes_prev_text_page_tl +\tl_new:N \l__postnotes_curr_text_page_tl +\tl_new:N \l__postnotes_prev_mark_page_tl +\tl_new:N \l__postnotes_prev_mark_chap_tl +\tl_new:N \l__postnotes_prev_mark_sect_tl +\tl_new:N \l__postnotes_prev_mark_name_tl +\cs_new_protected:Npn \__postnotes_get_headers_data:N #1 + { + \group_begin: + \tl_gclear:N \pnhdpagefirst + \tl_gclear:N \pnhdpagelast + \tl_gclear:N \pnhdchapfirst + \tl_gclear:N \pnhdchaplast + \tl_gclear:N \pnhdsectfirst + \tl_gclear:N \pnhdsectlast + \tl_gclear:N \pnhdnamefirst + \tl_gclear:N \pnhdnamelast + \prop_gclear:N \g__postnotes_header_page_first_prop + \prop_gclear:N \g__postnotes_header_page_last_prop + \prop_gclear:N \g__postnotes_header_chap_first_prop + \prop_gclear:N \g__postnotes_header_chap_last_prop + \prop_gclear:N \g__postnotes_header_sect_first_prop + \prop_gclear:N \g__postnotes_header_sect_last_prop + \prop_gclear:N \g__postnotes_header_name_first_prop + \prop_gclear:N \g__postnotes_header_name_last_prop + \tl_gclear:N \g__postnotes_header_prev_last_page_tl + \tl_gclear:N \g__postnotes_header_prev_last_chap_tl + \tl_gclear:N \g__postnotes_header_prev_last_sect_tl + \tl_gclear:N \g__postnotes_header_prev_last_name_tl + \tl_clear:N \l__postnotes_prev_text_page_tl + \tl_clear:N \l__postnotes_curr_text_page_tl + \tl_clear:N \l__postnotes_prev_mark_page_tl + \tl_clear:N \l__postnotes_prev_mark_chap_tl + \tl_clear:N \l__postnotes_prev_mark_sect_tl + \tl_clear:N \l__postnotes_prev_mark_name_tl + \seq_map_inline:Nn #1 + { + \exp_args:Nx \tl_if_eq:nnT + { \__postnotes_prop_item:nn {##1} { type } } + { note } + { + \__postnotes_get_pageref:Nn + \l__postnotes_curr_text_page_tl { text@ ##1 } + \tl_if_empty:NF \l__postnotes_curr_text_page_tl + { + \tl_if_eq:NNTF + \l__postnotes_prev_text_page_tl + \l__postnotes_curr_text_page_tl + { + \__postnotes_get_pageref:Nn + \l__postnotes_prev_mark_page_tl { mark@ ##1 } + \__postnotes_prop_get:nnN {##1} { thechapter } + \l__postnotes_prev_mark_chap_tl + \__postnotes_prop_get:nnN {##1} { thesection } + \l__postnotes_prev_mark_sect_tl + \__postnotes_prop_get:nnN {##1} { pnsectname } + \l__postnotes_prev_mark_name_tl + } + { + \tl_if_empty:NF \l__postnotes_prev_text_page_tl + { + \prop_gput:Nxx \g__postnotes_header_page_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_page_tl } + \prop_gput:Nxx \g__postnotes_header_chap_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_chap_tl } + \prop_gput:Nxx \g__postnotes_header_sect_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_sect_tl } + \prop_gput:Nxx \g__postnotes_header_name_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_name_tl } + } + \prop_gput:Nxx \g__postnotes_header_page_first_prop + { \l__postnotes_curr_text_page_tl } + { \__postnotes_extract_pageref:n { mark@ ##1 } } + \prop_gput:Nxx \g__postnotes_header_chap_first_prop + { \l__postnotes_curr_text_page_tl } + { \__postnotes_prop_item:nn {##1} { thechapter } } + \prop_gput:Nxx \g__postnotes_header_sect_first_prop + { \l__postnotes_curr_text_page_tl } + { \__postnotes_prop_item:nn {##1} { thesection } } + \prop_gput:Nxx \g__postnotes_header_name_first_prop + { \l__postnotes_curr_text_page_tl } + { \__postnotes_prop_item:nn {##1} { pnsectname } } + \__postnotes_get_pageref:Nn + \l__postnotes_prev_mark_page_tl { mark@ ##1 } + \__postnotes_prop_get:nnN {##1} { thechapter } + \l__postnotes_prev_mark_chap_tl + \__postnotes_prop_get:nnN {##1} { thesection } + \l__postnotes_prev_mark_sect_tl + \__postnotes_prop_get:nnN {##1} { pnsectname } + \l__postnotes_prev_mark_name_tl + \tl_set:NV \l__postnotes_prev_text_page_tl + \l__postnotes_curr_text_page_tl + } + } + } + } + \tl_if_empty:NF \l__postnotes_prev_text_page_tl + { + \prop_gput:Nxx \g__postnotes_header_page_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_page_tl } + \prop_gput:Nxx \g__postnotes_header_chap_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_chap_tl } + \prop_gput:Nxx \g__postnotes_header_sect_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_sect_tl } + \prop_gput:Nxx \g__postnotes_header_name_last_prop + { \l__postnotes_prev_text_page_tl } + { \l__postnotes_prev_mark_name_tl } + } + \group_end: + } +\cs_new_protected:Npn \__postnotes_set_headers_vars:n #1 + { + \group_begin: + \prop_get:NnNTF \g__postnotes_header_page_first_prop + {#1} \l_tmpa_tl + { \tl_gset:NV \pnhdpagefirst \l_tmpa_tl } + { \tl_gset:NV \pnhdpagefirst \g__postnotes_header_prev_last_page_tl } + \prop_get:NnNTF \g__postnotes_header_page_last_prop + {#1} \l_tmpa_tl + { + \tl_gset:NV \pnhdpagelast \l_tmpa_tl + \tl_gset:NV \g__postnotes_header_prev_last_page_tl \l_tmpa_tl + } + { \tl_gset:NV \pnhdpagelast \g__postnotes_header_prev_last_page_tl } + \prop_get:NnNTF \g__postnotes_header_chap_first_prop + {#1} \l_tmpa_tl + { \tl_gset:NV \pnhdchapfirst \l_tmpa_tl } + { \tl_gset:NV \pnhdchapfirst \g__postnotes_header_prev_last_chap_tl } + \prop_get:NnNTF \g__postnotes_header_chap_last_prop + {#1} \l_tmpa_tl + { + \tl_gset:NV \pnhdchaplast \l_tmpa_tl + \tl_gset:NV \g__postnotes_header_prev_last_chap_tl \l_tmpa_tl + } + { \tl_gset:NV \pnhdchaplast \g__postnotes_header_prev_last_chap_tl } + \prop_get:NnNTF \g__postnotes_header_sect_first_prop + {#1} \l_tmpa_tl + { \tl_gset:NV \pnhdsectfirst \l_tmpa_tl } + { \tl_gset:NV \pnhdsectfirst \g__postnotes_header_prev_last_sect_tl } + \prop_get:NnNTF \g__postnotes_header_sect_last_prop + {#1} \l_tmpa_tl + { + \tl_gset:NV \pnhdsectlast \l_tmpa_tl + \tl_gset:NV \g__postnotes_header_prev_last_sect_tl \l_tmpa_tl + } + { \tl_gset:NV \pnhdsectlast \g__postnotes_header_prev_last_sect_tl } + \prop_get:NnNTF \g__postnotes_header_name_first_prop + {#1} \l_tmpa_tl + { \tl_gset:NV \pnhdnamefirst \l_tmpa_tl } + { \tl_gset:NV \pnhdnamefirst \g__postnotes_header_prev_last_name_tl } + \prop_get:NnNTF \g__postnotes_header_name_last_prop + {#1} \l_tmpa_tl + { + \tl_gset:NV \pnhdnamelast \l_tmpa_tl + \tl_gset:NV \g__postnotes_header_prev_last_name_tl \l_tmpa_tl + } + { \tl_gset:NV \pnhdnamelast \g__postnotes_header_prev_last_name_tl } + \group_end: + } +\cs_generate_variant:Nn \__postnotes_set_headers_vars:n { x } +\AddToHook { shipout/before } [ postnotes/header ] + { \__postnotes_set_headers_vars_next: } +\bool_new:N \g__postnotes_header_vars_next_bool +\cs_new_protected:Npn \__postnotes_set_headers_vars_next: + { + \bool_if:NT \g__postnotes_header_vars_next_bool + { \__postnotes_set_headers_vars:x { \int_eval:n { \c@page + 1 } } } + } +\cs_new_protected:Npn \__postnotes_set_headers_vars_first: + { + \__postnotes_set_print_page_label:x + { \int_use:N \g__postnotes_print_postnotes_int } + \__postnotes_set_headers_vars:x + { + \__postnotes_extract_pageref:e + { print@ \int_use:N \g__postnotes_print_postnotes_int } + } + } +\NewDocumentCommand \pnheaderdefault {} + { + \tl_if_eq:NNTF \pnhdpagefirst \pnhdpagelast + { \pnhdnotes{} ~ \pnhdtopage{} ~ \pnhdpagefirst } + { \pnhdnotes{} ~ \pnhdtopages{} ~ \pnhdpagefirst -- \pnhdpagelast } + } +\AddToHook { postnotes/note/begin } [ postnotes ] + { + \cs_if_exist:NT \@captype + { \bool_set_true:N \l__postnotes_maybe_multi_bool } + } +\bool_new:N \g__postnotes_hyperref_loaded_bool +\AddToHook { package/hyperref/after } + { \bool_gset_true:N \g__postnotes_hyperref_loaded_bool } +\cs_new_protected:Npn \__postnotes_hyperref_make_currentHref:n #1 + { + \bool_if:NT \g__postnotes_hyperref_loaded_bool + { \Hy@MakeCurrentHref {#1} } + } +\cs_new_protected:Npn \__postnotes_hyperref_set_anchor:n #1 + { + \bool_if:NT \g__postnotes_hyperref_loaded_bool + { \Hy@raisedlink { \hyper@anchor {#1} } } + } +\cs_new_protected:Npn \__postnotes_ref_star:n #1 + { + \bool_if:NTF \g__postnotes_hyperref_loaded_bool + { \ref*{#1} } + { \ref{#1} } + } +\AddToHook { package/biblatex/after } + { + \AddToHook { postnotes/store/note } [ postnotes ] + { + \prop_gput:cnx { \__postnotes_data_name:e { \l__postnotes_note_id_tl } } + { biblatex@refsection } { \int_use:N \c@refsection } + \prop_gput:cnx { \__postnotes_data_name:e { \l__postnotes_note_id_tl } } + { biblatex@refsegment } { \int_use:N \c@refsegment } + \prop_gput:cnx { \__postnotes_data_name:e { \l__postnotes_note_id_tl } } + { biblatex@refcontextbool } + { \iftoggle { blx@refcontext } { true } { false } } + \prop_gput:cnV { \__postnotes_data_name:e { \l__postnotes_note_id_tl } } + { biblatex@refcontext } \blx@refcontext@context + } + \AddToHook { postnotes/print/begin } [ postnotes ] + { + \__postnotes_biblatex_endrefcontext_local: + \__postnotes_biblatex_citereset_local: + \toggletrue { blx@footnote } + } + \tl_new:N \l__postnotes_biblatex_restore_tl + \AddToHook { postnotes/print/eachnote } [ postnotes ] + { + \__postnotes_prop_get:nnN { \l__postnotes_print_note_id_tl } + { biblatex@refsection } \l__postnotes_biblatex_restore_tl + \int_set:Nn \c@refsection { \l__postnotes_biblatex_restore_tl } + \__postnotes_prop_get:nnN { \l__postnotes_print_note_id_tl } + { biblatex@refsegment } \l__postnotes_biblatex_restore_tl + \int_set:Nn \c@refsegment { \l__postnotes_biblatex_restore_tl } + \__postnotes_prop_get:nnN { \l__postnotes_print_note_id_tl } + { biblatex@refcontextbool } \l__postnotes_biblatex_restore_tl + \use:c { toggle \l__postnotes_biblatex_restore_tl } { blx@refcontext } + \__postnotes_prop_get:nnN { \l__postnotes_print_note_id_tl } + { biblatex@refcontext } \l__postnotes_biblatex_restore_tl + \blx@edef@refcontext { \l__postnotes_biblatex_restore_tl } + } + \AddToHook { begindocument/before } [ postnotes/mkbibendnote ] + { + \cs_set_nopar:Npn \blx@theendnote { \postnote } + \cs_set_nopar:Npn \blx@theendnotetext + { \blx@err@endnote \footnotetext } + } + \cs_new_protected:Npn \__postnotes_biblatex_endrefcontext_local: + { + \togglefalse { blx@refcontext } + \tl_clear:N \blx@refcontext@labelprefix + \tl_clear:N \blx@refcontext@labelprefix@real + \tl_set:Nx \blx@refcontext@sortingtemplatename { \blx@sorting } + \tl_set:Nn \blx@refcontext@sortingnamekeytemplatename { global } + \tl_set:Nn \blx@refcontext@uniquenametemplatename { global } + \tl_set:Nn \blx@refcontext@labelalphanametemplatename { global } + \blx@edef@refcontext + { + \blx@refcontext@sortingtemplatename / + \blx@refcontext@sortingnamekeytemplatename / + / + \blx@refcontext@uniquenametemplatename / + \blx@refcontext@labelalphanametemplatename + } + } + \cs_new_protected:Npn \__postnotes_biblatex_citereset_local: + { + \tl_clear:c { blx@bsee@ \int_use:N \c@refsection } + \tl_clear:c { blx@fsee@ \int_use:N \c@refsection } + \undef \blx@lastkey@text + \undef \blx@lastkey@foot + \undef \blx@lasthash@text + \undef \blx@lasthash@foot + \clist_map_inline:Nn \blx@trackhash@text + { \csundef { blx@lastkey@text@ ##1 } } + \tl_clear:N \blx@trackhash@text + \clist_map_inline:Nn \blx@trackhash@foot + { \csundef { blx@lastkey@foot@ ##1 } } + \tl_clear:N \blx@trackhash@foot + \clist_map_inline:Nn \blx@trackkeys@text + { \csundef { blx@lastnote@text@ ##1 } } + \tl_clear:N \blx@trackkeys@text + \clist_map_inline:Nn \blx@trackkeys@foot + { \csundef { blx@lastnote@foot@ ##1 } } + \tl_clear:N \blx@trackkeys@foot + \cs_set_eq:NN \blx@lastmpfn \z@ + } + } +\tl_new:N \l__postnotes_note_zlabel_tl +\AddToHook { package/zref-user/after } + { + \keys_define:nn { postnotes/note } + { + zlabel .tl_set:N = \l__postnotes_note_zlabel_tl , + zlabel .value_required:n = true , + } + \NewDocumentCommand \postnotezref { s m } + { \__postnotes_note_zref:nn {#1} {#2} } + \cs_new_protected:Npn \__postnotes_note_zref:nn #1#2 + { + \group_begin: + \__postnotes_typeset_mark_wrapper:n + { + \bool_lazy_and:nnTF + { ! #1 } + { \l__postnotes_hyperlink_bool } + { + \hyperlink + { \zref@extractdefault {#2} { anchor } { } } + { \__postnotes_make_mark:nnn { \zref{#2} } { } { } } + } + { \__postnotes_make_mark:nnn { \zref{#2} } { } { } } + } + \group_end: + } + } +\AddToHook { package/zref-clever/after } + { + \zcsetup + { + countertype = { postnote = endnote } , + countertype = { postnotetext = endnote } , + } + \AddToHook { postnotes/print/begin } [ postnotes ] + { \zcsetup { counterresetby = { postnotetext = postnotesection } } } + } +\AddToHook { package/amsmath/after } + { + \AddToHook { postnotes/note/inhibit } [ postnotes ] + { + \legacy_if:nT { measuring@ } + { + \bool_set_true:N \l__postnotes_inhibit_note_bool + \bool_set_true:N \l__postnotes_print_plain_mark_bool + } + } + \AddToHook { postnotes/note/begin } [ postnotes ] + { + \legacy_if:nF { firstchoice@ } + { \bool_set_true:N \l__postnotes_maybe_multi_bool } + } + } +\AddToHook { package/csquotes/after } + { + \bool_new:N \l__postnotes_csquotes_measuring_bool + \BlockquoteDisable + { \bool_set_true:N \l__postnotes_csquotes_measuring_bool } + \AddToHook { postnotes/note/inhibit } [ postnotes ] + { + \bool_if:NT \l__postnotes_csquotes_measuring_bool + { + \bool_set_true:N \l__postnotes_inhibit_note_bool + \bool_set_true:N \l__postnotes_print_plain_mark_bool + } + } + } +\AddToHook { package/tabularx/after } + { + \bool_new:N \l__postnotes_tabularx_inside_env_bool + \AddToHook { env/tabularx/begin } [ postnotes ] + { + \bool_set_true:N \l__postnotes_tabularx_inside_env_bool + \cs_set_eq:NN \__postnotes_tabularx_saved_write:Nn \write + } + \AddToHook { postnotes/note/inhibit } [ postnotes ] + { + \bool_lazy_and:nnT + { \l__postnotes_tabularx_inside_env_bool } + { ! \cs_if_eq_p:NN \write \__postnotes_tabularx_saved_write:Nn } + { + \bool_set_true:N \l__postnotes_inhibit_note_bool + \bool_set_true:N \l__postnotes_print_plain_mark_bool + } + } + } +\AddToHook { package/tabularray/after } + { + \clist_map_inline:nn + { tblr , longtblr , talltblr , booktabs , longtabs , talltabs , +array } + { + \AddToHook { env/#1/begin } [ postnotes ] + { \bool_set_true:N \l__postnotes_maybe_multi_bool } + } + } +\tl_new:N \pntitle +\tl_new:N \pnhdnotes +\tl_new:N \pnhdtopage +\tl_new:N \pnhdtopages +\tl_set:Nn \pntitle { Notes } +\tl_set:Nn \pnhdnotes { Notes } +\tl_set:Nn \pnhdtopage { to~page } +\tl_set:Nn \pnhdtopages { to~pages } +\cs_new_protected:Npn \__postnotes_define_language:nn #1#2 + { + \tl_new:c { g__postnotes_language_ #1 _tl } + \tl_gset:cn { g__postnotes_language_ #1 _tl } {#2} + } +\cs_new_protected:Npn \__postnotes_set_babel_language:nn #1#2 + { + \ActivateGenericHook { babel/#1/beforeextras } + \exp_args:Nnv \AddToHook { babel/#1/beforeextras } + { g__postnotes_language_ #2 _tl } + } +\cs_new_protected:Npn \__postnotes_set_polyglossia_language:nn #1#2 + { + \AddToHook { package/polyglossia/after } + { + \exp_args:Nnv \csgappto { captions #1 } + { g__postnotes_language_ #2 _tl } + } + } +\__postnotes_define_language:nn { english } + { + \tl_set:Nn \pntitle { Notes } + \tl_set:Nn \pnhdnotes { Notes } + \tl_set:Nn \pnhdtopage { to~page } + \tl_set:Nn \pnhdtopages { to~pages } + } +\__postnotes_set_babel_language:nn { english } { english } +\__postnotes_set_babel_language:nn { british } { english } +\__postnotes_set_babel_language:nn { american } { english } +\__postnotes_set_babel_language:nn { canadian } { english } +\__postnotes_set_babel_language:nn { australian } { english } +\__postnotes_set_babel_language:nn { newzealand } { english } +\__postnotes_set_babel_language:nn { UKenglish } { english } +\__postnotes_set_babel_language:nn { USenglish } { english } +\__postnotes_set_polyglossia_language:nn { english } { english } +\__postnotes_define_language:nn { portuguese } + { + \tl_set:Nn \pntitle { Notas } + \tl_set:Nn \pnhdnotes { Notas } + \tl_set:Nn \pnhdtopage { da~página } + \tl_set:Nn \pnhdtopages { das~páginas } + } +\__postnotes_set_babel_language:nn { portuguese } { portuguese } +\__postnotes_set_babel_language:nn { brazilian } { portuguese } +\__postnotes_set_babel_language:nn { portuges } { portuguese } +\__postnotes_set_babel_language:nn { brazil } { portuguese } +\__postnotes_set_polyglossia_language:nn { portuguese } { portuguese } +%% +%% +%% End of file `postnotes.sty'. |