brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
961 stars 101 forks source link

link to (sub)section in title of that (sub)section #2370

Open GregDMeyer opened 5 months ago

GregDMeyer commented 5 months ago

In webpages with many sections, subsections, etc (like those frequently produced by LaTeXML), it can be really helpful to be able to easily get a link to specific section (using the #ID). For example, this is helpful if you want to send someone a paper but direct them to a specific relevant section. Certain sites, like this one generated by Sphinx, add a little link symbol to the end of section titles, that appears on hover, and can be copied and pasted to easily grab a link to that section. (Hover over a section header and look for the "¶" symbol that appears).

Would it be possible to add a flag to LaTeXML postprocessing to include such links? I tried to implement it with CSS ::after but I'm not sure it's possible. Also if this already exists and I missed it, apologies!

dginev commented 5 months ago

This feature has also been requested and discussed in the ar5iv context here: https://github.com/dginev/ar5iv/issues/92

It isn't currently available in the default LaTeXML CSS or in ar5iv, so it is a good enhancement suggestion to consider.

GregDMeyer commented 5 months ago

ah, thanks for linking to that issue!

Is it clear if it is actually possible to do in just CSS? According to this it seems like it may not be possible in a way that works well across browsers.

Anyway if I play with it and come up with a solution I will be sure to submit a pull request.

dginev commented 5 months ago

The github approach I was discussing in the ar5iv issue:

I think from a generic LaTeXML perspective that kind of solution is a bit heavy to do by default, but would be a reasonable post-processing customization. The meta issue there is how to enable convenient "theming" in post-processed HTML. I believe that currently requires swapping in a copy of the respective top-level XSLT, with only the desired bits modified.