# No indentation for paragraphs after floating figures

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:

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:

• latex goes to some lengths not to start a paragraph after a float so you do not need to do anything, just do not add a paragraph break. – David Carlisle Apr 11 '18 at 18:53
• This is very hard to achive due to LaTeX’s asynchronous handling of paragraph-making and page-breaking tasks. By the time LaTeX knows that the first line of a paragraph lies at the beginning of a page that has a figure atop, the paragraph has already been typeset and the indentation is already there. But it is that hard to achieve because it is completely illogical: why should a paragraph lack indentation just because it happens to follow a figure on a page? – GuM Apr 11 '18 at 18:58
• – GuM Apr 11 '18 at 19:02
• @GuM "why should a paragraph lack indentation just because it happens to follow a figure on a page?" -- It is desired by Springer guidelines. – dexteritas Apr 11 '18 at 19:05
• @dexteritas that can only refer to non floating figures (equations etc) , it does not make sense to make floating figures which are not part of the text flow affect the paragraph setting within the text flow. – David Carlisle Apr 11 '18 at 19:33

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.

• Thanks for the answer. I adapted the example around image c, so that there is no new paragraph directly before or after the figure environment. Still a new paragraph may move just after the image. – dexteritas Apr 11 '18 at 19:31
• Ok, if the positioning and the layout of the text are independent, it just may be not possible, to automatize it. – dexteritas Apr 11 '18 at 19:33
• @dexteritas more than that you should not suppress the indentation of paragraph just because a float happens to be inserted otherwise there is no information that a paragraph start is there at all. How would you distinguish the case where a float is inserted mid-paragraph to the case where it was inserted before a paragraph??? – David Carlisle Apr 11 '18 at 19:35
• (Well, you could distinguish it, if the paragraph before does not end at the end of the line.) But I think you're right, that it does not make sense there. – dexteritas Apr 11 '18 at 19:45