我有一张大表格,其中许多单元格都有段落形式的自由流动文本。\midrule
我没有使用 's 来帮助读者在行之间划线,而是尝试压缩表格行内的文本行距并在表格行之间插入一些额外的间距。我使用环境spacing
(如果我滥用该术语,请告诉我)来压缩行距。然后我使用命令\rule
在每个表格行的第一个单元格中创建一个零宽度框字符,以便让它与上面的表格行有足够的距离。但是,即使注释掉命令\rule
(如下),我仍然发现行之间有太多莫名其妙的空间。有人能指出这是从哪里来的吗?这是我的 MWE,我通过一次调用“pdflatex tmp.tex”进行编译:
\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{setspace}
\begin{document}
\begin{tabular}{
>{\raggedright\begin{spacing}{0.75}}p{1.5in}<{\end{spacing}}
>{\raggedright\begin{spacing}{0.75}}p{0.45in}<{\end{spacing}}
}
\toprule
World domination scheme
&
Linear, either +ve
\tabularnewline\midrule
Sum over in subtree, including multiple instances
&
1.8\
\tabularnewline%\rule{0pt}{0.2in}%
Sum over nothing in subtree, including multiple instances blah
dee blah
&
3.6
\tabularnewline%\rule{0pt}{0.2in}%
Sum over adfasd in subtree, including multiple adfads asdf asdf
&
8.4
\tabularnewline
\bottomrule
\end{tabular}
\end{document}
答案1
空格来自spacing
您在列中使用的环境。您可以把整个空格括tabular
在里面,而不是在那里添加空格:
\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{setspace}
\begin{document}
\begin{spacing}{0.75}
\begin{tabular}{
>{\raggedright}p{1.5in}
>{\raggedright}p{0.45in}
}
\toprule
World domination scheme
&
Linear, either +ve
\tabularnewline\midrule
Sum over in subtree, including multiple instances
&
1.8\
\tabularnewline\rule{0pt}{0.2in}%
Sum over nothing in subtree, including multiple instances blah
dee blah
&
3.6
\tabularnewline\rule{0pt}{0.2in}%
Sum over adfasd in subtree, including multiple adfads asdf asdf
&
8.4
\tabularnewline
\bottomrule
\end{tabular}
\end{spacing}
\end{document}
答案2
如果您想坚持自己的方法,请使用\setstretch
如下spacing
环境:
\begin{tabular}[t]{
>{\raggedright\setstretch{0.75}}p{1.5in}
>{\raggedright\setstretch{0.75}}p{0.45in}
}
以下是两种方法的比较。右侧表格使用\setstretch
\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{setspace}
\begin{document}
\begin{tabular}[t]{
>{\raggedright\begin{spacing}{0.75}}p{1.5in}<{\end{spacing}}
>{\raggedright\begin{spacing}{0.75}}p{0.45in}<{\end{spacing}}
}
\toprule
World domination scheme
&
Linear, either +ve
\tabularnewline\midrule
Sum over in subtree, including multiple instances
&
1.8\
\tabularnewline%\rule{0pt}{0.2in}%
Sum over nothing in subtree, including multiple instances blah
dee blah
&
3.6
\tabularnewline%\rule{0pt}{0.2in}%
Sum over adfasd in subtree, including multiple adfads asdf asdf
&
8.4
\tabularnewline
\bottomrule
\end{tabular}
\begin{tabular}[t]{
>{\raggedright\setstretch{0.75}}p{1.5in}
>{\raggedright\setstretch{0.75}}p{0.45in}
}
\toprule
World domination scheme
&
Linear, either +ve
\tabularnewline\midrule
Sum over in subtree, including multiple instances
&
1.8\
\tabularnewline%\rule{0pt}{0.2in}%
Sum over nothing in subtree, including multiple instances blah
dee blah
&
3.6
\tabularnewline%\rule{0pt}{0.2in}%
Sum over adfasd in subtree, including multiple adfads asdf asdf
&
8.4
\tabularnewline
\bottomrule
\end{tabular}
\end{document}