1

I have a very specific problem: I need two or three subfigures placed under each other. I want to have one main caption for both of them and a subcaption for each one. Because the pictures are pretty large and the space is limited, I want the subcaptions to be on the left side of the subfigures and being vertical while the picture itself stays horizontal.

I was already able to get the subfigures under each other with a caption on their left side using the subfig and floatrow package (see the code below)

My current problem is that whatever caption I enter in the \sidesubfloat commands, it is not displayed and I have no idea how to get it to be displayed vertically.

I know this problem is very specific and very complex, but maybe someone knows how to achieve it.

Any help is appreciated, Thanks in advance

\usepackage{subfig}
\usepackage{floatrow}
\floatsetup[figure]{style=plain,subcapbesideposition=center}

...

\begin{figure}
    \centering
    \begin{subfloatrow*}
        \sidesubfloat[]{
            \label{fig:XiParameterCuts0}
            \includegraphics[width=\textwidth]{Preliminary/XiParameter_Cuts0.png}
        }
    \end{subfloatrow*}
    \vspace*{1cm}
    \begin{subfloatrow*}
        \sidesubfloat[]{
            \label{fig:XiParameterCuts3}
            \includegraphics[width=\textwidth]{Preliminary/XiParameter_Cuts3.png}
        }
    \end{subfloatrow*}
    \vspace*{1cm}
    \caption{Topologieparameterverteilungen thermischer \textXi\textsuperscript{--} Hyperonen - simulierte Signale (grün) und kombinatorischer Untergrund (rot) - ohne (\ref{fig:XiParameterCuts0}) und mit (\ref{fig:XiParameterCuts3}) Precuts (schwarze Linien) \todo{Neue Bilder}}
    \label{fig:XiParameter}
\end{figure}
  • I can show you how to do it without using floatrow or subfig. How to do it WITH those packages is harder. – John Kormylo Nov 4 '17 at 21:00
  • OK, at least the comments work now, thanks for the help, somehow the site cretaed two acoounts for me. Anyway: I do not have to use the floatrow or subfib package, it was just the only way I could find to achieve what I was looking for. If there are better packages that look the same way, I would be happy to get to know them. – Triple S Nov 5 '17 at 8:24
  • A full MWE would be useful. I don't know what package \textXi comes from. – John Kormylo Nov 5 '17 at 14:41
  • I don't know what MWE stands for, but \textXi comes from the package textgreek, its nothing special, I just use it to get the Unicode characters for greek letters outside of a math area, because I want the font of the greek characters to match the font of the rest of the text. – Triple S Nov 5 '17 at 15:27
0

This solution places the \subcaption in the upper left corner and rotates it 90 degrees.

Note: Because \subcaption is in a minipage and the image isn't, one must place any \label inside the caption argument. (\refstepcounter defines macros used by \label which will be lost at the end of the minipage.)

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}

\newcommand{\ULsubfloat}[2][\empty]% #1 = caption (optional), #2 = image
{\hbox{% unbreakable group
  \sbox0{#2}% measure height of image
  \captionsetup{position=top, justification=raggedleft, singlelinecheck=false}%
  \rotatebox[origin=bl]{90}{\begin{minipage}[b]{\dimexpr \ht0+\dp0}
    \subcaption{#1}
  \end{minipage}}\raisebox{\dp0}{\usebox0}%
}}

\begin{document}

\begin{figure}
    \centering
    \ULsubfloat[some text here\label{fig:XiParameterCuts0}]{%
       \includegraphics[width=.9\textwidth]{example-image-a}%
    }
    \vspace{10pt}
    \ULsubfloat[\label{fig:XiParameterCuts3}]{%
       \includegraphics[width=.9\textwidth]{example-image-b}%
    }
    \caption{Topologieparameterverteilungen thermischer \textsuperscript{--} Hyperonen - simulierte Signale (grün) und kombinatorischer Untergrund (rot) - ohne (\ref{fig:XiParameterCuts0}) und mit (\ref{fig:XiParameterCuts3}) Precuts (schwarze Linien)}
    \label{fig:XiParameter}
\end{figure}
\end{document}
  • Wow, Thanks, works like a charm!!! I just changed it to justification=centering in the \captionsetup, so that its not at the top, but centered. – Triple S Nov 5 '17 at 16:02

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.