Skip to content

\href and math mode#2739

Open
remimorvan wants to merge 2 commits into
brucemiller:masterfrom
remimorvan:fixhrefinmath
Open

\href and math mode#2739
remimorvan wants to merge 2 commits into
brucemiller:masterfrom
remimorvan:fixhrefinmath

Conversation

@remimorvan
Copy link
Copy Markdown

This pull request fixes the behaviour of the \href command while in math mode, and of math passed as an argument to \href.

  • The LaTeX code $\href{#}{x = y}$ did not produce any link. The href attribute was present in the XML file, but not in the HTML. This is fixed by changing the pmml_maybe_resize subroutine in the postprocessor.
  • The LaTeX code \item foo \href{#}{$x = y$} (inside an itemize environment) was producing a link, but a linebreak was present between foo and the link. This is fixed by changing the css.

@dginev
Copy link
Copy Markdown
Collaborator

dginev commented Jan 14, 2026

Nice initiative, as this synchronizes with another effort. MathML Core is about to introduce a new use for <a> anchor elements inside MathML to hold links, in contrast to the MathML 3 use of the href attribute on MathML elements themselves. That is tracked in PR w3c/mathml-core#307

I think we should wait just a little for that change to land in MathML Core, then start emitting these <a> elements right away in LaTeXML. Bruce likely has his own thoughts on the ideal timeline, logging my own for now.

@dginev
Copy link
Copy Markdown
Collaborator

dginev commented Jan 14, 2026

Btw, the CSS change seems unrelated, and is probably discussed better elsewhere.

@brucemiller
Copy link
Copy Markdown
Owner

Interesting; So, href already works for tokens (handled in stylizeContent), but not for mrow expressionsl perhaps patching pmml_maybe_resize is the right approach (it's already been abused to do frames & colors, so it's not just resizing after all).

But I don't get what the 2nd point is about. The XML and HTML do indeed get a newline between the "foo" and the math element, but that shouldn't cause a linebreak in the display unless there's some other line wrapping going on.

text-align:right; }
.ltx_item .ltx_tag + .ltx_para {
display:inline-block; vertical-align:top;}
.ltx_item .ltx_tag + .ltx_para,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants