# makecell: how to reduce the line spacing in multiline cells?

The following LaTeX source code

\documentclass[12pt]{article}
\usepackage{makecell}
\begin{document}

\begin{tabular}{ll}
foobar                    & 0  \\
foo                       & 1  \\
\makecell[tl]{bar plus \\
other    \\
stuff}      & 2  \\
baz                       & 3  \\
qux                       & 4  \\
quux                      & 5  \\
\end{tabular}

\end{document}


...produces the following rendering:

This is almost what I want, but I would like that the spacing between the lines in the multiline cell ("bar plus other stuff") be noticeably smaller than the spacing between table's rows.

Therefore, I tried adding \renewcommand{\arraystretch}{1.3} right before the \begin{tabular}[ll} line1; i.e.:

\renewcommand{\arraystretch}{1.3}
\begin{tabular}{ll}
foobar                    & 0  \\
foo                       & 1  \\
\makecell[tl]{bar plus \\
other    \\
stuff}      & 2  \\
baz                       & 3  \\
qux                       & 4  \\
quux                      & 5  \\
\end{tabular}


Here's what the results look like:

After seeing this, I realized that I would like to keep the between-rows spacing as it was before (i.e. as it was before I added \renewcommand{\arraystretch}{1.3}), and instead make the spacing between the lines in the multiline cell narrower2.

I have read, and re-read, and re-read once more, the documentation for the makecell package, but I just cannot make heads or tails of it. (Nothing that I have copied verbatim from that documentation will even compile, let alone do what I'm after.) I'm sure that somewhere in that documentation is the information I need to change the spacing between the lines in the multiline cell. Could someone please spell it out for me?3

EDIT: I learned from @Bernard's helpful answer that the reason nothing worked for me when I tried customizing makecell's behavior is that I was missing the \usepackage{array} directive. With this knowledge in hand, I tried to get the tighest possible spacing between the lines of a multiline cell as follows:

\documentclass[12pt]{article}
\usepackage{array}
\usepackage{makecell}
\setlength\extrarowheight{0pt}}

\begin{tabular}{ll}
foobar                    & 0  \\
foo                       & 1  \\
\makecell[tl]{bar plus \\
other    \\
stuff}      & 2  \\
baz                       & 3  \\
qux                       & 4  \\
quux                      & 5  \\
\end{tabular}

\end{document}


The results:

Granted, the between-line spacing resulting from this particular directive may be a bit too tight; probably a slightly looser spacing (but still tighter than the spacing between rows) would be better. Nevertheless, I use this extreme case to better illustrate the remaining problem: namely the newly added directive

\setlength\extrarowheight{0pt}}


...affects not only the spacing between the lines in the multiline cell (as desired), but also the spacing between the last line of the multiline cell ("stuff") and the next row ("baz  3"), which is definitely not what I want4.

Is there a way to tweak this latest version (based on makecell5) so that only the spacing between the lines in the multiline cells is reduced, but all the other vertical spacing, including the spacing between the last line of the multiline cell ("stuff") and the next row ("baz  3") are preserved?

EDIT 2: Actually, the issue in my last edit can be understood more clearly if one replaces all the entries in the first column with a common string, e.g. "0000". Hence, if we change the document's body to

\begin{tabular}{ll}
0000                      & 0  \\
0000                      & 1  \\
\makecell[tl]{0000 \\
0000 \\
0000}       & 2  \\
0000                      & 3  \\
0000                      & 4  \\
0000                      & 5  \\
\end{tabular}


...leaving everything else unchanged, the result looks like this:

In words: the newly added directive does reduce the spacing between the lines in the multiline cell, but it also reduces the spacing between the last line of the multiline cell and the next row (the one with "3" in the second colum). Granted, this latter spacing is slightly larger than the former, but it is still significantly smaller than the spacing between the remaining rows.

EDIT 3: As I mentioned earlier, I have not found a combination of parameters that for the new directive that will produce the desired results. For example, the result I get from the source code below (where I've changed \extrarowheight's parameter to 1pt) looks to me exactly the same as the one I showed in the last display above.

\documentclass[12pt]{article}
\usepackage{array}
\usepackage{makecell}
\setlength\extrarowheight{1pt}} %% NB: I see no difference in results
%% between 0pt and 1pt

\begin{document}

\begin{tabular}{ll}
0000                      & 0  \\
0000                      & 1  \\
\makecell[tl]{0000 \\
0000 \\
0000}       & 2  \\
0000                      & 3  \\
0000                      & 4  \\
0000                      & 5  \\
\end{tabular}

\end{document}


