Remova o espaço em branco antes da paisagem

Remova o espaço em branco antes da paisagem

Estou inserindo uma landscapefigura.

\begin{landscape}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{figures/sensor_diffs.jpg}
\caption{Example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{figures/sensor_diffs2.jpg}
\caption{Another example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs2}
\end{figure}
\end{landscape}

No entanto, a página anterior à figura produz muitos espaços em branco no final. Há muito texto na mesma seção após a figura, porém não parece estar ajustando corretamente.

Alguma ideia?

Além disso, tenho esse problema em vários lugares do documento, portanto qualquer tipo de solução global seria ideal.

Responder1

Você pode usar afterpagepackage para isso, para que as figuras sejam compostas após preencher a página atual.

\documentclass{article}
\usepackage{pdflscape}
\usepackage{graphicx}
\usepackage{afterpage}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\afterpage{%         <--------------like this
  \begin{landscape}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{Example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Another example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs2}
\end{figure}
\end{landscape}
}
\lipsum
\end{document}

insira a descrição da imagem aqui

Responder2

Sugiro que você carregue o rotatingpacote e seu sidewaysfigureambiente, que é um "ambiente flutuante" no jargão do LaTeX. Em contrapartida, o landscapeambiente énãoum ambiente flutuante, e é por isso que você obtém a quebra de página imediata quando \begin{landscape}é encontrado.

Observe também que (i) é possível ter diversas imagens, cada uma com suas próprias \captioninstruções \label, em um único sidewaysfigureambiente, e (ii) as \centeringinstruções não fazem nada (e podem, portanto, ser omitidas), pois as larguras dos gráficos são definidas para \linewidth.

\documentclass{article}
\usepackage[demo]{graphicx}   % omit 'demo' option in real document
\usepackage{rotating}   % for 'sidewaysfigure' environment
\usepackage{lipsum}     % for filler text

\begin{document}

\lipsum[1-2]   % filler text

A cross-reference to Figures \ref{fig:sensor_diffs} and \ref{fig:sensor_diffs2}.

\begin{sidewaysfigure}   % this will show up on page 2

\includegraphics[width=\linewidth]{figures/sensor_diffs.jpg}
\caption{Example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs}

\vspace{2cm}  % get some vertical separation

\includegraphics[width=\linewidth]{figures/sensor_diffs2.jpg}
\caption{Another example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs2}

\end{sidewaysfigure}

\lipsum[3-7]   % more filler text, continued on page 1 and then on page 3
\end{document}

informação relacionada