LaTeX多张图排列subfigure和subfloat的使用
·
\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会更新功能更强大。具体需要进一步探索。
参考资料:
更多推荐
已为社区贡献5条内容
所有评论(0)