Wednesday, 23 May 2012

Adjusting vertical alignment of subfigures in LaTeX

When using subfigures in Latex, I have sometimes found it annoying how the figures are vertically aligned at the bottom, rather than being centered. An example: The following code

\begin{figure}
\subfigure{\includegraphics[width=67mm]{PipeScannerUnderGround}}
\subfigure{\includegraphics[width=47mm]{CylScanGeometryPipe}}
\caption{}
\end{figure}

produces the following figure:


which seems a little lopsided. I found a nice solution at stackoverflow: Use the \raisebox command to adjust the vertical position of individual subfigures, for example

\begin{figure}
\subfigure{\includegraphics[width=67mm]{PipeScannerUnderGround}}
\subfigure{\raisebox{10mm}{\includegraphics[width=47mm]{CylScanGeometryPipe}}}
\caption{}
\end{figure}

which yields the following result:



Much nicer! :)


5 comments:

Anonymous said...

Thanks, that was very helpful!
Much easier than other solutions I found so far.

Anonymous said...

Many, many thanks!

Anonymous said...

Thank you

Anonymous said...

Thank you. This really helps me.

Mel said...

Your blog is really helpful, thanks for posting!
Is there also a solution for horizontal alignment?

Post a Comment