# Indentation lost after table/figure

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}

• \begin{table}[h] \centering \caption{caption here} \begin{tabular}{cccc} will look the same (and is the typical approach). – LaRiFaRi Aug 19 '16 at 8:26
• By the way, if you want to keep this design, you should have a look on the package booktabs which will result in much nicer vertical spacing. In short \usepackage{booktabs} and then replace the \hlines by \toprule, \midrule, and bottomrule. – LaRiFaRi Aug 19 '16 at 8:32

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}


I guess you're doing

\captionof{table}{caption here}
\begin{center}
\begin{tabular}{cccc}


in order to get some vertical space between the caption and the table, but this is wrong: \captionof should be in the same environment as the table.

In order to get the vertical spacing, issue

\captionsetup{position=above}


Example:

\documentclass[10pt,a4paper,twoside]{report}
\usepackage{caption}

\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
\begin{center}
\captionsetup{position=above}
\captionof{table}{caption here}
\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 % indented

blalblablabla % indented

\end{document}


However, you should use the table environment with the regular \caption, rather than center and \captionof: you're going to have several page breaking related problems, if you want “here” tables and figures.