[Tex/LaTex] Reducing Row Height in a Longtable

longtable

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}

Best Answer

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.

Related Question