0

I am pretty new to Latex. I am confused because before and after some of my figures appears some vertical space which I didn't include.

\subsection{xy}
\begin{figure}[H]
    \begin{center}
    \hspace*{-0.3cm}
    \includegraphics[width=\linewidth]{images/Bla.png}
    \newline
    \caption{Bla}
    \end{center}
\end{figure}

This is how I do it every time...so I do not understand why the space sometimes appears and sometimes doesn't...Maybe anyone could help?

I googled already but as I am new to Latex I feel like I am googling wrong... if that makes sense :/

  • 1
    If you use `[H]` you explicitly forbid latex from doing its job of finding a good location for your figure. It has no other choice than to insert ugly space around your image. Better use `[htbp]`. Also don't use `\begin{center}...\end{center}` in a figure. This will add additional vertical spacing. Normally I would say "Use `\centering` instead", but your figure spans the whole line, not much point in centring it ... – samcarter_is_at_topanswers.xyz Jul 23 '23 at 12:51
  • Also remove the `\hspace*{-0.3cm}` and the `\newline`, both won't do any good in your figure. Rule of thumb: if you find yourself in a situation where you use manual formatting like this in your tex document, something else already went wrong beforehand ... – samcarter_is_at_topanswers.xyz Jul 23 '23 at 12:52
  • You might find this article interesting https://tug.org/tug2023/files/fr-04-beeton-newbie/beeton-newbie-preprint.pdf – samcarter_is_at_topanswers.xyz Jul 23 '23 at 12:55

0 Answers0