Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0bebb37
Content MathML read through ctop.xsl; amssymb symbols in LaTeX
simonebortolin Nov 8, 2026
9299685
LaTeX reader: limits of \mathop{x} and of both scripts of \overbrace,…
simonebortolin Nov 8, 2026
848163b
LaTeX reader: \newenvironment and \renewenvironment, expanded as TeX …
simonebortolin Nov 8, 2026
da87d71
Merge remote-tracking branch 'origin/main' into claude/latex-limits-d…
simonebortolin Nov 8, 2026
870048c
[no-new-version] Run CI, CodeQL and pre-release cleanup on pull reque…
simonebortolin Nov 8, 2026
4635474
Merge fixes: one \Box in Renamed, the latex2mathml cases b6eeafc read…
simonebortolin Nov 8, 2026
0a1cb6e
Merge main into claude/latex-macros-bd8629
simonebortolin Nov 8, 2026
4a285b5
Merge main into claude/content-mathml
simonebortolin Nov 9, 2026
98cb283
mhchem: \ce and \pu in the LaTeX reader
simonebortolin Nov 9, 2026
b49e592
[no-new-version] LaTeX reader reads every command the writer writes
simonebortolin Nov 8, 2026
817ed28
[no-new-version] Merge pull request #11 from simonebortolin/claude/l…
simonebortolin Nov 9, 2026
25ad9c4
[no-new-version] Merge pull request #19 from simonebortolin/claude/mh…
simonebortolin Nov 9, 2026
6847bda
Merge origin/main into claude/latex-limits-dacdf3
claude Nov 9, 2026
9c156ab
Merge claude/latex-limits-dacdf3 into claude/latex-macros-bd8629
claude Nov 9, 2026
7e9243e
Merge branch 'macros' into content
claude Nov 9, 2026
688e13e
mhchem: prescripts written as \prescript, which the LaTeX reader now …
claude Nov 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ init-only record: `Display`, `Strict`, `PreserveFormatting`, `LaTeXFlavor` stand
`menclose notation="bottom"`. The default intents (`:fenced`, `:function`, `absolute-value`,
`binomial-coefficient`, the matrices...) are not kept, since they would make an equation differ by how it was
written (`\binom`, `⒞`, `(¦)`); `DefaultIntents.Restore` infers them again from the structure for the LaTeX and
UnicodeMath writers.
UnicodeMath writers. Content MathML of the source (`apply`, `ci`, `cn`..., outside the annotations) is first rewritten
as presentation MathML by `ctop.xsl` (David Carlisle's, see `NOTICE`), keeping the presentation MathML around it.
- `Internal/Omml/`: OMML ↔ MathML with the XSLT 1.0 stylesheets of `Resources/` (from the TEI Stylesheets, see
`NOTICE`), run with `XslCompiledTransform`. OMML is written as Word writes it (plain letters with `m:sty`/`m:scr`,
underbars as `m:bar`), and an upright word of OMML (`max`) is read as one identifier.
Expand Down
62 changes: 62 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,38 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------
src/SharpEquations/Resources/ctop.xsl
tests/data/contentmathml/ctop-*.mml

From https://github.com/davidcarlisle/web-xslt (ctop/ctop.xsl), the XSLT 1.0
stylesheet of Content MathML to presentation MathML, and its test equations
(ctop/tests/ctopxslt.html). The web-xslt collection is distributed under the MIT
licence; ctop.xsl also under the W3C Software Notice and License, Apache 2,
MPL 1.1 or MPL 2.0. SharpEquations uses them under the MIT licence, the stylesheet
modified as described in its header:

Copyright David Carlisle 2001, 2002, 2008, 2009, 2013.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

----------------------------------------------------------------------------
tests/data/latex/latex2mathml-*.json

Expand Down Expand Up @@ -238,3 +270,33 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------
src/SharpEquations/Internal/LaTeX/Mhchem.cs
tests/data/latex/treeblood-mhchem.json

The rules of mhchem's \ce in Mhchem.cs follow mhchem.go of https://github.com/Wyatt915/treeblood,
rewritten in C# to write LaTeX rather than MathML; the test cases are those of its test/TESTCASES.yaml:

MIT License

Copyright (c) 2024 Wyatt Sheffield

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ format) and LaTeX, in .NET, with MathML as the common representation.

| Format | Read | Write |
|---|---|---|
| MathML | ✓ | ✓ |
| MathML (presentation; Content MathML is read as the presentation it is written as) | ✓ | ✓ |
| OMML (Office Math Markup Language, the equations of `.docx`) | ✓ | ✓ |
| MTEF (MathType, Equation Editor 3.0) | ✓ | |
| UnicodeMath | ✓ | ✓ |
Expand Down
6 changes: 6 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ also regroups an n-ary operation or a function application that normalization fl
### MathML (`Internal/MathML/`)

`ParseXml` reads the XML with DTDs prohibited and no resolver (no external entities), the undeclared prefixes `mml:`, `m:` and `w:` known; in strict mode `Validate` accepts presentation MathML only.
Content MathML (`<apply><plus/><ci>x</ci><cn>1</cn></apply>`), alone or inside presentation MathML, is rewritten
first as the presentation MathML it is written as, by `ctop.xsl` (David Carlisle's stylesheet; the changes made
to it are in its header): the white space between the elements and around the text
of `ci` and `cn` goes before, and the limits it leaves empty (an integral without bounds) after. The Content MathML of
an `annotation-xml` is left alone, and a `semantics` whose first child is Content MathML is read from its
`MathML-Presentation` annotation when it has one. `tests/data/contentmathml` holds the test equations of ctop.
`MathMLSerializer` writes the normalized MathML as it is.

### OMML (`Internal/Omml/`)
Expand Down
Loading
Loading