
Cuando se utiliza un align
entorno y posteriormente un figure
entorno en código Latex, en el pdf resultante aparece de repente un espacio en blanco donde en el código reside la figura del entorno.
¿Por qué pasó esto? ¿Como arreglarlo?
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}
Respuesta1
Normalmente el final de la línea después\end{figure}
no produce un espacio visible. En realidad, el código llevará un posible espacio en blanco proveniente deantesel entorno, añadiendo un espacio normal si figure
se inicia en modo párrafo y antes no había espacio \begin{figure}
.
Entonces
Before\begin{figure}
<code>
\end{figure}
Test
producirá un regular
Antes de la prueba
así como
Before
\begin{figure}
<code>
\end{figure}
Test
Sin embargo, estamos al final de un despliegue matemático y esto tiene como consecuencia que terminamos en un caso similar a Before\begin{figure}
, que agrega un espacio.
El align
medio ambiente no es relevante para el tema: el 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}
muestra el mismo comportamiento.
En general, mi consejo es escribir siempre figure
los table
entornos rodeados de líneas en blanco, para que el problema no pueda aparecer en primer lugar.
En su caso, me temo que la única forma alternativa es escribir
\end{figure}%