[Tex/LaTex] Reduce the space between two lines in a latex table

line-spacingtables

I am writing a table in latex in which one entry (an algorithm name) is too large. I divided its content in three lines as it is shown in the following table:

\begin{tabular}{lccc}
    \toprule
    \textbf{Problem} & \multicolumn{3}{c}{\textbf{Mean objective value}} \\
    \midrule
    & Algorithm X & \scriptsize  Algorithm X without &  Algorithm X with \\
    &             & \scriptsize component A and with &  component C \\
    &             & \scriptsize and component B      & \\
    \midrule
    eil51         & \textbf{427.267} & \underline{1286.37} & 439.467 \\
    \bottomrule
\end{tabular}

However, those lines are too separated when compiling to pdf.

enter image description here

Is it possible to reduce the space between two table lines? Is there any other solution?

Possible solutions:

  • I have tried \renewcommand{\baselinestretch}{2} and it did not work.

Best Answer

I'd add the clauses below the main entry in the header:

\documentclass{article}

\usepackage{booktabs}

\newcommand{\descrcell}[2]{%
  \scriptsize
  \begin{tabular}[t]{@{}c@{}}\normalsize#1\\#2\end{tabular}%
}


\begin{document}
\begin{tabular}{lccc}
\toprule
\textbf{Problem} & \multicolumn{3}{c}{\textbf{Mean objective value}} \\
\midrule
& Algorithm X
& \descrcell{Algorithm X}{without component A \\ and with component B}
& \descrcell{Algorithm X}{with component C} \\
\midrule
eil51         & \textbf{427.267} & \underline{1286.37} & 439.467 \\
\bottomrule
\end{tabular}

\end{document}

enter image description here