如何使用 Figure 获得具有适当数字的图形\ref{x}
?
我尝试编译我的.tex
文档两次,但没有帮助。我收到以下警告:\label whitout proper reference
。我不知道该怎么办了 :/。
Figure \ref{Schematic_representation_of_a_spectrophotometer}`
\begin{figure}[h!]
\centering
\makebox[\textwidth]{
\includegraphics[scale=1]{./Spectroscopy_and_microscopy_techniques/media/abs.png}
\caption[Schematic representation of a spectrophotometer. ] {\textbf{Schematic representation of a spectrophotometer. }{ description.}}}
\label{Schematic_representation_of_a_spectrophotometer}
\end{figure}
然后我编译了多次之后,得到了图??
谢谢
答案1
正如 David Carlisle 指出的那样,问题似乎出在\makebox
。尝试将其删除。作为备注,我还将定位参数更改为[htb]
,尤其是对于大图片,这[h!]
可能会给 TeX 带来问题。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
Figure \ref{Schematic_representation_of_a_spectrophotometer}
\begin{figure}[htb]
\centering
\includegraphics[scale=0.5]{example-image}
\caption[Schematic representation of a spectrophotometer. ] {\textbf{Schematic representation of a spectrophotometer. }{ description.}}
\label{Schematic_representation_of_a_spectrophotometer}
\end{figure}
\end{document}
如果目的是使图片与文本宽度相同,则figure
可以将环境写为
\begin{figure}[htb]
\includegraphics[width=\linewidth]{example-image}
\caption[Schematic representation of a spectrophotometer. ] {\textbf{Schematic representation of a spectrophotometer. }{ description.}}
\label{Schematic_representation_of_a_spectrophotometer}
\end{figure}