syntax highlighter incorrect in nested latex environment

Bug #1206957 reported by Michael
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kile
Fix Released
Low
kile (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Hi,

This bug probably classifies as a polish bug, but I've stumbled upon some LaTeX code that causes incorrect syntax highlighting.

1) $ lsb_release -rd
Description: Ubuntu 12.04.2 LTS
Release: 12.04

2) $ apt-cache policy kile
kile:
  Installed: 1:2.1.0-1ubuntu2.1
  Candidate: 1:2.1.0-1ubuntu2.1
  Version table:
 *** 1:2.1.0-1ubuntu2.1 0
        500 http://mirror.csclub.uwaterloo.ca/ubuntu/ precise-updates/universe amd64 Packages
        100 /var/lib/dpkg/status
     1:2.1.0-1ubuntu2 0
        500 http://mirror.csclub.uwaterloo.ca/ubuntu/ precise/universe amd64 Packages

The following code, when pasted into the Kile editor, highlights the second "cases" wrong:

\begin{align}
 U_{bg}(z) = \begin{cases}
              U_{max} e^{-(b(z-z_0))^4} &\mbox {if } z \leq z_0,\\
              U_{max} &\mbox {if } z > z_0,\\
             \end{cases}
\end{align}

3) Expectation is that the colour of the second 'cases' matches the first (blue)
4) Actual result is that it got highlighted in green rather than blue

Misc:
- The LaTeX code is correct, it compiles without warnings or errors.
- See the attached screenshot for a visualisation

Revision history for this message
Michael (mdunphy-g) wrote :
Revision history for this message
Michael (mdunphy-g) wrote :

Hmmm. The fix was pretty simple, add "cases" to the MathEnv list in /usr/share/kde4/apps/katepart/syntax/latex.xml

See attached patch!

Cheers,
Michael

Revision history for this message
In , Michael (mdunphy-g) wrote :

The following code, when pasted into the Kile editor (via Katepart), highlights the second "cases" wrong:

\begin{align}
 U_{bg}(z) = \begin{cases}
              U_{max} e^{-(b(z-z_0))^4} &\mbox {if } z \leq z_0,\\
              U_{max} &\mbox {if } z > z_0,\\
             \end{cases}
\end{align}

Reproducible: Always

Steps to Reproduce:
1. Paste above code into Kate,
2. select Tools->Highlighting->Markup->Latex
3.
Actual Results:
The second "cases" is green

Expected Results:
The second "cases" should be blue

Revision history for this message
In , Michael (mdunphy-g) wrote :

Created attachment 81484
A patch to fix the broken syntax highlighting

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "A patch that fixes the highlighter" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in kile:
importance: Unknown → Low
status: Unknown → New
Revision history for this message
In , Dhaumann (dhaumann) wrote :

Git commit 4afa72930126f7241aa7eb54307f80db1509d4e7 by Dominik Haumann.
Committed on 01/08/2013 at 08:17.
Pushed by dhaumann into branch 'master'.

fix cases environment highlighting

Thanks to Michael for the patch!
FIXED-IN: 4.11.1

M +10 -1 examples/syntax/highlight.tex
M +3 -3 part/syntax/data/latex.xml

http://commits.kde.org/kate/4afa72930126f7241aa7eb54307f80db1509d4e7

Revision history for this message
In , Dhaumann (dhaumann) wrote :

Git commit 76ef0c074b7dd85dfe5e7bb45e9f0ba3cf999efc by Dominik Haumann.
Committed on 01/08/2013 at 08:17.
Pushed by dhaumann into branch 'KDE/4.11'.

fix cases environment highlighting

Thanks to Michael for the patch!
FIXED-IN: 4.11.1

M +10 -1 examples/syntax/highlight.tex
M +3 -3 part/syntax/data/latex.xml

http://commits.kde.org/kate/76ef0c074b7dd85dfe5e7bb45e9f0ba3cf999efc

Changed in kile:
status: New → Fix Released
Changed in kile (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.