LaTeX forum ⇒ GeneralURL with % included, doesn't compile with Overleaf Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
ebigunso
Posts: 9
Joined: Sat Jul 29, 2017 5:04 pm

URL with % included, doesn't compile with Overleaf

Postby ebigunso » Mon Jun 04, 2018 9:23 pm

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?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9151
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Jun 05, 2018 3:11 pm

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 \urldef to define the URL in advance:

  1. \documentclass{article}
  2. \usepackage{url}
  3. \urldef{\technical}\url{https://www.iter.org/album/Media/7%20-%20Technical}
  4. \begin{document}
  5. \begin{figure}[!htbp]
  6. --figure here--
  7. \caption{stuff \protect \footnotemark}
  8. \end{figure}
  9. \footnotetext{ITER Organization \technical (2018/5/29)}
  10. \end{document}


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
Site admin

ebigunso
Posts: 9
Joined: Sat Jul 29, 2017 5:04 pm

Postby ebigunso » Wed Jun 06, 2018 3:08 pm

Thank you! This works perfectly.

I'll try to post a full working piece of code next time. Thanks for the advice as well :)


Return to “General”

Who is online

Users browsing this forum: No registered users and 14 guests