LaTeX 控制图片的位置

加感叹号来忽略“美学”标准。

egin{figure}[!htb]

usepackage{float}
egin{figure}[H]
插到你代码相应的位置。

1,插入并列的子图

usepackage{subfigure}


egin{figure}[H]
centering
subfigure[SubfigureCaption]{
label{Fig.sub.1}
includegraphics[width=0.4 extwidth]{figurename.eps}}
subfigure[SubfigureCaption]{
label{Fig.sub.2}
includegraphics[width=0.4 extwidth]{figurename.eps}}
caption{MainfigureCaption}
label{Fig.lable}
end{figure}


2,控制图片位置
如果不喜欢让Latex自动安排图片位置,可以使用float包,然后
用egin{figure}[H]。

usepackage{float}
1,插入jpg图片
在命令行环境下,使用命令:
ebb figure.jpg
生成bounding box文件figure.bb。

使用如下命令:
includegraphics[width=0.8 extwidth]{figure.jpg}

可以使用Pdf Texify直接编译成pdf文件。

2,插入bmp图片
还没有找到直接插入bmp图片的方法。现在的方法是,使用
gimp将bmp转换成jpg,然后按上述方法插入。转换时不要
使用windows自带的painter,图片质量损失太多。用gimp或
fastone image viewer,将jpg质量选为最高,转换之后得到的
图片质量较好。

3,同时插入jpg和eps图片
插入的命令不变。编译时使用Latex, dvi2pdf,两种格式的
图片都可以显示。 

插入eps图片
使用includegraphics[选项]{文件} 命令可以插入eps图片。下面是一个最简单的例子:

documentclass{article}
usepackage{graphicx} %使用graphicx包
egin{document}
includegraphics{file.eps} %插入图片,按图片原尺寸插入
end{document}

注意:
(1)eps文件和tex文件放在同一个文件夹,只用文件名就可以调用,不用写路径。

(2)编译时不能使用pdflatex,会出错。即使不出错,也看不到图。应使用latex编译生成dvi,然后dvi2ps,ps2pdf就可以看到图了。

使用[选项]可以指定图片大小:

includegraphics[width=3in]{file.eps}
设定图片宽度为3 inches,图片高度会自动缩放。

includegraphics[width= estwidth]{file.eps}
设定图片宽度为文本宽度。

includegraphics[width=0.8 extwidth]{file.eps}
设定图片宽度为文本宽度的0.8倍

includegraphics[width= estwidth-2.0in]{file.eps}
设定图片宽度比文本宽度少2 inches。

使用[选项]指定图片旋转角度:
includegraphics[angle=270]{file.eps}
将图片旋转270度。

两个选项同时使用,中间用逗号隔开:
includegraphics[width= estwidth, angle=270]{file.eps}

转自http://hi.baidu.com/bend90/blog/item/45236a100dcf6006203f2e4c.html

原文地址:https://www.cnblogs.com/zhaoyang10/p/4468565.html