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

4
  • 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, 2014 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, 2014 at 9: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 6, 2014 at 10:28
  • I think there is a related question: tex.stackexchange.com/questions/51839/… Feb 8, 2014 at 1:05

1 Answer 1

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

4
  • 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, 2014 at 14:13
  • Have a solution for the label placement with adjustbox..
    – math
    Feb 12, 2014 at 8:37
  • 1
    @math maybe you can add your solution as a new answer on the original question? Feb 12, 2014 at 8:41
  • Oops, you are right. I will do that.
    – math
    Feb 12, 2014 at 9:32

Not the answer you're looking for? Browse other questions tagged .