subcaption 與 hyperref 的 backref 選項不相容

subcaption 與 hyperref 的 backref 選項不相容

我的包裹有問題subcaption

它導致對錶的反向引用僅顯示為問號。

最小工作範例

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

答案1

相關選項應該是backref=page,因為這會插入到頁面的正確連結。

此外,hyperref包應該在包之後加載subcaption,這在這個最小的示例中根本不需要。

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

相關內容