I am using sidewaysfigure environment to rotate my figures. However, they are not centered in the middle of the page. I can't use \centering since I want that my footnote is "left aligned".

Here is a short example:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{amsthm}
\usepackage{mathtools}

\usepackage{rotating}
 \usepackage{float}


\begin{document}
\begin{sidewaysfigure}
\caption{Fill}
 \includegraphics[width=0.9\paperwidth]{example-image-c}
 \footnotesize 

 A long footnote
  \label{fig:fill}
\end{sidewaysfigure}
\end{document}

The output of my "real example" with the code mentioned in the comments:

enter image description here

The caption should be aligned in the same height as the footnote.

up vote 5 down vote accepted

There are a number of ways to achieve centering, or to overcome \centering. Centering is achieved by setting \leftskip and \rightskip to \hfil (more of less). You can also center an image by adding \hfil to the left (and \par to the right), or \hfill before and after. One can overcome \centering using \parbox{\linewidth}{...} or \makebox[\linewidth][l]{...}.

BTW, inserting \hfil between subfigures has a nice effect too.

You also might consider using afterpage and pdflscape instead of sidewaysfigure (It displays the page so that the image is right-side-up.)

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{amsthm}
\usepackage{mathtools}

\usepackage{rotating}
 \usepackage{float}
\usepackage[format=plain, justification=RaggedRight, singlelinecheck=false]{caption}
\usepackage{showframe}

\begin{document}
\begin{sidewaysfigure}
\caption{Fill}\label{fig:fill}
\hfil\includegraphics[width=0.8\linewidth]{example-image-c}% center inamge only

\footnotesize A long footnote
\end{sidewaysfigure}

\begin{sidewaysfigure}
\centering
\caption{Fill}\label{fig:fill}
\includegraphics[width=0.8\linewidth]{example-image-c}
\parbox{\linewidth}{\footnotesize A long footnote}% justify footnote
\end{sidewaysfigure}
\end{document}

Measure the image and use a suitably sized tabular:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{rotating}

\newsavebox{\imagebox}

\begin{document}

\begin{sidewaysfigure}
\centering
\caption{Fill}\label{fig:fill}

\sbox{\imagebox}{\includegraphics[width=0.9\paperwidth]{example-image-c}}
\begin{tabular}{@{}p{\wd\imagebox}@{}}
\usebox{\imagebox} \\
\footnotesize  A long footnote, long footnote, long footnote,
long footnote, long footnote, long footnote, long footnote,
long footnote, long footnote, long footnote, long footnote,
long footnote, long footnote
\end{tabular}
\end{sidewaysfigure}

\end{document}

enter image description here

Note that the \label refers to \caption, so it's best placed near it.

A different realization with the caption left aligned with respect to the image:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{rotating}
\usepackage{ragged2e}
\usepackage[
  format=plain,
  justification=RaggedRight,
  singlelinecheck=false
]{caption}

\newsavebox{\imagebox}

\begin{document}
\begin{sidewaysfigure}
\centering

\sbox{\imagebox}{\includegraphics[width=0.9\paperwidth]{example-image-c}}

\begin{minipage}{\wd\imagebox}
\caption{Fill}\label{fig:fill}

\usebox{\imagebox}

\footnotesize  A long footnote, long footnote, long footnote,
long footnote, long footnote, long footnote, long footnote,
long footnote, long footnote, long footnote, long footnote,
long footnote, long footnote

\end{minipage}
\end{sidewaysfigure}

\end{document}

enter image description here

  • Thanks. This works partially. The caption is now too "left aligned". I'll add the output of my real example. My caption options are:\usepackage[format=plain, justification=RaggedRight, singlelinecheck=false]{caption} – Vala Aug 18 at 11:41
  • @Vala Added code for your setup. – egreg Aug 18 at 17:19

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.