LaTex 中的浮点数和图片问题 [英] Problem with float and pictures in LaTex
问题描述
图片在标题位置:http://dl.getdropbox.com/u/175564/%20latex1.png
代码:
egin{figure}
subfloat[A gull]{label{fig:gull}includegraphics[width=0.15 extwidth]{p1.png}}
subfloat[A tiger]{label{fig:tiger}includegraphics[width=0.15 extwidth]{p2.png}}
caption{Pictures of animals}
label{fig:animals}
end{figure}
egin{document} 之前的代码:
Code before egin{document}:
documentclass[12pt,a4paper, notitlepage]{article}
usepackage[english]{babel}
usepackage[latin1]{inputenc}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{graphicx}
usepackage{amsthm}
usepackage{fancyhdr}
usepackage{verbatim} % by egin{comment}---end{comment}
usepackage{subfig}
usepackage{lastpage}
usepackage{fancyhdr}
usepackage{float}
usepackage{subfig}
floatstyle{ruled}
ewfloat{program}{thp}{lop}
floatname{program}{Program}
cfoot{ }
enewcommand{headrulewidth}{0pt}
enewcommand{footrulewidth}{0pt}
itle{Applying a}
问题的原因可能是什么?
What could be the cause of the problem?
推荐答案
数字 浮动.
也就是说,TeX 移动它们以适应其排版需要.您可以选择指定希望 TeX 尝试放置它们的位置类型:
That is, TeX moves them around to accommodate its typesetting needs. You have the option of specifying what types of places you want TeX to try to put them using:
egin{figure}[htpb]
...
end{figure}
选项的含义:
h -- here
t -- top
b -- bottom
p -- page (on a page-o-floats)
H -- Absolutely right here (but requires the `float` package)
在选项中使用 !
会告诉 TeX 尝试努力把它放在源文件中它相邻的东西附近.默认定位是 tbp
,所以除非你要求,否则这里"甚至不是一个选项.另请注意,选项的顺序无关紧要,因此 [p!bh]
将给出与 [!hbp]
相同的结果.
Using !
in the options will tell TeX to try hard to put it near the things it is adjacent to in the source file. The default positioning is tbp
, so "here" is not even an option unless you ask for it. Also note that the ordering of the options is irrelevant, so [p!bh]
will give the same result as [!hbp]
.
所以试试 egin{figure}[h!]
(或 egin{figure}[H]
如果你已经做了 usepackage{float}
)
相同的选项可用于表格和您定义的任何其他浮动.
The same options are available for tables and any other floats you define.
这篇关于LaTex 中的浮点数和图片问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!