After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 128223 - Latex: \$ and \% are not escaped
Latex: \$ and \% are not escaped
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Syntax files
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
: 140992 157362 164644 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-11-30 11:47 UTC by gary_martin_au
Modified: 2005-02-07 16:53 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Example screenshot 54k png (53.06 KB, image/png)
2003-11-30 11:52 UTC, gary_martin_au
Details

Description gary_martin_au 2003-11-30 11:47:20 UTC
Using GEdit on a LaTeX file, the commands \$ and \% are not escaped. eg: it
treats \$ as $ (start of inline math mode) and waits for another $ or \$
before re-starting normal syntax colouring. Same for \%.

Using version 0.7
Comment 1 gary_martin_au 2003-11-30 11:52:44 UTC
Created attachment 21936 [details]
Example screenshot 54k png
Comment 2 Paolo Maggi 2004-07-20 10:00:45 UTC
*** Bug 140992 has been marked as a duplicate of this bug. ***
Comment 3 Paolo Maggi 2004-12-07 16:01:11 UTC
*** Bug 157362 has been marked as a duplicate of this bug. ***
Comment 4 Bruno Schneider 2005-01-19 14:45:23 UTC
It does not seem possible to create a good latex syntax file. I found no
specification of what is possible to specify on a syntax file, but I looked all
examples and it seems that escaped characters can't be represented.

The dollar, for instance is treated as block comment, which is defined by a
starting regex and an ending regex. To avoid escaped dollar signs, one could use
the regex [^\\]\$ as starting regex, but then the character before the dollar
would also be marked as comment.

It seems to me this could be solved if keywords were matched before comments.
This way, the keyword \$ could be defined, preventing the $ from being matched
as the begining of a comment.
Comment 5 Paolo Borelli 2005-01-20 08:30:13 UTC
*** Bug 164644 has been marked as a duplicate of this bug. ***
Comment 6 Paolo Borelli 2005-01-20 09:06:33 UTC
Forgive my naive incompetence and my latex ignorance, but why cannot we have the
following line as in C and many other .lang files?

        <escape-char>\</escape-char>

Comment 7 Bruno Schneider 2005-01-25 16:35:35 UTC
Well, using the "escape-char" seems to actually work! Paolo found the answer! It
seems that all we have to do is to put the "<escape-char>\</escape-char>" in
latex.lang file...

I'm sorry for stating that "it does not seem possible to create a good latex
syntax file".
Comment 8 Loïc Minier 2005-02-05 11:44:27 UTC
(This is Debian bug <http://bugs.debian.org/280235>.)
Comment 9 Paolo Maggi 2005-02-07 16:53:13 UTC
Adding <escape-char>\</escape-char> seems to work for me.
I'm going to commit it.

Fixed in CVS HEAD.