我在用长桌使用 p 列(用于包含长文本的最后一列)。我还使用设置空间,因为我想增加正文的间距。尽管设置空间不会改变表格环境中的间距,但是,情况并非如此长桌我发现一个建议使用 \begingroup \arraystretch{0.5} \endgroup 来绕过长桌引入拉伸。然而,当使用p 柱。它会删除表格行之间的空间,但不会删除 p-column 设置所创建的行之间的空间。有什么解决方法吗?
欢迎提供任何其他使该表格更美观的提示(例如,如何删除表格底部两行之间的空格)。
\documentclass[a4paper,10pt]{article}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{caption}
\captionsetup[table]{skip=3pt}
\usepackage{longtable}
\usepackage{setspace}
\begin{document}
\setstretch{1.45}
\begin{center}
\begingroup
\renewcommand\arraystretch{0.5}
{\small\tabcolsep=1pt
\begin{longtable}{ccccp{5cm}}
\caption{List of Indicators}\\
\toprule\midrule
Category & Dataset & Ticker & Num & Description \\
\midrule \endfirsthead
\midrule \endhead
\midrule \endfoot
\bottomrule \endlastfoot
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
\bottomrule
\label{table:vl}
\end{longtable}
}
\endgroup
\end{center}
\end{document}
答案1
我根据你的 MWE 做了一些改动,可能在回答中引入了一些不好的做法。因此,我建议你不要从我的代码中学习,尽管它可能有助于你解决问题。也许有人可以通过编辑我的答案来改进。
作为Mico 建议 \setstretch{1.0}
可能会解决行与行之间的间距p 柱
要控制最后两个规则之间的间距,您可以\specialrule
在原始 MWE 中使用。其\bottomrule
工作原理如下:
\specialrule{\heavyrulewidth}{\aboverulesep}{\belowbottomsep}
因此,您可以使用以下命令来控制其上方的间距:
\specialrule{\heavyrulewidth}{-9pt}{\belowbottomsep}
(编辑:你甚至不需要\specialrule
你的情况)
完整代码如下:
\documentclass[a4paper,10pt]{article}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{caption}
\captionsetup[table]{skip=3pt}
\usepackage{longtable}
\usepackage{setspace}
\usepackage{lipsum} % <---- To have dummy text
\usepackage[width=16cm]{geometry} % <---- So that the table has enough space to fit on the page and you see it centered
\begin{document}
\setstretch{1.45}
\lipsum[1] % <---- Dummy text (see that the stretching works here)
\begingroup
\setstretch{1.0}
\small
\tabcolsep=1pt
\begin{longtable}{ccccp{5cm}}
\caption{List of Indicators}\\
\toprule\midrule
Category & Dataset & Ticker & Num & Description \\
\midrule \endfirsthead
\midrule \endhead
\midrule \endfoot
\midrule\bottomrule \endlastfoot
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\[-2pt]
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons) \\
Non-Household Balance Sheets & x2 & TNWMVgh34JRM3 & 103 & Nonfinancial Corporate Business Sector Net Worth to Disposable Business Income (Percent) \\
Stock Markets & x3 & NIKKEI & 0 & Stock Average \\
Labor & x1 & UNEMPLRATE25o & 7 & Unemployment Level - Job Leavers (Thousands of Persons)
% Moved the \bottomrule up to \endlastfoot declaration
\label{table:vl}
\end{longtable}
\endgroup
\lipsum[1] % <---- Dummy text (see that the stretching works here too)
\end{document}
笔记:
您编写顶部和底部双线的方式导致表格以以下宽度开始:
\heavyrulewidth
\lightrulewidth
最后以以下内容作为结束:
\heavyrulewidth
\heavyrulewidth
您可能想要\toprule\midrule
在开始和\midrule\bottomrule
结束时使用。