1

I'm trying to keep a landscape figure on the same page as the section heading -- with section heading still in portrait. But figure keeps slipping onto next page.

MWE here:

\documentclass{article}

\usepackage{pdflscape}  % landscape figures tables and caption
\usepackage{graphicx}

\begin{document}

\section{Figures}

\begin{landscape}
\begin{figure}[htbp]
\centering
\includegraphics{FIGURE.png}
\caption{Figure cpation}
\label{figsitemap}
\end{figure}
\end{landscape}

\end{document}

Tried altering top/bottom margins and scale bit not joy. Rotating and sidewaysfigure aren't what I want.

Any help? cheers

1
  • 2
    landscape environment changes the entire page (and forces a page break at start and end, so can't rotate a figure within a page. The description sounds like rotating package's sidewaysfigure is exactly what you want? Mar 28, 2014 at 23:15

2 Answers 2

2

Another possible solution is the rotation by 90 degrees. In cases that you do not want to use landscape environment. A sample of output is provided underneath.

\documentclass{article}
\usepackage{graphicx} % angle=90 option provided by graphicx package.
\usepackage{wrapfig}
\usepackage{pdflscape}  % landscape figures tables and caption
\usepackage{lipsum}% dummy text
\usepackage{rotating} %sideways table
\usepackage{float} % \begin{figure}[H] same as \begin{figure}[h!]

\begin{document}
\section{Figures}
%\lipsum % Text before (remove the % to view the picture with text)

\begin{figure}[ht]
\centering
  \includegraphics[angle=0]{test.png}
  \caption{This is a caption 0 degrees.}
  \label{fig:test:1}
\end{figure}

%\lipsum % Text between (remove the % to view the picture with text)

\begin{figure}[ht]
\centering
  \includegraphics[angle=90]{test.png} % angle here 45/90/180 what ever
  \caption{This is a caption 90 degrees.}
  \label{fig:test:2}
\end{figure}

%\lipsum % Text after

\end{document}

I found the example Landscape figure in LaTeX and converted to the output: Sample

Another possible solution would be the minipage. Sample of the output is provided below:

\documentclass[a4paper,12pt]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{lipsum}

\begin{document}

\section{My sideways figure}

\lipsum[2]
\begin{figure}[h!]
  \centering
  \begin{minipage}[b][5cm][c]{0.5\textwidth}

  \begin{turn}{90}
    \centering
    \includegraphics{test.png}
  \end{turn}

  \end{minipage}

\hspace{-3cm}

\begin{turn}{90}
  \begin{minipage}[b][5cm][c]{0.35\textwidth}
    \caption{This is a caption.}
    \label{fig:image}
  \end{minipage}
\end{turn}

\end{figure}
\lipsum[1]

\end{document}

I found some information from Rotating: Sideways figure with Section title. You can always modify the code based on your needs. The output of the code is: Sample:2.

Personally I prefer the first sample, but depends your code and the expected output. Just try both and observe which one fits your needs.

Update:

I was sure that if I look my old files I could find a working example. Approximately a year ago that I started working with LaTeX I had the same idea with you to create a landscape picture (due to size) but I also wanted to have the section and text inside. Well I had found a solution but for different ways did not work for me but maybe it works for you. Although I do not recommend this solution to be used with text due to the difference text width (because of landscape). You can somehow suppress the document to fit the appropriate length but the result based on my criteria was not satisfying. A working example is provided underneath with the code:

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{wrapfig}
%\usepackage{chngpage}
%\usepackage{geometry} %\Change page size for floats
\usepackage{pdflscape} %\landscape latex
\usepackage{lipsum}% dummy text

\begin{document}

%\lipsum % Text before (remove the % to view the picture with text)

%\newgeometry{margin=1cm}
\begin{landscape}

\section{Land Scape Figure}
\lipsum[2]

  \begin{figure}[hb]
  %\begin{adjustwidth}{-0.1cm}{-0.1cm}
   % {
    \centering
    \includegraphics{test.png} % angle here 45/90/180 what ever
    \caption{This is a caption of a landscape figure}
    \label{fig:test}
    % }
  % \end{adjustwidth}
  \end{figure}
\lipsum[2]
\thispagestyle{empty}
\end{landscape}
%\restoregeometry

%\lipsum % Text after (remove the % to view the picture with text)

\end{document}

I have added several other "code tricks" that I managed to combine while I was implementing my solution based on my needs. I mean geometry package (very useful for really big figures, ganttcharts etc. The adjustwidth command to center a really big figure, ganttchart etc. Just play with the code and you will find many interesting things. This is a sample of the output:Sample

So in conclusion to your question. Yes it is possible to add a section in landscape with a figure and text in the same page.

0

You can try several ways. In the second method you can change the size of the figure 1.

\begin{landscape}
\begin{figure}[h!]
\centering
\includegraphics{FIGURE.png}
\caption{Figure cpation}
\label{figsitemap}
\end{figure}
\end{landscape}

2.

\begin{landscape}
\begin{figure}[h!]
\centering
\includegraphics[scale=0.2]{FIGURE.png}
\caption{Figure cpation}
\label{figsitemap}
\end{figure}
\end{landscape}
2
  • 1
    This is basically what the example in the question does and does not address the problem, which is to put the figure on the same page as the section head. Also please never suggest that people use [h!] it almost always generates a warning from LaTeX. Mar 29, 2014 at 0:15
  • 1
    Yes, above code doesn't solve the problem
    – mark
    Mar 29, 2014 at 8:38

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.