LaTeX技巧96:LaTeX 图片控制命令,位置控制
2012-04-05 17:25
806 查看
LaTeX 控制图片的位置,就是加感叹号来忽略“美学”标准。
\begin{figure}[!htb]
\usepackage{float}
\begin{figure}[H]
插到你代码相应的位置。
1,插入并列的子图
\usepackage{subfigure}
\begin{figure}[H]
\centering
\subfigure[SubfigureCaption]{
\label{Fig.sub.1}
\includegraphics[width=0.4\textwidth]{figurename.eps}}
\subfigure[SubfigureCaption]{
\label{Fig.sub.2}
\includegraphics[width=0.4\textwidth]{figurename.eps}}
\caption{MainfigureCaption}
\label{Fig.lable}
\end{figure}
2,控制图片位置
如果不喜欢让Latex自动安排图片位置,可以使用float包,然后用
\begin{figure}[H]
\usepackage{float}
插入jpg图片
在命令行环境下,使用命令:
ebb figure.jpg
生成bounding box文件figure.bb。
使用如下命令:
\includegraphics[width=0.8\textwidth]{figure.jpg}
可以使用Pdf Texify直接编译成pdf文件。
插入bmp图片
还没有找到直接插入bmp图片的方法。现在的方法是,使用gimp将bmp转换成jpg,然后按上述方法插入。转换时不要使用windows自带的painter,图片质量损失太多。用gimp或fastone
image viewer,将jpg质量选为最高,转换之后得到的图片质量较好。
同时插入jpg和eps图片
插入的命令不变。编译时使用Latex, dvi2pdf,两种格式的图片都可以显示。
插入eps图片
使用\includegraphics[选项]{文件} 命令可以插入eps图片。
下面是一个最简单的例子:
\documentclass{article}
\usepackage{graphicx} %使用graphicx包
\begin{document}
\includegraphics{file.eps} %插入图片,按图片原尺寸插入
\end{document}
注意:
(1)eps文件和tex文件放在同一个文件夹,只用文件名就可以调用,不用写路径。
(2)编译时不能使用pdflatex,会出错。即使不出错,也看不到图。应使用latex编译生成dvi,然后dvi2ps,
ps2pdf就可以看到图了。
使用[选项]可以指定图片大小:
\includegraphics[width=3in]{file.eps}
设定图片宽度为3 inches,图片高度会自动缩放。
\includegraphics[width=\testwidth]{file.eps}
设定图片宽度为文本宽度。
\includegraphics[width=0.8\textwidth]{file.eps}
设定图片宽度为文本宽度的0.8倍
\includegraphics[width=\testwidth-2.0in]{file.eps}
设定图片宽度比文本宽度少2 inches。
使用[选项]指定图片旋转角度:
\includegraphics[angle=270]{file.eps}
将图片旋转270度。
两个选项同时使用,中间用逗号隔开:
\includegraphics[width=\testwidth, angle=270]{file.eps}
\begin{figure}[!htb]
\usepackage{float}
\begin{figure}[H]
插到你代码相应的位置。
1,插入并列的子图
\usepackage{subfigure}
\begin{figure}[H]
\centering
\subfigure[SubfigureCaption]{
\label{Fig.sub.1}
\includegraphics[width=0.4\textwidth]{figurename.eps}}
\subfigure[SubfigureCaption]{
\label{Fig.sub.2}
\includegraphics[width=0.4\textwidth]{figurename.eps}}
\caption{MainfigureCaption}
\label{Fig.lable}
\end{figure}
2,控制图片位置
如果不喜欢让Latex自动安排图片位置,可以使用float包,然后用
\begin{figure}[H]
\usepackage{float}
插入jpg图片
在命令行环境下,使用命令:
ebb figure.jpg
生成bounding box文件figure.bb。
使用如下命令:
\includegraphics[width=0.8\textwidth]{figure.jpg}
可以使用Pdf Texify直接编译成pdf文件。
插入bmp图片
还没有找到直接插入bmp图片的方法。现在的方法是,使用gimp将bmp转换成jpg,然后按上述方法插入。转换时不要使用windows自带的painter,图片质量损失太多。用gimp或fastone
image viewer,将jpg质量选为最高,转换之后得到的图片质量较好。
同时插入jpg和eps图片
插入的命令不变。编译时使用Latex, dvi2pdf,两种格式的图片都可以显示。
插入eps图片
使用\includegraphics[选项]{文件} 命令可以插入eps图片。
下面是一个最简单的例子:
\documentclass{article}
\usepackage{graphicx} %使用graphicx包
\begin{document}
\includegraphics{file.eps} %插入图片,按图片原尺寸插入
\end{document}
注意:
(1)eps文件和tex文件放在同一个文件夹,只用文件名就可以调用,不用写路径。
(2)编译时不能使用pdflatex,会出错。即使不出错,也看不到图。应使用latex编译生成dvi,然后dvi2ps,
ps2pdf就可以看到图了。
使用[选项]可以指定图片大小:
\includegraphics[width=3in]{file.eps}
设定图片宽度为3 inches,图片高度会自动缩放。
\includegraphics[width=\testwidth]{file.eps}
设定图片宽度为文本宽度。
\includegraphics[width=0.8\textwidth]{file.eps}
设定图片宽度为文本宽度的0.8倍
\includegraphics[width=\testwidth-2.0in]{file.eps}
设定图片宽度比文本宽度少2 inches。
使用[选项]指定图片旋转角度:
\includegraphics[angle=270]{file.eps}
将图片旋转270度。
两个选项同时使用,中间用逗号隔开:
\includegraphics[width=\testwidth, angle=270]{file.eps}
相关文章推荐
- LaTeX 控制图片的位置
- LaTeX 控制图片的位置
- WEB程序设计-JSP结合CSS控制图片出现的位置
- latex之图表位置控制
- 【Latex】高级插入图片技巧: 双栏中如何正确插入图片 + 如何多图
- LaTex使用技巧(7):图片的水平排版
- 自定义控件—AndroidTagView标签,可在标签中添加图片,控制图片的位置
- Javascript实现图片位置控制(鼠标拖拽 + 键盘方向键移动)源码分享
- LaTeX插入图片位置报错
- LaTeX技巧353:图片标题的字体大小怎么设定呢?
- Javascript实现图片位置控制(鼠标拖拽 + 键盘方向键移动)源码分享
- iText7 生成 PDF 文件,解决各种操作系统中文问题,控制指定位置显示图片、文字、图文混排
- 利用pdflatex命令编译含eps图片的tex (TexLive, CTex)
- Latex强制图片位置
- 使用背景图片时,控制单行文字距顶部距离的技巧。
- LaTeX技巧24:LaTeX常用命令集锦
- SHELL脚本中 tput 的使用技巧 (tput 控制光标位置)
- 不喜欢让Latex自动安排图片位置,可以使用float包
- h5头像图片旋转css3精确控制每个图片的位置
- Latex强制图片位置