11
\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

7
  • 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 May 21, 2016 at 12:52
  • @DavidCarlisle hallo David , i have added a usable example.
    – rayallen
    May 21, 2016 at 13:23
  • @Werner this is not a duplicate as if you need \noindent here it's a float package bug/ May 21, 2016 at 13:42
  • 1
    Dont use [H] figure option! With [htb] or [!h] you will obtain nicer and desired results.
    – Zarko
    May 21, 2016 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, 2016 at 17:32

3 Answers 3

7

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

3
  • No. If you need no indent that is a bug. May 21, 2016 at 13:41
  • You are right, but in that case it would solve the problem. May 21, 2016 at 13:43
  • using \noindent sometimes appears bug, but i have no better method to solve this. This time i use it without bug.
    – rayallen
    May 21, 2016 at 13:49
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}
2
  • probably the bug inherited from the original here package that defined H. I wonder who wrote that? May 21, 2016 at 13:54
  • well, the whole [H] thingy is a bug, so...
    – yo'
    May 21, 2016 at 20:56
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}
2
  • 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. Aug 9, 2019 at 7: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. Aug 19, 2019 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.