Temml 0.1.0
dotnet add package Temml --version 0.1.0
NuGet\Install-Package Temml -Version 0.1.0
<PackageReference Include="Temml" Version="0.1.0" />
<PackageVersion Include="Temml" Version="0.1.0" />
<PackageReference Include="Temml" />
paket add Temml --version 0.1.0
#r "nuget: Temml, 0.1.0"
#:package Temml@0.1.0
#addin nuget:?package=Temml&version=0.1.0
#tool nuget:?package=Temml&version=0.1.0
Temml for .NET
Convert TeX math to MathML, in C#.
It is an unofficial community port of Temml by Ron Kok. It ports upstream 0.14.0. The output is MathML, which browsers display without any script.
To learn more, read the documentation.
Preview the docs site locally:
cd docs-site && npm ci && npm run api && npm run dev
Open http://localhost:4321/temml-dotnet/ . That URL is the marketing page. Documentation starts at http://localhost:4321/temml-dotnet/docs/ . Article sources stay in docs/articles/. See docs-site/README.md.
Installation
The packages target net10.0 and netstandard2.0.
| Package | What it has |
|---|---|
Temml |
TeX to MathML, macros, the stylesheets and font. No third-party runtime dependencies. |
Temml.AngleSharp |
Rendering into an AngleSharp document, auto-render, and \ref post-processing. |
Run dotnet add package Temml. To render into an HTML document, run dotnet add package Temml.AngleSharp.
Usage
Rendering to a string
<a id='snippet-render-to-string'></a>
var mathml = TemmlRenderer.RenderToString(@"c = \pm\sqrt{a^2 + b^2}");
Console.WriteLine(mathml); // <math>...</math>
<sup><a href='/examples/Quickstart/Program.cs#L7-L11' title='Snippet source file'>snippet source</a> | <a href='#snippet-render-to-string' title='Start of snippet'>anchor</a></sup>
Display mode
<a id='snippet-display-mode'></a>
var display = TemmlRenderer.RenderToString(
@"\sum_{k=1}^{n} k = \frac{n(n+1)}{2}",
new TemmlOptions { DisplayMode = true }
);
Console.WriteLine(display); // <math display="block" ...>...</math>
<sup><a href='/examples/Quickstart/Program.cs#L13-L20' title='Snippet source file'>snippet source</a> | <a href='#snippet-display-mode' title='Start of snippet'>anchor</a></sup>
Handling errors
Invalid TeX comes back as error markup unless you set ThrowOnError. See Errors.
<a id='snippet-throw-on-error'></a>
try
{
TemmlRenderer.RenderToString(@"\sqrt{", new TemmlOptions { ThrowOnError = true });
}
catch (ParseError error)
{
Console.WriteLine(error.Message); // the message upstream Temml reports
Console.WriteLine(error.RawMessage);
Console.WriteLine(error.Position); // 6, the offset in the input
}
<sup><a href='/examples/ErrorHandling/Program.cs#L14-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-throw-on-error' title='Start of snippet'>anchor</a></sup>
Macros
<a id='snippet-macros-option'></a>
var options = new TemmlOptions
{
Macros = new TemmlMacroDictionary
{
[@"\RR"] = @"\mathbb{R}",
[@"\norm"] = @"\lVert #1 \rVert",
},
};
Console.WriteLine(TemmlRenderer.RenderToString(@"\norm{x} \in \RR", options));
<sup><a href='/examples/Macros/Program.cs#L7-L18' title='Snippet source file'>snippet source</a> | <a href='#snippet-macros-option' title='Start of snippet'>anchor</a></sup>
See Macros and extensions. mhchem, physics, and texvc are built in.
Rendering the math in an HTML page
With Temml.AngleSharp:
<a id='snippet-auto-render'></a>
var document = parser.ParseDocument(
@"<!DOCTYPE html><body><p>Euler: \(e^{i\pi} + 1 = 0\)</p><p>$$\int_0^1 x^2\,dx$$</p></body>"
);
TemmlDom.RenderMathInElement(document.Body!);
Console.WriteLine(document.Body!.InnerHtml);
<sup><a href='/examples/AutoRender/Program.cs#L10-L18' title='Snippet source file'>snippet source</a> | <a href='#snippet-auto-render' title='Start of snippet'>anchor</a></sup>
See DOM and auto-render.
Styles and fonts
Include one Temml stylesheet and serve Temml.woff2 next to it. Both are embedded in the package. See Styles and fonts.
Security
Commands that load resources or set HTML attributes are blocked by default. Read Security before rendering TeX from users.
Coming from JavaScript
Migrating from upstream maps the JavaScript names to the C# ones. Compatibility records the ported version.
Contributing
See CONTRIBUTING.md.
License
MIT. Temml is Copyright (c) 2020 Ron Kok. The .NET port is Copyright (c) 2026 Darío Kondratiuk. See LICENSE and NOTICE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Temml:
| Package | Downloads |
|---|---|
|
Temml.AngleSharp
Render TeX math into an AngleSharp document, with auto-render. A .NET port of Temml. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 49 | 12/4/2026 |