3

I need to put three pictures side by side. From the hint in this post How to order 3 images horizontally?, I have this code.

\documentclass[12pt]{article}

\usepackage{graphicx}

\begin{document}
    \begin{figure}[!htb]
    \centering  
    \minipage{0.22\textwidth}
        \includegraphics[width=\linewidth]{pic/m1}
        \caption{Conventional}\label{fig:model1}
    \endminipage\hspace{1cm}%\hfill
    \minipage{0.22\textwidth}
        \includegraphics[width=\linewidth]{pic/m2}
        \caption{Knowledge Transfer}\label{fig:model2}
    \endminipage\hspace{1cm}%\hfill
    \minipage{0.22\textwidth}%
        \includegraphics[width=\linewidth]{pic/m3}
        \caption{Piaget}\label{fig:model3}
    \endminipage
    \end{figure}
\end{document}

However, with the lengthy caption in the second picture, these pictures are not correctly aligned. How to fix this?

enter image description here

prosseek
  • 6,033

1 Answers1

3

You should write \begin{minipage}...\end{minipage} and pass the t option for vertical alignment. This will align the baselines of the first line of each minipage with that of the others. Provided the figures do not descend below the baseline, this will give you a better alignment of the captions:

Sample output

\documentclass[12pt]{article}

\usepackage{graphicx}

\begin{document}
    \begin{figure}[!htb]
      \centering
    \begin{minipage}[t]{0.22\textwidth}
      \includegraphics[width=\linewidth]{example-image-a}
      \caption{Conventional}\label{fig:model1}
    \end{minipage}\hspace{1cm}%\hfill
    \begin{minipage}[t]{0.22\textwidth}
      \includegraphics[width=\linewidth,height=3cm]{example-image-b}
      \caption{Knowledge Transfer}\label{fig:model2}
    \end{minipage}\hspace{1cm}%\hfill
    \begin{minipage}[t]{0.22\textwidth}%
      \includegraphics[width=\linewidth,height=1cm]{example-image-a}
      \caption{Piaget}\label{fig:model3}
    \end{minipage}
    \end{figure}
\end{document}

The height= arguments to two of the graphics are just to emphasise the effect.

To improve the formatting of the narrow captions you might consider putting the following in your preamble:

\usepackage{caption}
\captionsetup{justification=centering}

producing the following instead

Second sample

Andrew Swann
  • 95,762