5

Extending the question Double line spacing (as I'm new round here I don't seem to be able to comment), I'd like to use double spacing too. Except in tables, where I'd like to be able to leave that at single spacing, or specify a separate line spacing.

But I have a constraint: my LaTeX is being generated from MultiMarkdown via Pandoc, and so I don't get much control over the code. I do get to insert header code before the \begin{document}, so these lines do take effect:

\usepackage{setspace}
\doublespacing

Is there a way of setting tables to be single spaced in the header?

If it matters, I believe the table package used in the generated source is longtable.

3

The start of environment longtable can be redefined to add \singlespacing:

\documentclass{article}

\usepackage{lipsum}
\usepackage{longtable}

\usepackage{setspace}
\doublespacing
\usepackage{etoolbox}
\preto\longtable{\par\singlespacing}

\begin{document}
  \lipsum[2]
  \begin{longtable}{lp{10cm}}
    1&a\tabularnewline
    2&b\tabularnewline
    3&\lipsum[2]
  \end{longtable}
\end{document}

Result

| improve this answer | |

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.