Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#345 LaTeX syntax highlighting

Cosmetic
closed-fixed
Neil Hodgson
Scintilla (790)
2
2011-05-25
2005-08-19
Anonymous
No

Hi,

I am the developer of WinShell (www.winshell.de), a
LaTeX editor and I am using the scilexer, great work!!

I got a user eMail which stated some cosmetics
concerning the syntax highlighting which I want to
parse to you:

* LaTeX environments are highlighted by a special
color. "\begin{something}"
"\end{something}" and "\begin {something}" is all right
while in "\end
{something}" only "\end" is colored and by other color
(as a command).
The version with a space before the argument is useful
because it is more readable.

* There is improper highlighting of commands. For
instance if one writes
"\comm,#1" then all is hilited as a command while only
"\comm" should
be. It seems that the highlighting of commands starting
by a letter is
terminated only by a space, "[", "{" or "}" while every
non-letter
(except maybe "@") should play this role.

* The other type of commands consists of "\" and one
non-letter.
However, usually also following characters are marked.
For instance in
"\$42" everything is hilited while only "\$" should be.
It seems that
only "\`", "\~", "\^", "\;", "\'", '\"', "\," and "\\"
are all right.

* The LaTeX mathematical environment "\[ ... \]" is not
recognized and
hence it is not highlighted as mathematics.

best regards
Ingo

Discussion

  • Neil Hodgson
    Neil Hodgson
    2005-08-20

    • priority: 5 --> 2
    • assigned_to: nobody --> nyamatongwe
     
  • Alex
    Alex
    2010-10-08

    I have a fix for the first problem listed (inconsistent highlighting depending on whether there is a space between \end and {). I can't see anywhere to attach a file to this comment, so I'll just dump the patch here:

    Index: LexOthers.cxx

    --- LexOthers.cxx (revision 5240)
    +++ LexOthers.cxx (working copy)
    @@ -1166,7 +1166,7 @@
    while (i < 5 && e) {
    s[i] = styler[start + i];
    i++;
    - e = styler[start + i] != '{';
    + e = (strchr ("{ \t", styler[start + i]) == NULL);
    }
    s[i] = '\0';
    return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0);

    I haven't looked at the other problems

     
  • Neil Hodgson
    Neil Hodgson
    2010-10-10

    • status: open --> open-fixed
     
  • Neil Hodgson
    Neil Hodgson
    2010-10-10

    OK, works for example so committed.

     
  • Neil Hodgson
    Neil Hodgson
    2011-05-25

    • status: open-fixed --> closed-fixed