I am adding a footnote:
\footnote{\url{http://example.org/\#manual}}
The hashtag # escaped and success in compile the document and result in a http://example.org/#manual footnote. However, the link itself was encoded, and if one clicks the URL, it will open http://example.org/%23manual, which cannot be processed by the destination website.
Since we cannot change the behavior of the destination website, how to disable the URL encoding for the URL itself?
Example, use latexmk -pdf main.tex to compile:
% main.tex
\documentclass{scrartcl}
\usepackage{hyperref}
\begin{document}
Read\footnote{\url{https://threejs.org/docs/index.html\#manual/en/introduction/Creating-a-scene}}
\end{document}
If we click the generated URL, the link opened in a browser is encoded by the percentage symbol, i.e. because the hashtag is encoded to %23.
Expected:
https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene
Actual:
https://threejs.org/docs/index.html%23manual/en/introduction/Creating-a-scene
It looks like the problem exists in the macOS Preview. Adobe Acrobat works and doesn't introduce URL encoding.
More investigation:
I believe this is a problem that can be addressed by the package but doesn't know how to do it. Evidence: in the hyperref's document (Septmber 2018), page 7, the link http://somewhere/path/file.pdf#nameddest=chapter.4 opens without URL encoding and works as expected.
A workaround (many thanks to @Ulrike Fischer), use the following instead:
\footnote{\color{blue}\texttt{http://example.org/\#manual}}
#character is correctly transcribed and the link works perfectly. – KersouMan Apr 27 '20 at 08:43#character just right. Would, by any chance, adding theinputencpackage with theutf8option as\usepackage[utf8]{inputenc}solve your problem? – KersouMan Apr 27 '20 at 09:13http://somewhere/path/file.pdf#nameddest=chapter.4opens without URL encoding. – Changkun Apr 27 '20 at 09:33http://somewhere/path/file.pdf#nameddest=chapter.4is not a real link in the manual, it is simple verbatim text. That means you pdf viewer is guessing what to do here (and now does it right). I'm sorry but there have been other reports regarding preview. It seems not to be the best of pdf viewer. – Ulrike Fischer Apr 27 '20 at 09:42\input{glyphtounicode} \pdfgentounicode=1in the preamble (or use lualatex), then use\texttt{http://somewhere/path/file.pdf\#nameddest=chapter.4}and hope for the best. But be aware that every pdf viewer will then have to guess that this is a link, so if your students use a viewer who doesn't do this they will have no link at all. – Ulrike Fischer Apr 27 '20 at 10:01