Safe counterpart of \\
without optional parameters
#321
Replies: 6 comments 15 replies
-
At first I did not noticed the difference between original report in #20 \begin{tblr}{c|cccc}
\times & [1] & [2] & [3] & [4]\\\relax
\hline\relax and the closing comment $\begin{tblr}{c|cccc}
\times & [1] & [2] & [3] & [4] \\
\hline\relax There is no |
Beta Was this translation helpful? Give feedback.
-
It is reliable to add \documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{tblr}{rl}
a & b \\\empty
[1, 2] & [3, 4] \\\hline\empty
[1, 2] & [3, 4]
\end{tblr}
\end{document} |
Beta Was this translation helpful? Give feedback.
-
Consider internal representation of table structure as
So during export of a row it is not known if it followed by another row (and possibly brackets in first cell) or an hline. So either safe new row command should be added at the end of each row or alternatively \relax cell & cell \\
\relax cell & cell \\
\hline If I admit that the problem with an exporter unaware of context may sound artificial. E.g. for HTML there is no element for horizontal line, so CSS properties for table rows must be adjusted. As a result not so dumb technique for exporter should be implemented anyway. |
Beta Was this translation helpful? Give feedback.
-
Add |
Beta Was this translation helpful? Give feedback.
-
You could define
|
Beta Was this translation helpful? Give feedback.
-
This bug has been fixed (see issue #526). From \begin{tblr}{rl}
a & b \\
[1em] & [3, 4]
\end{tblr}
\begin{tblr}{rl}
a & b \\%
[1em] & [3, 4]
\end{tblr} ![]() |
Beta Was this translation helpful? Give feedback.
-
It is well known issue that in the following snippet square brackets are considered as a part of the
\\
command despite they are separated by newlineIt is not a real problem when LaTeX commands are typed by a human. Consider an application with another kind of primary markup that uses LaTeX as an intermediate format to produce PDF files. What do you think concerning adding a command that acts like
\\
but does not have optional*
and[<LENGTH>]
arguments? The purpose is to allow quite simple code generators that do not need forward lookup or other tricks.Tabularray is quite special case in this sense. Other packages allows to protect table newline or text line break by
\\\empty
or\\{}
whiletblr
uses a specific parser. (Side note:\\\relax
as in #20 causes misplaced\noalign
error when followed by\hline
.) Perhaps\\[0pt]
is a more generic workaround, however I considered\empty
as real no-op variant.expand=\empty
outer spec helps, but if I got it correctly only one command may be expanded, so I would prefer to reserve such feature.By simple LaTeX code generator I mean a visitor that walks through AST in depth first order and joins string produced by children nodes in post hook. In such approach following text and command is not known. Analyzing first character of first cell may be suitable for tables, but for text paragraphs it is not so easy.
So I propose to add a command similar to
\\
but having no pitfall due to square brackets in the following text (I do not mind to have it even outside oftabularray
). Have I missed an obvious robust workaround?Beta Was this translation helpful? Give feedback.
All reactions