11

I'm putting two figures above each other with \subfloat from the subfig package. Their captions are empty as I just want to describe the figures with the main caption, but I still want the (a) and (b) subcaptions to show up, so that I've got something to refer to.

How can I put those tiny subcaptions to the right of the subfloats instead? They're eating my precious vertical space.

Here is a minimal working (but not as I'd like to) example:

\documentclass[a4paper,draft]{scrreprt}

\usepackage{graphicx} 
\usepackage[margin=1cm]{caption}
\usepackage{subfig}

\begin{document}

\begin{figure}[htb]
    \centering
    \subfloat[]{%
        \includegraphics{pic-1.png}%
        \label{label-1}%
    }\\%
    \subfloat[]{%
        \includegraphics{pic-2.png}%
        \label{label-2}%
    }%
    \caption{This is the text that describes \subref{label-1} and \subref{label-2}.}
\end{figure}

\end{document}

mwe

I started looking at the subcaption package, but it claims to be incompatible with subfig.

Tim N
  • 10,219
  • 13
  • 63
  • 88
  • Would you be able to include a full compilable MWE? – Werner Dec 16 '11 at 18:27
  • @Werner: Sure, I've added one now. – Tim N Dec 16 '11 at 18:42
  • I am interested in seeing a solution to this problem, but are you sure you want to do this? In languages that read from left-to-right, having the caption on the right hand side of the figure might be distracting. – cmhughes Dec 16 '11 at 18:52
  • @cmhughes: The actual pictures are plots with the Y-axis to the left, and I don't want too much text in different fonts close to each other. I was browsing through a textbook using this technique though, so I suppose it isn't horrible. Thanks for your comment, I hadn't thought of it. – Tim N Dec 16 '11 at 18:56

2 Answers2

8

You can use the \sidesubfloat command provided by the floatrow package (this, however, will put the subcaptions to the left of the subfloats):

\documentclass[a4paper,10pt]{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{subfig}

\begin{document}

\floatsetup[figure]{style=plain,subcapbesideposition=top}
\begin{figure}
  \sidesubfloat[]{\includegraphics{pic-1.png}\label{fig:sub1}}\\[10pt]%
  \sidesubfloat[]{\includegraphics{pic-2.png}\label{fig:sub2}}%
  \caption{Two subfigurfes with their caption beside}\label{fig:test}
\end{figure}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
4

Here is an option:

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{subfig}% http://ctan.org/pkg/subfig
\newsubfloat{figure}% Allow sub-figures
\begin{document}
\begin{figure}[htb]
  \centering
  \raisebox{\dimexpr-.5\height-1em}{\includegraphics{pic-1.png}}\ \subfloat[\label{label-1}]{} \\[\topskip]
  \raisebox{\dimexpr-.5\height-1em}{\includegraphics{pic-2.png}}\ \subfloat[\label{label-2}]{}
  \caption{This is the text that describes \protect\subref{label-1} and \protect\subref{label-2}.}
\end{figure}
\end{document}

The above example typesets the image (dropped by a half its height) and then inserts an empty \subfloat for captioning/referencing purposes.

Werner
  • 603,163
  • Thank you! What does [\topskip] do? – Tim N Dec 18 '11 at 23:28
  • While \\ causes a line break, adding an optional <len> (that is, using \\[<len>] you can specify the line break gap. So, I specified a vertical gap of \topskip for the line break. See the difference when using something like \\[\baselineskip] or \\[40pt], for example. – Werner Dec 19 '11 at 00:50
  • Ah, I didn't realise \\ was a command, much less that it had an argument. Another new thing I've learnt today! – Tim N Dec 19 '11 at 00:55