lvjr / tabularray

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

& and % in tblr cause an error despite verb option #358

Closed ysalmon closed 1 year ago

ysalmon commented 1 year ago

The following code causes an error \verb ended by end of line. \end.

\documentclass{scrartcl}

\usepackage{tabularray}

\begin{document}
\begin{tblr}{verb,colspec={c}}
\verb!&!
\end{tblr}
\end{document}

The same happens with %.

This is with tabularray 2022D and a freshly update texlive 2022, compiling with lualatex.

muzimuzhi commented 1 year ago

Just to make contents linked, this was originally asked on https://tex.stackexchange.com/q/673205.

lvjr commented 1 year ago

This is related to the tricky \catcode system in TeX and almost nothing can be done in the side of tabularray at present (see #13 for a future plan).

For % characters in \verb commands, you will also get an error if you use them inside a classical tabular environment. See #104 for a workaround for tabularray.

For & characters in \verb commands, you will also get an error if you use them inside a classical tabularx environment.

I am planning to add \fakeverb command to my codehigh package (see https://github.com/lvjr/codehigh/issues/11). Hopefully with the next release of codehigh package, you could easily write \fakeverb{&\%} to get &% in tabularray tables and other LaTeX commands.

lvjr commented 1 year ago

I have uploaded a new version of codehigh package (with \fakeverb command) to CTAN.

lvjr commented 1 year ago

Since version 2023A, verb option was obsolete. Please use \fakeverb command instead.