LaTeX多张图排列subfigure和subfloat的使用

  • Post author:
  • Post category:其他





\usepackage{subfig}



\subfloat{}



需要注意的是使用了

\newline

来另起一行。

......
\usepackage{graphicx}
\usepackage{subfig}
......
\begin{document}
\begin{figure*}[ht]
  \subfloat[img 1]{\includegraphics[width=0.3\textwidth]{1.jpg}}
 \hfill 	
  \subfloat[img 2]{\includegraphics[width=0.3\textwidth]{2.jpg}}
 \hfill	
  \subfloat[img 3]{\includegraphics[width=0.3\textwidth]{3.jpg}}
  \newline
  \subfloat[img 4]{\includegraphics[width=0.3\textwidth]{1.jpg}}
 \hfill 	
  \subfloat[img 5]{\includegraphics[width=0.3\textwidth]{2.jpg}}
 \hfill	
  \subfloat[img 6]{\includegraphics[width=0.3\textwidth]{3.jpg}}
\caption{Caption}
\end{figure*}
......
\end{document}

效果:

在这里插入图片描述




\usepackge{subcaption}



\subfigure{}



需要注意的是使用了

\newline

来另起一行。

......
\usepackage{graphicx}
\usepackage{subcaption}
......
\begin{document}
......
\begin{figure*}[ht]
\begin{subfigure}{.3\textwidth}
  \centering
  % include first image
  \includegraphics[width=.8\linewidth]{1.jpg}
  \caption{Put your sub-caption here}
  \label{fig:sub-first}
\end{subfigure}
\hfil
\begin{subfigure}{.3\textwidth}
  \centering
  % include second image
  \includegraphics[width=.8\linewidth]{2.jpg}
  \caption{Put your sub-caption here}
  \label{fig:sub-second}
\end{subfigure}
\hfil
\begin{subfigure}{.3\textwidth}
  \centering
  % include second image
  \includegraphics[width=.8\linewidth]{3.jpg}
  \caption{Put your sub-caption here}
  \label{fig:sub-second}
\end{subfigure}
\newline
\begin{subfigure}{.3\textwidth}
  \centering
  % include first image
  \includegraphics[width=.8\linewidth]{1.jpg}
  \caption{Put your sub-caption here}
  \label{fig:sub-first}
\end{subfigure}
\hfil
\begin{subfigure}{.3\textwidth}
  \centering
  % include second image
  \includegraphics[width=.8\linewidth]{2.jpg}
  \caption{Put your sub-caption here}
  \label{fig:sub-second}
\end{subfigure}
\hfil
\begin{subfigure}{.3\textwidth}
  \centering
  % include second image
  \includegraphics[width=.8\linewidth]{3.jpg}
  \caption{Put your sub-caption here}
  \label{fig:sub-second}
\end{subfigure}
\caption{Put your caption here}
\label{fig:fig}
\end{figure*}
......
\end{document}

效果:

在这里插入图片描述




\usepackage{subfigure}



\subfigure{\minipage{}}

这种方法在之前的博文

LaTeX subfigure和minipage的使用

中也有介绍过。

......
\usepackage{graphicx}
\usepackage{subfigure}
......
\begin{document}
......
\begin{figure*}
\centering
\subfigure[Caption a]{
\begin{minipage}[b]{0.23\textwidth}
\includegraphics[width=1\linewidth]{1.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{2.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{3.jpg}
\end{minipage}}
\subfigure[Caption b]{
\begin{minipage}[b]{0.23\textwidth}
\includegraphics[width=1\linewidth]{1.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{2.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{3.jpg}
\end{minipage}}
\subfigure[Caption c]{
\begin{minipage}[b]{0.23\textwidth}
\includegraphics[width=1\linewidth]{1.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{2.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{3.jpg}
\end{minipage}}
\subfigure[Caption d]{
\begin{minipage}[b]{0.23\textwidth}
\includegraphics[width=1\linewidth]{1.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{2.jpg}\vspace{4pt}
\includegraphics[width=1\linewidth]{3.jpg}
\end{minipage}}
\caption{description of figure}
\end{figure*}
......
\end{document}

效果:

在这里插入图片描述

对比之下,实现相同的效果,第一种

\subfloat

会更简洁。第三种包subfigure官方声明被弃用了。

在这里插入图片描述

三个包subcaption会更新功能更强大。具体需要进一步探索。



参考资料:


How to add subfigure in Latex



版权声明:本文为u012428169原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。