[Tex/LaTex] general command to disable indentation of paragraphs after figures and tables

floatsindentationparagraphs

I am typesetting a manual, that uses normal indentation for paragraphs. The pages have a lot of figures and tables and I would like to have the paragraph after tables and figures to have no indentation. Currently I just use \noindent, but I am sure there is an easier way?

Can anyone explain how this is achieved after sections? It might give me a pointer as to how to write a macro to do this.

Best Answer

You asked how it is done for sections: \section uses \@afterheading which puts code in \everypar so that it suppress the indentation in the first paragraph and then reset its own content to empty for the following paragraphs. The LaTeX kernel also has a \@doendpe command which is e.g. used by lists to suppress the indentation after the list if there is no empty line/\par following. Here two examples how you could use this code yourself (but I doubt that they can be used in the case of real floats.)

 \documentclass{article}
 \usepackage{lipsum}

 \makeatletter
 %Variant 1:
 \newif\ifafterpar
 \newcommand\afterparnoindent{%
   \afterpartrue
   \everypar{%
     \ifafterpar
       \afterparfalse
       {\setbox\z@\lastbox}%
     \else
       \everypar{}%
     \fi}}

 %Variant 2:
 % will suppress indentation if there is no
 % empty line behind \afterparnoindent
 %\renewcommand\afterparnoindent{\par\@doendpe}
 \makeatother
 \begin{document}

 \lipsum[1]

 abc\afterparnoindent

 first paragraph \lipsum[1]

 the next \lipsum[1]

 \end{document}
Related Question