3

I have 6 images and I need to align them in a 2x3 matrix with 3 images on 1 line and 3 on the other. This is the code so far which vertically aligns all 6 images. How do I change it?

\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}
}}
snazziii
  • 141

1 Answers1

4

With your approach, you're heading in the right direction. But you define a \parbox[\columnwidth] for each of your graphics. So you explicitly tell LaTeX to put every picture on a separate line. Just remove 4 of your "big" \parboxes and it works the way you planned it to.

\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}

By the way, I recommend to use \centering instead of \begin{center}...\end{center} in an environment such as a \parbox. Refer to l2tabu for this and also see Should I use center or centering for figures and tables?

Huugo
  • 1,738