如何在 LaTeX 中的图形出现之前对其进行引用?
我总是喜欢将图形放置在文本之间,而不是放置在页面的顶部或底部。我还喜欢在展示该图之前先谈谈它。所以我试图拥有这样的东西:
通过查看Figure~\ref{fig:VCO},你可以看到等等等等。
\begin{figure}[h]
\caption{VCO test circuit}\label{fig:VCO}
\begin{center}
\includegraphics[width=0.9\columnwidth]{figures/VCO_circuit.eps}
\end{center}
\end{figure}
这似乎不起作用,因为我猜它引用的是尚未发生的事情?有人有一些简单的解决方案吗?我对 LaTeX 还很陌生。
I always like my figures to be placed in between text as opposed to the top or bottom of the page. I also like to talk about the figure before it is shown. So I am trying to have something like this:
By looking at Figure~\ref{fig:VCO} you can see that blah blah blah.
\begin{figure}[h]
\caption{VCO test circuit}\label{fig:VCO}
\begin{center}
\includegraphics[width=0.9\columnwidth]{figures/VCO_circuit.eps}
\end{center}
\end{figure}
This doesn't seem to work because it I guess it is referencing something that hasn't occurred yet? Does anyone have some simple solution? I am still very new to LaTeX.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一般来说,LaTeX 至少需要两次来解析其所有引用,第一次将它们写入辅助文件,第二次将它们放入最终的 ps/pdf/dvi 文件中。所以参考在哪里并不重要。
例如,如果您的文档有很长的目录,这会搞乱页码,则需要第三遍。
Generally LaTeX needs at least two passes to resolve all its references, the first time to write them to an auxiliary file and the second time to put them into the final ps/pdf/dvi file. So it does not matter where the reference is.
A third pass will be needed, for example, if your document has a long table-of-contents which will screw up page numbers.
第一次失败了,因为标记和引用是一个两遍过程。第一次处理乳胶时,所有标签都被索引,因此引用失败。第二次,由于标签已被索引,裁判知道它实际引用的是什么。
It failed the first time because labeling and referencing are a two-pass process. The first time you processed your latex, all the labels were being indexed so the ref failed. The second time around, since the labels had been indexed the ref knew what it was actually referencing.
我会添加
latexmk
(链接) 多年来事实证明对我来说是无价的。这是一个用 Perl 编写的 LaTeX“构建”脚本,旨在以正确的次数编译.tex
源文件。它解析 Latex 命令的输出并执行依赖性检查,以确保输出文档以最少的传递次数保持最新。它还可以处理 BibTeX 参考书目文件。一般来说,我从 Ant 或 GNU Make makefile 调用latexmk
并像编译 C++ 代码一样对待它。I would add that
latexmk
(link) has proven invaluable to me over the years. This is a LaTeX "build" script written in Perl that is designed to compile.tex
source files the right number of times. It parses the output from thelatex
command and performs dependency checking to ensure that the output document is kept up-to-date with the minimum number of passes. It can also deal with BibTeX bibliography files. Generally speaking, I invokelatexmk
from either an Ant or GNU Make makefile and treat it just like I'm compiling C++ code, for example.我遇到了同样的问题,我找到了这个解决方案:
\graphicspath{{images/}} 是用来声明图片路径的
\DeclareGraphicsExtensions{.jpg} 是用来声明图片扩展名的(多个可以用逗号分隔(我认为;- ))
是否可以精确确定位置这里
有指定高度的图片以及带有标题和标签的图片...
我希望它会对您有所帮助;-)。
I had same problem and I found this solution:
\graphicspath{{images/}} is there to declare your path to your pictures
\DeclareGraphicsExtensions{.jpg} is there for declare picture extension (multiple can be with comma (I think ;-))
is there for precise determination of position here
there is your picture with height specified and caption and label with it...
I hope it will help you ;-).