Skip to content

Incorrect placement of horizontally stretched math accents in justified lines #2301

@Omikhleia

Description

@Omikhleia

Accidentally noticed when checking solutions for #2300 -- just looking quickly (and not exhaustively yet) for possible impacts on my booklet SILE and the Hydra of Maths -- but the problem was already in the original edition.

It's just slightly more visible here (with the last "attempt" on #2300, resulting in slightly scaled parentheses also raising the overline bar...), but it was still present and I just failed to notice it earlier...

Image

... And that overline bar is actually misplaced -- it should have been as MathJax renders it with the exact same formula (\textstyle added to switch to inline mode):

Image

Minimal reproduction

Inline $`\mathcal{L}_\phi=\overline{\left(\partial_\mu\phi\right)}\partial^\mu\phi-\frac{\mu\phi-m_h^2\left[\bar{\phi}\phi-\frac{\nu^2}{2}\right]^2}{2\nu^2}`

$`\mathcal{L}_\phi=\overline{(\partial_\mu\phi)}\partial^\mu\phi-\frac{\mu\phi-m_h^2[\bar{\phi}\phi-\frac{\nu^2}{2}]^2}{2\nu^2}`

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
$`\mathcal{L}_\phi=\overline{\left(\partial_\mu\phi\right)}\partial^\mu\phi-\frac{\mu\phi-m_h^2\left[\bar{\phi}\phi-\frac{\nu^2}{2}\right]^2}{2\nu^2}`
Sedeiusmod tempor incididunt.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
$`\mathcal{L}_\phi=\overline{(\partial_\mu\phi)}\partial^\mu\phi-\frac{\mu\phi-m_h^2[\bar{\phi}\phi-\frac{\nu^2}{2}]^2}{2\nu^2}`
Sedeiusmod tempor incididunt.
Image

Analysis

  • It's correct when the line is short.

  • It's independent from \left...\right constructs being explicitly used or not

  • It occurs when the line is stretched or shrunk due to justification. The formula is also stretched or shrunk, everything seems at its intended place, except the accents.

    Image

Solution

It turns out there's just a missing scaling for the x position in the call to scaleFn() in method elements.text:output

SILE.outputter:scaleFn(x, y, xratio, yratio, function ()

Should have been:

SILE.outputter:scaleFn(scaleWidth(x, line), y, xratio, yratio, function ()

(Well, this scaleWidth(x, line) is invoked a few lines earlier, so could be stored in a variable of course, and just reused)

And hurray! This does fix too in my booklet some slightly offset accents on p. 5 (formula above the table of contents), which I had noticed but did not understood at the time.

Metadata

Metadata

Assignees

Labels

modules:packagesIssue relates to core or 3rd party packages

Type

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions