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.

0

1 Answer 1

4

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .