使用下面的命令,我可以生成一个 2x3 的表格图形:
\begin{figure}[htbp]
\centering
\begin{tabular}{ccc}
\subfloat[configuration 1]{\includegraphics[height=1.8in]{8}} &
\subfloat[configuration 2]{\includegraphics[height=1.8in]{9}} &
\subfloat[configuration 3]{\includegraphics[height=1.8in]{7}} \\
\subfloat[configuration 4]{\includegraphics[height=1.8in]{8}} &
\subfloat[configuration 5]{\includegraphics[height=1.8in]{9}} &
\subfloat[configuration 6]{\includegraphics[height=1.8in]{8}}
\end{tabular}
\caption{Here goes the caption.}
\label{fig6}
\end{figure}
我会得到:
图形按行优先顺序标记。我的问题是,我怎样才能按照 col-major 顺序标记它们才能得到如下图所示的效果?
答案1
如果您希望按列排序,第一种方法是将其放在multicols
环境中:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig,multicol}
\begin{document}
\begin{figure}[htbp]
\begin{multicols}{3}
\noindent
\subfloat[configuration 1]{\includegraphics[width=.9\linewidth]{8}}\par
\subfloat[configuration 2]{\includegraphics[width=.9\linewidth]{9}}\newpage
\subfloat[configuration 3]{\includegraphics[width=.9\linewidth]{7}}\par
\subfloat[configuration 4]{\includegraphics[width=.9\linewidth]{8}}\newpage
\subfloat[configuration 5]{\includegraphics[width=.9\linewidth]{9}}\par
\subfloat[configuration 6]{\includegraphics[width=.9\linewidth]{8}}
\end{multicols}
\caption{Here goes the caption.}
\label{fig6}
\end{figure}
\end{document}
答案2
另一种方法是使用三个tabular
环境,每个环境一列。
代码:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}[!htbp]
\centering
\begin{tabular}{l}
\subfloat[configuration 1]{\includegraphics[width=0.3\linewidth]{8}} \\
\subfloat[configuration 2]{\includegraphics[width=0.3\linewidth]{9}}
\end{tabular}
\begin{tabular}{l}
\subfloat[configuration 3]{\includegraphics[width=0.3\linewidth]{7}} \\
\subfloat[configuration 4]{\includegraphics[width=0.3\linewidth]{8}}
\end{tabular}
\begin{tabular}{l}
\subfloat[configuration 5]{\includegraphics[width=0.3\linewidth]{9}} \\
\subfloat[configuration 6]{\includegraphics[width=0.3\linewidth]{8}}
\end{tabular}
\caption{Here goes the caption.}
\label{fig6}
\end{figure}
\end{document}