1

I have a problem aligning my figures. I am using following code. However, one figure appears a bit higher than the other one. Everything else is perfectly aligned in the paper. Except for these two:

\begin{figure*}
\begin{minipage}[b]{2.5in}
\centering
\includegraphics[width=2.8in]{P}
 \caption{P is a figure.}
\label{figure:p}
\end{minipage}
\hspace{0.21in}
\begin{minipage}[b]{2.5in}
\centering
 \includegraphics[width=2.8in]{D}
 \caption{D is a figure.}
\label{figure:d}
\end{minipage}
%\end{center}
\end{figure*}
juliohm
  • 3,452
Marjan
  • 11
  • 1
    Welcome to TeX.SX! You probably want to specify equal heights rather than equal widths. – egreg Oct 08 '13 at 22:29
  • That did not solve the problem. they are same height but one of them appears a bit higher than the other one. – Marjan Oct 08 '13 at 22:41
  • Sorry, but the data are not sufficient for saying more. – egreg Oct 08 '13 at 22:43
  • Possible duplicate: http://tex.stackexchange.com/questions/5769/two-figures-side-by-side – juliohm Oct 08 '13 at 23:17
  • As mentioned in an earlier comment, you're not giving much context for us to go on. But, I'm wondering why you're specifying a greater width in for the \includegraphics than you are for the minipage. – A.Ellett Oct 09 '13 at 01:19

1 Answers1

3

You've not given us much go to on. Nevertheless I'm going to go out on a limb here and make some guesses about what might be going on.

According to your comments, the height of the two images is the same. In that case, there's nothing in your partial example that should result in misaligned images. Here's your partial example built into a MWE as follows

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfigure}
\pagestyle{empty}
\usepackage{lipsum}
\begin{document}

\lipsum[1]

\begin{figure*}
  \begin{minipage}[b]{2.5in}
    \centering
    \includegraphics[width=2.28in]{P}
    \caption{P is a figure.}
    \label{figure:p}
  \end{minipage}
  \hspace{0.21in}
  \begin{minipage}[b]{2.5in}
    \centering
    \includegraphics[width=2.28in]{D}
    \caption{D is a figure.}
    \label{figure:d}
  \end{minipage}
\end{figure*}

\lipsum[2]

\end{document}

enter image description here

A possible issue might be that the contents of the caption might have different heights and depths. Here's a rather extreme example of what I'm referring to:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[demo]{graphicx}
\usepackage{subfigure}
\pagestyle{empty}
\usepackage{lipsum}
\begin{document}

\lipsum[1]

\begin{figure*}
  \begin{minipage}[b]{2.5in}
    \centering
    \includegraphics[width=2.28in]{P}
    \caption{P is a figure.\protect\rule[-2ex]{0.4pt}{5ex}}
    \label{figure:p}
  \end{minipage}
  \hspace{0.21in}
  \begin{minipage}[b]{2.5in}
    \centering
    \includegraphics[width=2.28in]{D}
    \caption{D is a figure.}
    \label{figure:d}
  \end{minipage}
\end{figure*}

\lipsum[2]

\end{document}

resulting in

enter image description here

Assuming nothing extreme is going on in the caption, you might consider adding \strut to the both caption lines. Of course, that wouldn't help in the extreme case I've demoed here.

Essentially I'm suggesting you make sure the heights and depths of your two captions are equal.

A.Ellett
  • 50,533