0

Would someone happen to have a clever idea how to set the line spacing of the body text to 1.5 and inside tables to 1.0? I was looking at this package \usepackage[onehalfspacing]{setspace} but although it didn't touch the captions the table content became 1.5 spaced. I have a huge amount of tables in my document and I would really like to avoid setting the line spacing separately for each one of them.

Here the MWE:

\documentclass[11pt,a4paper,twoside]{report}
\usepackage{caption}
\usepackage{booktabs}

\begin{document}
Some text 
Some more text which continues on the next row. More text and more and more and more and more text.     
\begin{table}[htb]
\caption{Caption to be placed here.}
\centering
\begin{tabular}{cccc}
    \toprule
    \textbf{A}&\textbf{B}&\textbf{C}&\textbf{D}\\
    \midrule
    \textbf{1}&bla&bla&blabla\\
    \textbf{2}&bla&bla&bl\\
    \textbf{3l}&blablaba&bla&bla\\
    \textbf{4}&bla&b&la\\
    \bottomrule 
\end{tabular}   
\end{table}
\end{document}
  • You wrote, "I was looking at this package \usepackage[onehalfspacing]{setspace} but although it didn't touch the captions the table content became 1.5 spaced." Are you sure your claim is correct? For sure, if I add the instruction \usepackage[onehalfspacing]{setspace} to your code, the line spacing inside the table environment does not change at all. Please clarify what exactly you are experiencing. – Mico Jan 24 '17 at 17:06
  • Well it's definitely happening since my larger tables reach the second page with the larger spacing... But the problem was solved by letting them on two pages and just repeating the top row. I thought it's for the best not to start messing with the quality of the tables. – Hann Jan 26 '17 at 6:13
  • Are you saying, then, that the example code you posted is more or less irrelevant for what's going on in your actual document? If so, you may want to either delete this posting or edit it to provide information about the actual issues you're trying to solve. For instance, a table environment never breaks across pages. If you do have a two-page table, you may want to provide some pertinent information about it. – Mico Jan 26 '17 at 7:47
  • Bad example, my apologies. It is a longtable which behaved this way. I just assumed all of them would behave the same way. Feel free to remove, I don't know how.. – Hann Jan 26 '17 at 8:35
2

What you view as 1.5-spacing of the tabular lines is the regular spacing. In fact, using \usepackage[onehalfspacing]{setspace} (or \usepackage[doublespacing]{setspace} for a better visible effect) does not affect the tabular lines. You can control their spacing by adding e.g.

\renewcommand\arraystretch{0.8}

to the preamble. The default value is 1.0, a larger value stretches the lines, a smaller one moves them closer together. However, this may lead to a poor quality of the tables from a typesetting point of view (see below); the default space has been chosen deliberately as rather large.

enter image description here

\documentclass[11pt,a4paper,twoside]{report}
\usepackage{caption}
\usepackage{booktabs}
\usepackage[onehalfspacing]{setspace}
\renewcommand\arraystretch{0.8}
\begin{document}
Some text Some more text which continues on the next row. More text
and more and more and more and more text.
\begin{table}[htb]
\caption{Caption to be placed here.}
\centering
\begin{tabular}{cccc}
  \toprule
  \textbf{A}&\textbf{B}&\textbf{C}&\textbf{D}\\
  \midrule
  \textbf{1}&bla&bla&blabla\\
  \textbf{2}&bla&bla&bl\\
  \textbf{3l}&blablaba&bla&bla\\
  \textbf{4}&bla&b&la\\
  \bottomrule 
\end{tabular}  
\end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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