4

The package tabularray seems like a good start, but the documentation is really sparse. Is there a way to add math columns? Like X[$] in tabu or \newcolumntype{C}{>{$}c<{$}}in array.

2
  • 1
    What about something like \documentclass{article} \usepackage{tabularray} \begin{document} \begin{table}[h] \caption{Table caption} \begin{tblr}{colspec={l>{$}c<{$}}} text & \alpha \end{tblr} \end{table} \end{document}?
    – leandriis
    Jun 3, 2021 at 9:30
  • @leandriis Thanks! Post it as an answer and I will mark it as the solution. Bonus points if you can define a new column type like the newcolumntype.
    – Mankka
    Jun 3, 2021 at 9:34

2 Answers 2

4
\documentclass{article}
\usepackage{tabularray}
\NewColumnType{C}{>{$}c<{$}}
\begin{document}

\begin{table}[h]
    \caption{Table caption}
    \begin{tblr}{colspec={l>{$}c<{$}}}
    text & \alpha 
    \end{tblr}
\end{table}


\begin{table}[h]
    \caption{Table caption}
    \begin{tblr}{colspec={lC}}
    text & \alpha 
    \end{tblr}
\end{table}
\end{document}
9

Since version 2021P, tabularray package has $ and $$ options for cells/rows/columns.

\documentclass{article}

\usepackage{amsmath}
\usepackage{tabularray}

\begin{document}

\begin{tblr}{colspec={lQ[c,$]Q[r,$$]},hlines}
  text & \frac{1}{2} & -\frac{3}{4} \\
  text & \frac{5}{6} & -\frac{7}{8}
\end{tblr}

\end{document}

enter image description here

You must log in to answer this question.

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