5

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: minimal example

math
  • 3,135
  • 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 06 '14 at 09: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 06 '14 at 09:40
  • 1
    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 06 '14 at 10:28
  • I think there is a related question: http://tex.stackexchange.com/questions/51839/wrap-caption-around-tikz-figure/51842#51842 – olga.saucedo Feb 08 '14 at 01:05

1 Answers1

3

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]
  % Your images
   \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
       \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}% Add content to "List of..."
       {\protect\numberline{\csname the\@captype\endcsname}{ToC entry}}%
        \csname fnum@\@captype\endcsname: % Float caption + #
        \makeatother

         % Actual caption
         \lipsum[2]

    \end{figure}

    \lipsum

    \end{document}

enter image description here