表格前后的间距消失

表格前后的间距消失

我对框前后的间距有些困扰tabular。当我的表格只有一行时,一切都没问题。

\documentclass{article}
\usepackage{setspace}

\begin{document}
\doublespacing
Some text.

\begin{tabular}{|l|}
\hline
Some text.\\
\hline
\end{tabular}

Some text.
\end{document}

一行

但是当我添加新行时,表格前后的间距消失了!

\begin{tabular}{|l|}
\hline
Some text.\\ \hline
Some text.\\
\hline
\end{tabular}

两排

我应该怎样修复此问题?

答案1

如果您不喜欢flushleftcenter,您可以使用\vspace

\documentclass{article}
\usepackage{setspace}

\begin{document}
    \doublespacing
    \noindent I think the best solution is with \texttt{flushleft} (or \texttt{center}) environment:

    \begin{flushleft}
        \begin{tabular}{|l|}
            \hline
            Some text.\\
            \hline
            Some text.\\
            \hline
        \end{tabular}
    \end{flushleft}
    Some text.

    \noindent However, you could use \textbackslash\texttt{vspace*} and set any spacing you want:\vspace*{.1\baselineskip}

    \noindent
    \begin{tabular}{|l|}
        \hline
        Some text.\\
        \hline
        Some text.\\
        \hline
    \end{tabular}\vspace*{.2\baselineskip}  

    \noindent Some text.
\end{document}

在此处输入图片描述

相关内容