Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the following code to put two figures next to each other (I am not providing a minimal example right away, because maybe the problem is obvious from the code. However, I will, if someone needs one!):

\begin{figure}[h]
\begin{minipage}[h]{0.5\linewidth}
\centering
\includegraphics[width=\linewidth]{pdfexp.png}
\caption{Dichte der Exponential-Verteilung für  $a=0.5,\ \frac{1}{3},\ \frac{1}{5},\ \frac{1}{1000}.$}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[h]{0.5\linewidth}
\centering
\includegraphics[width=\linewidth]{cdfexp.png}
\caption{Verteilungsfunktion der Exponential-Verteilung für $a=0.5,\ \frac{1}{3},\ \frac{1}{5},\ \frac{1}{1000}$.}
\end{minipage}
\end{figure}

This produces:

Image

The images are of the same size, but the axes are not at the same base level. The axes from the right figure are put higher than the ones of the left figure. Why is this happening?

share|improve this question
    
Please always use the provided method to include images. This insures that they don't disappear after a while. –  Martin Scharrer May 5 '12 at 14:52
    
If the bounding box of the separate images (pdfexp.png and cdfexp.png) have the same bounding box, then it would be possible align the baselines of the chart. Otherwise you'll have to fiddle with their vertical placement using \raisebox. –  Werner May 5 '12 at 14:54
3  
There is no [h] option for minipage, is there? Try [t] (top) instead. I think this happens because the one caption is higher. Top alignment to the baseline of the first line (i.e. the images) might fix it. –  Martin Scharrer May 5 '12 at 14:54
    
t fixed it, you guys are the best! –  Chris May 5 '12 at 14:59
    
Easiest solution is to set height=4.3cm or similar rather than width. If necessary you can adjust slightly the second or retake thecapture. (Avoids minipages as well). –  Yiannis Lazarides May 5 '12 at 15:04

2 Answers 2

up vote 4 down vote accepted

There is no [h] option for minipage. You should use [t] (top) to align both minipages to the baselines of their first lines, which are the images. The misalignment happens because the one caption is higher and the minipages are center-aligned be default. The unknown [h] option is silently ignored, but might break the alignment altogether.

Another thing is that you have 2x 0.5\linewidth plus \hspace{0.5cm} which is of course to wide. I would recommend to use 0.49\linewidth and \hfill instead.

share|improve this answer

In your example you are building out two boxes, each with the graphic and its caption inside. That means that the bottom point of the graphic is somewhere inside and not accessible to any alignment mechanism.

Due to the fact that you use \begin{minipage}[h] (which is invalid but unfortunately doesn't give an error) you effectively and up with the default which is \begin{minipage[c]. But even [t] or [b] wouldn't really help as you are interested in aligning at the graphics bottom.

A simple solution to achieve your goal is to forget about minipageand instead use a 2-column tabular environment where the graphics and the captions are each in their own cell.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.