我在文本中引用图表时遇到了一个奇怪的问题。编译后的 PDF 中的红色方框显示,图表的链接已建立。但红色方框中显示的是问号而不是图表编号。有人能帮我解决这个问题吗?
代码如下(我使用 \usepackage{caption} 来抑制标题中的图形编号,我交换了 \caption 和 \label 的顺序,但没有帮助):
\begin{description}
\item[ideal market theorem:] the ideal market picture consists of an uptrend, top, downtrend, and bottom (figure~\ref{fig:DowIdealMarketPicture}), interspersed with retracements and consolidations, the purpose of the ideal market picture is to provide a generalized model of the stock market's price behavior over time, it presumes that prices \underline{oscillate} over long periods based on the accumulated \underline{emotion} of investors as well as the facts of the \underline{business cycle}
\begin{figure}[hbt]
\centering
\includegraphics[scale=0.54]{Figure/DowIdealMarketPicture}
\caption*{figure 2.1 the Dow theory ideal market picture}
\label{fig:DowIdealMarketPicture}
\end{figure}
\end{description}
日志文件包含以下警告消息:
包标题警告:\label 在输入行 150 上没有正确的引用。请参阅标题包文档以获取解释。
答案1
您必须\@currentlabel
手动设置。如果您使用hyperref
同样,另外\phantomsection
还应提供正确的超目标。
\documentclass{article}
\usepackage{caption,graphicx}
\usepackage{hyperref}
\makeatletter
\newcommand{\setrefnumber}{\phantomsection\renewcommand{\@currentlabel}}%
\makeatother
\begin{document}
\begin{description}
\item[ideal market theorem:] the ideal market picture consists of an uptrend,
top, downtrend, and bottom (figure~\ref{fig:DowIdealMarketPicture}), interspersed
with retracements and consolidations, the purpose of the ideal market picture is
to provide a generalized model of the stock market's price behavior over time, it
presumes that prices \underline{oscillate} over long periods based on the
accumulated \underline{emotion} of investors as well as the facts of the
\underline{business cycle}
\begin{figure}[hbt]
\setrefnumber{2.1}%
\centering
\includegraphics[width = .5\linewidth]{example-image}
\caption*{figure 2.1 the Dow theory ideal market picture}
\label{fig:DowIdealMarketPicture}
\end{figure}
\end{description}
\end{document}
请注意如何\setrefnumber{<whatever>}
放置在环境的顶部figure
,以便\ref
erence 超链接跳转到图的顶部。