1 If I understand correctly, the way I've added the \renewcommand{\arraystretch}{1.3} directive means that it will affect all the subsequent code, up until the end of the file. Just curious: is there a way that I can limit the effect of this directive to just the one table?

2 I realize that making the line spacing in the multiline cell narrower will make the text look cramped. That's OK. In practice, I expect multiline cells will be quite rare. Therefore, I prefer a solution that keeps the normal case (rows consisting entirely of single-line cells) looking nice, even if the occasional multiline cell ends up looking cramped.

3 Asking such a question is deeply embarrassing for me. I have been programming for a living for >30 years, and I have been using LaTex pretty much all that time. I have written dozens of reports and scientific papers, and one doctoral dissertation, with LaTeX. I have read books on LaTeX cover-to-cover. Even with all this experience and study, I still find LaTeX utterly mystifying. (And please let's not talk about TeX...) This is particularly true of the documentation of the typical LaTeX package, as illustrated by my complete failure to find even an approximation to the answer to my question in the documentation for the makecell package. I hope that, in addition to solving my immediate problem, the answer to this question may teach me a bit how to find my way around LaTeX documentation.


5 I realize, after reading @Zarko's also very helpful answer, that makecell is probably not the best package for what I'm trying to do, and therefore, that by insisting on using makecell for this, I am probably making this problem unnecessarily difficult. Unfortunately, it appears that tabularray requires a newer installation of LaTeX than what I have in my system. This means that, until I figure out how to upgrade the LaTeX installation on my system, something that has eluded me for weeks already, I am basically stuck with makecell.

Does this solution with only makecell befit you?

    \documentclass{article}
\usepackage{array, makecell}
\setlength\extrarowheight{0pt}}

\begin{document}

\renewcommand{\arraystretch}{1.3}
\begin{tabular}{ll}
foobar & 0 \\
foo & 1 \\
\makecell[tl]{bar plus \\
other \\
stuff} & 2 \\
baz & 3 \\
qux & 4 \\
quux & 5 \\
\end{tabular}

\end{document}


• Thank you. I now realize, after reading your answer, that the reason nothing was working for me when I tried to tweak the separations for the makecell package is that I had somehow overlooked that makecell requires the array package!
– kjo
May 21 at 11:46
• That said, I confess that I accepted your solution partly because I feel guilty for being such a whiny, picky pest... If truth be told, your answer doesn't quite give me what I want, but the problem is obscured by the fact that your solution kept the \renewcommand{\arraystretch}{1.3}, which I had explicitly rejected in my original question. If you remove this directive from your solution, you will see the problem that remains; namely, that the spacing between the last line of the multiline cell and the next row is too narrow. In other words, ...
– kjo
May 21 at 11:46
• ...your solution affects more than the spacing between the lines in the multiline cell. Is there a way to reduce only this spacing, leaving all other spacing as is?
– kjo
May 21 at 11:46
• @kjo: normally, it affects only the vertical spacing in\makecell. May 21 at 12:05
• I had tested with your last code (0000 in each row). Mayb- e you should indeed update your installation. Mine is an up-to-date MiKTeX. Note that makecell is not the only possibility – stackengine is another one. May 21 at 14:53

With use of the tabularray package is simple:

\documentclass[12pt]{article}
\usepackage{tabularray}

\begin{document}
\begin{tblr}{cells=l,
rowsep=3pt}
foobar                      & 0  \\
foo                         & 1  \\
{bar plus\\other\\stuff}    & 2  \\
baz                         & 3  \\
qux                         & 4  \\
quux                        & 5  \\
\end{tblr}
\end{document}


Edit: If you like to have lines in multi lines cell even closer, than you can experiment with changes of \linespread in table:

\begin{tblr}{cells=l,
rowsep=3pt,

• Thank you. I'm sure this is the way to go. Unfortunately, it appears that my installation of LaTeX is too old for tabularray (at least that's what the error message I get tells me). I have been trying to upgrade my LaTeX for weeks now, without success. This is yet another example of my all-around inability to work with LaTeX/TeX. For the time being, at least, I think I'm stuck with makecell.
• You can use Overleaf. There is an old tabularray but for this simple examle it should work. BTW, upgrade your installation should not be big deal. Use wizard, which is part of your LaTeX installation (for example at MiKTeX is called "Console". May 20 at 12:29
• Thanks, I'll look into Overleaf. BTW, I cannot find any executable file with the string "wizard" or the string "console" (case-insensitive search) in the basename and the perl-regex /tex\b/i in the path. My system is a Debian Linux workstation. I typically have no problem with software installation and management on this machine. LaTeX/TeX is an exception to this. In fact, to call it an "exception" puts it mildly. A "catastrophe" is closer to the mark.