Suppose you want to create a URL that has embedded % signs. One option is to just use \%, but you don't get the benefit of nice line breaks. Another option is to use the hyperref package and its \url command. There is no need to escape the % sign then, but you might as well, since most editors will get the syntax highlighting wrong otherwise. But suppose you don't want hyperref. There's also the url package which just gives nice line breaks but no links. Unfortunately, trying to use \% with this package actually typesets it literally as \%, instead of escaping the % sign. Is there anything that can be done about this? (Simplifying assumption, if it helps: I have no intention of typesetting a url that contains an embedded \ within this document.) I suppose I should provide a MWE example, though it seems superfluous here:

  • The main purpose of using the \url macro of the eponymous package is to typeset URL strings that may contain (nearly) arbitrary characters. If you're going to use the url package, why would you even consider escaping "special" characters (such as %) in the first place? – Mico Jan 19 '16 at 5:02
  • My editor's syntax highlighting gets confused otherwise. – Mark Jan 19 '16 at 5:04
  • 1
    Which editor do you use? Is there a way to turn off syntax checking inside the argument of \url? Clearly, no syntax checking should be going on in there. – Mico Jan 19 '16 at 5:06
  • I use TexWorks. – Mark Jan 19 '16 at 5:06
  • I've taken the liberty of adding the tag 'texworks' to your posting. – Mico Jan 19 '16 at 5:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.