emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Tom Alexander <tom@fizz.buzz>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87wmr3xk0n.fsf@localhost> (raw)
In-Reply-To: <875y42zi1n.fsf@localhost>

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>


  parent reply	other threads:[~2024-02-17 12:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 22:45 Subscript with parenthesis Tom Alexander
2023-09-21 23:02 ` Tom Alexander
2023-09-22  9:14   ` Ihor Radchenko
2023-09-29 16:12     ` Tom Alexander
2024-02-17 14:06     ` Ihor Radchenko [this message]
2024-02-17 19:36       ` [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? (was: Subscript with parenthesis) William Denton
2024-02-17 20:03         ` Thomas Dye
2024-02-17 21:22       ` Mark Barton
2024-02-19 18:15       ` [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? Fraga, Eric
2024-02-19 18:30         ` Ihor Radchenko
2024-03-20 13:57           ` Ihor Radchenko
2024-04-21  9:44             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmr3xk0n.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=tom@fizz.buzz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).