LaTeX hyperref链接转到了错误的页面

ect*_*cto 15 latex hyperref

我正在尝试创建一个不使用标题的浮点数的引用.如果我在float中包含\ label {foo}并使用\ pageref {foo}引用它,则在我的pdf文档中显示正确的页码,但是由hyperref包创建的超链接链接到不同的页面(第一页)部分).如果我在float中的标签之前包含标题,则hyperref链接将转到正确的页面.

有没有办法让hyperref链接正常工作而不在浮点数中包含标题?或者有没有办法抑制标题的显示,所以我可以包括一个没有显示?

以下是一个最小的例子.如果我使用pdflatex处理它,我会得到三页."图"显示在第二页上,第三页正确显示"见第2页上的图".但是'2'上的超链接表示"转到第1页",如果我点击它,则会将我带到第1页.

如果我在\ label {foo}之前放置一个空的\ caption {},那么超链接可以正常工作,但我不想为我的浮点显示一个标题.

\documentclass[11pt]{memoir}

\usepackage{hyperref}

\begin{document}

some text
\clearpage


\begin{figure}
  a figure
  \label{foo}
\end{figure}

more text
\clearpage


See figure on page \pageref{foo}.

\end{document}
Run Code Online (Sandbox Code Playgroud)

Mei*_*bur 16

\label命令引用了最后一次调用\refstepcounter.\caption认识到它在数字环境中并且调用\refstepcounter{figure}.你可以\refstepcounter自己打电话.

为避免跳过一系列数字中的数字,您可以创建一个自己的,无意义的计数器\newcounter{dummy}.结果:

\documentclass{scrreprt}
\usepackage{hyperref}
\newcounter{dummy}
\begin{document}

\chapter{First}

\newpage
\begin{figure}
{\Huge FIGURE}
\refstepcounter{dummy}
\label{fig:figure}
\end{figure}

\chapter{Second}

Goto \pageref{fig:figure}

\end{document}
Run Code Online (Sandbox Code Playgroud)

创建指向图末尾的超链接.(适用于我的机器:-)注意比\ref{fig:figure}无意义.


Mar*_* VY 9

在标签之前,使用\ phantomsection,如下所示:

\documentclass{memoir}
\usepackage{hyperref}
\begin{document}
some text
\clearpage
\begin{figure}
a figure
\phantomsection
\label{foo}
\end{figure}
more text
\clearpage
See figure on page \pageref{foo}.
\end{document}
Run Code Online (Sandbox Code Playgroud)

:)