默认情况下,行会编号,然后移动到下一列,如 1,2
3,4
但我想把它编号为
1,3
2,4
即,
|图1 |图3 |
|图 2 | 图 4 |
怎么做?
答案1
一种方法是使用multicol
有两列的。
\documentclass{article}
\usepackage{subfig}
\usepackage{multicol}
\begin{document}
\begin{figure}[!ht]
\begin{multicols}{2}
\centering
\subfloat[]{A}\par
\subfloat[]{B}\par
\subfloat[]{C}\par
\subfloat[]{D}\par
\subfloat[]{E}\par
\subfloat[]{F}
\end{multicols}
\caption{All six.}
\label{fig:allsix}
\end{figure}
\end{document}
含subcaption
包装:
\documentclass{article}
\usepackage{subcaption,graphicx}
\usepackage{multicol}
\begin{document}
\begin{figure}[!ht]
\begin{multicols}{2}
\centering
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\end{subfigure}
\par
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\end{subfigure}
\par
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{}
\end{subfigure}
\par
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{example-image-c}
\caption{}
\end{subfigure}
\par
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{example-image}
\caption{}
\end{subfigure}
\par
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\end{subfigure}
\end{multicols}
\caption{All six.}
\label{fig:allsix}
\end{figure}
\end{document}
答案2
此解决方案保留了行的水平对齐(如果出现)。它之所以有效,是因为全局计数器会立即更改,即使保存框直到稍后才显示。
请注意,您甚至可以按随机顺序显示这些框。
\documentclass{article}
\usepackage{subcaption,graphicx}
\begin{document}
\begin{figure}[!ht]
\sbox0{\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\end{subfigure}}% a
\sbox1{\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\end{subfigure}}% b
\sbox2{\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{}
\end{subfigure}}% c
\sbox3{\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\caption{}
\end{subfigure}}% d
\sbox4{\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{example-image}
\caption{}
\end{subfigure}}% e
\sbox5{\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\end{subfigure}}% f
\centering
\usebox0\hfil \usebox3\par
\usebox1\hfil \usebox4\par
\usebox2\hfil \usebox5
\caption{All six.}
\label{fig:allsix}
\end{figure}
\end{document}