LaTeXML icon indicating copy to clipboard operation
LaTeXML copied to clipboard

llncs: Weird `\url` behavior with math

Open nschloe opened this issue 2 years ago • 1 comments

When a tilde appears in an URL, LaTeX users will frequently and incorrectly replace it with $\sim$ (since the tilde character is a non-breaking space in LaTeX).

Here's a particularly weird case:

\documentclass{llncs}
\begin{document}
\url{http://example.com/$\sim$jdoe/}
\end{document}

LaTeX output:

screenshot_2023-11-02-174926

LaTeXML output:

<p><ref href="http://example.com/$∼$jdoe/">http://example.com/$∼$jdoe/</ref></p>

Somehow, the "math" gets lost and the dollar signs are taken literally.

nschloe avatar Nov 02 '23 16:11 nschloe

There's something stranger going on. The pdf shows http://example.com/~jdoe/ but the hyperref is to http://example.com

And if you \usepackage{url}, then the pdf shows http://example.com/$\sim$jdoe/ and the hyperref is to http://example.com/$%5Csim$jdoe/ and LaTeXML has http://example.com/$\sim$jdoe/ in both places.

teepeemm avatar Feb 04 '24 01:02 teepeemm