views:

1620

answers:

2

Hi, I am working on my thesis and I am struggling with placing 2 images next to each other, so that the second image would be centered vertically along the first one. I was also trying to use subfigure instead of subfloat but neither of them works.

This is how it looks alt text

and my code is:

\begin{figure}[H]
\centering  \subfloat[H][sparse($\mathbf{A}$)]{\includegraphics[width=0.28\textwidth]{sparsesmall} \label{sparse}}
    \subfloat[H][full($\mathbf{A}$)]{\includegraphics[width=0.55\textwidth]{fullsmall}\label{full}}
  \caption{Representation of $\mathbf{A}$ in MATLAB}
  \label{schematic}
\end{figure}

Any suggestions to make it look better than now? Thx

+3  A: 

If you use subfig package, you can do this easily. The solution is in section 5.4 of the manual:

\newsavebox{\tempbox}
\begin{figure}[H]
\sbox{\tempbox}{\includegraphics[width=0.28\textwidth]{sparsesmall}}
\subfloat[sparse($\mathbf{A}$)]{\usebox{\tempbox}\label{sparse}}%
\qquad
\subfloat[full($\mathbf{A}$)]{\vbox to \ht\tempbox{%
  \vfil
  \includegraphics[width=0.55\textwidth]{fullsmall}
  \vfil}\label{full}}%
  \caption{Representation of $\mathbf{A}$ in MATLAB}\label{schematic}
\end{figure}

I haven't tested it, and there may be typos, but it should work.

Alok
For some reason the caption of the second figure is aligned to right. Otherwise it works perfectly, thanks.
Kate M
A: 

You can also use \raisebox{x}{\includegraphics[...]{...}} where x is negative to shift it downwards and positive to shift upwards.

krashalot