1

I want to have both rows bottom aligned, using NiceMatrix package, specifying linebreak in one of the cells.

If I only have a long text in the first column, without further specification, then by defining bottom alignment of the second column in the declaration of the NiceMatrix environment, there is no problem, the content of the second column remains bottom aligned (both columns are):

\documentclass[12pt,a4paper]{book}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabularX}{8cm}{X[2,l,b]X[2,r,b]}[hvlines]
    I write a rather long text that will be spread over more than one lines & Bottom-aligned text \\
\end{NiceTabularX}

\end{document}

enter image description here

Now, I still want to have both columns bottom-aligned, but I want to specify where I want to have the linebreak in the first column. If I simply add a rowbreak, NiceMatrix considers that I want to create a new row, and not to specify a linebreak in a cell (which is perfectly fine):

\documentclass[12pt,a4paper]{book}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabularX}{8cm}{X[2,l,b]X[2,r,b]}[hvlines]
    I write another rather long text \\ that will be spread over more than one lines & Other bottom-aligned text \\
\end{NiceTabularX}

\end{document}

enter image description here

So far, when I wanted to add a linebreak in a cell, I would create a 1-1 block. But, in that case, it results in the right column being strangely (and, in any case, not bottom-)aligned.\par

\documentclass[12pt,a4paper]{book}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabularX}{8cm}{X[2,l,b]X[2,r,b]}[hvlines]
    \Block{1-1}{I write another rather long text \\ that will be spread over more than one lines} & Other bottom-aligned text \\
\end{NiceTabularX}

\end{document}

enter image description here

Do you have any idea on how I could get around that?

1 Answer 1

0

You should use \newline where you want to break a line.

\documentclass[12pt,a4paper]{book}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabularX}{8cm}{X[2,l,b]X[2,r,b]}[hvlines]
    I write another rather long text \newline that will be spread over more than one lines & Other bottom-aligned text \\
\end{NiceTabularX}

\end{document}

As usual with nicematrix, you need several compilations.

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .