[Tex/LaTex] No indentation for paragraphs after floating figures

floatsindentation

Is there a way of removing automatically the indent of a paragraph if it directly follows a figure? Other paragraphs should be normally indented.

Because it is a floating environment it would be desirable if you did not need to manually add \noindent or the like after looking at the output.

Example:

enter image description here

After image A and image C there should not be an indent.

Code:

\documentclass[a4paper,12pt]{article}

\usepackage{graphicx}
\usepackage{lipsum}

\begin{document}

\section{Paragraph}

\lipsum[2]
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{image A}
\end{figure}
\lipsum[2]
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{example-image-b}
\caption{image B}
\end{figure}
\lipsum[3]
\lipsum[2]
%abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
%abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst Uvwxyu.

Abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{example-image-c}
\caption{image C}
\end{figure}
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz
abcdefghijklm nopqrstuvwxyz abcde fghijklmnopqr stuvwxyz abcdef ghijklmnopqrst uvwxyz

\end{document}

References:

Best Answer

LaTeX does not insert a paragraph break (or even a line break) you can set a figure as

hello\begin{figure}...\end{figure} world

with "hello world" being set as a sentence with no paragraph break.

The new paragraphs in your example code are not caused by the figure environment but by the preceding \lipsum macro which typesets complete paragraphs so ends the paragraph before the figure so the text after the figure in the source is the start of a new paragraph.

Note that the position of the figure after it is re-inserted does not (and should not) affect the layout of the paragraphs in that location, it mat be inserted mid paragraph or between paragraphs but does not change the linebreaking.

So the "the text after A" if it is not to be indented should simply not be a new paragraph. The insertion of the figure does not change the mechanism for detecting paragraph breaks.