Bug 274440 - Kile: syntax highlighting failed to match aligned environment within equation
Summary: Kile: syntax highlighting failed to match aligned environment within equation
Status: RESOLVED DUPLICATE of bug 410477
Alias: None
Product: kile
Classification: Applications
Component: editor (other bugs)
Version First Reported In: 2.9.92
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Michel Ludwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-29 18:25 UTC by outermeasure
Modified: 2019-08-07 07:33 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
screenshot (171.96 KB, image/png)
2011-05-29 18:25 UTC, outermeasure
Details
Folding for cases/dcases (157.36 KB, image/png)
2012-05-04 21:07 UTC, houstontyoung
Details
Folding for split (157.70 KB, image/png)
2012-05-04 21:07 UTC, houstontyoung
Details
Updated LaTeX syntax highlighting file (34.55 KB, text/xml)
2013-11-02 16:58 UTC, houstontyoung
Details
Diff from original latex.xml to new one (2.96 KB, text/plain)
2013-11-02 16:59 UTC, houstontyoung
Details
Updated LaTeX syntax highlighting file (take two) (35.08 KB, text/xml)
2013-11-02 17:52 UTC, houstontyoung
Details
Diff from original latex.xml to new one (take two) (3.68 KB, text/plain)
2013-11-02 17:53 UTC, houstontyoung
Details

Note You need to log in before you can comment on or make changes to this bug.
Description outermeasure 2011-05-29 18:25:59 UTC
Created attachment 60439 [details]
screenshot

Version:           2.1b5 (using KDE 4.6.2) 
OS:                Linux

Kile's syntax highlighting failed to match the \begin{aligned} with \end{aligned} if this block lie within an \begin{equation}...\end{equation}.  Also happens if it is within equation*, gather; and probably other amsmath defined environments too.

Doesn't happen within \[ ... \] or \( ... \).

Reproducible: Always

Steps to Reproduce:
minimum example:
\begin{equation}
\begin{aligned}
a & b\\
c & d
\end{aligned}
\end{equation}

Actual Results:  
The \end{aligned} isn't recognised --- the "\end{align" is usual colour (the default seems to be red for \end, black for {, and blue for align) but then "ed}" appears in green.  Also, folding the \begin{aligned} line folds up to and including the \end{equation}, and if you try to fold the \begin{equation} it will fold to at least the end of the next \begin{...}\end{...} (this seems to vary... haven't been able to determine a rule yet).

See screenshot attached for a slightly more complicated example.

Expected Results:  
The syntax highlighting should be aware that the \end{aligned} match the \begin{aligned}, etc.

OS: Linux (x86_64) release 2.6.37-hardened-r7
Compiler: x86_64-pc-linux-gnu-gcc
(Hardend amd64 Gentoo)
Comment 1 outermeasure 2011-06-02 14:30:38 UTC
The bug also show up in
\begin{equation}
\begin{cases}
(something)
\end{cases}
\end{equation}
and similar.
Comment 2 houstontyoung 2012-05-04 21:04:48 UTC
Same behavior for me; note the folding region on attached screenshots.

Kile 2.1.0
KDE 4.7.2
Ubuntu 11.04
Comment 3 houstontyoung 2012-05-04 21:07:21 UTC
Created attachment 70866 [details]
Folding for cases/dcases
Comment 4 houstontyoung 2012-05-04 21:07:43 UTC
Created attachment 70867 [details]
Folding for split
Comment 5 houstontyoung 2013-11-02 16:50:35 UTC
Here is a fix: I made some changes in the latex.xml file; the changed version is attached below, along with a diff from the original to the new one.

Just put the new latex.xml in ~/.kde/share/apps/katepart/syntax/ and restart kile.
Comment 6 houstontyoung 2013-11-02 16:58:24 UTC
Created attachment 83296 [details]
Updated LaTeX syntax highlighting file

Summary of changes:
- fixed "EndEnvironment" and replaced "MathFindEnd" with "EndMathEnv" contexts: this fixes the bug
- fixed "BeginEnvironment" context: removed pmatrix and friends from line pointing to "MathModeEnv"
- added highlighting for commands \Cref (from cleveref package) and \shortintertext (from mathtools package)
- added a new itemData "Reference" that is used for labels and citations; originally these share highlighting with "Environment"
Comment 7 houstontyoung 2013-11-02 16:59:32 UTC
Created attachment 83298 [details]
Diff from original latex.xml to new one
Comment 8 houstontyoung 2013-11-02 17:52:06 UTC
Created attachment 83299 [details]
Updated LaTeX syntax highlighting file (take two)
Comment 9 houstontyoung 2013-11-02 17:53:15 UTC
Created attachment 83300 [details]
Diff from original latex.xml to new one (take two)
Comment 10 merlin 2013-11-13 20:03:08 UTC
I have adapted the patch to current version 1.55 of latex.xml and sent it to the maintainer of Kile (Michel Ludwig) to commit it.
Comment 11 Andrew Crouthamel 2018-11-10 03:22:24 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 12 Andrew Crouthamel 2018-11-21 04:37:06 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? This bug will be moved back to REPORTED Status for manual review later, which may take a while. If you are able to, please lend us a hand.

Thank you for helping us make KDE software even better for everyone!
Comment 13 houstontyoung 2018-11-22 20:40:11 UTC
I haven't used Kile in several years and don't use LaTeX much anymore.
Comment 14 Raphaël Jakse 2019-08-01 10:55:19 UTC
I just ran into this issue in the latest Kate with the following text:

\begin{align}
\begin{aligned}
\end{aligned}
\end{align}
Comment 15 Raphaël Jakse 2019-08-01 10:58:24 UTC
Still current in Kile version 2.9.92.
Comment 16 Nibaldo G. 2019-08-07 07:33:04 UTC

*** This bug has been marked as a duplicate of bug 410477 ***