不带 footmisc 的样式脚注(超引用冲突)

不带 footmisc 的样式脚注(超引用冲突)

我获得了一个sty带有此代码的模板和文档,它提供了比默认布局更好的脚注布局:

\usepackage[hang, flushmargin,splitrule,multiple]{footmisc}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makefntext}{
    \ifFN@hangfoot
    \bgroup
    }{
    \ifFN@hangfoot
    \bgroup\def\@makefnmark{
        \rlap{\normalfont\@thefnmark.}
    }
}{}{}
\patchcmd{\@makefntext}{
    \ifdim\footnotemargin>\z@
    \hb@xt@ \footnotemargin{\hss\@makefnmark}
    }{
    \ifdim\footnotemargin>\z@
    \hb@xt@ \footnotemargin{\@makefnmark\hss}
}{}{}
\makeatother
\setlength{\footnotemargin}{1.25em} % Between marker and text
\setlength{\skip\footins}{1\baselineskip} % Between main text and note rule
\setlength{\footnotesep}{\skip\footins} % Between footnotes [= previous]
\renewcommand{\hangfootparskip}{0pt}
\renewcommand{\hangfootparindent}{1em}

但是,使用footmiscbreaks†hyperref对内联脚注标记的支持。

MWE - 取消注释comment环境以查看所需的脚注布局样式,注释它以查看带有脚注有效链接的默认设置:

\documentclass{article}

\usepackage{verbatim} % to allow commenting code section

% hyperref options as per my uni's thesis class
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=true, plainpages=false,
colorlinks,linkcolor={blue},citecolor={green},urlcolor={red},
pdfstartview={FitV},unicode,breaklinks=true,pdfpagelabels]{hyperref}

%\begin{comment}
\usepackage[hang, flushmargin,splitrule,multiple]{footmisc}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makefntext}{
    \ifFN@hangfoot
    \bgroup
}{
    \ifFN@hangfoot
    \bgroup\def\@makefnmark{
        \rlap{\normalfont\@thefnmark.}
    }
}{}{}
\patchcmd{\@makefntext}{
    \ifdim\footnotemargin>\z@
    \hb@xt@ \footnotemargin{\hss\@makefnmark}
}{
    \ifdim\footnotemargin>\z@
    \hb@xt@ \footnotemargin{\@makefnmark\hss}
}{}{}
\makeatother
\setlength{\footnotemargin}{1.25em} % Between marker and text
\setlength{\skip\footins}{1\baselineskip} % Between main text and note rule
\setlength{\footnotesep}{\skip\footins} % Between footnotes [= previous]
\renewcommand{\hangfootparskip}{0pt}
\renewcommand{\hangfootparindent}{1em}
%\end{comment}

\begin{document}
Lorem ipsum dolor\footnote{A note} sit amet, consectetur adipiscing elit. Nam posuere risus\footnote{Another note} risus, et lobortis nunc egestas eu.
\end{document}

有没有一种方法可以实现更好的脚注布局,而无需使用footmisc或添加任何破坏超文本功能的内容?

确实有一种方法可以让脚注链接回其内联锚点。

因此,期待有一天我们不再使用传统(纸质)格式来编写数字原生文档。在撰写超文本时尤其具有讽刺意味。在此之前,我们仍使用 LaTeX。

† FWIW,etoolbox似乎在其他地方使用(我没有编写类代码!)但不会破坏 hyperref 的超文本。

答案1

给 hyperref 一个机会:稍后加载它,以便它可以注入其代码:

\documentclass{article}

\usepackage{verbatim} % to allow commenting code section

%\begin{comment}
\usepackage[hang, flushmargin,splitrule,multiple]{footmisc}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@makefntext}{
    \ifFN@hangfoot
    \bgroup
}{
    \ifFN@hangfoot
    \bgroup\def\@makefnmark{
        \rlap{\normalfont\@thefnmark.}
    }
}{}{}
\patchcmd{\@makefntext}{
    \ifdim\footnotemargin>\z@
    \hb@xt@ \footnotemargin{\hss\@makefnmark}
}{
    \ifdim\footnotemargin>\z@
    \hb@xt@ \footnotemargin{\@makefnmark\hss}
}{}{}
\makeatother
\setlength{\footnotemargin}{1.25em} % Between marker and text
\setlength{\skip\footins}{1\baselineskip} % Between main text and note rule
\setlength{\footnotesep}{\skip\footins} % Between footnotes [= previous]
\renewcommand{\hangfootparskip}{0pt}
\renewcommand{\hangfootparindent}{1em}
%\end{comment}
% hyperref options as per my uni's thesis class
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=true, plainpages=false,
colorlinks,linkcolor={blue},citecolor={green},urlcolor={red},
pdfstartview={FitV},unicode,breaklinks=true,pdfpagelabels]{hyperref}


\begin{document}
Lorem ipsum dolor\footnote{A note} sit amet, consectetur adipiscing elit. Nam posuere risus\footnote{Another note} risus, et lobortis nunc egestas eu.
\end{document}

相关内容