1

I'm trying to split a large table (I use NiceTabular environment from nicematrix package) into two parts and arrange them side by side. At the same time, I want the tables to be vertically aligned not in the center, but the first part up and the second down. For example, this is how I want the tables to look like:

If the first half       If the right half
is higher in height:    is higher in height:
    a a                     a a  a a
    a a  a a                a a  a a
    a a  a a                     a a

To achieve this goal, I tried adding the argument [t] to the first table, and [b] to the right one. However, the result surprised me: the first half turned out to be lower than the right one. Example:

     a a
a a  a a
a a
a a

How can to fix this problem and achieve the desired alignment?

I tried various solutions from this question, but either there was no effect, or the file stopped compiling.

MWE:

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table} \centering \begin{NiceTabular}[t]{cc} a & a \ a & a \ a & a \end{NiceTabular} \quad \begin{NiceTabular}[b]{cc} a & a \ a & a \end{NiceTabular} \end{table}

\end{document}

Perhaps in this question it is possible to replace nicetabular with tabular, but I used NiceTabular and I assume that solutions working with tabular may not work with NiceTabular.

  • 2
    b means that the bottom (that is, the last row of the tabular) is at the same level as the text surrounding the tabular, while t means that the top (the first row of the tabular) is at the same level. Hence the vertical alignment that you get. You can maybe better understand this by typing an a right before the two instances of \begin{NiceTabular}. – Jasper Habicht Apr 25 '23 at 12:43
  • 1
    you want both [b] in this case or both [t] if the second one is larger – David Carlisle Apr 25 '23 at 13:38

1 Answers1

1

Thanks to Jasper Habicht's comment, I found a solution: it is necessary to make [b] or [t] for both tables:

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table} \centering \begin{NiceTabular}[b]{cc} % ^^^ a & a \ a & a \ a & a \end{NiceTabular} \quad \begin{NiceTabular}[b]{cc} % ^^^ a & a \ a & a \end{NiceTabular} \end{table}

\end{document}

for

a a
a a  a a
a a  a a

and

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table} \centering \begin{NiceTabular}[t]{cc} % ^^^ a & a \ a & a \ a & a \end{NiceTabular} \quad \begin{NiceTabular}[t]{cc} % ^^^ a & a \ a & a \end{NiceTabular} \end{table}

\end{document}

for

a a  a a
a a  a a
     a a