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 ...

Submitter:  Philippe Joyez <pjoyez>
Submitted:  Fri 24 Jul 2015 12:02:06 PM UTC
Category:  Conversion Priority:  7 - High
Item Group:  Error Status:  Fixed
Privacy:  Public Assigned to:  vdhoeven
Originator Name:  Open/Closed:  Closed
Release:  None Release: 
Fixed Release:  1.99.12 Fixed Release: 

Jump to the original submission

Tue 22 Oct 2019 05:52:34 AM UTC, comment #6: 

I fixed this bug in revision 12406.
Please re-open if you think that there is still a problem.

Joris van der Hoeven <vdhoeven>
Group administrator
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>
Group 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>
Group 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>
Group 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>
Group 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>
Group 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>
Group Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-22 vdhoeven StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 1.99.12
    2017-06-23 vdhoeven CategoryNone Conversion
        Priority8 - Very high 7 - High
        Item GroupNone Error
    2017-03-18 pjoyez Priority5 - Normal 8 - Very high
        Assigned toNone vdhoeven
        Summarybad bracket matching when paste from latex bracket issues with auto-correct : bad matching, impossible input ...
    2015-07-24 fpoulain StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-1277.
    Corresponding source code