* The less ambiguous math delimiters in tables
@ 2024-12-24 9:20 Rudolf Adamkovič
2024-12-24 9:25 ` Ihor Radchenko
2024-12-24 9:50 ` Rudolf Adamkovič
0 siblings, 2 replies; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-12-24 9:20 UTC (permalink / raw)
To: emacs-orgmode
We know that
\(...\) math delimiters are superior to $...$
in that
they remove parsing ambiguities.
So, I updated my notes to the new delimiters, but
Org still struggles with | within \(...\) in tables,
such as
| \(|x|\) |
Is this a feature or a bug?
I was hoping to reap the benefits of \(...\) in this case.
P.S. I know about '\vert' in LaTeX.
Rudy
--
"Programming reliably -- must be an activity of an undeniably
mathematical nature […] You see, mathematics is about thinking, and
doing mathematics is always trying to think as well as possible."
--- Edsger W. Dijkstra, 1981
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: The less ambiguous math delimiters in tables
2024-12-24 9:20 The less ambiguous math delimiters in tables Rudolf Adamkovič
@ 2024-12-24 9:25 ` Ihor Radchenko
2024-12-25 17:56 ` Rudolf Adamkovič
2024-12-24 9:50 ` Rudolf Adamkovič
1 sibling, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2024-12-24 9:25 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> Org still struggles with | within \(...\) in tables,
>
> such as
>
> | \(|x|\) |
>
> Is this a feature or a bug?
It is a syntax limitation.
Org parser is outer-inner - the table row is parsed first.
So, | are unconditionally used as table delimiters, *before* verbatim
LaTeX markup is recognized.
\vert is one possible workaround, but it does not work inside verbatim
text.
The only sane way would be adding some kind of alternative table
delimiter syntax to aid the situations like in your example.
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: The less ambiguous math delimiters in tables
2024-12-24 9:20 The less ambiguous math delimiters in tables Rudolf Adamkovič
2024-12-24 9:25 ` Ihor Radchenko
@ 2024-12-24 9:50 ` Rudolf Adamkovič
1 sibling, 0 replies; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-12-24 9:50 UTC (permalink / raw)
To: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
> P.S. I know about '\vert' in LaTeX.
But, I was not able to figure out how to put
\(\|\vec{u}\|\)
into a table.
[The \| sequence typesets as || but with different spacing than \vert\vert.]
Rudy
--
"Logic is a science of the necessary laws of thought, without which no
employment of the understanding and the reason takes place."
--- Immanuel Kant, 1785
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: The less ambiguous math delimiters in tables
2024-12-24 9:25 ` Ihor Radchenko
@ 2024-12-25 17:56 ` Rudolf Adamkovič
2024-12-25 18:05 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-12-25 17:56 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> It is a syntax limitation.
> Org parser is outer-inner - the table row is parsed first.
> So, | are unconditionally used as table delimiters, *before* verbatim
> LaTeX markup is recognized.
How is that not a parser bug?
I thought that, with the noisy \(...\) delimiters,
the parser finally has enough information
to not screw up.
P.S. It is impossible to write, e.g. \|, which is vector length (norm).
Rudy
--
"I would prefer an intelligent hell to a stupid paradise."
--- Blaise Pascal
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: The less ambiguous math delimiters in tables
2024-12-25 17:56 ` Rudolf Adamkovič
@ 2024-12-25 18:05 ` Ihor Radchenko
2024-12-25 20:14 ` Rudolf Adamkovič
0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2024-12-25 18:05 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
>> It is a syntax limitation.
>> Org parser is outer-inner - the table row is parsed first.
>> So, | are unconditionally used as table delimiters, *before* verbatim
>> LaTeX markup is recognized.
>
> How is that not a parser bug?
>
> I thought that, with the noisy \(...\) delimiters,
>
> the parser finally has enough information
>
> to not screw up.
Your example shows ambiguous markup that can be
interpreted in multiple ways:
1. <begin cell> \(<end cell><begin cell>x<end cell><begin cell>\) <end cell>
2. <begin cell> <begin latex>|x|<end latex> <end cell>
Org parser chooses one. It has to choose some.
Org parser also chooses a simpler interpretation that does not require
backtracking.
> P.S. It is impossible to write, e.g. \|, which is vector length (norm).
Yes, it is impossible. That's why I call it markup limitation.
We need to improve the markup to address this known problematic scenario.
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: The less ambiguous math delimiters in tables
2024-12-25 18:05 ` Ihor Radchenko
@ 2024-12-25 20:14 ` Rudolf Adamkovič
2024-12-26 9:17 ` Ihor Radchenko
0 siblings, 1 reply; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-12-25 20:14 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> Your example shows ambiguous markup that can be
> interpreted in multiple ways:
>
> 1. <begin cell> \(<end cell><begin cell>x<end cell><begin cell>\) <end cell>
> 2. <begin cell> <begin latex>|x|<end latex> <end cell>
>
> Org parser chooses one. It has to choose some.
> Org parser also chooses a simpler interpretation that does not require
> backtracking.
But (2) is a *much, much, much* better choice (for the user).
How often does a table row contain
- a sole '\(` in one cell and
- a sole '\)` in another cell?
Virtually never [excluding verbatim/code, which is a different problem.]
How often does LaTeX include `|'? Often:
- absolute value,
- parallel lines,
- vector length,
- set cardinality,
- various norms,
on and on.
The use starts at elementary school level, so
it is like Org reserving the minus sign in LaTeX for itself,
which would be a similar usability disaster.
Rudy
--
"It is no paradox to say that in our most theoretical moods we may be
nearest to our most practical applications." --- Alfred North
Whitehead, 1861-1947
Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: The less ambiguous math delimiters in tables
2024-12-25 20:14 ` Rudolf Adamkovič
@ 2024-12-26 9:17 ` Ihor Radchenko
0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2024-12-26 9:17 UTC (permalink / raw)
To: Rudolf Adamkovič; +Cc: emacs-orgmode
Rudolf Adamkovič <rudolf@adamkovic.org> writes:
>> 1. <begin cell> \(<end cell><begin cell>x<end cell><begin cell>\) <end cell>
>> 2. <begin cell> <begin latex>|x|<end latex> <end cell>
>>
>> Org parser chooses one. It has to choose some.
>> Org parser also chooses a simpler interpretation that does not require
>> backtracking.
>
> But (2) is a *much, much, much* better choice (for the user).
Maybe, but it is also much more complex in terms of parser.
Backtracking will introduce non-linear complexity to the parser,
degrading the performance significantly. It will also make Org syntax
much, much harder in more complex cases - there will still be
ambiguities when you have more than 2 interpretations: e.g.
| \(|x|\) | \(|x|\) |
this one has 3 possibilities:
1. <cell> \(</cell><cell>x...
2. <cell> <latex>|x|\) | \(|x|</latex> </cell>
3. <cell> <latex>|x|</latex> </cell><cell> <latex>|x|</latex> </cell>
And there will be similar situations with even more possibilities. In
fact, the number of ambiguous alternatives can blow up pretty quickly
when the text is complex enough combination of literal and non-literal
markups.
In any case, the way Org parser works in this example is one of the most
fundamental design decisions in the Org markup. We cannot change it at
this point without breaking all the historical documents + third-party
parsers. That's why I am talking about providing markup extension to
address the issue rather than altering the existing parser fundamentals.
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-26 9:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-24 9:20 The less ambiguous math delimiters in tables Rudolf Adamkovič
2024-12-24 9:25 ` Ihor Radchenko
2024-12-25 17:56 ` Rudolf Adamkovič
2024-12-25 18:05 ` Ihor Radchenko
2024-12-25 20:14 ` Rudolf Adamkovič
2024-12-26 9:17 ` Ihor Radchenko
2024-12-24 9:50 ` Rudolf Adamkovič
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.