换行表格文本的行距

换行表格文本的行距

我有一个文档,其中的文本设置为双倍行距。表格中有一些文本,我使用段落说明符。它可以正确换行,但间距设置为单倍。是否可以将表格的段落单元格设置为双倍行距?

以下是一个示例文档:

\documentclass{article}
\usepackage{booktabs}
\usepackage{setspace}

\doublespacing

\begin{document}

test

test

\begin{figure}[t]
\centering
\begin{tabular}{l r r}
\toprule
Item      & 0.5 & 0.2  \\
Something & 0.3 & 34.2 \\
\bottomrule
\end{tabular}
\caption{This should be single spaced.}
\end{figure}

\begin{figure}[t]
\centering
\begin{tabular}{p{0.25\linewidth} p{0.65\linewidth}}
\toprule
Item      & This is a long line of text that will get wrapped since it doesn't fit
            in the table . It gets wrapped properly, but since it's a paragraph, I
            would like it to have the same spacing as the rest of the document,
            here doublespacing. \\
Something & Blah blah text goes here \\
\bottomrule
\end{tabular}
\caption{This should have the paragraph cell double-spaced.}
\end{figure}

\end{document}

它的渲染效果如下:

在此处输入图片描述

是否有某种方法可以使段落单元格(例如pmb)具有双倍间距,同时保持其他类型的单元格不变?

最好的情况下,我可以在序言中为所有表格设置它,而不必在行内指定它。

答案1

\doublespacing在之前添加\begin{tabular}

\documentclass{article}
\usepackage{booktabs}
\usepackage{setspace}

\doublespacing

\begin{document}

test

test

\begin{figure}[t]
\centering
\begin{tabular}{l r r}
\toprule
Item      & 0.5 & 0.2  \\
Something & 0.3 & 34.2 \\
\bottomrule
\end{tabular}
\caption{This should be single spaced.}
\end{figure}

\begin{figure}[t]
\centering\doublespacing
\begin{tabular}{p{0.25\linewidth}p{0.65\linewidth}}
\toprule
Item      & 
This is a long line of text that will get wrapped since it doesn't fit
            in the table . It gets wrapped properly, but since it's a paragraph, I
            would like it to have the same spacing as the rest of the document,
            here doublespacing. \\
Something & Blah blah text goes here \\
\bottomrule
\end{tabular}
\caption{This should have the paragraph cell double-spaced.}
\end{figure}

\end{document}

在此处输入图片描述

顺便说一句,将桌子放在环境中有点“奇怪” figure

相关内容