lvjr / tabularray

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

Font commands will be considered undefined if certain conditions are met. #294

Closed Meiting-Wang closed 1 year ago

Meiting-Wang commented 1 year ago

Hello Mr. Lu. I find that in the table body of tblr and longtblr environemts,\rmfamily, \bfseries, \heiti, \fangsong, and other font commands will be considered undefined if (1) they are followed by Chinese(I use package ctex to reach support for chinese), (2) I compile with xelatex or lualatex, and (3) I add the option "verb".

So this could be caused by conflicting conditions above?

Best wishes

PS. my system: win10 Tex Live version: TeX 3.141592653 (TeX Live 2022) tlmgr update time: August 6, 2022 My MWE:

image

\documentclass{article}
\usepackage{ctex}
\usepackage{tabularray}

\begin{document}

\section{Test}

% no problem here
\begin{tblr}{
  hline{1,Z}={1pt,solid},
}
rmfamily & \bfseries bfseries & \ttfamily ttfamily & \itshape itshape \\
宋体 & \bfseries 黑体 & \ttfamily 仿宋 & \itshape 楷书 \\
宋体 & \heiti 黑体 & \fangsong 仿宋 & \kaishu 楷书 \\
\end{tblr}

% no problem here
\begin{tblr}{
  verb,
  hline{1,Z}={1pt,solid},
}
rmfamily & \bfseries bfseries & \ttfamily ttfamily & \itshape itshape \\
中文 & 中文 & 中文 & 中文 \\
中文 & 中文 & 中文 & 中文 \\
\end{tblr}

% There is a problem here.
\begin{tblr}{
  verb,
  hline{1,Z}={1pt,solid},
}
rmfamily & \bfseries bfseries & \ttfamily ttfamily & \itshape itshape \\
\bfseries 中文 & 中文 & 中文 & 中文 \\
中文 & 中文 & 中文 & 中文 \\
\end{tblr}

\end{document}
davidcarlisle commented 1 year ago

@lvjr may be able to fix that in the package, but a simple workaround is add {}

\bfseries{}中文

works fine, it is not \bfseries that is undefined but \bfseries中文 as the space is dropped by the verb processing and 中文 are considered as letters as part of the command name. {} forces the \bfseries name to end.

Meiting-Wang commented 1 year ago

@davidcarlisle Thank you for your answer, from which I know the cause of the bug and a temporary solution.

lvjr commented 1 year ago

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