On 17/10/2022 22:01, Juan Manuel Macías wrote:
\documentclass{article}
\usepackage{tabularray}
LaTeX I have installed is too old for this package. It is marked as
"Experimental LaTeX3", so I am unsure, maybe you have found a bug in
this package.
https://ctan.org/pkg/tabularray
You believe that an issue with brackets is extremely rare. It may be
true for humanitarian texts. For some users it may be a constant source
of pain e.g. in the case of interval notation as [a,b]. I have already
mentioned tables generated by code blocks, not typed directly. I can not
say that I often need to export my notes, but I was afraid that I will
be bitten by this bug because I may try to put dates close to left margin:
- Something\\
[2022-10-17 Mon]
By default dates wrapped into \textit, but it may be customized to just
"%s".
Selectively adding some workaround require complete reimplementation of
exporters. I have some curiosity concerning pandoc approach, but I am
unsure if I will reserve some time to read its code.
An idea how to avoid complete redesign: at first add something like
%__ORG_PROTECT_NEWLINE__
after each \\, later at an optimizing pass remove the comment if next
line does not start from a star or a square bracket, otherwise use some
workaround, e.g. "{[}". \relax may be suitable as well (in the beginning
of rows, not after \\).
I do not like approach with a custom command. It is effectively the same
as adding \empty but \\ may be redefined by some packages, so I strongly
prefer to keep \\ in exported markup. Redefining of \\ is a way to new
issues. I do not feel firm ground with a command that will expand to \\.
I am afraid that \\ may still consume following "[" unless \empty or its
equivalent is added after it. I am completely unsure concerning
tabularray parser that does not rely on TeX primitives.
I found \empty when I was looking for an approach with minimal overhead.
I expect that e.g. \\[0pt] may have higher performance penalty since it
is expanded to several commands. When the idea with "\\\relax" failed I
was choosing between "\\{}" and "\\\empty". I decided that the latter
minimizes risk to add spurious space.
Some problems:
I do not see a way to add some LaTeX code between table lines.
Semi-verbatim environment may be a source of new bugs. They may be
rather selective in respect to what they consider a command and what is
passed as raw text. tabularray perhaps is similar in this sense.