2

When using multirow, how can I shrink the space between the two rows while still keeping everything vertically centered? Here's an example

\documentclass{article}
\usepackage{multirow}
% ---------------
\begin{document}
\begin{tabular}{l l}
some & text \\
& b \\[-4pt]
\multirow{-2}{*}{a}
& b \\
some & text \\
\end{tabular}
% ----------------
\begin{tabular}{l l}
some & text \\
& b \\
\multirow{-2}{*}{a}
& b \\
some & text \\
\end{tabular}
\end{document}

If I shrink the space between the rows with the two b's, the a isn't vertically centered anymore.

enter image description here

1

You do not need any packages to achieve this, you can just nest tabulars.

\documentclass{article}
\begin{document}
\begin{tabular}{l l}
some & text \\
a & \begin{tabular}{@{}l}b \\[-4pt] b
\end{tabular}\\
some & text \\
\end{tabular}
\end{document}

enter image description here

Comparison:

\documentclass{article}
\usepackage{multirow}
% ---------------
\begin{document}
\begin{tabular}{l l}
some & text \\
a & \begin{tabular}{@{}l}b \\[-4pt] b
\end{tabular}\\
some & text \\
\end{tabular}
% ----------------
\begin{tabular}{l l}
some & text \\
& b \\[-4pt]
\multirow{-2}{*}{a}
& b \\
some & text \\
\end{tabular}
% ----------------
\begin{tabular}{l l}
some & text \\
& b \\
\multirow{-2}{*}{a}
& b \\
some & text \\
\end{tabular}
\end{document}

enter image description here

1

Would using \makecell, without multirow, be enough for your needs? By defult, its content is vertically and horizontally centred.

\documentclass{article}
\usepackage{makecell}
\renewcommand{\cellset}{\renewcommand{\arraystretch}{0.5}}

\begin{document}

\begin{tabular}{l l}
some & text \\
a & \makecell{ b \\ b }\\
some & text \\
\end{tabular}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.