Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.