4

This minimal example won't compile:

\documentclass{article}
\usepackage{url}
\newcommand{\mycommand}[1]{#1}
\begin{document}
\mycommand{\url{http://www.example.org/index.php?a=Hello%20World.}}
\end{document}

The reason is the percent sign inside the URL. Note that a percent sign occurs often in URLs and that the \url command usually handles it correctly. How do I fix this?

Volker
  • 347
  • 1
    I found duplicates, but I think I lack the reputation to link them: https://tex.stackexchange.com/questions/42413/displaying-percent-symbol-in-footnotes-using-url?lq=1 https://tex.stackexchange.com/questions/12230/getting-percent-sign-into-an-url-in-a-footnote?rq=1

    The only solution is a workaround but if there is no better solution this can be closed.

    – Volker Feb 09 '16 at 14:21
  • Do you need the \url at all? Or are you looking for a command that has a verbatim argument which allows % then? Something like \NewDocumentCommand{\mycommand}{v}{#1} (use xparse package for this!) –  Feb 09 '16 at 14:22
  • Yes, I need the \url. I want it to be clickable in the PDF. – Volker Feb 09 '16 at 14:24

0 Answers0