8

How can we change the line spacing in a long-table? I used package setspace and \linestretch command, but its not working. Minimal Example is attached.

\documentclass[english]{article}
\usepackage[T1]{fontenc}

\usepackage[latin9]{inputenc}

\usepackage{array}

\usepackage{longtable}

\usepackage{float}

\usepackage{lipsum}

%\usepackage{stepspace}

\makeatletter

\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{setspace}

\usepackage{babel}

\begin{document}

\renewcommand{\baselinestretch}{.8}


\lipsum{1}

\begin{longtable}{>{\raggedright}p{135pt}>{\raggedright}p{135pt}r}

\caption{dfkg kdlfgj dfjkg dfklgj sd}

\hline 

\textbf{Country} & \textbf{District} & \textbf{Amount }\textbf{\scriptsize ('000'USD)}\tabularnewline

\hline 

\endhead

Afghanistan & L & 6\tabularnewline

\hline 
Australia & K & 2,9\tabularnewline

\hline 
Austria & I & 3\tabularnewline

\hline 
Bahrain & K & 3\tabularnewline
 & L & 1\tabularnewline
\hline 
Belgium & K & 1\tabularnewline
 & L & 2\tabularnewline

\hline 
Canada & I & 99,965\tabularnewline
 & K & 9\tabularnewline
 & L & 1\tabularnewline

\hline 
Cayman I & I & 2\tabularnewline
 & Ka & 1\tabularnewline

\hline 
\textbf{Grand Total} &  & \textbf{2}\tabularnewline

\hline 

\end{longtable}

\end{document}
2
  • You can change the parameter \arraystretch via \renewcommand; the default value is 1.0.
    – Mico
    May 13, 2014 at 8:16
  • You can use \setstretch{0.8} just before the long table.
    – user11232
    May 13, 2014 at 8:29

1 Answer 1

13

First, in a LaTeX document it's best not to modify low-level TeX commands such as \baselineskip directly. Second, if you use the setspace package, use its \setstretch command -- or, equivalently, commands such as \onehalfspacing or \doublespacing -- to organize the line spacing for entire document parts. Note, though, that even if you've set \onehalfspacing for your document, line spacing in tabular-like environments will still be single-spaced.

To fine-tune the line spacing in tabular-like and array-like environments, start with the \arraystretch command. E.g., to reduce the leading of a given tabular environment by 50%, you could type

\renewcommand\arraystretch{0.5}

between \begin{table} and \begin{tabular}{...}.

For a longtable environment, you would type

\begingroup
\renewcommand\arraystretch{0.5}
\begin{longtable}{...}
% longtable headers, footers, and body
\end{longtable}
\endgroup

The \begingroup and \endgroup statements serve to keep the scope of \renewcommand\arraystretch{0.5} local to the group.

Of course, if you want the redefinition of \arraystretch to have global or document-wide scope, just insert the instruction in the preamble.

3
  • Is there any way I can define the \arraystretch only for the content rows, but omit this setting for the header and footer rows?
    – Socrates
    Sep 19, 2018 at 18:47
  • @Socrates - As as I know, the answer to your question is "No". However, I'm not the ultimate expert on this subject. I would like to encourage you to post a new query to explore exactly this topic. Thanks.
    – Mico
    Sep 19, 2018 at 18:55
  • 1
    Already done, tex.stackexchange.com/questions/451581/…
    – Socrates
    Sep 19, 2018 at 20:01

You must log in to answer this question.

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