
Ao utilizar um align
ambiente e posteriormente um figure
ambiente em código Latex no pdf resultante aparece repentinamente um espaço em branco onde no código reside o ambiente da figura.
Por que isso acontece? Como corrigi-lo?
MWE:
\documentclass{article}
\usepackage{todonotes}
\usepackage{amsmath}
\begin{document}
\section{My Chapter}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test.
\begin{align}
a = b
\end{align}
\begin{figure}
\centering
\missingfigure[figwidth=6cm]{Testing a long text string}
\caption{Test1.}
\end{figure}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test.
\end{document}
Responder1
Normalmente o fim da linha depois \end{figure}
não produz um espaço visível. Na verdade, o código carregará um possível espaço em branco vindo deanteso ambiente, adicionando um espaço normal se figure
iniciar no modo parágrafo e não havia espaço antes \begin{figure}
.
Então
Before\begin{figure}
<code>
\end{figure}
Test
produzirá um regular
Antes do teste
assim como
Before
\begin{figure}
<code>
\end{figure}
Test
No entanto, estamos no final de uma exibição matemática e isso tem como consequência que terminamos em um caso semelhante a Before\begin{figure}
, que adiciona um espaço.
O align
meio ambiente não é relevante para a questão: o documento
\documentclass{article}
\usepackage{todonotes}
\begin{document}
\begin{equation}
text
\end{equation}
\begin{figure}
\centering
\missingfigure[figwidth=6cm]{Testing a long text string}
\caption{Test1.}
\end{figure}
Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test.
\end{document}
apresenta o mesmo comportamento.
Em geral meu conselho é sempre digitar figure
ambientes table
cercados por linhas em branco, para que o problema não apareça em primeiro lugar.
No seu caso, infelizmente, a única outra maneira é digitar
\end{figure}%