I am trying to format a URL using the url package. My URL has a dollar sign ($) in it.

This line

\url{\\\ Redirected$ \DBLocker}

compiles correctly and the result is what I want.

However, the text editor in Texmaker highlights everything after the dollar sign (until the end of the document!) in green (eg. math mode format) which is obviously very annoying .

I can't just add another dollar somewhere to close math mode as it isn't actually open, so the .tex file wouldn't compile!

It's as if Texmaker doesn't appreciate that $ signs are not escaped in URLs.

Things I have tried:

  1. Escaping the dollar sign with a backslash. This doesn't work as the backslash shows in the URL.
  2. Using \textbackslash and similar. Also doesn't work, they appear as literal strings in the URL.

Any suggestions?

  • 9
    You could try to add an $ after a comment sign: %$ Aug 14, 2015 at 12:18
  • Can't TeXmaker use filters for highlighting?
    – Bernard
    Aug 14, 2015 at 12:21
  • Could you add a screenshot of what you see in Texmaker? Also, you shouldn't have to jump through hoops and modify your source code just to obviate shortcomings of your TeX IDE. File this as a bug in the Texmaker issue tracker.
    – jub0bs
    Aug 14, 2015 at 12:25
  • 1
    This is also seen in other editors. Ulrikes solution is usually the fastest
    – daleif
    Aug 14, 2015 at 12:38
  • Now sorted thanks @Jubobs. I will file a bug report. Aug 14, 2015 at 12:38

1 Answer 1


You could add an $ after a comment sign: %$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .