[Tex/LaTex] Indentation lost after table/figure

indentationtables

Does someone know why the indentation specified in the beginning of the document is lost after the table/figure? How could I fix this? My simplified piece of code is:

\documentclass[10pt,a4paper,twoside]{report}
\usepackage{caption}
\usepackage{pgfplots}
\setlength{\parindent}{4em}
\begin{document}
\chapter{A}
\section{B}
blabla % not indented because first paragraph

blablabla % indented

blalablablabla % indented
\subsection{C}
blblabla % not indented because first paragraph

blalalblabla % nicely indented
\captionof{table}{caption here}
\begin{center}
\begin{tabular}{cccc}
    \hline
    \textbf{I} & \textbf{S} & \textbf{M} & \textbf{S}\\
    \hline
    A & 0.75 & G & 30\\
    B & 1.2 & H & 750\\
    C & 15 & I & 2250\\
    D & 7.1 & J & 0.4 \\
    E & 1300 & K & 0.7\\
    & & F & 0-0.2\\
     \hline
\end{tabular}
\end{center}

blablablaaablabla % no indentation anymore

blalblablabla % and here neither
\end{document}

Best Answer

It is the command \captionof that causes the indentation fail. Try to comment it and the indentation is correct. In the documentation of caption it is said that "you should use both \captionof and \captionof* only inside boxes or environments". There is also given a warning during the compilation. That means you need to put the table inside e.g. a minipage.

In this case I do not really see the point of not using the floating table instead of having it fix in the text.

\begin{table}[htb]
  \centering
  \caption{caption here}
  \label{tab:table}
  \begin{tabular}{cccc}
    \hline
    \textbf{I} & \textbf{S} & \textbf{M} & \textbf{S}\\
    \hline
    A & 0.75 & G & 30\\
    B & 1.2 & H & 750\\
    C & 15 & I & 2250\\
    D & 7.1 & J & 0.4 \\
    E & 1300 & K & 0.7\\
    & & F & 0-0.2\\
    \hline
  \end{tabular}
\end{table}
Related Question