0

I've been given a template & sty doc with this code which gives a nicer footnote layout than the default:

\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}

But, using footmisc breaks† hyperref's support for inline footnote markers.

MWE - uncomment the comment environment to see the desired footnote layout style, comment it to see the default with working links to footnotes:

\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}

Is there a way to achieve the better footnote layout, without using footmisc or adding anything else that breaks hypertextual functions?

Indeed is there a way to give the footnotes a link back to their inline anchor.

So looking forward to the day we stop using legacy (paper) formats for digital native documents. Especially ironic when writing about hypertext. Until then, LaTeX it is.

† FWIW, etoolbox seems to be used elsewhere (class code I didn't write!) but doesn't break hyperref's hypertext.

0

give hyperref a chance: load it later so that it can inject its code:

\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}
4
  • Thanks. It's annoying that the package documentation of both hyperref and footmisc completely fail to mention this. I took a lot of time reading the instructions before posting here.
    – mwra
    Aug 10 '19 at 23:15
  • Grr. No line breaks allowed in comments. I'll likely mark the above as accepted but whilst it works in the MWE , when I move the footmisc code into the thesis CLS file before hyperrefthe LaTeX won't compile as seemingly the newly added code now breaks a macro maketitle in the CLS. Of course, the LateX logs are both verbose but uninformative as to the issue. The CLS file is c.470 LOC so I don't think I can post it as a comment.
    – mwra
    Aug 10 '19 at 23:52
  • If you have a new problem ask a new question. If you accept this question or not should not depend on something you didn't show in you MWE. Aug 11 '19 at 7:30
  • OK. Approved. Thanks for your quick and helpful reply. Even though it's not working in my actual document the MWE above gives me hope.
    – mwra
    Aug 11 '19 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.