我有 6 幅图像,需要将它们排列成 2x3 矩阵,其中 3 幅图像位于一行,3 幅图像位于另一行。这是迄今为止垂直对齐所有 6 幅图像的代码。我该如何更改它?
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\begin{center}
\includegraphics[width=0.3\textwidth]{img/preproc_1.png}
Raw Image
\end{center}
}}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\begin{center}
\includegraphics[width=0.3\textwidth]{img/preproc_2.png}
Gaussian Smoothing
\end{center}
}}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\begin{center}
\includegraphics[width=0.3\textwidth]{img/preproc_3.png}
Eigenvalues
\end{center}
}}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\begin{center}
\includegraphics[width=0.3\textwidth]{img/preproc_4.png}
Seeds
\end{center}
}}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\begin{center}
\includegraphics[width=0.3\textwidth]{img/preproc_5.png}
Labeled Seeds
\end{center}
}}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\begin{center}
\includegraphics[width=0.3\textwidth]{img/preproc_6.png}
Boxes
\end{center}
}}
答案1
按照你的方法,你正朝着正确的方向前进。但是你\parbox[\columnwidth]
为每个图形定义了一个。所以你明确地告诉 LaTeX 将每张图片放在单独的一行上。只需删除 4 个“大” \parbox
es,它就会按照你计划的方式工作。
\documentclass[draft]{article}
\usepackage{graphicx}
\begin{document}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\centering
\includegraphics[width=0.3\textwidth]{img/preproc_1.png}
Raw Image
}
\parbox{0.3\columnwidth}{
\centering
\includegraphics[width=0.3\textwidth]{img/preproc_2.png}
Gaussian Smoothing
}
\parbox{0.3\columnwidth}{
\centering
\includegraphics[width=0.3\textwidth]{img/preproc_3.png}
Eigenvalues
}}
\parbox{\columnwidth}{
\parbox{0.3\columnwidth}{
\centering
\includegraphics[width=0.3\textwidth]{img/preproc_4.png}
Seeds
}
\parbox{0.3\columnwidth}{
\centering
\includegraphics[width=0.3\textwidth]{img/preproc_5.png}
Labeled Seeds
}
\parbox{0.3\columnwidth}{
\centering
\includegraphics[width=0.3\textwidth]{img/preproc_6.png}
Boxes
}}
\end{document}
顺便说一句,我建议在诸如 这样的环境中使用\centering
而不是。请参阅\begin{center}...\end{center}
\parbox
禁忌为此,还请参阅我应该对图形和表格使用 center 还是 centering ?