Hello. I'm using Overleaf to create a report, and I have run into an issue where Overleaf wouldn't compile URLs with % included in it.
I am using the URL package, and here is what I am having trouble with:
--figure here--
\caption{stuff \protect \footnotemark}
--figure end here--
\footnotetext{ITER Organization \url{https://www.iter.org/album/Media/7%20-%20Technical} (2018/5/29)}
Since I am using the URL package, if I try to escape the % as in \%, the resulting PDF will show the \ as well which is not ideal. When I have it in the form I posted above, the % is considered a start of a comment line even though it's inside a \url{}.
I haven't had this issue on my local TeX Live install, so I'm confused. What is going on, and how can I fix it?
General ⇒ URL with % included, doesn't compile with Overleaf
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10344
- Joined: Mon Mar 10, 2008 9:44 pm
URL with % included, doesn't compile with Overleaf
Hi,
in general it would be good if you would post a small piece of (compilable) code that shows the issue. So we can test it and fix it. Otherwise every reader has to build a test example on his own and possibly simply skips the topic if there's not much time.
Here is a solution: using
You can see how handy such a small example is: you could open it by just one click in Overleaf (top right of the code block) and see the result. 
Stefan
in general it would be good if you would post a small piece of (compilable) code that shows the issue. So we can test it and fix it. Otherwise every reader has to build a test example on his own and possibly simply skips the topic if there's not much time.
Here is a solution: using
\urldef
to define the URL in advance:Code: Select all
\documentclass{article}
\usepackage{url}
\urldef{\technical}\url{https://www.iter.org/album/Media/7%20-%20Technical}
\begin{document}
\begin{figure}[!htbp]
--figure here--
\caption{stuff \protect \footnotemark}
\end{figure}
\footnotetext{ITER Organization \technical (2018/5/29)}
\end{document}

Stefan
LaTeX.org admin
URL with % included, doesn't compile with Overleaf
Thank you! This works perfectly.
I'll try to post a full working piece of code next time. Thanks for the advice as well
I'll try to post a full working piece of code next time. Thanks for the advice as well
