From d257a2ab13b230a8dec898483ae96e55c1489c15 Mon Sep 17 00:00:00 2001 From: delfanbaum Date: Tue, 18 Nov 2025 12:54:41 -0500 Subject: [PATCH 1/2] Add additional operators to operators list This is to ensure that they are wrapped appropriately in tags as expected, instead of tags, which adversely changes the display, and is also semantically incorrect. --- latex2mathml/converter.py | 6 ++++++ tests/test_converter.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/latex2mathml/converter.py b/latex2mathml/converter.py index 195830a..620aa4c 100644 --- a/latex2mathml/converter.py +++ b/latex2mathml/converter.py @@ -31,8 +31,11 @@ r">", r"<", r".", + r"\ast", r"\bigotimes", + r"\cdot", r"\centerdot", + r"\div", r"\dots", r"\dotsc", r"\dotso", @@ -42,8 +45,10 @@ r"\lvert", r"\lVert", r"\lvertneqq", + r"\mp", r"\ngeqq", r"\omicron", + r"\pm", r"\rvert", r"\rVert", r"\S", @@ -51,6 +56,7 @@ r"\smallint", r"\smallsmile", r"\surd", + r"\times", r"\varsubsetneqq", r"\varsupsetneqq", ) diff --git a/tests/test_converter.py b/tests/test_converter.py index d8f22a2..fcf5a53 100644 --- a/tests/test_converter.py +++ b/tests/test_converter.py @@ -19,6 +19,9 @@ pytest.param("12x", MultiDict([("mn", "12"), ("mi", "x")]), id="numbers-and-identifiers"), pytest.param("+", {"mo": "+"}, id="single-operator"), pytest.param("3-2", MultiDict([("mn", "3"), ("mo", "−"), ("mn", "2")]), id="numbers-and-operators"), + pytest.param(r"3 \times 2", MultiDict([("mn", "3"), ("mo", "×"), ("mn", "2")]), id="numbers-and-operators-times"), + pytest.param(r"3 \cdot 2", MultiDict([("mn", "3"), ("mo", "·"), ("mn", "2")]), id="numbers-and-operators-cdot"), + pytest.param(r"3 \div 2", MultiDict([("mn", "3"), ("mo", "÷"), ("mn", "2")]), id="numbers-and-operators-div"), pytest.param( "3x*2", MultiDict([("mn", "3"), ("mi", "x"), ("mo", "*"), ("mn", "2")]), From aec68291b8e734aa4df0bd45ca22cb349370b65a Mon Sep 17 00:00:00 2001 From: delfanbaum Date: Wed, 19 Nov 2025 10:51:52 -0500 Subject: [PATCH 2/2] Remove \pm and \mp as they caused test regression Will review the cases later --- latex2mathml/converter.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/latex2mathml/converter.py b/latex2mathml/converter.py index 620aa4c..39dfd4c 100644 --- a/latex2mathml/converter.py +++ b/latex2mathml/converter.py @@ -45,10 +45,8 @@ r"\lvert", r"\lVert", r"\lvertneqq", - r"\mp", r"\ngeqq", r"\omicron", - r"\pm", r"\rvert", r"\rVert", r"\S",