3

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}
7

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.