LATEX如何连续插入多个图片 - 论文投稿 - 小木虫 - 学术 科研 第一站

用\usepackage{subfigure}

\begin{figure}
\centering
\subfigure{\includegraphics{fig4a.eps}}
\subfigure{\includegraphics{fig4b.eps}}
\subfigure{\includegraphics{fig4c.eps}}
\subfigure{\includegraphics{fig4d.eps}}
\caption{ Dynamics of hysteretic neurons with different initial
noise amplitudes $A(0)$. (a) Dynamics of the proposed hysteretic
neuron with $A(0)=0.01$; (b) Dynamics of the proposed hysteretic
neuron with $A(0)=0.003$; (c) Dynamics of the neuron using the
previous hysteretic activation function with $A(0)=0.01$; (d)
Dynamics of the neuron using the previous hysteretic activation
function with $A(0)=0.003$.} \label{fig4}
\end{figure}





lyx生成的源代码,注意两个\subfloat是连着的,中间没有空白行,这样才会左右排列。如果中间有空白行,两个图就会上下排列。
\usepackage{graphicx}
\usepackage{subfig}

\begin{figure}[tbh]
\begin{centering}
\subfloat[虚警概率]{\begin{centering}
\includegraphics[width=7.4cm]{fig1}
\par\end{centering}

}\subfloat[检测门限估计误差]{\begin{centering}
\includegraphics[width=7.4cm]{fig2}
\par\end{centering}

}
\par\end{centering}

\caption{\label{fig:PF}虚警概率和检测门限估计误差}
\end{figure}


在LaTeX文档中插入图片都是通过使用一些latex图形处理宏命令来实现的, 有很多宏命令都支持在在LaTeX文档中插入eps格式的图形文件, 主要有:
(1)用includegraphics宏命令(graphicx包)
首先需在latex文档的文件说明部分加上:
\usepackage{graphicx}
然后在需要插入图片的地方引用:
\includegraphics[height=高度]{图片文件名} 或者: \includegraphics[width=宽度]{图片文件名}
其中的"高度"和"宽度"是指希望图片打印的高度和宽度, 必须给出单位, 可用厘米(cm)或英寸(in). 高度和宽度也可用上述格式同时给出, 这样可以改变原图的长宽比例. 上述命令中的图片文件名是指欲插入的图片文件 的文件名, 图片必需是eps格式的.
用graphicx包的includegraphics宏命令插入图片时还可以使图片旋转, 方法是:
\includegraphics[height=高度][angle=旋转角度]{图片文件名}
插入的图形通常为eps、pdf或者jpg、png等格式,假设名字叫fig,把它放在你的tex文档同一目录下。
1、先导言区加一句\usepackage{graphicx}
2、如果想插入inline的图形, 直接使用
\includegraphics[width=5in]{fig},
不用加后缀名。
这个width是我最常用的选项, 也可以改成其他的。
3、如果你想插入浮动图形, 使用
\begin{figure}[htbp]
\centering\includegraphics[width=3.5in]{fig}
\caption{something}\label{fig:1}
\end{figure}
4、如果是eps的图形, 编译过程是latex, dvips, ps2pdf.
如果是pdf jpg png图形, 编译过程是pdflatex.用includegraphics宏命令(graphics包):
使用graphics包插入图片过程较麻烦.

(2)用psfig宏命令
首先需在latex文档的文件说明

部分加上:
\usepackage{psfig}
然后在需要插入图片的地方引用:
\psfig{figure=图片文件名,height=高度} 或者: \psfig{figure=图片文件名,width=宽度}
其中的"高度"和"宽度"是指希望图片打印的高度和宽度, 必须给出单位, 可用厘米(cm)或英寸(in). 高度和宽度也可用上述格式同时给出, 这样可以改变原图的长宽比例. 上述命令中的图片文件名是指欲插入的图片文件的文件名, 图片必需是eps格式的

(3)用epsfig宏命令
epsfig宏命令的使用方法和psfig完全相同, 具体方法是:
首先需在latex文档的文件说明部分加上:
\usepackage{epsfig}
然后在需要插入图片的地方引用:
\epsfig{figure=图片文件名,height=高度} 或者: \epsfig{figure=图片文件名,width=宽度}
其中的"高度"和"宽度"是指希望图片打印的高度和宽度, 必须给出单位, 可用厘米(cm)或英寸(in). 高度和宽度也可用上述格式给出, 这样可以改变原图的长宽比例. 上述命令中的图片文件名是指欲插入的图片文件的文件名, 图片必需是eps格式的

(4)用epsf宏命令
用epsf宏命令的使用方法是: 首先需在latex文档的文件说明部分加上:
\usepackage{epsf}
然后在需要插入图片的地方引用:
\epsfxsize=宽度\epsffile{图片文件名} 或者: \epsfysize=高度\epsffile{图片文件名}
其中的"高度"和"宽度"是指希望图片打印的高度和宽度, 必须给出单位, 可用厘米(cm)或英寸(in). 高度和宽度也可用上述格式给出, 这样可以改变原图的长宽比例. 上述命令中的图片文件名是指欲插入的图片文件的文件名, 图片必需是eps格式的.

(5)LaTeX 图片控制命令,位置控制
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{https://www.360docs.net/doc/d011150876.html,ble}
\end{figure}

2,控制图片位置
如果不喜欢让Latex自动安排图片位置,可以使用float包,然后
用\begin{figure}[H]。
\usepackage{float}
1,插入jpg图片
在命令行环境下,使用命令:
ebb figure.jpg
生成bounding box文件figure.bb。
使用如下命令:
\includegraphics[width=0.8\textwidth]{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包
\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}

相关文档
最新文档