有没有办法让 LaTeX 将图形放置在同一页面中作为对该图形的引用?
我正在使用 LaTeX 和图形环境。
我非常熟悉该环境的参数:[htbp],而且我通常也熟悉 LaTeX 默认情况下决定将每个图形放在哪里的策略。 例如,将图形放置在页面的顶部或底部。
我想知道是否有一个包、宏或一些我可以提供的命令,这样如果我有一个单列文档并且我主要有一个对图的文本内引用,那么该图会更多可能会被放置在参考文献的同一页中吗?
例如,假设我有一个很长的段落,中间有一个 \ref{FIG:X}。 渲染时,有些段落出现在分页符之前,有些则出现在分页符之后。 我还可以将图形命令放置在整个段落之前和之后的某个位置。 有没有办法让它实际放置在与实际参考相同的页面中?
I am using LaTeX and the figure environment.
I am well familiar with the parameters to that environment: [htbp], and I am also generally familiar with the strategies that LaTeX takes, by default, to decide where to put each figure. For example, by placing figures at the top or bottom of the page.
What I am wondering is whether there is a package, macro, or some commands that I can give so that if I have a single-column document and I mostly have a single in-text reference to a figure, that the figure would be more likely to be placed in the same page of the reference?
For example, imagine that I have a long paragraph which in the middle has a \ref{FIG:X}. When rendered, some of the paragraph appears before the page break, and some appears after the page break. I can also place the figure command somewhere before and after the whole paragraph. Is there a way to get it to actually be placed in the same page as the actual reference?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我不想听起来太消极,但有时候,如果没有大量“人为”的分页符调整,您想要的几乎是不可能的。
如果标注自然落在页面底部附近,并且图形落在下一页上,则将图形向后移动一页可能会使标注向前移动。
我建议(尽可能,并取决于数字的确切大小):
根据我的经验,这是一个很大的非- 可用时间 (:-)
在回复 Jon 的评论时,我认为这本质上是一个困难的问题,因为 LaTeX 的人并不懒惰。 您可能想阅读Frank Mittelbach 的论文 。
I don't want to sound too negative, but there are occasions when what you want is almost impossible without a lot of "artificial" tuning of page breaks.
If the callout falls naturally near the bottom of a page, and the figure falls on the following page, moving the figure back one page will probably displace the callout forward.
I would recommend (as far as possible, and depending on the exact size of the figures):
In my experience, this is a big eater-up of non-available time (:-)
In reply to Jon's comment, I think this is an inherently difficult problem, because the LaTeX guys are no slouches. You may like to read Frank Mittelbach's paper.
是的,将 float 包包含到文档顶部,并将 H(大写 H)作为数字说明符:
Yes, include float package into the top of your document and H (capital H) as a figure specifier:
您可以随时添加“!” 进入你的浮动选项。 这样,Latex 会尽力将图形放置在您想要的位置(我主要使用 [h!tb]),从而扩展了排版的正常规则。
我找到了另一个解决方案:
使用 float 包。 这样您就可以将图形放置在您想要的位置。
You can always add the "!" into your float-options. This way, latex tries really hard to place the figure where you want it (I mostly use [h!tb]), stretching the normal rules of type-setting.
I have found another solution:
Use the float-package. This way you can place the figures where you want them to be.
我通过始终在浮点数(例如数字)上使用
[h]
选项来解决这个问题,以便它们(大部分)到达我放置它们的位置。 然后,当我查看最终草案时,我通过在 LaTeX 源中移动浮动来调整浮动的位置。 通常这意味着将其移动到引用它的段落中。 有时我需要在适当的位置添加分页符。我发现 LaTeX 中浮动的默认位置是合理的,但几乎总是需要手动调整才能使这样的事情恰到好处。 (有时,当有大量浮动和脚注时,不可能一切都完美。)
memoir 类的手册 有一些关于 LaTeX 如何放置浮动的有用信息以及一些操作算法的建议。
I solve this problem by always using the
[h]
option on floats (such as figures) so that they (mostly) go where I place them. Then when I look at the final draft, I adjust the location of the float by moving it in the LaTeX source. Usually that means moving it around the paragraph where it is referenced. Sometimes I need to add a page break at an appropriate spot.I've found that the default placement of floats is reasonable in LaTeX, but manual adjustments are almost always needed to get things like this just right. (And sometimes it isn't possible for everything to be perfect when there are lots of floats and footnotes.)
The manual for the
memoir
class has some good information about how LaTeX places floats and some advice for manipulating the algorithm.如果您想在所有人物上强制执行此行为,请尝试
If you want force this behaviour on all of your figures try
也许这会对你有帮助?
我认为当你的图形跑掉时最好使用图形命令。
Maybe this will help you?
I think is better to use the graphics command when your figures run away.
我有一些有用的意见。 因为我在人物位置上也遇到了类似的问题。
我使用了“wrapfig”包,它允许用文本包裹图形。
像
In options
{r}
之类的意思是从右侧放置数字。{l}
可用于左侧。I have some useful comments. Because I had similar problem with location of figures.
I used package "wrapfig" that allows to make figures wrapped by text.
Something like
In options
{r}
means to put figure from right side.{l}
can be use for left side.http://robjhyndman.com/researchtips/latex-floats/
http://robjhyndman.com/researchtips/latex-floats/
我发现有助于解决此问题的一种方法是使用
\include{file_with_tex_figure_commands}
(不是输入)
One way I found that helps with this is to use
\include{file_with_tex_figure_commands}
(not input)