[texworks] Syntax highlighting puzzle
Mark Yagnatinsky
markyag at gmail.com
Wed Jan 20 03:36:59 CET 2016
I considered doing that, then "\url{" is also hot pink, which is not
ideal if you ask me, but definitely better than the current situation,
so I might just go with that.
On Tue, Jan 19, 2016 at 4:47 AM, Alain Delmotte <leliseron at yahoo.fr> wrote:
> Hi!
>
> Le 19/01/2016 08:12, Mark Yagnatinsky a écrit :
>
> If anyone knows how to do the following, I'd appreciate it. First,
> some background, just in case it turns out I'm asking the wrong
> question. I've asked here:
> http://tex.stackexchange.com/questions/288297/percent-sign-in-url-without-hyperref
> about how to get the \url command from the url package to accept \% as
> a synonym for %, just like the \url command from the hyperref package
> does, because use a bare % sign makes TeXworks syntax highlighting get
> confused since it looks like a comment. I was told that \url is right
> and my editor is wrong, so I went about trying to fix my editor.
>
> It seems that the right approach here is editing the
> syntax-patterns.txt file. But I can't figure out the right rules to
> get the effect I want. First, I want \url to be blue just like other
> commands. Second, I want the url itself to not turn red when it
> contains % signs. I had hoped that some clever use of regex
> assertions would do the trick, but I'm getting nowhere.
>
> Is this possible? Does anyone else have this problem? What do other people
> do?
>
> Looking at syntax-atterns.txt, I modified the
> # LaTeX packages
> blue N \\usepackage\s*(?:\[[^]]*\]\s*)?\{[^}]*\}
> as
> hotpink N \\url\s*(?:\[[^]]*\]\s*)?\{[^}]*\}
>
> and It looks like it is doing what you want!!
> Right?
>
> Regards,
>
> --
> Alain
>
More information about the texworks
mailing list