1

Is there a way to get in a NiceTabular the text stretched up to the column width?

\documentclass{beamer}
\usepackage{nicematrix}

\begin{document}
\begin{NiceTabular}{wl{20em}}
Sunt cumque voluptatem quasi \\
quam commodi culpa quaerat sunt
\end{NiceTabular}
\end{document}

I know about \makebox[\mywidth][s]{my text} but isn't there any simpler solution with tabulars?

As I often use tikz, the solution should also work with \node. NiceTabular does well.

0

2 Answers 2

1

You could use the tabularray package instead:

\documentclass{beamer}
\usepackage{tabularray}

\begin{document}
\begin{frame}
\begin{tblr}{
  colspec={Q[20em]},
  cell{1}{1-2} = {cmd=\makebox[\linewidth][s]}
}
Sunt cumque voluptatem quasi \\
quam commodi culpa quaerat sunt\\
\end{tblr}

\end{frame}
\end{document}

enter image description here

2

EDIT

With the latest version of nicematrix (v. 6.17 of 2023/03/31), you can use in {NiceTabular} the columns standard columns w{s}{...} and W{s}{...} (of the package array) with the expected output.

\documentclass{beamer}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{w{s}{20em}}
Sunt cumque voluptatem quasi \\
quam commodi culpa quaerat sunt
\end{NiceTabular}

\end{document}

The output is the same as with {tabular} (see below).


You probably want to use the column type w{s}{...} of {tabular} (as defined by the package array).

\documentclass{beamer}
\usepackage{array}

\begin{document}

\begin{tabular}{w{s}{20em}}
Sunt cumque voluptatem quasi \\
quam commodi culpa quaerat sunt
\end{tabular}

\end{document}

Output of the above code

Since {NiceTabular} of nicematrix is an extension of {tabular} (of array), the same should work with {NiceTabular}. However, it does not. That may be considered as a bug. I will try to solve that bug (I'm the author of nicematrix).

You must log in to answer this question.

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