OfficeIMO.Latex
3.6.1
Prefix Reserved
dotnet add package OfficeIMO.Latex --version 3.6.1
NuGet\Install-Package OfficeIMO.Latex -Version 3.6.1
<PackageReference Include="OfficeIMO.Latex" Version="3.6.1" />
<PackageVersion Include="OfficeIMO.Latex" Version="3.6.1" />
<PackageReference Include="OfficeIMO.Latex" />
paket add OfficeIMO.Latex --version 3.6.1
#r "nuget: OfficeIMO.Latex, 3.6.1"
#:package OfficeIMO.Latex@3.6.1
#addin nuget:?package=OfficeIMO.Latex&version=3.6.1
#tool nuget:?package=OfficeIMO.Latex&version=3.6.1
OfficeIMO.Latex
OfficeIMO.Latex is a dependency-free, source-preserving LaTeX2e interoperability engine. It implements the bounded OfficeIMO document profile; it is not a TeX compiler and never executes commands, loads packages, or invokes an external runtime.
The native parser retains every input character, exposes tokens, groups, commands, environments, math, comments, and common document semantics, and writes unchanged input exactly.
using OfficeIMO.Latex;
LatexDocument document = LatexDocument.Parse(source);
LatexParseResult result = LatexDocument.ParseResult(source);
LatexHeading first = document.Headings[0];
first.Command.GetRequiredArgument(0)!.Content = "Updated section";
string updated = document.ToLatex();
Named profiles make semantic assumptions explicit and testable:
LatexDocument semantic = LatexDocument.Parse(
source,
LatexParseOptions.CreateProfile(LatexDocumentProfile.OfficeIMO));
LatexDocument preserved = LatexDocument.Parse(
source,
LatexParseOptions.CreateProfile(LatexDocumentProfile.PreserveOnly));
OfficeIMO binds the typed document semantics described below. PreserveOnly retains the structural syntax tree without profile-specific headings, paragraphs, lists, figures, tables, citations, references, labels, theorems, footnotes, or macro-definition projections. Both profiles remain lossless and non-executing.
The profile recognizes article/report/book structure, paragraphs, lists, figures, tabular data, labels/references, citations, theorem-like environments, footnotes, and inline/display math. Unknown commands and environments remain source-backed instead of disappearing. Definition bodies retain syntax without contributing active headings, tables, or references. Known required arguments bind either a brace group or one character/control-sequence token. LatexArgument.IsSingleToken identifies the latter; editing it writes the replacement in braces so following text stays outside the argument. Missing arguments are preserved and diagnosed. Environment names still require braces.
LatexDocument.Footnotes exposes source-backed \footnote commands in source order. Content edits the body through the same argument owner used by other semantic edits. Mark retains an existing optional mark; it does not calculate TeX counters or insert a new optional argument.
LatexDocument document = LatexDocument.Parse(
@"\begin{document}Text\footnote{Original note.}\end{document}");
document.Footnotes[0].Content = "Updated note.";
string updated = document.ToLatex();
\verb and verbatim-like environments are opaque tokenizer nodes: braces, percent signs, commands, and environment-looking text inside them are never reparsed as LaTeX structure. The default set includes verbatim, Verbatim, lstlisting, minted, and comment; add producer-specific names through LatexParseOptions.VerbatimEnvironmentNames. Unterminated opaque constructs produce structural diagnostics.
Stream and file loading is bounded by MaxInputBytes and MaxInputLength; token count and nesting depth are bounded separately. Parse, tokenization, and load APIs cooperate with cancellation; the synchronous stream load result also accepts a cancellation token. Parse options and opaque environment names are snapshotted so later caller changes do not alter an existing document. UTF-8 output is emitted without an unexpected byte-order mark.
Simple document-local macros can be expanded only when explicitly enabled:
LatexDocument document = LatexDocument.Parse(
source,
new LatexParseOptions {
MacroExpansion = LatexMacroExpansion.SafeSimpleDefinitions
});
LatexMacroExpansionResult expansion = document.ExpandSimpleMacros(@"\project{OfficeIMO}");
This is deliberately not general TeX expansion. Replacement control words must be another transitively safe document-local simple macro or an explicitly allow-listed formatting/reference command; file I/O, packages, shell escape, dynamic control sequences, category-code changes, bibliography tools, and TeX typesetting remain outside the product. The operation is bounded string substitution, not a sanitizer: invocation arguments and expanded output must still be treated as untrusted if another system will compile the TeX.
Macro expansion has independent input and output budgets. Configure MaxExpansionInputLength for the invocation source and MaxExpansionLength for the produced text; a long invocation that contracts to a short value is not rejected merely because the output limit is small.
Document-level expansion uses the current edited definitions, including optional defaults and transitive safety checks. Brace-protected brackets remain inside optional invocation arguments. Native parsing classifies local macro dependencies once and propagates unsafe definitions without repeated document rescans; semantic binding cooperates with cancellation.
See the LaTeX support matrix for the exact boundary.
Targets: netstandard2.0, net8.0, net10.0, and net472 on Windows.
Parsing retains compact internal token records. LatexDocument.Tokens and
LatexTokenizer.Tokenize expose the same read-only public token contract, with
stable object identity when a token is read repeatedly or concurrently. Inspecting
every token materializes the public token objects and has a different allocation
cost from parsing or sparse inspection. See the model memory evidence
for measured workloads and platform limits.
Dependency footprint
- External: None; no TeX runtime, compiler, or parser package.
- OfficeIMO:
OfficeIMO.Core. Parsing, source preservation, bounded macro expansion, and writing are first-party.
See the complete OfficeIMO package map for related formats and conversion paths.
Generated capability summary
This table is generated from the package-neutral OfficeIMO operation catalog. The detailed source contracts remain authoritative for feature-level behavior and limitations.
| Operation | Supported | Partial | Preserved | Rejected | Unsupported | Not applicable |
|---|---|---|---|---|---|---|
| Create | 1 | 0 | 0 | 0 | 0 | 0 |
| Read | 1 | 0 | 0 | 0 | 0 | 0 |
| Edit | 1 | 0 | 0 | 0 | 0 | 0 |
| Preserve | 1 | 0 | 0 | 0 | 0 | 0 |
| Inspect | 1 | 0 | 0 | 0 | 0 | 0 |
| Validate | 1 | 0 | 0 | 0 | 0 | 0 |
The complete rows for OfficeIMO.Latex are published in the generated operation contract.
| 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 is compatible. 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 is compatible. 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. |
-
.NETFramework 4.7.2
- OfficeIMO.Core (>= 3.6.1)
-
.NETStandard 2.0
- OfficeIMO.Core (>= 3.6.1)
-
net10.0
- OfficeIMO.Core (>= 3.6.1)
-
net8.0
- OfficeIMO.Core (>= 3.6.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OfficeIMO.Latex:
| Package | Downloads |
|---|---|
|
OfficeIMO.Latex.Markdown
Loss-aware LaTeX and Markdown conversion bridge for OfficeIMO. |
|
|
OfficeIMO.Reader.Latex
Modular OfficeIMO.Reader adapter for bounded-profile LaTeX ingestion. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.6.1 | 213 | 11/10/2026 |
| 3.6.0 | 319 | 11/6/2026 |
| 3.5.3 | 276 | 10/31/2026 |
| 3.5.2 | 253 | 10/24/2026 |
| 3.5.1 | 299 | 10/16/2026 |
| 3.4.5 | 733 | 10/10/2026 |
| 3.4.4 | 393 | 9/27/2026 |
| 3.4.3 | 399 | 9/12/2026 |
| 3.4.2 | 318 | 9/9/2026 |
| 3.4.1 | 325 | 9/7/2026 |
| 3.4.0 | 278 | 9/6/2026 |
| 3.3.0 | 43,998 | 9/2/2026 |
| 3.2.7 | 263 | 8/29/2026 |
| 3.2.6 | 369 | 8/22/2026 |
| 3.2.5 | 377 | 8/21/2026 |
| 3.2.4 | 355 | 8/19/2026 |
| 3.2.3 | 275 | 8/17/2026 |
| 3.2.2 | 471 | 8/13/2026 |
| 3.2.1 | 406 | 8/11/2026 |
| 3.2.0 | 566 | 8/7/2026 |