diff options
author | Karl Berry <karl@freefriends.org> | 2023-11-01 20:13:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-11-01 20:13:49 +0000 |
commit | a776d572cfd8fa24365dbc0cc22bbd856fbbe97b (patch) | |
tree | 849f92803a749fc1bc8aecd7ba910bd723ec4095 /Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx | |
parent | d090e61f0bea55cb371aeb790140dbcb6c5d7d36 (diff) |
latex2e (1nov23)
git-svn-id: svn://tug.org/texlive/trunk@68720 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx')
-rw-r--r-- | Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx | 254 |
1 files changed, 134 insertions, 120 deletions
diff --git a/Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx b/Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx index 4a3a046a21d..38876d0c908 100644 --- a/Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx +++ b/Master/texmf-dist/tex/latex/latex-lab/latex-lab-footnotes.ltx @@ -33,8 +33,12 @@ %% %% %% File: latex-lab-footnotes.dtx +\def\ltlabfootnotedate{2023-09-04} +\def\ltlabfootnoteversion{0.8c} + \ProvidesFile{latex-lab-footnotes.ltx} - [2023-02-04 v0.7 changes to the footnote interfaces] + [\ltlabfootnotedate\space v\ltlabfootnoteversion\space + changes to the footnote interfaces] %% alterations not covered: \ExplSyntaxOn @@ -54,9 +58,6 @@ \bool_set_true:N \l__fnote_autodetect_bool \tl_new:N \l__fnote_currentstruct_tl \tl_set:Nn \l__fnote_currentstruct_tl {1} -\cs_generate_variant:Nn \ref_label:nn { Vn } -\cs_generate_variant:Nn \ref_value:nn { Vn } -\cs_generate_variant:Nn \prop_gput:Nnn {cxn} \cs_generate_variant:Nn \hook_gput_code:nnn{nne} \cs_generate_variant:Nn \tag_struct_use:n {e} \cs_new_protected:Npn \fnote_step_fnmark:nn #1#2 { @@ -99,11 +100,11 @@ { \bool_if:NT \g_fnote_debug_bool { - \LogHook{fnmark/before} - \LogHook{fnmark} - \LogHook{fnmark/begin} - \LogHook{fnmark/end} - \LogHook{fnmark/after} + \hook_log:n {fnmark/before} + \hook_log:n {fnmark} + \hook_log:n {fnmark/begin} + \hook_log:n {fnmark/end} + \hook_log:n {fnmark/after} \cs_gset_eq:NN \__fnote_debug_footnotemark: \prg_do_nothing: } } @@ -111,52 +112,56 @@ { \bool_if:NT \g_fnote_debug_bool { - \cs_log:N\@footnotetext@cfgpoint - \cs_log:N\@footnotetext@cfgpointii - \cs_log:N\@footnotetext@cfgpointiii - \cs_log:N\@footnotetext@cfgpointiv - \cs_log:N\@makefntext@cfgpoint - \cs_log:N\@makefntext@cfgpointii - \LogHook{fntext/before} - \LogHook{fntext} - \LogHook{fntext/para} - \LogHook{fntext/begin} - \LogHook{fntext/end} - \LogHook{fntext/after} + \socket_log:n {fntext/process} + \socket_log:n {fntext/make} + \socket_log:n {fntext/begin} + \socket_log:n {fntext/end} + \socket_log:n {fntext/mark} + \socket_log:n {fntext/text} + \socket_log:n {tagsupport/fnmark} + \socket_log:n {tagsupport/fntext/begin} + \socket_log:n {tagsupport/fntext/end} + \socket_log:n {tagsupport/fntext/mark} + \socket_log:n {tagsupport/fntext/text} + \hook_log:n {fntext/before} + \hook_log:n {fntext} + \hook_log:n {fntext/para} + \hook_log:n {fntext/begin} + \hook_log:n {fntext/end} + \hook_log:n {fntext/after} \cs_gset_eq:NN \__fnote_debug_footnotetext: \prg_do_nothing: } } \cs_new_protected:Npn \fnote_footnotemark: { \__fnote_debug_footnotemark: - \UseHook{fnmark/before} + \hook_use:n {fnmark/before} \leavevmode \ifhmode \edef\@x@sf{\the\spacefactor} - \UseHook{fnmark} + \hook_use:n {fnmark} \nobreak \fi - \UseHook{fnmark/begin} - \@kernel@process@makefnmark - \@makefnmark + \hook_use:n {fnmark/begin} + \socket_use:nn {tagsupport/fnmark} \@makefnmark \__fnote_footnotemark_finish: } -\cs_new_protected:Npn \__fnote_finish: { +\cs_new_protected:Npn \__fnote_footnotemark_default_finish: { \UseHook{fnmark/end} \ifhmode \spacefactor \@x@sf \relax \fi \UseHook{fnmark/after} } - -\cs_new_eq:NN \__fnote_footnotemark_finish: \__fnote_finish: -\def \@kernel@process@makefnmark { } +\cs_new_eq:NN \__fnote_footnotemark_finish: \__fnote_footnotemark_default_finish: +\NewSocket{tagsupport/fnmark}{1} \cs_set_eq:NN \@footnotemark \fnote_footnotemark: \cs_new_protected:Npn \fnote_footnotetext:n #1 { \__fnote_debug_footnotetext: - \UseHook{fntext/before} - \@kernel@process@footnotetext - \@footnotetext@cfgpoint { % config point - \UseHook{fntext} + \hook_use:n {fntext/before} + \socket_use:n {tagsupport/fntext/begin} + \socket_use:nn {fntext/process} + { + \hook_use:n {fntext} \reset@font \footnotesize \interlinepenalty\interfootnotelinepenalty @@ -168,27 +173,53 @@ \parindent 1em % typical default used in \@makefntext moved up here \def\@currentcounter{footnote} \protected@edef \@currentlabel { \p@footnote \@thefnmark } - \UseHook{fntext/para} + \hook_use:n {fntext/para} \color@begingroup - \@footnotetext@cfgpointii % config point + \socket_use:nn {fntext/make} { - \@footnotetext@cfgpointiii % config point - \UseHook{fntext/begin} + \socket_use:n {fntext/begin}% + \hook_use:n {fntext/begin} \ignorespaces #1 - \UseHook{fntext/end} - \@footnotetext@cfgpointiv % config point + \hook_use:n {fntext/end} + \socket_use:n {fntext/end} } \par \color@endgroup } - \UseHook{fntext/after} + \socket_use:n{tagsupport/fntext/end} + \hook_use:n {fntext/after} +} +\NewSocket {fntext/process}{1} +\NewSocketPlug{fntext/process}{default}{ \insert\footins {#1} } +\NewSocketPlug{fntext/process}{side} { \marginpar {#1} } +\AssignSocketPlug{fntext/process}{default} +\NewSocket {fntext/make}{1} +\NewSocketPlug{fntext/make}{default}{ \@makefntext {#1} } +\NewSocketPlug{fntext/make}{para} +{ + \setbox\FN@tempboxa\hbox{\@makefntext{#1}}% + \dp\FN@tempboxa\z@ + \ht\FN@tempboxa + \dimexpr\wd\FN@tempboxa *% + \footnotebaselineskip /\columnwidth\relax + \box\FN@tempboxa } -\cs_new_protected:Npn \@footnotetext@cfgpoint { \insert\footins } -\cs_new_protected:Npn \@footnotetext@cfgpointii { \@makefntext } -\cs_new_protected:Npn \@footnotetext@cfgpointiii { \rule\z@\footnotesep } -\cs_new_protected:Npn \@footnotetext@cfgpointiv { \@finalstrut\strutbox } -\cs_new_protected:Npn \@kernel@process@footnotetext {} +\AssignSocketPlug{fntext/make}{default} +\NewSocket {fntext/begin}{0} +\NewSocketPlug{fntext/begin}{default}{ \rule\z@\footnotesep } +\AssignSocketPlug{fntext/begin}{default} +\NewSocket {fntext/end}{0} +\NewSocketPlug{fntext/end}{default}{ \@finalstrut\strutbox } +\NewSocketPlug{fntext/end}{para} + {% + \strut + \penalty-10\relax + \hskip\footglue + } +\AssignSocketPlug{fntext/end}{default} +\NewSocket{tagsupport/fntext/begin}{0} +\NewSocket{tagsupport/fntext/end}{0} \AddToHook{begindocument} { \cs_set_eq:NN \@footnotetext \fnote_footnotetext:n @@ -202,29 +233,31 @@ \setlength\footnotemargin{1.8em} \fi } - \cs_new_protected:Npn \fnote_makefntext:n #1 { - \@makefntext@cfgpoint - { - \ifdim\footnotemargin>\z@ - \hb@xt@ \footnotemargin{\hss\@makefnmark} - \else - \ifdim\footnotemargin=\z@ - \llap{\@makefnmark} - \else - \ifdim\footnotemargin=-\maxdimen - \@makefnmark - \else - \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}} - \fi - \fi - \fi - } - \@makefntext@cfgpointii - { #1 } + \noindent + \socket_use:nn {tagsupport/fntext/mark} { \socket_use:n {fntext/mark} } + \socket_use:nn {tagsupport/fntext/text} { \socket_use:nn {fntext/text}{#1} } +} +\NewSocket {fntext/mark}{0} +\NewSocketPlug{fntext/mark}{default}{ + \ifdim\footnotemargin>\z@ + \hb@xt@ \footnotemargin{\hss\@makefnmark} + \else + \ifdim\footnotemargin=\z@ + \llap{\@makefnmark} + \else + \ifdim\footnotemargin=-\maxdimen + \@makefnmark + \else + \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}} + \fi + \fi + \fi } -\cs_new_protected:Npn \@makefntext@cfgpoint { \noindent } -\cs_new_protected:Npn \@makefntext@cfgpointii #1 { #1 } +\AssignSocketPlug{fntext/mark}{default} +\NewSocket {fntext/text}{1} +\NewSocket{tagsupport/fntext/mark}{1} +\NewSocket{tagsupport/fntext/text}{1} \newcommand\old@std@class@makefntext[1]{% \parindent 1em% \noindent @@ -234,7 +267,7 @@ \cs_new_protected:Npn \__fnote_patch: { - \tl_set:No \l__fnote_patch_tl { \@makefntext { \@makefntext@cfgpointii{##1} } } + \tl_set:No \l__fnote_patch_tl { \@makefntext { \UseSocket{tagsupport/fntext/text}{##1} } } \tl_if_in:NnTF \l__fnote_patch_tl { \hbox } { \cs_set_eq:NN \__fnote_tmp:w \__fnote_patch_hbox:w } { @@ -258,7 +291,7 @@ { \exp_stop_f: #1 \@makefntext@processX { \hb@xt@ #2 } } \cs_new:Npn \__fnote_patch_@makefnmark:w #1 \@makefnmark { \exp_stop_f: #1 \@makefntext@processX { \use:n } { \@makefnmark } } -\cs_new:Npn \@makefntext@processX #1#2{\@makefntext@cfgpoint{#1{#2}}} +\cs_new:Npn \@makefntext@processX #1#2{\UseSocket{tagsupport/fntext/mark}{#1{#2}}} \AddToHook{begindocument} { @@ -281,7 +314,7 @@ \fnote_step_fnmark:nn {#1} \@mpfn \cs_set_eq:NN \__fnote_footnotemark_finish: \prg_do_nothing: \@footnotemark - \cs_set_eq:NN \__fnote_footnotemark_finish: \__fnote_finish: + \cs_set_eq:NN \__fnote_footnotemark_finish: \__fnote_footnotemark_default_finish: \@footnotetext {#2} \__fnote_footnotemark_finish: } @@ -302,20 +335,13 @@ \@footnotemark \bool_set_true:N \l__fnote_autodetect_bool } -\cs_new_protected:Npn \@mpfootnotetext@cfgpoint #1 +\NewSocketPlug{fntext/process}{mp} { \global\setbox\@mpfootins\vbox{% \unvbox\@mpfootins #1 } } -\RequirePackage{etoolbox} -\ExplSyntaxOff -\patchcmd\@iiiminipage - {\let\@footnotetext\@mpfootnotetext} - {\let\@footnotetext@cfgpoint\@mpfootnotetext@cfgpoint} - {}{\ERROR} -\ExplSyntaxOn \AddToHook{class/memoir/before} { \let\new@std@class@makecol\@makecol } \AddToHook{class/memoir/after} @@ -343,38 +369,31 @@ \bool_set_false:N \l_fnote_link_bool } } -\ref_attribute_gset:nnnn {fnote/struct}{1}{now}{\l__fnote_currentstruct_tl} -\cs_new_protected:Npn \__fnote_label_hook: {} -\AddToHook{begindocument/before} - { - \RequirePackage{nameref} - \g@addto@macro\label@hook - { - \__fnote_label_hook: - } - } +\property_new:nnnn {fnote/struct}{now}{1}{\l__fnote_currentstruct_tl} +\cs_new_protected:Npn \__fnote_label_hook:e #1 {} +\AddToHookWithArguments{label}{ \__fnote_label_hook:e{#1}} \AddToHook{fntext/begin} { - \cs_set_protected:Npn \__fnote_label_hook: + \cs_set_protected:Npn \__fnote_label_hook:e #1 { - \ref_label:Vn \label@name {fnote/struct} + \property_record:ee {__fnote/#1} {fnote/struct} } } -\cs_new_protected:Npn \fnote_new:nn #1 #2 % #1 name, #2 options +\cs_new_protected:Npn \fnote_class_new:nn #1 #2 % #1 name, #2 options { \prop_new:c { g__fnote_currentmarks_ #1 _prop } } -\fnote_new:nn {default}{} +\fnote_class_new:nn {default}{} \cs_new_protected:Npn \fnote_mark_gput:nn #1 #2 % #1 the representation of the mark, #2 type { - \prop_gput:cxn { g__fnote_currentmarks_ #2 _prop } + \prop_gput:cen { g__fnote_currentmarks_ #2 _prop } { \tag_get:n{struct_num} } { #1 } } \cs_generate_variant:Nn \fnote_mark_gput:nn {no,oo} -\cs_new_protected:Npn \fnote_mark_gpop:nnN #1 #2 #3 +\cs_new_protected:Npn \fnote_mark_gpop_all:nnN #1 #2 #3 { \seq_clear:N #3 \prop_set_eq:Nc \l__fnote_tmpa_prop { g__fnote_currentmarks_ #2 _prop } @@ -387,25 +406,24 @@ } } } -\cs_generate_variant:Nn\fnote_mark_gpop:nnN {ooN} - -\cs_new_protected:Npn \tag@FEMark #1 %#1 content +\cs_generate_variant:Nn\fnote_mark_gpop_all:nnN {ooN} +\NewSocketPlug{tagsupport/fnmark}{FEMark} { \tag_mc_end_push: \tag_struct_begin:n { tag=footnotemark } \bool_if:NTF \l__fnote_autodetect_bool { \fnote_mark_gput:oo {\@thefnmark}{\l_fnote_type_tl} - \tl_set:Nx \l__fnote_linktarget_tl {footnote*.\tag_get:n{struct_num}} + \tl_set:Ne \l__fnote_linktarget_tl {footnote*.\tag_get:n{struct_num}} } { \hook_gput_code:nne {tagpdf/finish/before} {tagpdf/footnote} { \exp_not:N\fnote_gput_refs:ee { \tag_get:n{struct_num} } - { \ref_value:Vn\l__fnote_currentlabel_tl {fnote/struct} } + { \property_ref:ee{ __fnote/\l__fnote_currentlabel_tl } {fnote/struct} } } - \tl_set:Nx \l__fnote_linktarget_tl {footnote*.\ref_value:Vn\l__fnote_currentlabel_tl {fnote/struct}} + \tl_set:Ne \l__fnote_linktarget_tl {footnote*.\property_ref:ee {__fnote/\l__fnote_currentlabel_tl} {fnote/struct}} } \tag_mc_begin:n{tag=Lbl} % @@ -423,8 +441,7 @@ \tag_struct_end: \tag_mc_begin_pop:n{} } -\cs_set_eq:NN \@kernel@process@makefnmark \tag@FEMark - +\AssignSocketPlug{tagsupport/fnmark}{FEMark} \cs_new_protected:Npn \__fnote_gput_ref:nn #1 #2 %#1 the structure number receiving the ref #2 { @@ -441,7 +458,7 @@ \cs_generate_variant:Nn \fnote_gput_refs:nn {ee} \tl_new:N \l__fnote_dflt_struct_tl \tl_set:Nn \l__fnote_dflt_struct_tl {1} -\cs_new_protected:Npn \tag@FENote #1#2 % #1 config point, \insert\footins #2 content +\NewSocketPlug{tagsupport/fntext/begin}{FENote} { \tag_mc_end_push: \tag_check_child:nnTF {FENote}{pdf2} @@ -451,11 +468,11 @@ { \tag_struct_begin:n { tag=footnote,parent=\l__fnote_dflt_struct_tl } } - \tl_set:Nx \l__fnote_currentstruct_tl { \tag_get:n{struct_num} } + \tl_set:Ne \l__fnote_currentstruct_tl { \tag_get:n{struct_num} } \tag_struct_begin:n { tag=footnotelabel }\tag_struct_end: \bool_if:NTF \l__fnote_autodetect_bool { - \fnote_mark_gpop:ooN { \@thefnmark }{ \l_fnote_type_tl } \l__fnote_currentrefs_seq + \fnote_mark_gpop_all:ooN { \@thefnmark }{ \l_fnote_type_tl } \l__fnote_currentrefs_seq \seq_map_inline:Nn \l__fnote_currentrefs_seq { \fnote_gput_refs:ee {##1}{ \l__fnote_currentstruct_tl } @@ -464,20 +481,18 @@ {%no auto } - #1 {#2} - \tag_struct_end: - \tag_mc_begin_pop:n{} } -\cs_set_eq:NN \@kernel@process@footnotetext \tag@FENote -\cs_set_protected:Npn \@makefntext@cfgpoint #1 %#1 code that typesets the mark. + +\NewSocketPlug{tagsupport/fntext/end}{FENote} { - \noindent - \tag_mc_end_push: - \tag@FENoteLbl { #1 } + \tag_struct_end: \tag_mc_begin_pop:n{} } -\cs_new_protected:Npn \tag@FENoteLbl #1 +\AssignSocketPlug{tagsupport/fntext/begin}{FENote} +\AssignSocketPlug{tagsupport/fntext/end}{FENote} +\NewSocketPlug{tagsupport/fntext/mark}{FENoteLbl} { + \tag_mc_end_push: %\seq_show:N\l__fnote_currentrefs_seq \seq_map_inline:Nn\l__fnote_currentrefs_seq {\MakeLinkTarget*{footnote*.##1}} \MakeLinkTarget*{footnote*.\l__fnote_currentstruct_tl} @@ -486,19 +501,18 @@ #1 \tag_mc_end: \tag_struct_end: - } -\cs_set_protected:Npn \@makefntext@cfgpointii #1 - { - \tag_mc_end_push: - \tag@FENotetext { #1 } \tag_mc_begin_pop:n{} } -\cs_new_protected:Npn \tag@FENotetext #1 +\AssignSocketPlug{tagsupport/fntext/mark}{FENoteLbl} +\NewSocketPlug{tagsupport/fntext/text}{FENotetext} { + \tag_mc_end_push: \tag_mc_begin:n{} #1 \tag_mc_end: + \tag_mc_begin_pop:n{} } +\AssignSocketPlug{tagsupport/fntext/text}{FENotetext} \ExplSyntaxOff \endinput |