Latex并没有插图功能,要使用graphicx的包。即首先在开头调用此包:
\documentclass{article}
\usepackage{graphicx}
然后我们可以使用\includegraphics命令来插图。
\includegraphics[scale=0.54]{图片}
scale指放缩比例,也可以使用width, height,即按照宽和高为标准对图片进行缩放。
图支持常见的图片格式,也可以使用pdf。
图片可以是绝对路径也可以是相对路径,不过graphicx包可以提前声明图片文件夹路径地址。
\usepackage{graphicx}
\graphicspath{{figure/}} %制定图片位置
一般在写论文的时候都是用figure,这样图会自适应地随着你的论文移动。格式如下:
\begin{figure}[ht] %h在here插入图,t在本页top处插入图,还有b页底,p独立的一页
\centering %居中
\includegraphics[scale=0.54]{图片}
\caption{图注}
\label{fig.1} %figure标号
\end{figure}
有时文章的格式是双栏,所以我们在跨栏插图时,需要在figure后加个*:
\begin{figure*}
有时跨双栏在每一行要写俩图,那么可以用minipage:
\begin{figure*}[t]
\begin{minipage}[t]{0.48\linewidth} //0.48制定minipage的宽度
\includegraphics[width=0.92\textwidth]{图}
\caption{图注}
\label{label}
\end{minipage}
\begin{minipage}[t]{0.48\linewidth}
\includegraphics[width=0.92\textwidth]{图}
\caption{图注}
\label{label}
\end{minipage}
\end{figure*}
除了minipage外,我们还可以用subfloat来完成一行多图,不同的是每个minipage都有一个不同的fig标号,而所有的subfloat共享一个figure编号,每个subfloat可以有自己的小标题。
\begin{figure*}
\centering
\subfloat[小标题1]{
\label{label1}
\includegraphics[width=0.48\textwidth]{图1}
}
\subfloat[小标题2]{
\label{label1}
\includegraphics[width=0.48\textwidth]{图2}
}