在导言区加上这个:
\ExplSyntaxOn\makeatletter
\providecommand\Hy@footnote@currentHref{}
\prop_new:N\g__codedoc_fnmark_prop
\cs_new_protected:Npn \__codedoc_fn_store:
{
\prop_gput:Nxx\g__codedoc_fnmark_prop
{fn\int_use:N\c@footnote}{{\Hy@footnote@currentHref}{\int_use:N\c@footnote}}
}
\cs_new_protected:Npn \__codedoc_fn_restore:n #1
{
\prop_get:NnN \g__codedoc_fnmark_prop {fn#1}\l__codedoc_tmpa_tl
\tl_gset:Nx\Hy@footnote@currentHref
{\exp_last_unbraced:NV\use_i:nn \l__codedoc_tmpa_tl }
\setcounter{footnote}{\exp_last_unbraced:NV\use_ii:nn \l__codedoc_tmpa_tl}
}
\cs_generate_variant:Nn \hook_gput_next_code:nn {ne}
\cs_new_protected:Npn \__codedoc_fn_footnote:nn #1 #2
{
\footnotemark
\__codedoc_fn_store:
\hook_gput_next_code:ne {env/#1/after}
{\exp_not:N\__codedoc_fn_restore:n{\int_use:N\c@footnote}{\exp_not:n{\footnotetext{#2}}}}}
\AddToHook{env/function/begin}{\def\footnote{\__codedoc_fn_footnote:nn{function}}}
\AddToHook{env/variable/begin}{\def\footnote{\__codedoc_fn_footnote:nn{variable}}}
\makeatother\ExplSyntaxOff
问 l3doc文档类中脚注无法正常显示?