1

I have searched around for this but couldn't figure out the solution for my particular document.

Using this answer I have placed two images of different width side by side.

I would like the text of image (a) to not wrap. Ideally, I would like the image to be centered above the non-wrapped caption.

MWE

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\newsavebox{\myimage}

\begin{figure}
  \centering
  \savebox{\myimage}{\hbox{\rule{150pt}{150pt}}}% Store largest image
  \subfloat[First caption text is a bit longer and wraps.]{\usebox{\myimage}} \quad
  \subfloat[Second fits on one line.]{\raisebox{\dimexpr.5\ht\myimage-.5\height\relax}{\rule{100pt}{20pt}}}
  \caption{This is a figure.}
\end{figure}
\end{document}

Text wrapping

1

Just add some space on the side of the larger image. This will make the caption not wrap:

enter image description here

\documentclass{article}

\usepackage{graphicx,subfig}

\newsavebox{\myimage}

\begin{document}

\begin{figure}
  \centering
  \savebox{\myimage}{\hbox{\rule{150pt}{150pt}}}% Store largest image
  \subfloat[First caption text is a bit longer and wraps.]{\quad\usebox{\myimage}\quad} \quad
  \subfloat[Second fits on one line.]{\raisebox{\dimexpr.5\ht\myimage-.5\height}{\rule{100pt}{20pt}}}
  \caption{This is a figure.}
\end{figure}

\end{document}

Above I used \quad on either side of the left image. For more options, see What commands are there for horizontal spacing?

  • Perfect, thanks! I completely forgot about \quad... – Steve Hatcher Nov 15 '16 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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