The math converters build their OMML directly, bypassing the writer's text-property environment, so runs in a mark span lost the highlight pen: a paragraph like `==alpha $x^2$ beta==` highlighted its text but left the formula bare, while the HTML and LaTeX writers highlight (math included) through `<mark>` and `\hl`. OMML runs take Word run properties in a `w:rPr` child after an optional `m:rPr`; inject the ambient highlight there, in every run of the converted expression. Unmarked math is unchanged. Penning only the glyph runs of a marked equation rendered as a segmented band: the spacing around groups and operators belongs to no m:r, so it stayed bare. Word keeps the formatting of a structure's non-glyph parts in a control run (`m:ctrlPr` inside the structure's property element) and pens it when an equation is highlighted by hand. `highlightMathRuns` does the same: every structure's `m:ctrlPr` takes the ambient highlight, synthesizing the property element when the converters omitted it and merging into an existing `w:rPr` rather than duplicating it. Marked equations now highlight continuously, matching Word's native pen.
13 lines
447 B
Plaintext
13 lines
447 B
Plaintext
[ Para
|
|
[ Span
|
|
( "" , [ "mark" ] , [] )
|
|
[ Str "a " , Math InlineMath "x^2" , Str " b" ]
|
|
]
|
|
, Para
|
|
[ Span ( "" , [ "mark" ] , [] ) [ Math DisplayMath "z = 1" ] ]
|
|
, Para [ Span ( "" , [ "mark" ] , [] ) [ Math InlineMath "\\hat{x}" ] ]
|
|
, Para [ Span ( "" , [ "mark" ] , [] )
|
|
[ Math InlineMath "\\sin x + \\sum_{i=1}^n i + \\frac{a}{b} + \\sqrt[3]{x}" ] ]
|
|
, Para [ Str "unmarked " , Math InlineMath "x^2" , Str " math" ]
|
|
]
|