合并单元格后 tabularray 自动换行

合并单元格后 tabularray 自动换行

我想把第一行第一列和第一行第二列的单元格合并,并且合并后单元格自动换行


\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{tblr}{colspec={|Q[c,0.1\linewidth]|Q[l,0.4\linewidth]|Q[r,0.45\linewidth]|},rowspec={Q[c]Q[l]}}
        \hline
     \SetCell[c=2]{c}{This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.}   &  &DE  \\
    \hline
 ABC     &  ABC  &  ABC \\
    \hline
    \end{tblr}

\end{document}

答案1

您需要hspan=minimal选择:

\documentclass{article}
\usepackage{tabularray}
\begin{document}

\begin{tblr}{
  colspec={|Q[c,0.1\linewidth]|Q[l,0.4\linewidth]|Q[r,0.45\linewidth]|},
  rowspec={|Q[c]|Q[l]|},
  hspan=minimal,
}
  \SetCell[c=2]{l}{This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.This is a text.} &       &  DE  \\
  ABC    &  ABC  &  ABC \\
\end{tblr}

\end{document}

在此处输入图片描述

相关内容