Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a document where the text is set to double spacing. I have some text inside tables, which I use the paragraphy specifier for. It wraps properly, but spacing is set to single. Is it possible to have the paragraph cells of table be double spaced?

Here's an example document:

\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}

and it gets rendered like this:

enter image description here

Is there some way to make just paragraphy cells (e.g. p, m, and b) have double spacing while leaving alone the other types of cells?

Preferably, it would be something I could set in my preamble for all tables without having to specify it inline.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Add \doublespacing just before \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}

enter image description here

By the way, it's a little "peculiar" to put your tables inside a figure environment,

share|improve this answer
    
any way to do it just for tables with p,b,t and not l,r,c? without have to do it manually? –  jterrace Sep 27 '12 at 14:32
    
lrc columns don't have multiple lines lines so the linespacing can't have any effect on them –  David Carlisle Sep 27 '12 at 14:38
    
@DavidCarlisle true, but \doublespacing will affect the separation between rows. –  Gonzalo Medina Sep 27 '12 at 14:42
    
@jterrace you can define a new column type: \newcolumntype{M}[1]{>{\doublespacing}p{#1}} and use it instead of p{...}, but this won't change the separation between rows. –  Gonzalo Medina Sep 27 '12 at 14:45
    
perfect, thanks! –  jterrace Sep 27 '12 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.