[Tex/LaTex] Why is hyperref inverting URL /’s to a backslash

hyperrefurls

This code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}

\begin{document}
\begin{center}
\url{http://demonstrations.wolfram.com/preview.html?draft/93173/000001/BallisticHookePendulum}
\end{center}
\end{document}

prints the URL properly. But if you click on it in the PDF the URL it tries to open have some of the /s changed by \s. Any idea why this is happening?

Best Answer

I don't have the exact answer, but rather an observation. I would have posted this as a comment but I cannot because of my low reputation. I am also using TexMaker, and I wanted to put this link into my report:

http://www.swi-prolog.org/pldoc/doc_for?object=section(%27packages/http.html%27)

It didn't work, as one / was treated as a \. The forward slashes that are converted to back slashes are the ones following a ? in the url. In the url you provide, after preview.html there is a question mark so the rest becomes draft\93173\000001\BallisticHooke‌​Pendulum. For my link, there's a question mark after doc_for, and the rest of the url is interpreted as object=section(%27packages\http.html%27).

As far as I've seen this is not a (pdf)Latex/MikTex problem. I have tried opening the same url with Adobe Reader and it works fine. It seems that only TexMaker gets it wrong on my computer. I am not sure why, however.

Related Question