sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Multiple labels inside math directives

Open tuncbkose opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. I'd like to label and refer to individual lines inside math directives.

Describe the solution you'd like Something like a :labels: option discussed here could work.

Describe alternatives you've considered I've tried thinking of sufficiently good workarounds, but nothing will work as well as a proper solution in Sphinx. I'm working on a document where both the HTML and LaTeX outputs matter and I couldn't devise a band-aid solution that works for both. But if one cares only about one of them, for example HTML, one could probably label/tag manually with LaTeX, and refer to them with {math}`\eqref{...}` .

tuncbkose avatar May 17 '24 07:05 tuncbkose

I was looking around to find the relevant part of the code, which seems to be patches.py.

The current behavior is due to the reference targeting the entire math_block. In order to label individual lines, I imagine one needs to break the math_block into pieces.

tuncbkose avatar May 17 '24 13:05 tuncbkose

+1 I currently convert a latex manual to sphinx, so an online documentation as well as a pdf can be generated. In this document I have a rather big equation with multiple lines which all are referenced inside the text.

ThoreWietzke avatar Jun 17 '24 14:06 ThoreWietzke