我希望正文的行距为 1.5 倍,而tabular
环境应使用默认(即较小的)行距。但是,以下代码为整个文档(包括表格)提供了 1.5 倍的行距:
\documentclass[12pt, a4paper] {report}
\parindent = 0cm \parskip = 0cm
\renewcommand\baselinestretch{1.5}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce accumsan congue leo, at
convallis diam pulvinar nec. In venenatis neque mi, pellentesque dictum turpis ultrices
quis. \bigskip
\centering
\begin{tabular} { p{2cm} p{6cm} }
Hello World & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce
accumsan congue leo, at convallis diam pulvinar nec. \\ \hline
Goodbye World & Lorem ipsum dolor sit amet, consectetur adipiscing elit. \\
\end{tabular}
\end{document}
答案是tex.stackexchange.com/a/79155对我来说不起作用。特别是,我尝试更换
\renewcommand\baselinestretch{1.5}
和\usepackage{setspace} \setstretch{1.5}
\centering
和\begin{center}
注意:\renewcommand\arraystretch{0.8}
没有帮助,因为我关心的是表格中文本行之间的间距,而不是表格行之间的间距。
答案1
解决方案是setspace
。我必须用 from 替换,\hline
以便\midrule
在booktabs
水平规则周围留出一些填充:
\documentclass[12pt, a4paper] {report}
\parindent = 0cm \parskip = 0cm
\usepackage{booktabs}
\usepackage{setspace}
\renewcommand\baselinestretch{1.5}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce accumsan congue leo, at
convallis diam pulvinar nec. In venenatis neque mi, pellentesque dictum turpis ultrices
quis. \bigskip
\begin{spacing}{0.8}\centering
\begin{tabular} { p{2cm} p{6cm} }
Hello World & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce
accumsan congue leo, at convallis diam pulvinar nec. \\
\midrule
Goodbye World & Lorem ipsum dolor sit amet, consectetur adipiscing elit. \\
\end{tabular}
\end{spacing}
\end{document}
答案2
似乎放入tabular
里面table
会给出默认的行距。 Bernard 的答案有效,但我不愿意booktabs
不必要地导入包(即)。
\documentclass[12pt, a4paper] {report}
\parindent = 0cm \parskip = 0cm
\usepackage{setspace} \setstretch{1.5}
\renewcommand\arraystretch{1.3}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce accumsan congue leo, at
convallis diam pulvinar nec. In venenatis neque mi, pellentesque dictum turpis ultrices
quis.
\begin{table} [h!]
\centering
\begin{tabular} { p{2cm} p{6cm} }
Hello World & Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce
accumsan congue leo, at convallis diam pulvinar nec. \\ \hline
Goodbye World & Lorem ipsum dolor sit amet, consectetur adipiscing elit. \\
\end{tabular}
\end{table}
\end{document}