lvjr / tabularray

Typeset tabulars and arrays with LaTeX3
https://ctan.org/pkg/tabularray
247 stars 22 forks source link

How to let `\diagbox` adapt the width of `X` column? #329

Closed DaftDogeee closed 1 year ago

DaftDogeee commented 1 year ago

For example,

\begin{tblr}{
    width = 0.9\linewidth,
    colspec = {X[1,c,m]X[2,c,m]X[2,c,m]},
    hlines,vlines
}
\diagbox{Aa}{Pp} & Beta & Gamma \\
Epsilon & Zeta & Eta \\
Iota & Kappa & Lambda \\
\end{tblr}

Snipaste_2022-11-14_20-07-36

As shown in figure, \diagbox may not be displayed correctly.

muzimuzhi commented 1 year ago
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{diagbox}

\begin{document}
\begin{tblr}{
  width = 0.9\linewidth,
  colspec = {X[1,c,m]X[2,c,m]X[2,c,m]},
  hlines,vlines
}
  \diagbox[width=\linewidth+\leftsep+\rightsep]{Aa}{Pp} & Beta & Gamma \\
  Epsilon & Zeta & Eta \\
  Iota & Kappa & Lambda \\
\end{tblr}
\end{document}

image

DaftDogeee commented 1 year ago

Many thanks~