I tend to use the memoir class together with the hyperref package, in order to have my table of contents, the lists of tables and figures, and the bibliography be hyperlinked. While all links to chapters, sections, and the like link to the correct positions in the document, the links to the table of contents, the lists of tables and figures, and the bibliography appear too low, approximately where the first item in these respective listings would be placed, but not just to the above-left of these lists' headings. Here is a minimal working example:

  % using the memoir class here is necessary
  % for all the desired hyperlinks to be created



\section{A section}
This is the only section.




(It might be necessary to enlarge the display in your pdf-reader to notice this effect.)

Is it possible to correct the hyperlink targets so that they point directly to the respective headings (here, "Contents", "List of Tables", "List of Figures", and "Bibliography")? (Note: I am aware of the hypcap package but not sure whether/how it can be used to address this.)


The following patch uses etoolbox. Add it to your document preamble after loading hyperref, and it will correct the hyper-links:

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
% Patch 'Table of Contents'
\patchcmd{\mem@tableofcontents}% <cmd>
  {\phantomsection}% <search>
  {\relax}% <replace>
  {}{\@latex@error{Could not patch \string\mem@tableofcontents}}% <success><failure>
% Patch 'List of Tables'
\patchcmd{\mem@listoftables}% <cmd>
  {\phantomsection}% <search>
  {\relax}% <replace>
  {}{\@latex@error{Could not patch \string\mem@listoftables}}% <success><failure>
% Patch 'List of Figures'
\patchcmd{\mem@listoffigures}% <cmd>
  {\phantomsection}% <search>
  {\relax}% <replace>
  {}{\@latex@error{Could not patch \string\mem@listoffigures}}% <success><failure>
% Patch 'Bibliography'
\patchcmd{\@memb@bchap}% <cmd>
  {\phantomsection}% <search>
  {\relax}% <replace>
  {}{\@latex@error{Could not patch \string\@memb@bchap}}% <success><failure>

The reason behind the faulty linking stems from the placement of \phantomsection inside the patched macros. It is placed after the respective headings have been created, causing the "low hyper target."

The thebibliography environment sets a \chapter*, which I've left as is in terms of its hyper-linking. As such, it inserts \phantomsection before setting the chapter space and header. However, as this is the default for all chapters, it seemed suitable.


I encountered the same problem when using biblatex with memoir trying to print separated bibliographies.

When using \printbibliography, the headings defined in biblatex.def specifically for memoir (and only those) add a \phantomsection after the chapter/section/subsection. Is this really by design?

A simple solution is to define a custom heading that has the \phantomsection before the section


and print the bibliography with

    title={Online Resources}]

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.