emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DISCUSSION] What should we do with undocumented x^(superscript inside /


From: Ihor Radchenko
Subject: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? (was: Subscript with parenthesis)
Date: Sat, 17 Feb 2024 14:06:32 +0000

Ihor Radchenko <yantar92@posteo.net> writes:

> "Tom Alexander" <tom@fizz.buzz> writes:
>
>> Some additional things I'm noticing:
>>
>> - when using parenthesis, :use-brackets-p is nil, so they're not equivalent 
>> to curly braces.
>
> `org-element-subscript-parser' uses `org-match-substring-regexp', which
> indeed allows foo_(...). This is not documented in org-syntax.org and in
> the manual (12.3 Subscripts and Superscripts).

Inconsistent with LaTeX syntax, Org mode not only allows
x^{superscript}, but also x^(superscript) with round braces used for
grouping.

This does not seem to be documented in the manual and is only vaguely
mentioned in the `org-use-sub-superscripts' docstring in a single
example:

 x_{i^2} or   x^(2-i)    braces or parenthesis do grouping.

The rest of the docstring only refers to {} or just to genetic "braces".

This situation is awkward, because such subtle inconsistency between Org
and LaTeX syntax can be very surprising.

To demonstrate, try to export the following to pdf:

# ---
Direct latex code =$foo^(bar)$= :: @@latex:$foo^(bar)$@@

Org mode markup =foo^(bar)= :: foo^(bar)
# ---

The first line will only create superscript for "(", while the second
line will make the whole "(bar)" into superscript.

-----

I tentatively propose to remove the x^(2-i) example from the docstring
and mark the ^(...) syntax deprecated.

WDYT?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]