4

I want to place 2 SideCaption Figures next to each other but having real trouble with it. I tried to place them in a minipage and tabular environment but nothing worked. Always got a while bunch of errors...

\documentclass[
    11pt, % Schriftgröße
    DIV10,
    ngerman, % für Umlaute, Silbentrennung etc.
    a4paper, % Papierformat
    oneside, % einseitiges Dokument
    titlepage, % es wird eine Titelseite verwendet
    parskip=half, % Abstand zwischen Absätzen (halbe Zeile)
    headings=normal, % Größe der Überschriften verkleinern
    listof=totoc, % Verzeichnisse im Inhaltsverzeichnis aufführen
    bibliography=totoc, % Literaturverzeichnis im Inhaltsverzeichnis aufführen
    index=totoc, % Index im Inhaltsverzeichnis aufführen
    captions=tableheading, % Beschriftung von Tabellen unterhalb ausgeben
    %draft % Status des Dokuments (final/draft)
    final % Status des Dokuments (final/draft)
]{scrreprt}

\usepackage[labelfont=bf,font=footnotesize]{caption}
\captionsetup{format=plain} 

\usepackage{sidecap}

\begin{document}

  \begin{SCfigure}
    \includegraphics[width=0.25\textwidth]{android-linearlayout}
    \caption[Android Layout 1]{Android Layout 1 \cite{Google.2010}}
    \label{fig:android-linearlayout1}
  \end{SCfigure}


  \begin{SCfigure}
    \includegraphics[width=0.25\textwidth]{android-linearlayout}
    \caption[Android Layout 2]{Android Layout 2 \cite{Google.2010}}
    \label{fig:android-linearlayout2}
  \end{SCfigure}

\end{document}

Hope someone can help.

6

Your problem here is that the SCfigure environment (offered by the sidecap package) sets a side-captioned float. And floats should not be contained within a restrictive environment. See the UK TeX FAQ entry Not in outer par mode.

One way around this is to avoid using float and use \captionof from the capt-of package (or caption) to set a float-specific caption. Here's a little example:

enter image description here

\documentclass{article}
\usepackage{capt-of}% http://ctan.org/pkg/capt-of
\usepackage[demo]{graphicx}% http://ctan.org/pkg/graphicx
% [demo] option just for this example
\begin{document}

\noindent
\begin{minipage}{.45\textwidth}
  \begin{minipage}{.45\linewidth}
    \includegraphics[width=\linewidth]{layout1}
  \end{minipage}\hfill
  \begin{minipage}{.45\linewidth}
    \captionof{figure}{Layout 1}
    \label{fig:layout1}
  \end{minipage}%
\end{minipage} \hfill
\begin{minipage}{.45\textwidth}
  \begin{minipage}{.45\linewidth}
    \includegraphics[width=\linewidth]{layout2}
  \end{minipage}\hfill
  \begin{minipage}{.45\linewidth}
    \captionof{figure}{Layout 2}
    \label{fig:layout2}
  \end{minipage}%
\end{minipage}
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​

This also allows you freedom over specifying the width of the caption, as well as the location.

  • Why avoiding floating environments here? Your example code should work fine within a figure environment (and \caption), too!? – Axel Sommerfeldt Apr 18 '12 at 4:17
  • @kitingChris: Note that my example sets the two figures within the text. However, as mentioned by Axel (the caption package author), you can place the content inside a floating environment as well (like a figure). – Werner Apr 18 '12 at 15:44

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.