[Tex/LaTex] Empty line after a tabular environment

spacingtables

I would like to have a little table without caption within my text. There should be, however, some space between the preceeding and following lines of text. The following snippet

\documentclass{report}
\begin{document}

Some text. Some text. Some text. Some text. Some text. Some text.
\\
\begin{center}
\begin{tabular}{r|c|c|}
&A&B\\\hline
C&AC&BC\\\hline
D&AD&DB\\\hline
\end{tabular}
\end{center}
\\\noindent
Some text. Some text. Some text. Some text.

\end{document}

does create a blank line above the table, but gives an error below as there is 'no line to end'. What's the right syntax here?

Best Answer

The center environment already adds some vertical space before and after it (while the \centering macro does not). If you want additional space, use, e.g., \smallskip, \medskip, or \bigskip.

\documentclass{report}

\begin{document}

Some text. Some text. Some text. Some text. Some text. Some text.

\medskip

\begin{center}
\begin{tabular}{r|c|c|}
&A&B\\\hline
C&AC&BC\\\hline
D&AD&DB\\\hline
\end{tabular}
\end{center}

\medskip

\noindent
Some text. Some text. Some text. Some text.

\end{document}

As centers spacing is based on that of the (internal) trivlist environment, you may also use the enumitem package to modify trivlist. This will save you typing \medskip before and after every in-text table, but it will also affect the spacing of other environments that use trivlist (e.g., flushleft).

\documentclass{report}

\usepackage{enumitem}
\setlist[trivlist]{topsep=\baselineskip}

\begin{document}

Some text. Some text. Some text. Some text. Some text. Some text.

\begin{center}
\begin{tabular}{r|c|c|}
&A&B\\\hline
C&AC&BC\\\hline
D&AD&DB\\\hline
\end{tabular}
\end{center}

\noindent
Some text. Some text. Some text. Some text.

\end{document}
Related Question