设置表格中文本行之间的间距

设置表格中文本行之间的间距

我想设置以下变量的文本之间的空间以使其看起来美观。

\begin{table}[H]
 \centering
    \setlength{\arrayrulewidth}{1mm}
    \renewcommand{\arraystretch}{0.65}

    \begin{threeparttable}
    \begin{tabular}{lp{12cm}{l}}

    \toprule[1.2pt]
    \textbf{Variable} & \multicolumn{1}{l}{\textbf{Description}} \\ 
    \cmidrule[0.8pt](lr){1-2}
    loan amnt & Asfasfaf Descriptive statistics for some of the                  Dictionary of the variables variables \\
    int rate & Interest rate of the loans Dictionary of the variables variables \\
    credit grade & based on its fico score Dictionary of the variables variables \\


    \midrule[1.2pt]
    \end{tabular}

     \begin{tablenotes}[online, flushleft]
   \tiny
   \item[]Notes: Dictionary for most of the variables is taken from the dictionary file
 \end{tablenotes}

    \caption{Dictionary of the variables}
    \label{tab:my_label}
    \end{threeparttable}

\end{table}

我得到的是

在此处输入图片描述

有什么建议吗?

答案1

我会重新设计你的桌子:

在此处输入图片描述

(红线表示页面布局)

  • 请始终提供完整但较小的文档,如您在下面的回答中看到的那样
  • 如果我们知道您实际文档序言的相关部分(与您的问题和页面布局相关的软件包),那么回答您的问题就容易得多
  • 在显示的解决方案中,我假设您的表格可以具有等于的宽度,\textwidth并且对于表格环境使用tabularx环境。它的列类型X会自动计算列宽。
  • 对于表中的规则,我建议使用规则的默认厚度。在包中booktabs是故意选择的......
  • 对于下表的注释,我将使用threeparttablex选项referable来定义命令\note
  • online没有定义threeparttable(据我所知),而是使用选项para
  • 建议您阅读一些有关餐桌布置的基本知识latex。例如LaTeX/表格

\documentclass{article}
\usepackage{booktabs, tabularx}
\usepackage[referable]{threeparttablex} % <--- for \note, \source in threepartable

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
    \begin{table}[htb]
\begin{threeparttable}
\caption{Dictionary of the variables}
    \label{tab:my_label}
\begin{tabularx}{\linewidth}{lX}
    \toprule
 \textbf{Variable} & \textbf{Description}   \\
    \midrule
oan amnt        & Asfasfaf Descriptive statistics for some of the Dictionary of the variables variables \\
int rate        & Interest rate of the loans Dictionary of the variables variables \\
credit grade    & based on its fico score Dictionary of the variables variables \\
    \bottomrule
    \end{tabularx}
    \begin{tablenotes}[para, flushleft]
    \scriptsize
\note: Dictionary for most of the variables is taken from the dictionary file
    \end{tablenotes}
\end{threeparttable}
    \end{table}
\end{document}

相关内容