1

I am experiencing broken hyperlinks with memoir + caption + hyperref and the sidecaption environment in documents compiled with pdflatex. A MWE replicating my issue is below:

\documentclass{memoir}

\usepackage{caption}
\usepackage{hyperref}

\begin{document}

% create empty page for demonstration
\mbox{}
\clearpage

\begin{figure}
  \begin{sidecaption}{test}[test]
    test
  \end{sidecaption}
\end{figure}

\ref{test} % link broken, links to first page

\end{document}

Compiling with pdflatex yields the warning

pdfTeX warning (dest): name{figure.0.1} has been referenced but does not exist, replaced by a fixed one

and the hyperlink to the sidecaptioned figure is broken unless either (1) the caption package is not loaded or (2) a different engine such as xelatex is used.

I experience this behavior with other sidecaptioned floats as well. In a large, complex document (https://bayesoptbook.com/), hyperrefs are all working fine except those pointing to sidecaptioned floats – similar warnings on compilation, and similar broken hyperlinks linking to the top of the document.

7
  • 1
    it is an incompability between the caption package and memoir. When caption is loaded the name of the destination is figure.caption.1 but the label doesn't store this. Probably this issue means that the author of caption is aware that there is a problem gitlab.com/axelsommerfeldt/caption/-/issues/112 Jan 12, 2022 at 9:16
  • With \captionsetup{hypcap=false} it works, but you naturally loose the hypcap function. Jan 12, 2022 at 9:19
  • @UlrikeFischer the incompatibility seems to only affect floats with the sidecaption environment; hyperlinks to floats without sidecaption work fine with memoir + caption + pdflatex. This makes me hopeful that there may be a fix.
    – rgarnett
    Jan 12, 2022 at 17:58
  • there is certainly a fix, but imho the author of the caption package will have to implement it, so make there a bug report. Jan 12, 2022 at 18:03
  • But the sidecaption environment (where the problems appear to be localized) is implemented in the memoir class. I don't see how the author of caption could address the behavior of sidecaption. Perhaps I misunderstand the core issue.
    – rgarnett
    Jan 12, 2022 at 20:12

1 Answer 1

1

The author of the caption package just implemented a fix: https://gitlab.com/axelsommerfeldt/caption/-/issues/175, thanks to this question.

It is not released on CTAN yet, but you can already implement the fix by manually replacing a file on your system, namely caption-memoir.sto, with this new version.
(For me, using Windows and TinyTeX, this file was located at C:\TinyTeX\texmf-dist\tex\latex\caption\caption-memoir.sto)

1
  • @rgarnett, the Bayes opt book internal links can be fixed now :)
    – Tomas
    Sep 13 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .