Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax?

2024-04-21 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Upon further examination, I found that ^:{} does accept _only_ curly
> braces:
> ...
> So, round braces can be seen as another variant of DWIM behavior.
>
> I conclude that there is no reason to change the existing syntax.
>
> I will need to update `org-use-sub-superscripts' docstring and
> https://orgmode.org/worg/org-syntax.html#Subscript_and_Superscript to
> document this special case.
>
> Maybe also update the manual section 12.3 Subscripts and Superscripts.

All done on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=36d092804
https://git.sr.ht/~bzg/worg/commit/834ac25e

Closed.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax?

2024-03-20 Thread Ihor Radchenko
Ihor Radchenko  writes:

> "Fraga, Eric"  writes:
>
>> On Saturday, 17 Feb 2024 at 14:06, Ihor Radchenko wrote:
>>> Inconsistent with LaTeX syntax, Org mode not only allows
>>> x^{superscript}, but also x^(superscript) with round braces used for
>>> grouping.
>>
>> Inconsistent with LaTeX is not a sufficient reason for removing this, in
>> my opinion.  Org has /dwim/ elements which make it easier to write some
>> expressions than in LaTeX.  Another example is ~x^-1~ which works as I
>> want but would make no sense in LaTeX (where only the "-" would be
>> superscripted, not the 1).
>
> Good point.
> Although, do note that unlike x^word, x^(some text) is not documented.
> Moreover, options like ^:{} create an impression that only curly braces
> are accepted.

Upon further examination, I found that ^:{} does accept _only_ curly
braces:

#+options: ^:{}
x^word
x^{word}
x^(word)

yields (in latex export):

x\^{}word
x\textsuperscript{word}
x\^{}(word)

So, round braces can be seen as another variant of DWIM behavior.

I conclude that there is no reason to change the existing syntax.

I will need to update `org-use-sub-superscripts' docstring and
https://orgmode.org/worg/org-syntax.html#Subscript_and_Superscript to
document this special case.

Maybe also update the manual section 12.3 Subscripts and Superscripts.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax?

2024-02-19 Thread Ihor Radchenko
"Fraga, Eric"  writes:

> On Saturday, 17 Feb 2024 at 14:06, Ihor Radchenko wrote:
>> Inconsistent with LaTeX syntax, Org mode not only allows
>> x^{superscript}, but also x^(superscript) with round braces used for
>> grouping.
>
> Inconsistent with LaTeX is not a sufficient reason for removing this, in
> my opinion.  Org has /dwim/ elements which make it easier to write some
> expressions than in LaTeX.  Another example is ~x^-1~ which works as I
> want but would make no sense in LaTeX (where only the "-" would be
> superscripted, not the 1).

Good point.
Although, do note that unlike x^word, x^(some text) is not documented.
Moreover, options like ^:{} create an impression that only curly braces
are accepted.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax?

2024-02-19 Thread Fraga, Eric
On Saturday, 17 Feb 2024 at 14:06, Ihor Radchenko wrote:
> Inconsistent with LaTeX syntax, Org mode not only allows
> x^{superscript}, but also x^(superscript) with round braces used for
> grouping.

Inconsistent with LaTeX is not a sufficient reason for removing this, in
my opinion.  Org has /dwim/ elements which make it easier to write some
expressions than in LaTeX.  Another example is ~x^-1~ which works as I
want but would make no sense in LaTeX (where only the "-" would be
superscripted, not the 1).

-- 
: Eric S Fraga, with org release_9.6.18-1158-g8e2ed4 in Emacs 30.0.50


Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? (was: Subscript with parenthesis)

2024-02-17 Thread Mark Barton



> On Feb 17, 2024, at 5:33 AM, Ihor Radchenko  wrote:
> 
> WDYT?
+1

I use the curly braces since I often use underscores for other reasons. There 
would be no impact to me and this is the first I ever heard that parentheses 
would work. 




Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? (was: Subscript with parenthesis)

2024-02-17 Thread Thomas Dye
+1

Tom

> On Feb 17, 2024, at 9:38 AM, William Denton  wrote:
> 
> On Saturday, February 17th, 2024 at 07:07, Ihor Radchenko 
>  wrote:
> 
>> I tentatively propose to remove the x^(2-i) example from the docstring
>> and mark the ^(...) syntax deprecated.
>> 
>> WDYT?
> 
> I think it's very sensible.  It's surprising ^(...) works like this, and if 
> anyone was using it (perhaps by accident) it will be easy to change when 
> necessary.
> 
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada
> 
> 




Re: [DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? (was: Subscript with parenthesis)

2024-02-17 Thread William Denton
On Saturday, February 17th, 2024 at 07:07, Ihor Radchenko  
wrote:

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

I think it's very sensible.  It's surprising ^(...) works like this, and if 
anyone was using it (perhaps by accident) it will be easy to change when 
necessary.


Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada




[DISCUSSION] What should we do with undocumented x^(superscript inside /round/ braces) syntax? (was: Subscript with parenthesis)

2024-02-17 Thread Ihor Radchenko
Ihor Radchenko  writes:

> "Tom Alexander"  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 .
Support Org development at ,
or support my work at