tabularray – How to Set Padding Per Cell in Tabularray

tabularray

In tabular, a cell can have a \multicolumn{1}{@{\hspace{1em}}l}{Some text} to set some left padding to that cell alone. In tabularray, the \SetCell command can be used to span columns but not to set some space to the left, like I mentioned.

Tabularray does allow to set the left and right space for that column, but that of course affects all cells in that column.

Is there a way to achieve this currently in tabularray?

It's a matter of \SetCell having something like the colspec key that supports the @{} syntax. In general it is a way to insert space for a single cell. Inserting space with preto wouldn't work, as it would be the same as setting an \hspace in the cell body and that only moves the first line.

Best Answer

You can change \leftskip for some cell:

\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{|m{2cm}|m{2cm}|m{3cm}|}
  Alpha & Beta & Gamma Gamma Gamma Gamma Gamma \\
  Alpha & Beta & \leftskip=1em Gamma Gamma Gamma Gamma Gamma \\
  Alpha & Beta & \leftskip=-3pt Gamma Gamma Gamma Gamma Gamma \\  
\end{tblr}
\end{document}

enter image description here