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 have an figure* environment with the following

\begin{figure*}
    \centerline {
    \subfloat[1]{...}
    \subfloat[2]{...}
    }
\end{figure*}

The images are different heights. How can I vertically align them? i.e. so the centre of each image is next to each other:

_____
|    |     _____  
|    |  _  |    |
|    |     |____|
|____|

     Fig. 1
share|improve this question

1 Answer 1

up vote 7 down vote accepted

There are two different scenarios, independent of whether you use the figure or figure* environment (or any other float for that matter). The first allows you to move the entire label with the image, while the second keeps the image label at the same level as the other one:

enter image description here

\documentclass{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{subfig}% http://ctan.org/pkg/subfig
\begin{document}
\newsavebox{\myimage}
\begin{figure}
  \centering
  \savebox{\myimage}{\hbox{\rule{150pt}{150pt}}}% Store largest image
  \subfloat[First]{\usebox{\myimage}} \quad
  \raisebox{\dimexpr.5\ht\myimage-.5\height\relax}{\subfloat[Second]{\rule{100pt}{100pt}}}
  \caption{This is a figure.}
\end{figure}

\begin{figure}
  \centering
  \savebox{\myimage}{\hbox{\rule{150pt}{150pt}}}% Store largest image
  \subfloat[First]{\usebox{\myimage}} \quad
  \subfloat[Second]{\raisebox{\dimexpr.5\ht\myimage-.5\height\relax}{\rule{100pt}{100pt}}}
  \caption{This is a figure.}
\end{figure}
\end{document}

The idea is to store the largest image in a box (\myimage). Then you raise the smaller image (50% of the largest box) - (50% of the smaller box) or, in LaTeX terms,

\dimexpr.5\ht\myimage-.5\height\relax

.5\ht\myimage refers to 50% of the height of \myimage, while .5\height refers to 50% of the height of the current box (contained within the \raisebox command). You first have to "create" a box using \newsavebox, and assign something to it using \savebox.

In the example above, graphicx was not required since no images were included (I used \rule{<width>}{<height>}). However, you'll need to use it if you include images.

Other options might also be possible via floatrow.

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.