Skip to content

Commit d257a2a

Browse files
committed
Add additional operators to operators list
This is to ensure that they are wrapped appropriately in <mo> tags as expected, instead of <mi> tags, which adversely changes the display, and is also semantically incorrect.
1 parent f8ecfc6 commit d257a2a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

latex2mathml/converter.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
r">",
3232
r"<",
3333
r".",
34+
r"\ast",
3435
r"\bigotimes",
36+
r"\cdot",
3537
r"\centerdot",
38+
r"\div",
3639
r"\dots",
3740
r"\dotsc",
3841
r"\dotso",
@@ -42,15 +45,18 @@
4245
r"\lvert",
4346
r"\lVert",
4447
r"\lvertneqq",
48+
r"\mp",
4549
r"\ngeqq",
4650
r"\omicron",
51+
r"\pm",
4752
r"\rvert",
4853
r"\rVert",
4954
r"\S",
5055
r"\smallfrown",
5156
r"\smallint",
5257
r"\smallsmile",
5358
r"\surd",
59+
r"\times",
5460
r"\varsubsetneqq",
5561
r"\varsupsetneqq",
5662
)

tests/test_converter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
pytest.param("12x", MultiDict([("mn", "12"), ("mi", "x")]), id="numbers-and-identifiers"),
2020
pytest.param("+", {"mo": "&#x0002B;"}, id="single-operator"),
2121
pytest.param("3-2", MultiDict([("mn", "3"), ("mo", "&#x02212;"), ("mn", "2")]), id="numbers-and-operators"),
22+
pytest.param(r"3 \times 2", MultiDict([("mn", "3"), ("mo", "&#x000D7;"), ("mn", "2")]), id="numbers-and-operators-times"),
23+
pytest.param(r"3 \cdot 2", MultiDict([("mn", "3"), ("mo", "&#x000B7;"), ("mn", "2")]), id="numbers-and-operators-cdot"),
24+
pytest.param(r"3 \div 2", MultiDict([("mn", "3"), ("mo", "&#x000F7;"), ("mn", "2")]), id="numbers-and-operators-div"),
2225
pytest.param(
2326
"3x*2",
2427
MultiDict([("mn", "3"), ("mi", "x"), ("mo", "&#x0002A;"), ("mn", "2")]),

0 commit comments

Comments
 (0)