# subcaption incompatible with backref option of hyperref

I have a problem with the subcaption package.

It leads to backrefs to tables only being displayed as questionmarks.

### Minimal working example

\RequirePackage{filecontents}

\begin{filecontents}{bibliography.bib}
@inproceedings{namespaces,
title = {Multiple instances of the global linux namespaces},
author = {Biederman, Eric},
booktitle = {Proceedings of the Linux Symposium},
year = {2006},
}
@MISC{kernel_2.4,
title = {Index of /pub/linux/kernel/v2.4},
author = {{The Linux Foundation}},
year = {2013},
}
@MISC{kernel_2.6,
title = {Index of /pub/linux/kernel/v2.6},
author = {{The Linux Foundation}},
year = {2014},
}
\end{filecontents}

\documentclass{report}
\usepackage[backref]{hyperref}
\usepackage{subcaption}

\begin{document}
\chapter{Loranium}
Lorem Ipsum
\section{notable}
this works \cite{namespaces}.
\chapter{Ipsonium}
\begin{table}
\begin{tabular}{|l|l|l|l|}
\hline
A & B & C & D \\ \hline
a & b & c & d \\ \hline
a & b & c & d \cite{kernel_2.4} \\ \hline
a & b & c & d \cite{kernel_2.6} \\ \hline
a & b & c & d \cite{kernel_2.6} \\ \hline
a & b & c & d \cite{kernel_2.6} \\ \hline
\end{tabular}
\caption{ABCD}
\label{tab:abcd}
\end{table}

\bibliography{bibliography}
\bibliographystyle{unsrt}
\end{document}

• hyperref should be the last package to be included in most cases – user31729 Dec 18 '14 at 17:25
• Do you want backref or pagebackref? – egreg Dec 18 '14 at 17:42

The relevant option should be backref=page, as this inserts the correct links to the page.

In addition, the hyperref package should be loaded after the subcaption package, which is not needed in this minimal example at all.

\documentclass{report}

\usepackage{subcaption}

\usepackage[backref=page]{hyperref}

\begin{document}
\chapter{Loranium}
Lorem Ipsum
\section{notable}
this works \cite{namespaces}.
\chapter{Ipsonium}
\phantomsection
\begin{table}
\begin{tabular}{|l|l|l|l|}
\hline
A & B & C & D \\ \hline
a & b & c & d \\ \hline
a & b & c & d \cite{kernel_2.4} \\ \hline
a & b & c & d \cite{kernel_2.6} \\ \hline
a & b & c & d \cite{kernel_2.6} \\ \hline
a & b & c & d \cite{kernel_2.6} \\ \hline
\end{tabular}
\caption{ABCD}
\label{tab:abcd}
\end{table}

\bibliographystyle{unsrt}
\bibliography{bibliography}
\end{document}

• This is not backref, though. – egreg Dec 18 '14 at 17:50
• @egreg: I edited my example since I remembered the backref=page option – user31729 Dec 18 '14 at 17:52
• I do not want backref=page. I want the backwards references to be chapter based, not page based. Since I have a PDF where the first few pages are not numbered (or numbered differently to be exact) it links to the wrong page anyways. Changing it to make hyperref the last include did nothing. – kaaaaal Dec 18 '14 at 23:56