2

Long time ago I defined some templates. In one of them I used this

\newcommand{\zwiueb}[1]{%
   \multicolumn{3}{l}{\makebox[0pt]{\textbf{#1}}}%
}

which obviously does no longer work with tabularray.

I have not yet succeeded in rewriting this rather simple command such that it works for the new tabularray interface.

All it should do is, set some text across all three columns in a longtblr environment.

Edit:

here is my minimal (not) working example:

\documentclass{article}
\usepackage{tabularray}

\newcommand{\zwiueb}[1]{%
  \multicolumn{3}{l}{\makebox[0pt]{\textbf{#1}}}%
}

\begin{document}

\begin{longtblr}{%
    rowsep=1.1pt,%
    width = \linewidth,%
    colspec = {r>{\raggedright\sffamily\footnotesize}XX[3.3]}%
    }
first col & second col & third col \\
\zwiueb{span all three cols}\\
first col & second col & third col \\
\end{longtblr}

\end{document}

yields this error:

! Misplaced \omit. \multispan ->\omit 
                   \@multispan  l.20 \end
       {longtblr}

Next try after getting the first comments:

\newcommand{\zwiueb}[1]{%
  \SetCell[c=3]{l, font=\bfseries}{#1}
}

result is this:

enter image description here


just to clearify: this is what I'd like to see:

enter image description here

working example:

\documentclass{article}
\usepackage{tabularray}[=v2021]

\newcommand{\zwiueb}[1]{%
  \multicolumn{3}{l}{\makebox[0pt]{\textbf{#1}}}%
}

\begin{document}

\begin{longtblr}{%
    rowsep=1.1pt,%
    width = \linewidth,%
    colspec = {r>{\raggedright\sffamily\footnotesize}XX[3.3]}%
    }
first col & second col & third col \\
\zwiueb{span all three columns to make sort of a heading} \\
first col & second col & third col \\
\end{longtblr}

\end{document}

but I'd like to get the same result without the need of [=v2021]

4
  • I thought the new interface just change how a table is set up, not how the contents are filled in. Could you post a minimal example that you think should work but doesn't, along with its error?
    – Teepeemm
    Jan 20, 2023 at 18:46
  • 1
    \SetCell[c=3]{l, font=\bfseries} text in cell or \SetCell[c=3]{l} \textbf{text in cell} or in case that whole ros has boldface texr, use row{<number>{ = {font=\bfseries}. See package documentation of recent tabularray version (2022B, 2022C, etc). Be aware, that new syntax require that in row should be all ampersands as are specified columns, For an example see tex.stackexchange.com/questions/672335/….
    – Zarko
    Jan 20, 2023 at 18:46
  • 1
    Sww package documentation; 6.2 The History where is described work around:\usepackage{tabularray}[=v2021] if you like to use old way for writting of multicolumn cells. But , be aware that new nice option as is guar for use of text inS columns` is not available and you had to stick with {{{ ...}}}, also new libraries like functional , zref ...
    – Zarko
    Jan 20, 2023 at 18:59
  • I would like to adapt my template to the new interface, but it dosen't work like expected ... \newcommand{\zwiueb}[1]{ \SetCell[c=3]{l, font=\bfseries}{#1} } results in neither bf font nor text across all three columns.
    – Martin L.
    Jan 20, 2023 at 19:01

2 Answers 2

1

See, if this is what you after:

\documentclass{article}
\usepackage{tabularray}
% new command instead of \zwiueb, 
% with optional number of spanned columns
% you can use old name, but better is replace it b
\NewTableCommand\SCC[1]{\SetCell[c=#1]{c, font=\bfseries}}

\begin{document}
    \begin{longtblr}[% here shoulb caption, label, note{...}, remark{...}
                    ]{rowsep  = 1.1pt,
                      colspec = {r X[l, font=\sffamily\footnotesize] X[3.3, l]},
                      vlines  % only for test purposesm remove in your document
                }
first col   & second col    & third col \\
\SCC{3} span all three cols             % instead of \zwiueb{span all three cols}
            &     a          &   b      \\
first col   & second col    & third col \\
    \end{longtblr}
\end{document}

enter image description here

2
  • That one sort of did the trick.
    – Martin L.
    Jan 20, 2023 at 19:30
  • great! works as expected now: \NewTableCommand\zwiueb{\SetCell[c=3]{l, font=\bfseries}} and I don't have to change my documents, still using \zwiueb{ new test --- span all three columns to make sort of a heading} \\ Thanks @Zarko
    – Martin L.
    Jan 20, 2023 at 19:34
0

For reference: this is how the minimal example finally looks like:

\documentclass{article}
\usepackage{tabularray}

\NewTableCommand\zwiueb{\SetCell[c=3]{l, font=\bfseries}}

\begin{document}

\begin{longtblr}{%
    rowsep=1.1pt,%
    width = \linewidth,%
    colspec = {r>{\raggedright\sffamily\footnotesize}XX[3.3]}%
    }
first col & second col & third col \\
\zwiueb{ new test --- span all three columns to make sort of a heading} \\
first col & second col & third col \\
\end{longtblr}

\end{document}

with this result:

enter image description here

You must log in to answer this question.

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