Closed j-oldroyd closed 7 years ago
Thanks for the catch, and for the report. I'm surprised that neither \url
nor \href
don't protect against this anyway. Your fix looks like it would correct the specific problem, but as usual it seems a tad more complicated than one would expect:
http://tex.stackexchange.com/questions/12230/getting-percent-sign-into-an-url-in-a-footnote
Perhaps only ever using href
and sanitizing the visible portion, while keeping the actual link version untouched, would be the cleanest solution. Classes are winding down and I'll try to get on top of this one soon. Holler if it is making you unproductive at the moment and it is urgent.
Thanks, Rob
Hi Rob,
Thanks for the quick reply! So far it's been pretty easy to work around, and I don't foresee it causing further problems with what I'm doing, so there's no rush on my end. Thanks for all your hard work!
--Jesse
Dear Jesse,
I'm guessing you have a percent sign inside a c
element as the content (not @href
) of a url
. First three below all behave. Fourth is authored correctly, but fails (I basically know why).
<p><ol>
<li>Good: <url href="http:/%/" /></li>
<li>Good: <url href="http:/%/">stuff</url></li>
<li>Good: <url href="http:/%/">stuff<percent />junk</url></li>
<li>Fails: <url href="http:/%/"><c>stuff%junk</c></url></li>
</ol></p>
It needs fixing no matter what, but please let me know if this is your problem, or if a fix announced here (shortly?) solves your problem.
Thanks, Rob
Improvements in at 03ed65f2
Can you test? If there is still a problem, could you post a complete block of XML that I can paste into the sample article for testing?
Thanks again for reporting this. Still one rare case to fix, I'll cross-reference to this.
Hi Rob,
I've tried the fix from the newest commit but it's still giving me an error when I go to compile; it seems that it's not escaping the '%' in my URL in the LaTeX output. Here's the relevant chunk of code in my XML source. Please let me know if you need more (or less!).
<p><fn><url href="https://en.wikipedia.org/wiki/Carleson%27s_theorem">Carleson's Theorem</url></fn></p>
And here's the corresponding LaTeX output:
\par
\footnote{\href{https://en.wikipedia.org/wiki/Carleson%27s_theorem}{Carleson's Theorem}\label{fn-2}}%
I really appreciate you looking into this!
--Jesse
Thanks, Jesse - that's exactly what I need. I was giving exactly this scenario some thought later last night. It was good to fix the other stuff, but I see what I've missed for you due to footnotes.
Footnotes are a bit tricky (I'd ban them if I could!) - so try to be "conventional" in how you use them.
Relevant: http://tex.stackexchange.com/questions/10218/listings-in-a-footnote
Dear Jesse,
This should be fixed now at f4dcb982. Percents, and several other dangerous LaTeX characters, should now behave better in URL @href
attributes (and therefore in footnotes). I've incorporated (with credit) your example above.
See the sample article, Section 8.3 and Table 13.16. Thanks for your patience while I waited until I had time to dig into this one.
Rob
I have a URL that contains '%', and the conversion to LaTeX places this inside of an \href{} command which causes an error, since the percent sign apparently needs to be escaped. I think replacing
with
in the
mathbook-latex.xsl
file may fix this, but I'm far too much of a novice to say for sure.