academic-mathtype-engine 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,104 @@
1
+ """Validate MTEF 5 setup records before examining the equation body."""
2
+ import re
3
+
4
+ _MAX_PREFIX = 8192
5
+ _ROOT_LINE = bytes((10, 1, 0))
6
+
7
+
8
+ class _Cursor:
9
+ def __init__(self, data: bytes):
10
+ self.data = data
11
+ self.pos = 0
12
+ self.limit = min(len(data), _MAX_PREFIX)
13
+
14
+ def byte(self) -> int:
15
+ if self.pos >= self.limit:
16
+ raise ValueError("Truncated or oversized MTEF settings")
17
+ value = self.data[self.pos]
18
+ self.pos += 1
19
+ return value
20
+
21
+ def uint(self) -> int:
22
+ value = self.byte()
23
+ if value == 255:
24
+ value = self.byte() + (self.byte() << 8)
25
+ return value
26
+
27
+ def string(self) -> bytes:
28
+ end = self.data.find(b"\x00", self.pos, min(self.limit, self.pos + 128))
29
+ if end <= self.pos:
30
+ raise ValueError("Invalid or oversized MTEF name")
31
+ value = self.data[self.pos:end]
32
+ # Platform-local font names may contain high bytes.
33
+ if any(c < 32 or c == 127 for c in value):
34
+ raise ValueError("Control character in MTEF name")
35
+ self.pos = end + 1
36
+ return value
37
+
38
+ def dimensions(self) -> None:
39
+ count = self.byte()
40
+ low = None
41
+
42
+ def nibble() -> int:
43
+ nonlocal low
44
+ if low is None:
45
+ pair = self.byte()
46
+ low = pair & 15
47
+ return pair >> 4
48
+ value, low = low, None
49
+ return value
50
+
51
+ for _ in range(count):
52
+ if nibble() > 4:
53
+ raise ValueError("Unknown MTEF dimension unit")
54
+ digits = []
55
+ while True:
56
+ part = nibble()
57
+ if part == 15:
58
+ break
59
+ if part > 11 or len(digits) >= 32:
60
+ raise ValueError("Invalid MTEF dimension")
61
+ digits.append("0123456789.-"[part])
62
+ if not re.fullmatch(r"-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)", "".join(digits)):
63
+ raise ValueError("Missing or malformed MTEF dimension value")
64
+ if low not in (None, 0):
65
+ raise ValueError("Invalid MTEF dimension padding")
66
+
67
+
68
+ def parse_prefix(data: bytes) -> int:
69
+ """Return the FULL offset after the validated header and definition records."""
70
+ cur = _Cursor(data)
71
+ if cur.byte() != 5 or cur.byte() not in (0, 1) or cur.byte() != 0:
72
+ raise ValueError("Unsupported MTEF 5 equation header")
73
+ cur.byte() # product major version
74
+ cur.byte() # product subversion
75
+ if not re.fullmatch(rb"[A-Za-z0-9_.-]{1,64}", cur.string()):
76
+ raise ValueError("Unsupported MTEF application key")
77
+ if cur.byte() not in (0, 1):
78
+ raise ValueError("Unsupported MTEF equation options")
79
+ encodings = 4 # predefined MTCode, Unknown, Symbol, MTExtra
80
+ fonts = 0
81
+ saw_prefs = False
82
+ while not data.startswith(_ROOT_LINE, cur.pos):
83
+ tag = cur.byte()
84
+ if tag == 19 and not saw_prefs: # ENCODING_DEF
85
+ cur.string()
86
+ encodings += 1
87
+ elif tag == 17 and not saw_prefs: # FONT_DEF
88
+ if not 1 <= cur.uint() <= encodings:
89
+ raise ValueError("MTEF font references an undefined encoding")
90
+ cur.string()
91
+ fonts += 1
92
+ elif tag == 18 and not saw_prefs: # EQN_PREFS
93
+ if cur.byte():
94
+ raise ValueError("Unsupported MTEF preferences flags")
95
+ cur.dimensions() # size definitions
96
+ cur.dimensions() # spacing definitions
97
+ for _ in range(cur.byte()):
98
+ font = cur.uint()
99
+ if font > fonts or (font and cur.byte() > 3):
100
+ raise ValueError("Invalid MTEF style definition")
101
+ saw_prefs = True
102
+ else:
103
+ raise ValueError(f"Unsupported MTEF setup record {tag} at byte {cur.pos - 1}")
104
+ return cur.pos
@@ -0,0 +1,157 @@
1
+ """Serialize the supported expression tree as MTEF 5 records.
2
+
3
+ Selectors, option bits and style numbers are fields of WIRIS MTEF 5.
4
+ Slot placement and size transitions are checked against the frozen source/body pairs.
5
+ """
6
+ from dataclasses import dataclass
7
+ from enum import IntEnum
8
+ import struct
9
+
10
+
11
+ class UnsupportedFormula(ValueError):
12
+ """The input lies outside the supported equation grammar."""
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class Expr:
17
+ operator: str
18
+ value: str = ""
19
+ children: tuple = ()
20
+
21
+
22
+ class Size(IntEnum):
23
+ FULL = 10
24
+ SUBSCRIPT = 11
25
+ SYMBOL = 13
26
+
27
+
28
+ # Unicode characters and their optional 8-bit Adobe Symbol glyph positions.
29
+ # None uses the MTCode alone when the typeface has no matching legacy byte.
30
+ GLYPHS = {
31
+ "−": 45, "±": 177, "×": 180, "÷": 184, "≤": 163, "≥": 179, "≠": 185,
32
+ "≈": 187, "∈": 206, "∉": 207, "∂": 182, "∇": 209, "∞": 165,
33
+ "→": 174, "←": 172, "↔": 171, "∑": 229, "∏": 213, "∫": 242,
34
+ "∪": 200, "∩": 199, "⊂": 204, "⊆": 205, "⋅": 215, "·": None, "∥": None, "‖": None,
35
+ "∀": 34, "∃": 36, **{c: ord(c) for c in "+=<>"}
36
+ }
37
+ GREEK_GLYPHS = dict(zip("ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", "ABGDEZHQIKLMNXOPRSTUFCYW"))
38
+ GREEK_GLYPHS.update({letter.lower(): glyph.lower() for letter, glyph in GREEK_GLYPHS.items()})
39
+ GREEK_GLYPHS.update({"ϕ": "j", "ϑ": "J", "ϖ": "v", "ς": "V"})
40
+
41
+
42
+ def character(text, face, glyph=None, accent=None):
43
+ options = (4 if glyph is not None else 0) | (1 if accent else 0)
44
+ data = struct.pack("<BBBH", 2, options, 128 + face, ord(text))
45
+ if glyph is not None:
46
+ data += bytes([glyph])
47
+ if accent:
48
+ data += bytes([6, 0, accent, 0])
49
+ return data
50
+
51
+
52
+ def symbol(text, style, comma_style):
53
+ if text == "-":
54
+ text = "−"
55
+ if text in GREEK_GLYPHS:
56
+ return character(text, 5 if text.isupper() else 4, ord(GREEK_GLYPHS[text]))
57
+ if text in GLYPHS:
58
+ return character(text, 6, GLYPHS[text])
59
+ if text == ",":
60
+ style = comma_style
61
+ elif text in "()[]{}.:;":
62
+ style = 2
63
+ elif text.isdigit():
64
+ style = 8
65
+ elif not text.isalpha():
66
+ style = 3
67
+ return character(text, style)
68
+
69
+
70
+ def slot(contents):
71
+ if contents is None:
72
+ return bytes((1, 1))
73
+ return bytes((1, 0)) + contents + bytes(1)
74
+
75
+
76
+ def template(selector, variation, *records, restore=False):
77
+ result = bytes((3, 0, selector, variation, 0)) + b"".join(records) + bytes(1)
78
+ return result + bytes([Size.FULL]) if restore else result
79
+
80
+
81
+ FENCES = {"round": 1, "brace": 2, "square": 3, "absolute": 4, "norm": 5}
82
+ STYLES = {"mathbf": 7, "mathit": 3, "mathrm": 2}
83
+ ACCENT_IDS = {"dot": 2, "ddot": 3, "hat": 9, "bar": 17}
84
+
85
+
86
+ def serialize(node, style=3, comma_style=2):
87
+ op, value, children = node.operator, node.value, node.children
88
+
89
+ def write(expr):
90
+ return serialize(expr, style, comma_style)
91
+
92
+ def argument(expr):
93
+ return slot(None if expr is None else write(expr))
94
+
95
+ sub_size = bytes([Size.SUBSCRIPT])
96
+ large_symbol = bytes([Size.SYMBOL])
97
+ if op == "list":
98
+ return b"".join(map(write, children))
99
+ if op == "letter":
100
+ return symbol(value, style, comma_style)
101
+ if op == "function":
102
+ return b"".join(character(letter, 2) for letter in value)
103
+ if op == "style":
104
+ return serialize(children[0], STYLES[value], comma_style)
105
+ if op == "fraction":
106
+ return template(11, 0, *map(argument, children))
107
+ if op == "sqrt":
108
+ return template(10, 0, argument(children[0]), sub_size, slot(None), restore=True)
109
+ if op == "scripts":
110
+ base, lower, upper = children
111
+ both = lower is not None and upper is not None
112
+ selector = 29 if both else (27 if upper is None else 28)
113
+ slots = ([slot(None)] if both else []) + [argument(lower), argument(upper)]
114
+ return write(base) + template(selector, 0, sub_size, *slots, restore=True)
115
+ if op == "fence":
116
+ left, inner, right = children
117
+ variation = int(bool(left)) + 2 * int(bool(right))
118
+ marks = [character(mark, 22) for mark in (left, right) if mark]
119
+ return template(FENCES[value], variation, argument(inner), *marks)
120
+ if op == "matrix":
121
+ rows, cols = len(children), len(children[0])
122
+ # Each row/column boundary has a two-bit partition-line field.
123
+ header = bytes([5, 0, 1, 1, 1, rows, cols]) + bytes((rows+4)//4 + (cols+4)//4)
124
+ cells = (serialize(cell, style, 3 if value == "cases" else comma_style)
125
+ for row in children for cell in row)
126
+ return header + b"".join(slot(cell or None) for cell in cells) + bytes(1)
127
+ if op == "accent":
128
+ inner = children[0]
129
+ while inner.operator == "list" and len(inner.children) == 1:
130
+ inner = inner.children[0]
131
+ if (value in ACCENT_IDS and inner.operator == "letter" and
132
+ inner.value.isascii() and inner.value.isalpha()):
133
+ return character(inner.value, style, accent=ACCENT_IDS[value])
134
+ content = argument(children[0])
135
+ if value in {"widehat", "hat"}:
136
+ return template(33, 0, content, character("\u0302", 22))
137
+ if value in {"overline", "bar"}:
138
+ return template(13, 0, content)
139
+ if value in {"vec", "overrightarrow"}:
140
+ return template(31, 2, content, character("\u20d7", 22))
141
+ raise UnsupportedFormula(f"{value} requires a single Latin letter")
142
+ if op == "limit":
143
+ name = write(Expr("function", value))
144
+ return template(22, 0x50, slot(None), sub_size, argument(children[0]),
145
+ slot(None), large_symbol, slot(name), restore=True)
146
+ if op == "operator":
147
+ lower, upper, operand = children
148
+ selector, variation, sign = {"int": (15, 1, "∫"), "sum": (16, 64, "∑"),
149
+ "prod": (17, 64, "∏")}[value]
150
+ if upper is not None:
151
+ variation |= 0x30
152
+ elif lower is not None:
153
+ variation |= 0x10
154
+ return template(selector, variation, argument(operand), sub_size,
155
+ argument(lower), argument(upper), large_symbol,
156
+ slot(symbol(sign, style, comma_style)), restore=True)
157
+ raise ValueError(f"Unknown expression node {op}")
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: academic-mathtype-engine
3
+ Version: 1.0.0
4
+ Summary: Generate embedded MathType-compatible equation objects in Word documents from LaTeX
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Repository, https://github.com/waterboyNick/academic-mathtype-engine
7
+ Project-URL: Documentation, https://github.com/waterboyNick/academic-mathtype-engine#readme
8
+ Project-URL: Issues, https://github.com/waterboyNick/academic-mathtype-engine/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Scientific/Engineering
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ License-File: LICENSE_STATUS.md
16
+ License-File: THIRD_PARTY_NOTICES.md
17
+ Requires-Dist: python-docx<2,>=1.2
18
+ Requires-Dist: lxml<7,>=6.1.1
19
+ Requires-Dist: Pillow<13,>=12.3
20
+ Requires-Dist: matplotlib<4,>=3.10.8
21
+ Provides-Extra: test
22
+ Requires-Dist: olefile<1,>=0.47; extra == "test"
23
+ Requires-Dist: tomli>=2; python_version < "3.11" and extra == "test"
24
+ Dynamic: license-file
25
+
26
+ # Academic MathType Engine
27
+
28
+ Generate a Word equation collection from LaTeX on Linux, macOS or Windows. Each equation has its own embedded `Equation.DSMT4` OLE object and associated PNG preview. The independent backend constructs both parts locally. Word and MathType are required on the editing workstation only.
29
+
30
+ **Version 1.0.0.** The maintainer checked the delivered 105-equation document in Windows Word and reported that it worked. For the same inputs, the release writer reproduces all 227 document parts byte for byte. The exact desktop builds and per-equation editing observations were not reported. [中文](README.zh-CN.md) · [Verification](VALIDATION_REPORT.md) · [Licensing](LICENSE_STATUS.md)
31
+
32
+ ## Install and generate
33
+
34
+ Use Python 3.10 or newer. Install from PyPI in your virtual environment.
35
+
36
+ ```sh
37
+ python -m pip install academic-mathtype-engine==1.0.0
38
+ academic-mathtype doctor
39
+ ```
40
+
41
+ For a CLI example, save this UTF-8 array as `input.json`.
42
+
43
+ ```json
44
+ [
45
+ {"id":"eq1","label":"Quadratic fraction","latex":"\\frac{x_i^2+1}{y_0}"},
46
+ {"id":"eq2","label":"Inline variable","latex":"x+1","inline":true}
47
+ ]
48
+ ```
49
+
50
+ ```sh
51
+ academic-mathtype build input.json demo.docx
52
+ academic-mathtype validate demo.docx --expected 2
53
+ ```
54
+
55
+ The equivalent Python program is self-contained.
56
+
57
+ ```python
58
+ from academic_mathtype import build_docx, compile_latex, pack_ole, validate_docx
59
+
60
+ cases = [{"id": "q", "label": "Normalized response", "latex": r"\frac{x_i^2+1}{y_0}"},
61
+ {"id": "r", "label": "Inline residual", "latex": "r=x-y", "inline": True}]
62
+ build_docx(cases, "equations.docx")
63
+ validate_docx("equations.docx", len(cases))
64
+ ole_bytes = pack_ole(compile_latex(cases[0]["latex"]))
65
+ ```
66
+
67
+ The CLI accepts a UTF-8 JSON array with these same fields. Escape each LaTeX backslash as `\\` in JSON. IDs must be unique. Use `--title` and `--per-page` to lay out a collection. The CLI requires `--overwrite` to replace a file. The Python API validates the entire document before replacing the destination. Installed commands are also available through `python -m academic_mathtype`.
68
+
69
+ ## Formula and preview support
70
+
71
+ The grammar covers Latin and selected Greek symbols, functions, scripts, fractions, square roots, accents, vector and font styles, fences, six matrix/cases environments, integrals, sums, products and lower limits. Use paired braces for compound operands, e.g. `\sum_{i=1}^{n}{a_i-b_i}`. Indexed roots, arbitrary macros and arbitrary TeX environments are outside this dialect. Limits include 700 tokens per expression, 12 × 12 per matrix and a bounded native body of 1 MiB.
72
+
73
+ Install TeX providing `latex`, `amsmath`, `amssymb` and `dvipng` for the full preview set. With these commands missing, Matplotlib mathtext can render simpler previews. An unavailable preview or unsupported expression aborts the build. Read the diagnostic for the equation ID. Run `doctor` to check the native round trip and whether the TeX commands are discoverable on PATH.
74
+
75
+ ## Verification and contribution
76
+
77
+ The frozen tests verify eight files, 29 exact MTEF bodies and 100 historical OLE/native hashes. The independent corpus includes 105 accepted inputs and 10 rejection cases. The checklist can record separate editing observations for specific desktop builds. [Historical record](VALIDATION.md) · [Acceptance materials](validation/) · [Architecture](ARCHITECTURE.md)
78
+
79
+ ```sh
80
+ python -m pip install ".[test]"
81
+ python -m unittest -v test_engine test_frozen test_document
82
+ python -m unittest discover -s tests -v
83
+ python -m unittest discover -s release -v
84
+ ```
85
+
86
+ Submit changes on a branch with a minimal LaTeX input, its expected mathematical structure and a regression check. Keep private manuscripts, local profiles and third-party template binaries off the repository. Preserve the frozen manifest and tag. The package declares dependency ranges in `pyproject.toml`; `requirements.txt` records the historical reproduction versions. [Agent workflows](docs/SKILLS.md) · [Source provenance](SOURCE_PROVENANCE.md) · [Third-party notices](THIRD_PARTY_NOTICES.md) · [Publication gates](PYPI_RELEASE_READINESS.md)
@@ -0,0 +1,18 @@
1
+ academic_mathtype/__init__.py,sha256=mTykSSrTEmwpO2-Ejc9JWCBuRu1hhN3I8_SLxjpsj-8,332
2
+ academic_mathtype/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
3
+ academic_mathtype/cli.py,sha256=JKdbVkkyzrNSGc9LKdJmjozEUpJBZcm6E7CApZry_GQ,3275
4
+ academic_mathtype/compound.py,sha256=iF_ig8bUwRnoJcLYC4HsApSlkdJWqBu0BDIIzQ8gAr8,8529
5
+ academic_mathtype/document.py,sha256=8TpbgYdPcQtlcdMFPsTq1fnFafeZuxZYr-s5FiBeQuA,11122
6
+ academic_mathtype/formula.py,sha256=isO58IxaYtl1e1nXki5sO_WGOyJGjdP9PQnuZAmNOTY,8179
7
+ academic_mathtype/native.py,sha256=8xVSFmJt-dNnmMl0r5shSJajDzBL5jwidycYLJXSonA,9671
8
+ academic_mathtype/opc.py,sha256=IME-4d1dfOt3oJgS9J01KK-CfdzLN6fiH6s61EDr8lk,9114
9
+ academic_mathtype/prefix.py,sha256=LuamcKYzezRbkDNzbgrtjtpkVDAIaLLZrCKaT3ICBiY,3839
10
+ academic_mathtype/records.py,sha256=UWRQxkdkP5KPa2EOxArgwR8EXJ11ML85SWsfc7LyW4A,6273
11
+ academic_mathtype_engine-1.0.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
12
+ academic_mathtype_engine-1.0.0.dist-info/licenses/LICENSE_STATUS.md,sha256=yUkF_1ldZXP2Qt2cw1LXncTk_FQaj2zBJNuE1Tgz86Y,694
13
+ academic_mathtype_engine-1.0.0.dist-info/licenses/THIRD_PARTY_NOTICES.md,sha256=db4NZj_fuin0iI85pqaa-NxJzYZvED0HWzQzpe07Ln8,3429
14
+ academic_mathtype_engine-1.0.0.dist-info/METADATA,sha256=HmnsXHmr7W8SIi9kZoGamTCvRMe2gti0NDaSlufNbwI,5126
15
+ academic_mathtype_engine-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
16
+ academic_mathtype_engine-1.0.0.dist-info/entry_points.txt,sha256=s5YboBNDjMg0tWuq1vgX6Tf5vJDrqn5MGOO_3JkyM_g,65
17
+ academic_mathtype_engine-1.0.0.dist-info/top_level.txt,sha256=KeQUKyUkElYi59H_355Gm61iVbJF-ImZpKCzQCzEphM,18
18
+ academic_mathtype_engine-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ academic-mathtype = academic_mathtype.cli:main
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ # Distribution license and scope
2
+
3
+ The Apache License, Version 2.0 in LICENSE applies to the project-authored source, packaging files and documentation identified in the approved 1.0.0 source inventory. THIRD_PARTY_NOTICES.md describes separately installed components and mapping references. Their respective terms continue to apply. The release grants no rights in vendor trademarks, software or fonts.
4
+
5
+ The historical root engine, extracted templates, historical benchmark and user data are outside the inventory and outside this license designation. The release ledger and source/asset review describe the exact scope. The owner authorized publication of version 1.0.0 on PyPI on 2026-12-02.
@@ -0,0 +1,20 @@
1
+ # Third-party components and historical references
2
+
3
+ This inventory distinguishes install-time components from repositories consulted during historical development. Exact copyright notices and license texts for material approved for distribution must accompany that distribution as required. [Rights status](LICENSE_STATUS.md) · [Function-level provenance](SOURCE_PROVENANCE.md)
4
+
5
+ | Component | Use and observed terms |
6
+ | --- | --- |
7
+ | npofsi/docx-equation | Historical MTEF/OLE investigation. Copyright © 2026 npofsi in the MIT v0.3.0 archives. Later source metadata declares AGPL-3.0-only. The final payload review identified no incorporated upstream implementation. [Version evidence](SOURCE_PROVENANCE.md) |
8
+ | loveTimish/latextomathtype | Historical record conventions and diagnostics. No project-wide license file found in inspected reachable history. An earlier README designation was removed. [History and attribution](SOURCE_PROVENANCE.md) |
9
+ | MathType / WIRIS and Microsoft Word | Product and format identifiers describe interoperability. Historical shell, XML and benchmark contain material extracted from or generated with proprietary tools. The project is independent of the vendors. [Asset inventory](ASSET_PROVENANCE.md) |
10
+ | python-docx 1.2.0 | MIT. The installed dependency supplies the blank DOCX container, including its default document parts. [License](https://github.com/python-openxml/python-docx/blob/v1.2.0/LICENSE) |
11
+ | lxml 6.1.1 | BSD-3-Clause according to package metadata. Distributed lxml wheels can carry libxml2, libxslt and additional notices. [Project licensing](https://lxml.de/copyright.html) |
12
+ | Pillow 12.3.0 | MIT-CMU metadata. See individual binary distributions for their bundled library notices. [Pillow license](https://pillow.readthedocs.io/en/stable/about.html#license) |
13
+ | Matplotlib 3.10.8 | Matplotlib's PSF-style license, with separate notices for bundled software and fonts, including assets usable by the preview renderer. [License and dependencies](https://matplotlib.org/stable/project/license.html) |
14
+ | olefile 0.47 | BSD license for independent compound-file inspection. [Project licensing](https://www.decalage.info/olefile) |
15
+ | tomli | Conditional test/release tooling for Python versions lacking tomllib. MIT. [License](https://github.com/hukkin/tomli/blob/master/LICENSE) |
16
+ | TeX distribution, LaTeX, dvipng and fonts | Optional, installed by the user or test environment. Individual packages and fonts have their own terms. A binary, font program or complete TeX distribution would require a separate redistribution review. [TeX Live licensing](https://tug.org/texlive/copying.html) |
17
+
18
+ The listed versions identify reviewed installations. Actual dependency versions and bundled native libraries depend on platform and resolver. The wheel and sdist inventory should be checked separately for each approved package release. No upstream implementation archive, WIRIS SDK or proprietary font is authorized by this inventory.
19
+
20
+ The selected mathematical glyph positions were checked against the Adobe Symbol Encoding to Unicode mapping, copyright © 1991–2011 Unicode, Inc. The table permits use of its information in products supporting Unicode. Neither the mapping file nor the font is bundled. Python’s HTML entity mapping is accessed through the installed standard library. [Unicode mapping and notice](https://www.unicode.org/Public/MAPPINGS/VENDORS/ADOBE/symbol.txt)
@@ -0,0 +1 @@
1
+ academic_mathtype