I am trying to include a URL in my Latex document which contains a pound sign, #, in it. If I run it without escaping the # sign, I get an error. If I escape it, then the escape character is printed out in the URL also. ("\#
" instead of "#
") Any ideas on how to fix this?
\documentclass[12pt, a4paper, twoside]{article}
\usepackage[T1]{fontenc}
\usepackage{endnotes}
\usepackage{url}
\begin{document}
Hello World\endnote{\url{http://www.rossettiarchive.org/docs/nb0005.duke.rad.html#0.1.19}}
\end{document}
Best Answer
As you noticed, the
#
confuses TeX, because the endnotes are eventually read in as a macro replacement text.Use
\urldef
for the problematic entry:Alternative way: put this in the preamble
and call