Closed note286 closed 1 year ago
First, when cmd=\textbf
is applied to a cell with text Beta\\Gamma
, it is the same as a cell with text \textbf{Beta\\Gamma}
. So it is a little weird to write cmd=\bfseries
.
Second, tabularray
will fail to split \textbf{Beta\\Gamma}
into lines with default measure=hbox
setting, so it will get a wrong width. You need to change it to measure=vbox
provided by varwidth
library.
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{varwidth}
\setlength{\parindent}{0pt}
\begin{document}
\section{no \texttt{cmd} option}
\begin{tblr}{hlines,vlines}
Alpha & {Beta\\Gamma}
\end{tblr}
\section{\texttt{cmd} option and \texttt{measure=hbox}}
\begin{tblr}{hlines,vlines,cells={cmd=\textbf}}
Alpha & {Beta\\Gamma}
\end{tblr}
\begin{tblr}{hlines,vlines}
\textbf{Alpha} & \textbf{Beta\\Gamma}
\end{tblr}
\fbox{\textbf{Beta\\Gamma}}
\section{\texttt{cmd} option and \texttt{measure=vbox}}
\begin{tblr}{hlines,vlines,cells={cmd=\textbf},measure=vbox}
Alpha & {Beta\\Gamma}
\end{tblr}
\begin{tblr}{hlines,vlines,measure=vbox}
\textbf{Alpha} & \textbf{Beta\\Gamma}
\end{tblr}
\end{document}
Thank you very much for your answer. Thank you for your package, too. It's really easy to use!
I found that when there are multiple lines in a certain cell, if the font style is configured with
cmd
, the column width is abnormal.Of course, I know that font style should be configured with
font
, but after I set the font size withcells={font=\scriptsize}
, using cmd configuration can avoid configuring the font size again. If you use font to configure, you need to configure the font size again.I have given examples of various situations, which should be enough to reproduce the phenomenon I described.
My tabularray version is
\ProvidesExplPackage{tabularray}{2022-07-01}{2022C}
. I am on Windows 10, TeX Live 2022.