13
\section{last paragraph}
Here are some words in the last paragraph. Now a figure is inserted below.
\begin{figure}[H]
\centering
\includegraphics[width=5cm]{...jpg}
\caption[Example .]{.,,}
\label{...}
\end{figure}
Now I want to start a new line after this figure. But there is always indentation at the begining. How to delete this indentation?

Here is the complied result: enter image description here

I add the usage exmaple:

\documentclass[a4paper,12pt]{article}

\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{float}

\begin{document}
\section{Paragraph}
Here are some words in the last paragraph. Now a figure is inserted below.
\begin{figure}[H]
\caption{A picture of a gull.}
\centering
\includegraphics[width=0.5\textwidth]{Penguins.jpg}
\end{figure}
Now I want to start a new line after this figure. But there is always indentation at the begining. How to delete this indentation?
\end{document}

Here is the compiled result:

enter image description here

rayallen
  • 313
  • an indentation should only occur at start of a paragraph, so if you have a blank line before or after the figure. If it is occurring when you have no blank line that looks like a bug, please post a usable example that reproduces the problem, not a fragment – David Carlisle May 21 '16 at 12:52
  • @DavidCarlisle hallo David , i have added a usable example. – rayallen May 21 '16 at 13:23
  • @Werner this is not a duplicate as if you need \noindent here it's a float package bug/ – David Carlisle May 21 '16 at 13:42
  • 1
    Dont use [H] figure option! With [htb] or [!h] you will obtain nicer and desired results. – Zarko May 21 '16 at 13:44
  • @DavidCarlisle: Floats have no concern over paragraphs, with or without the [H] option. If this was changed in the float package you may have just as many people requesting an option to have it reversed. – Werner May 21 '16 at 17:32
  • @Werner I don't understand your comment, it's clearly a bug in H it should work the same way as a normal float option and respect paragraph starts. – David Carlisle May 21 '16 at 20:06
  • Well formulated question! – gustafbstrom Sep 16 '20 at 08:39

3 Answers3

10

You need to include \noindent at the beginning of the first line.

\documentclass[a4paper,12pt,demo]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{float}

\begin{document}
\section{Paragraph}
Here are some words in the last paragraph. Now a figure is inserted below.
\begin{figure}[H]
\caption{A picture of a gull.}
\centering
\includegraphics[width=0.5\textwidth]{Penguins.jpg}
\end{figure}
\noindent Now I want to start a new line after this figure. But there is always indentation at the begining. How to delete this indentation?
\end{document}

That leeds to:

enter image description here

lukascbossert
  • 3,015
  • 1
  • 16
  • 37
9

This looks like a bug in the float package, here is the start of a fix, I show the image included with and without a blank line after the figure

enter image description here

\documentclass[a4paper,12pt]{article}

\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{float}

\makeatletter

\renewcommand\float@endH{\@endfloatbox\vskip\intextsep
  \if@flstyle\setbox\@currbox\float@makebox\columnwidth\fi
  \box\@currbox\vskip\intextsep\relax\@doendpe}

\makeatother
\begin{document}
\section{Paragraph}

xx

Here are some words in the last paragraph. Now a figure is inserted below.
\begin{figure}[H]
\caption{A picture of a gull.}
\centering
\includegraphics[width=0.5\textwidth]{example-image}
\end{figure}
Now I want to start a new line after this figure. But there is always indentation at the begining. How to delete this indentation?

Here are some words in the last paragraph. Now a figure is inserted below.
\begin{figure}[H]
\caption{A picture of a gull.}
\centering
\includegraphics[width=0.5\textwidth]{example-image}
\end{figure}

Now I want to start a new line after this figure. But there is always indentation at the begining. How to delete this indentation?






\end{document}
David Carlisle
  • 757,742
0

Actually you don't need to include \noindent manually every time.

It's enough to define what happens after every figure environment:

\AfterEndEnvironment{figure}{\noindent\ignorespaces}

Remember to remove any blank lines between \end{figure} and the start of your paragraph.

enter image description here

Tip: you can also do the same after other kinds of environments, for example after definitions:

\AfterEndEnvironment{definition}{\noindent\ignorespaces}
  • This will do the wrong thing in the common case that there is a blank line after the figure. LaTeX almost never uses \noindent to suppress paragraph indentation for this reason. – David Carlisle Aug 09 '19 at 07:50
  • Well, removing blank lines is a precondition of my answer, so technically it will never do the wrong thing if OP follows it entirely. – alessandrocalo Aug 19 '19 at 02:22