我正在从 csv 生成表格,这些表格在标题和间距方面有非常具体的格式要求。其中一些表格跨越多页,为此我使用了 csvsimple 包中的 csvautolongbook。我遇到的一个问题就是行必须是单倍行距,但我的代码在行之间添加了额外的垂直空间。同样,标题和表格之间不应该有垂直空间
\csvautobooklongtable[
table head={
\caption[Sampling effort and results.]{Sampling effort and results.}\\
\hline
\csvlinetotablerow\\
\hline
\endfirsthead
\caption[]{Continued.}\\\hline
\csvlinetotablerow\\
\hline
\endhead\hline
\endfoot
\label{tab:sample_results}
}, respect all]{tables/sample_results.csv}
这里的大部分内容与标题要求有关。如何删除标题后面和表格行之间的额外垂直空间?
答案1
由于您的 MWE 不完整(请参阅这里),不知道这个方案是否符合你的需要。
但是,您可以根据需要使用包\LTcapskip
来ltcaption
设置标题和标题下方的内容之间的跳过。
\documentclass{article}
\usepackage{csvsimple}
\usepackage{longtable}
\usepackage{array}
\renewcommand*{\arraystretch}{1.2}
\usepackage{ltcaption}
\setlength\LTcapskip{4pt}
\usepackage{filecontents}
\begin{filecontents*}{sample_results.csv}
No.,Name,Effort, Result
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
1,pippo,123, 10
2,pluto,456, 24
3,paperino,789, 31
\end{filecontents*}
\begin{document}
\csvautobooklongtable[
table head={
\caption[Sampling effort and results.]{Sampling effort and results.}\\
\hline
\csvlinetotablerow\\
\hline
\endfirsthead
\caption[]{Continued.}\\\hline
\csvlinetotablerow\\
\hline
\endhead\hline
\endfoot
\label{tab:sample_results}
}, respect all]{sample_results.csv}
\end{document}