子标题与 hyperref 的 backref 选项不兼容

子标题与 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}

相关内容