https://github.com/jmjrawlings/latexbuilder
Build LaTeX documents in C#
https://github.com/jmjrawlings/latexbuilder
csharp dotnet latex
Last synced: about 2 months ago
JSON representation
Build LaTeX documents in C#
- Host: GitHub
- URL: https://github.com/jmjrawlings/latexbuilder
- Owner: jmjrawlings
- Created: 2024-09-07T03:45:31.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-09-08T06:12:18.000Z (9 months ago)
- Last Synced: 2025-02-13T12:24:19.649Z (4 months ago)
- Topics: csharp, dotnet, latex
- Language: C#
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LatexBuilder
Helper classes for building [LaTeX](https://www.latex-project.org/) documents in C#.
The API is somewhat inspired by StringBuilder as it's really just a thin wrapper of it.
## Quickstart
```csharp
using LatexBuilder;LatexDocument doc = LatexBuilder
.Article()
.WithTitle("A new document")
.WithAuthor("Justin Rawlings")
.WithPackage("booktabs")
.Build();using (doc.Section("Introduction"))
doc.WriteLn("This is an introduction");using (doc.Section("A Section")){
doc.WriteLn("Section levels are maintained interally");
using (doc.Section("A subsection"))
doc.WriteLn("This is in a subsection");
using (doc.Env("align*"))
doc.WriteLn($$"""
\alpha &= 1 \\
\beta &= 2 \\
\intertext{thus}
\alpha + \beta &= 3
""");
doc.BeginSection("Manul section");
doc.WriteLn("You can also begin and end sections explicity");
doc.EndSection();
}var tex = doc.ToString();
var file = doc.WriteToFile("report.tex");
```