如何在 LaTeX 中的图形出现之前对其进行引用?

发布于 2024-09-27 07:19:56 字数 365 浏览 5 评论 0原文

我总是喜欢将图形放置在文本之间,而不是放置在页面的顶部或底部。我还喜欢在展示该图之前先谈谈它。所以我试图拥有这样的东西:

通过查看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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

寂寞笑我太脆弱 2024-10-04 07:19:56

一般来说,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.

々眼睛长脚气 2024-10-04 07:19:56

第一次失败了,因为标记和引用是一个两遍过程。第一次处理乳胶时,所有标签都被索引,因此引用失败。第二次,由于标签已被索引,裁判知道它实际引用的是什么。

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.

℉服软 2024-10-04 07:19:56

我会添加 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 the latex 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 invoke latexmk from either an Ant or GNU Make makefile and treat it just like I'm compiling C++ code, for example.

っ左 2024-10-04 07:19:56

我遇到了同样的问题,我找到了这个解决方案:

\graphicspath{{images/}}
\DeclareGraphicsExtensions{.jpg}

\makeatletter
\newenvironment{tablehere}
  {\def\@captype{table}}
  {}

\newenvironment{figurehere}
  {\def\@captype{figure}}
  {}
\makeatother

\begin{figurehere}
\includegraphics[height=5cm]{2-14aGa-Sur.jpg}
\caption{Hliněná destička s mapou severu Mezopotámie}
\label{fig:Ga-Sur}
\end{figurehere}

\graphicspath{{images/}} 是用来声明图片路径的

\DeclareGraphicsExtensions{.jpg} 是用来声明图片扩展名的(多个可以用逗号分隔(我认为;- ))

\makeatletter
\newenvironment{tablehere}
  {\def\@captype{table}}
  {}

\newenvironment{figurehere}
  {\def\@captype{figure}}
  {}
\makeatother

是否可以精确确定位置这里

\begin{figurehere}
\includegraphics[height=5cm]{2-14aGa-Sur.jpg}
\caption{Hliněná destička s mapou severu Mezopotámie}
\label{fig:Ga-Sur}
\end{figurehere}

有指定高度的图片以及带有标题和标签的图片...

我希望它会对您有所帮助;-)。

I had same problem and I found this solution:

\graphicspath{{images/}}
\DeclareGraphicsExtensions{.jpg}

\makeatletter
\newenvironment{tablehere}
  {\def\@captype{table}}
  {}

\newenvironment{figurehere}
  {\def\@captype{figure}}
  {}
\makeatother

\begin{figurehere}
\includegraphics[height=5cm]{2-14aGa-Sur.jpg}
\caption{Hliněná destička s mapou severu Mezopotámie}
\label{fig:Ga-Sur}
\end{figurehere}

\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 ;-))

\makeatletter
\newenvironment{tablehere}
  {\def\@captype{table}}
  {}

\newenvironment{figurehere}
  {\def\@captype{figure}}
  {}
\makeatother

is there for precise determination of position here

\begin{figurehere}
\includegraphics[height=5cm]{2-14aGa-Sur.jpg}
\caption{Hliněná destička s mapou severu Mezopotámie}
\label{fig:Ga-Sur}
\end{figurehere}

there is your picture with height specified and caption and label with it...

I hope it will help you ;-).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文