8

Possible Duplicate:
Getting percent sign into an URL in a footnote

In reference to this question: Getting percent sign into an URL in a footnote

I'm using the url package and am still having trouble getting the % symbol to display right in footnotes. If I enter the URL address as is, I get error messages, but if I insert backslashes (replacing % with \%) the backslashes show up in the text. Any ideas on how to get the percent symbol to display properly?

marked as duplicate by Werner, cmhughes, topskip, egreg, lockstep Jan 27 '12 at 0:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Please provide an example of what you've done/attempted in the form of a minimal working example (MWE) that illustrates your problem. When I compile the MWE in your linked post, the % shows up as expected. – Werner Jan 26 '12 at 21:42
  • Thanks. So I have: \footnote{\url{web.mac.com\%3A5\%3A11.pdf}.} And the backslashes show up in the text. If I don't put them in, it won't even compile because everything after the first % gets treated as comment text. – twofeet Jan 26 '12 at 21:44
  • 1
    Note that the linked example uses \urldef\myurl\url{web.mac.com\%3A5\%3A11.pdf} and then \footnote{\myurl} and not the nested \footnote{\url{...}} notation. – Werner Jan 26 '12 at 21:51
  • OK, that works. I didn't think it would compile with that definition of \myurl, since part of it shows up as comment text in my editor. But it does work. Thanks! – twofeet Jan 26 '12 at 21:56
8

The only safe way to use URLs containing special characters such as % in footnotes is via \urldef:

\urldef{\webmaccom}\url{web.mac.com%3A5%3A11.pdf} % in the preamble

\footnote{\webmaccom} % in the document
  • Thanks. I'd like to vote these answers up but now that I've registered I'm not getting "credit" for this question. Is there a way to tell the system that I asked this question? (I'm only able to write this comment because I registered using another browser.) – twofeet Jan 26 '12 at 23:55
  • The question will be closed as duplicate; you should register on the site, in order to be able to upvote and comment. Then a moderator can merge your registered account with the unregistered one. – egreg Jan 26 '12 at 23:59
  • OK. How do I get a moderator to merge my accounts? – twofeet Jan 27 '12 at 0:02
  • I will flag your question to make them aware. – egreg Jan 27 '12 at 0:08
5

Every editor is different. For example, even in this answer, the formatting may seem incorrect:

\urldef\myurl\url{web.mac.com%3A5%3A11.pdf}

But, the compiler will in interpret this correctly. Since URLs typically have strange (or special) characters in them, people are also inclined to use \verb|web.mac.com%3A5%3A11.pdf|. However, verbatim content is known to be problematic when passed as an argument. As such, you need to resort to using packages like fancyvrb for appropriate passing.

  • Thanks, yeah, verbatim seemed dangerous. And again, it was surprising that something that showed up as commentary in my front-matter still compiled. – twofeet Jan 26 '12 at 23:45
  • @twofeet: As mentioned, the editor has no indication of the compiled output, which is dependent on category codes. – Werner Jan 26 '12 at 23:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.