Render operatorname as upright math text

This commit is contained in:
gloamxun committed 2026-10-20 01:50:49 +08:00
1 parent 1e7cfd2c85
commit 65b50072af
2 files changed
+15 -1

No files matched your search

+1 -1
View File
@@ -140,7 +140,7 @@ const PRELUDE: &str = r#"
\def\mathbb#1{\texrramathfontstart{blackboard}#1\texrramathfontend}
\def\mathfrak#1{\texrramathfontstart{fraktur}#1\texrramathfontend}
\def\boldsymbol#1{\texrramathfontstart{bold}#1\texrramathfontend}
\def\operatorname#1{\texrraoperatorstart#1\texrraoperatorend}
\def\operatorname#1{\mathrm{#1}}
\def\stackrel#1#2{\mathrel{\mathop{#2}\limits^{#1}}}
\def\overset#1#2{\mathop{#2}\limits^{#1}}
\def\underset#1#2{\mathop{#2}\limits_{#1}}
+14
View File
@@ -1826,6 +1826,20 @@ fn aligned_with_leading_space_and_big_brace_compiles() {
assert_eq!(value["status"], "ok");
}
#[test]
fn operatorname_renders_operator_glyphs() {
let source =
"\\documentclass{article}\n\\begin{document}\n$\\operatorname{H}(x)$\n\\end{document}\n";
let value = fresh_preview(source, "operatorname.tex");
assert_eq!(value["status"], "ok");
let svg = page_svg(&value, 0);
assert!(
svg.matches("<image").count() >= 2,
"operatorname should paint its glyphs: {}",
&svg[..svg.len().min(300)]
);
}
#[test]
fn eqref_and_math_accents_compile() {
let source = r#"\documentclass{article}