https://github.com/uhoefel/jatex
A library for writing LaTeX from within Java.
https://github.com/uhoefel/jatex
java latex
Last synced: 11 months ago
JSON representation
A library for writing LaTeX from within Java.
- Host: GitHub
- URL: https://github.com/uhoefel/jatex
- Owner: uhoefel
- License: mit
- Created: 2020-10-28T12:41:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-22T22:20:15.000Z (over 2 years ago)
- Last Synced: 2025-03-25T08:11:21.468Z (over 1 year ago)
- Topics: java, latex
- Language: Java
- Homepage:
- Size: 207 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jatex
[](https://github.com/uhoefel/jatex/issues)
[](https://github.com/uhoefel/jatex/stargazers)
[](https://zenodo.org/badge/latestdoi/308012469)
[](https://search.maven.org/search?q=g:%22eu.hoefel%22%20AND%20a:%22jatex%22)
[](https://choosealicense.com/licenses/mit/)
Jatex is a [Java](https://openjdk.java.net/) library designed to programmatically write [LaTeX](https://www.latex-project.org/) files and run them.
It is designed to allow generic LaTeX documents, but provide reasonable defaults for ease of use.
Some of the supported features include:
- pdflatex, [lualatex](http://www.luatex.org/) (default), xetex, ...
- [biblatex](https://ctan.org/pkg/biblatex) support
- [tikz](https://www.ctan.org/pkg/pgf)/[pgfplots](https://www.ctan.org/pkg/pgfplots), including tikzexternalize
- [amsmath](https://www.ctan.org/pkg/amsmath), including all types of equation environments, including starred environments
- figures, including [wrapfig](https://www.ctan.org/pkg/wrapfig)
- tables, including [longtable](https://www.ctan.org/pkg/longtable)
- warns about incompatible packages (if metadata is correctly incorporated)
Example usage for pgfplots:
```java
PgfPlots.contourOf(x, y, pdfvalues, Map.of("contour filled", "{number=20}"))
.xlabel("$\\ell_{x}$")
.ylabel("weight in kg")
.clabel("$P(A|D)$")
.exec("yourPathToSaveTo");
```
wherein `x` and `y`are 1D double arrays and `pdfvalues` is a 2D array of size `[x.length][y.length]`. This produces a pdf looking as follows:

Furthermore, a convenience class for writing letters (via [scrlttr2](https://www.ctan.org/pkg/scrlttr2)) is provided. Example usage:
```java
KomaLetter.as("yourPathToSaveTo")
.user(JohnDoe.defaults()) // fill in specifics for yourself
.toName("Mr. Bob Doe")
.cc("Jane Doe")
.toStreet("Wendelsteinstraße 1")
.toCity("D-12345 Entenhausen")
.yourMail("1970-01-01")
.subject("subject")
.opening("Dear Testreader,")
.write("This letter is not really a letter. I just test for example if the paragraph building works.",
"Let's see\\ldots")
.closing("Mit freundlichen Grüßen,")
.encl("Document1.pdf", "Document2.pdf")
.exec();
```
producing

Installation
============
The artifact can be found at maven central:
```xml
eu.hoefel
jatex
1.3.5
```
Requirements
============
Jatex is designed to work with Java 17+. It also needs a LaTeX distribution, like e.g. [MikTeX](https://miktex.org/).