bugGNU TeXmacs - Bugs: bug #45614, bracket issues with auto-correct :...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #45614: bracket issues with auto-correct : bad matching, impossible input ...

Submitted by:  Philippe Joyez <pjoyez>
Submitted on:  Fri 24 Jul 2015 12:02:06 PM UTC  
 
Category: ConversionPriority: 7 - High
Item Group: ErrorStatus: Confirmed
Privacy: PublicAssigned to: Joris van der Hoeven <vdhoeven>
Originator Name: Open/Closed: Open
Release: Release: None
Fixed Release: NoneFixed Release: 
Keywords: 

Sat 18 Mar 2017 09:44:56 AM UTC, comment #5:

You can also trigger the bad bracket matching by typing (as text) f(g(-2)), selecting it and convert to inline equation by typing $. At this point the content of the equation was not "auto-corrected" so we still have the original content, with no "around" tags (bug #43859). Now if you apply Edit->Correct->Correct all, the bad bracket matching occurs.

So it's not at all related to latex import, but it's a bug in the auto-correct algorithm (and bug #43859 can be exploited as a workaround the present bug!)

This is also related to

#41968 Unable to type right parenthesis in math mode
#41681 Bug with auto brackets and "|"

To better reflect that it is a wider problem I change the title

"bad bracket matching when paste from latex"
-> "bracket issues with auto-correct : bad matching, impossible input ..."

and raise the priority because it affects useability in several ways (and workarounds are not obvious)

Philippe Joyez <pjoyez>
Project Member
Wed 22 Feb 2017 09:12:37 PM UTC, comment #4:

I was hit again by this bug, and investigated it a bit more.

f(g(2)) -> f<around|(|g<around|(|2|)>|)> which is fine.
f(g(-2)) -> f<around|(|g|(>-2)) BAD: wrongly matches the two opening ( in an around!

So it looks like the problem is really with the - sign, not the comma as I suspected.

However, as François pointed out, it's not that simple since

f\left(g\left(-2\right)\right) -> f<around|(|g<around|(|-2|)>|)> which is fine too, in spite of the minus.

I've given a look to the algorithm François pointed to, but I got lost... I can't see why or where an opening symbol could become considered a closing symbol. Obviously it should never happen if, as here, it leaves unmatched closing symbols (it should occur only in very last resort, if ever).

The least I can say is that a few comments outlining the principles of the code could help.

Philippe Joyez <pjoyez>
Project Member
Mon 28 Sep 2015 02:06:37 PM UTC, comment #3:

It seems actually that downgrade_dubious () goes berserk. But I don't understand how the algorithm should works. Maybe only Joris know it.

Moreover, I guess it is impossible to change any line of this code, without testing massive convertion on a set of documents, in order to avoid big regressions.

Francois Poulain <fpoulain>
Project Member
Fri 24 Jul 2015 03:22:23 PM UTC, comment #2:

The bugs occurs into upgrade_brackets in src/Data/Tree/tree_brackets.cpp.

Francois Poulain <fpoulain>
Project Member
Fri 24 Jul 2015 03:09:25 PM UTC, comment #1:

Yes it is bugged.

Actually these case correctly import:

\left(u + B\left(-i \alpha,0 \right)\right)

And this case is wrongly imported :
(u + B(-i \alpha,0))

As far as I remember, this piece of code is quite fragile.

Francois Poulain <fpoulain>
Project Member
Fri 24 Jul 2015 12:02:06 PM UTC, original submission:

When pasting this latex snippet:

\left(u + B(-i \alpha,0)\right)

I get an <around> matching the two opening (, which is obviously not what one would expect when opening/closing parentheses go in perfectly matching pairs.
Apparently the algorithm fails at handling the coma for the two-parameter function.

Philippe Joyez <pjoyez>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by vdhoeven (Updated the item)
  • -unavailable- added by pjoyez (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 23 Jun 2017 04:08:10 PM UTCvdhoevenCategoryNone=>Conversion
      Priority8 - Very high=>7 - High
      Item GroupNone=>Error
    Sat 18 Mar 2017 09:44:56 AM UTCpjoyezPriority5 - Normal=>8 - Very high
      Assigned toNone=>vdhoeven
      Summarybad bracket matching when paste from latex=>bracket issues with auto-correct : bad matching, impossible input ...
    Fri 24 Jul 2015 03:09:25 PM UTCfpoulainStatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1