latex多幅图片排列 2*2示例

时间:2022-09-14 19:26:39

需在文件初始化时加(1) \usepackage{graphicx} (2)\usepackage{subfigure}

2*2图片排列代码如下:

\begin{figure} 

\centering 

\subfigure[subfigure 1-1]{\label{fig:subfig:a}

\includegraphics[width=0.45\linewidth]{losebg_small}}

\hspace{0.01\linewidth}

\subfigure[subfigure 1-2]{\label{fig:subfig:b}

\includegraphics[width=0.45\linewidth]{losebg_small}}

\vfill

\subfigure[subfigure 2-1]{\label{fig:subfig:a}

\includegraphics[width=0.45\linewidth]{losebg_small}}

\hspace{0.01\linewidth}

\subfigure[subfigure 2-2]{\label{fig:subfig:b}

\includegraphics[width=0.45\linewidth]{losebg_small}}

\caption{two figures}

\label{fig:subfig}

\end{figure}


另,若需子图片的标题置中且格式与图片标题一致,需在初始化时加以下代码:

\makeatletter

\long\def\@makecaption#1#2{\ifx\@captype\@IEEEtablestring%

\footnotesize\begin{center}{\normalfont\footnotesize #1}\\

{\normalfont\footnotesize\scshape #2}\end{center}%

\@IEEEtablecaptionsepspace

\else

\@IEEEfigurecaptionsepspace

\setbox\@tempboxa\hbox{\normalfont\footnotesize {#1.}~~ #2}%

\ifdim \wd\@tempboxa >\hsize%\setbox\@tempboxa\hbox{\normalfont\footnotesize {#1.}~~ }%

\parbox[t]{\hsize}{\normalfont\footnotesize \noindent\unhbox\@tempboxa#2}%

\else

\hbox to\hsize{\normalfont\footnotesize\hfil\box\@tempboxa\hfil}\fi\fi}

\makeatother

图片排列部分摘自:http://blog.sina.com.cn/s/blog_656681710100qhqw.html