From ff287ed37c8f8b296d8408acf1f932c90230daf2 Mon Sep 17 00:00:00 2001 From: MdSaifAliMolla <145194907+MdSaifAliMolla@users.noreply.github.com> Date: Sat, 1 Nov 2025 17:32:15 +0530 Subject: [PATCH 1/3] katex: add CSS support for notequal --- lib/model/katex.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/model/katex.dart b/lib/model/katex.dart index e4bd080e95..0ac4f2c7c4 100644 --- a/lib/model/katex.dart +++ b/lib/model/katex.dart @@ -611,6 +611,12 @@ class _KatexParser { _ => throw _KatexHtmlParseError(), }; + case 'thinbox': + // .thinbox { display: inline-flex; flex-direction: row; width: 0; max-width: 0; } + case 'rlap': + // .rlap { width: 0; position: relative; } + widthEm = 0; + // TODO handle more classes from katex.scss case 'mord': @@ -626,6 +632,9 @@ class _KatexParser { case 'nobreak': case 'allowbreak': case 'mathdefault': + case 'vbox': + case 'inner': + case 'fix': // Ignore these classes because they don't have a CSS definition // in katex.scss, but we encounter them in the generated HTML. // (Why are they there if they're not used? The story seems to be: From e5cbf2b3a84b5922ef056d7441eadc8fa83f8df1 Mon Sep 17 00:00:00 2001 From: MdSaifAliMolla <145194907+MdSaifAliMolla@users.noreply.github.com> Date: Sat, 1 Nov 2025 17:33:42 +0530 Subject: [PATCH 2/3] katex-test: add unit test for \ne(notequal) --- test/model/katex_test.dart | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/model/katex_test.dart b/test/model/katex_test.dart index 6ebc832e02..f0f0427218 100644 --- a/test/model/katex_test.dart +++ b/test/model/katex_test.dart @@ -731,6 +731,43 @@ class KatexExample extends ContentExample { ]), ]), ]); + + static final notEqual = KatexExample.inline( + r'not-equal, like `\ne`.', + //https://chat.zulip.org/#narrow/channel/7-test-here/topic/Saif.20KaTeX/near/2285658.2E01 + r'\ne', + '
' + '' + '
',[ + KatexSpanNode(nodes: [ + KatexStrutNode(heightEm: 0.8889, verticalAlignEm: -0.1944), + KatexSpanNode(nodes: [ + KatexSpanNode(nodes: [ + KatexSpanNode(nodes: [ + KatexSpanNode( + styles: KatexSpanStyles(widthEm: 0), + nodes: [ + KatexSpanNode( + styles: KatexSpanStyles(widthEm: 0), + nodes: [KatexStrutNode(heightEm: 0.8889, verticalAlignEm: -0.1944), + KatexSpanNode(nodes: [ + KatexSpanNode(nodes: [KatexSpanNode(text: '')]), + ]),KatexSpanNode(nodes: [])], + )]), + ])]), + KatexSpanNode(text: '=')]), + ]), + ]); } void main() async { @@ -754,6 +791,7 @@ void main() async { testParseExample(KatexExample.bigOperators); testParseExample(KatexExample.colonEquals); testParseExample(KatexExample.nulldelimiter); + testParseExample(KatexExample.notEqual); group('parseCssHexColor', () { const testCases = [ From e6d684c6bd35b5f4ee75cd7623af16b3606ab750 Mon Sep 17 00:00:00 2001 From: MdSaifAliMolla <145194907+MdSaifAliMolla@users.noreply.github.com> Date: Sat, 1 Nov 2025 17:34:15 +0530 Subject: [PATCH 3/3] katex-test: add widget test for \ne(notequal) --- test/widgets/katex_test.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/widgets/katex_test.dart b/test/widgets/katex_test.dart index 0d6a93ca52..ce4ca17d9a 100644 --- a/test/widgets/katex_test.dart +++ b/test/widgets/katex_test.dart @@ -81,6 +81,10 @@ void main() { ('a', Offset(2.47, 3.36), Size(10.88, 25.00)), ('b', Offset(15.81, 3.36), Size(8.82, 25.00)), ]), + (KatexExample.notEqual, skip: false, [ + ('=', Offset(0.0, 8.64), Size(16.0, 25.0)), + ('', Offset(0.0, 10.1), Size(0.0, 25.0)), + ]), ]; for (final testCase in testCases) {