Line-spacing in a cell of table
\arraystretch
only affects line spacing between table rows. In an X
column, you can change the spacing between lines inside a cell by adjusting \baselineskip
. Below is the same example coded in two slightly different ways, the first using \ctable
, the other using your tabularx
set-up. Notice the \ctable
gives better spacing for the caption relative to the table.
\documentclass[10pt]{article}
\usepackage{ctable}
\begin{document}
{\renewcommand{\arraystretch}{1.5}
\ctable[caption = Test,pos=htp,width=\textwidth]
{c l >{\setlength{\baselineskip}{1.5\baselineskip}}X}{}{
\FL
No. & Code & Name \ML[0.08em]
01 & 01XXX & Agriculture, forestry and fishing \NN
02 & 05XXX & Manufacture of Electronic Components, Computer,
Radio, Television and Communication Equipment and Apparatuses
\NN
03 & 06XXX & Nursing \LL
}}
\begin{table}[htp]
\renewcommand{\arraystretch}{1.5}
\caption{Test}
\begin{tabularx}{\textwidth}{c l >{\setlength{\baselineskip}{1.5\baselineskip}}X}
\FL
No. & Code & Name \ML[0.08em]
01 & 01XXX & Agriculture, forestry and fishing \NN
02 & 05XXX & Manufacture of Electronic Components, Computer,
Radio, Television and Communication Equipment and Apparatuses
\NN
03 & 06XXX & Nursing \LL
\end{tabularx}
\label{tab:test}
\end{table}
\end{document}
I demonstrated this with increasing the spacing, as this is more realistic. Squeezing will work too, just replace both 1.5
by 0.75
in the \arraystretch
and the >{...}X
, but it does not look too good. As Mico suggests, in such situations reducing font sizes is better.
In both cases, note that the change to \arraystretch
has been inside a group/environment, to prevent this affecting other places later in the document.