Today I Learned that using quoted URLs in \(\LaTeX\) is quite tricky, and that `\detokenizer` is your friend.
I was trying to have a `\footnote` that pointed to the ALMA papers which are refereed, and that are published in the astronomy collection of the NASA Astronomy Database System (ADS) [1], and I was getting errors while trying to use
HyperRef's `\url` and `\href` commands, in particular a Runaway error inside footnote and href.
In the end, there were several issues that made LaTeX hickup on it.
The first one, the URL was not fully quoted, and needed to change `(` and `)` to their quoted versions,`%28` and `%29`, respectively, because the parenthesis were also considered suspect.
The second one, and is the main source of issues, is that `%`, in LaTeX, is the character for line comments: anything in the line after `%` is treated as a comment, unless it is in a verbatim environment… or inside `\detokenizer`.
Third, even with `\detokenizer{https://url.tld/%20quoted%20url}`, you might get issues.
So, what solved the issue?
🧵 1/2
#TIL #TodayILearned #LaTeX #HyperRef #HRef #XURL #detokenizer #LaTeXQuirks

