Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use em rather than percent for MathML mo minsize, maxsize #2341

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/LaTeXML/Post/MathML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,9 @@ sub pmml_infix {
my %default_token_content = (
MULOP => "\x{2062}", ADDOP => "\x{2064}", PUNCT => "\x{2063}");

# chars that all browsers will know are stretchy (notably, apparently, NOT "|")
my %safe_stretchy = map { $_ => 1; } "(", ")", "[", "]", "{", "}";

# Remaps some mathvariants to a simpler subset of Unicode
my %plane1hackable = ( # CONSTANT
script => 'script',
Expand Down Expand Up @@ -777,11 +780,15 @@ sub stylizeContent {
# (Thanks Peter Krautzberger)
# Really we should check the Operator Dictionary to see if it's expected to be symmetric
if ($size) { # if non-default size
if ($size =~ /^(.*?)%$/) { # Convert to em, as safari apparently ignores %
$size = fmt_em($1 / 100); }
if ($issymm || $props{symmetric}) { # but should be symmetric?
$stretchyhack = 1;
$stretchy = 1; } # so, pretend we asked for stretchy
# BUT force attribute to avoid browser bugs. (esp "|")
$props{stretchy} = undef unless $safe_stretchy{$text};
$stretchy = 1; } # so, pretend we asked for stretchy
elsif ($tag eq 'm:mo') {
$stretchy = undef; } } } # Conversely, if size specifically set, don't stretch it!
$stretchy = undef; } } } # Conversely, if size specifically set, don't stretch it!

return ($text,
($variant ? (mathvariant => $variant) : ()),
Expand Down
Loading