jgm / texmath

A Haskell library for converting LaTeX math to MathML.
GNU General Public License v2.0
312 stars 65 forks source link

Latex -> HTML hyperref in equation bug #186

Closed augustin-chevallier closed 2 years ago

augustin-chevallier commented 2 years ago

Explain the problem. Latex: \documentclass{article} \usepackage[hidelinks]{hyperref} \begin{document}

\section{test} \label{test}

$\hyperref[test]{K}$ \end{document}

isn't correctly parsed. The result should be a link inside the mathematical equation. Instead, Pandoc output a webpage showing \hyperref[test]K

Pandoc version? Pandoc 2.16.2 on Windows.

jgm commented 2 years ago

I didn't even know hyperref could be used inside math. In any event, moving this to texmath which does the math parsing. Probably the best we could do is ignore the link.

augustin-chevallier commented 2 years ago

Ok! Should I open another issue in texmath?

jgm commented 2 years ago

I moved the issue to texmath and already closed it (hyperref now ignored; you don't get a link but it won't stop the rest of the translation).

lcnbr commented 1 year ago

@jgm I don't know if this is the place to say this, but it seems like supporting hyperlinks in math could be a very powerful feature. See dlmf for a nice use case, with tooltips as well! On top of this one could build symbol glossaries, that are linked directly to the symbol. This is already done if one loads the hyperref package along with the glossaries package. Additionally, mathml supports tooltips and links as well (c.f. mathml-actions), so it would make sense to be able to translate.

jgm commented 1 year ago

If you want you can create an issue in jgm/texmath requesting support of hyperlinks. It would be quite an involved change, though. We'd need to change the basic types and all the readers and writers. And we'd need to collect information about how the hyperlinks are represented in tex, mathml, ooxml.