# Is it possible to let captions wrap a bit around includegraphics within figures? [duplicate]

Is it possible to place the caption a bit around includegraphics within the figure (to save some space?). As it may be misunderstood what I want, I try to explain it exemplary:

Currently the minimal example looks like this and uses minipage. I didn't know how to align without the ugly \vspace:

\documentclass{article}
\usepackage[caption=false]{subfig}
\usepackage{lipsum}

\begin{document}
\begin{figure}
\centering
\subfloat[][]{\rule{0.49\textwidth}{5cm}}\hfill
\subfloat[][]{\rule{0.49\textwidth}{5cm}}\\
\begin{minipage}{0.49\textwidth}
\vspace{-7.70cm}
\subfloat[][]{\rule{0.49\textwidth}{2cm}}\hfill
\subfloat[][]{\rule{0.49\textwidth}{2cm}}
\end{minipage}\hfill\subfloat[][]{\rule{0.49\textwidth}{5cm}}
\caption{\protect\lipsum*[2]}
\end{figure}
\end{document}


Which is rendered to:

## marked as duplicate by Werner, Svend Tveskæg, Jesse, Guido, Gonzalo MedinaFeb 8 '14 at 4:32

• Be careful what you wish for, you might get it! May be using \parshape (see here) and capt-of package, but I never tried some like this. – Fran Feb 6 '14 at 9:39
• One solution to the problem would be: place (c) over (d) next to (e) and use side-caption. But I guess this would involve to split (a) and (b) from (c-e) in two separate figures, right? – math Feb 6 '14 at 9:40
• I like your question, but please, provide a Minimal Working Example so that we don't need to do it from scratch -- it's a favour to the potentional answerers and you wish to do them a favour ;) You can use \rule{5cm}{4cm} or such in place of the figures. – yo' Feb 6 '14 at 10:28
• I think there is a related question: tex.stackexchange.com/questions/51839/… – olga.saucedo Feb 8 '14 at 1:05

I modified the solution on Wrap Caption Around TikZ Figure to fit your question. Those are @Werner's comments on the code. I must admit I don't understand half of what goes on there. The position=top option for the subfig package changes the baseline of the subfloats so that they are top aligned. It also puts the subcaptions on top of their figures. Maybe the captions on top don't bother you. Maybe someone else can help with that. I got a headache from trying to fix that with floatrow...

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage[caption=false, position=top]{subfig}

\begin{document}

\begin{figure}[h]
\subfloat[]{\rule{0.49\textwidth}{5cm}} \hfill \subfloat[]{\rule{0.49\textwidth}{5cm}} \par
\subfloat[]{\rule{0.24\textwidth}{2cm}} \hfill \subfloat[]{\rule{0.24\textwidth}{2cm}} \hfill \subfloat[]{\rule{0.49\textwidth}{5cm}} \par

% The caption
\vspace*{\dimexpr-\parskip-2.5cm\relax}% Skip backwards over last left-aligned image
\parshape 8 % Set flow of caption
0pt 0.48\textwidth %
0pt 0.48\textwidth %
0pt 0.48\textwidth
0pt 0.48\textwidth
0pt 0.48\textwidth
0pt 0.48\textwidth
0pt 0.48\textwidth
0pt \textwidth % last line restores regular flow ad infinitum
\makeatletter
% Setting of actual caption (this is taken from latex.ltx)
\refstepcounter\@captype% Increase float/caption counter
{\protect\numberline{\csname the\@captype\endcsname}{ToC entry}}%
\csname fnum@\@captype\endcsname: % Float caption + #
\makeatother

% Actual caption
\lipsum[2]

\end{figure}

\lipsum

\end{document}


• Yeah, the position=top, looks ugly but works. The journal I am submitting to, only allows captions for tables in top-alignment, but subfigure- and figure caption alignment should be bottom. – math Feb 10 '14 at 14:13
• Have a solution for the label placement with adjustbox.. – math Feb 12 '14 at 8:37
• @math maybe you can add your solution as a new answer on the original question? – Juan A. Navarro Feb 12 '14 at 8:41
• Oops, you are right. I will do that. – math Feb 12 '14 at 9:32