RepositoryTeXDEGermany
koppor

koppor/plantuml

A LuaLaTeX package for PlantUML in LaTeX

70stars
12forks
0issues
3views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: latex-package

#1 Repository of the week

1
TINIX TRENDING·Topic: lualatex

#1 Repository of the week

1
TINIX TRENDING·Topic: plantuml

#1 Repository of the week

plantuml CTAN

A LuaLaTeX and pdfLaTeX package for PlantUML in LaTeX

PlantUML is a program which transforms text into UML diagrams. This package allows for embedding PlantUML diagrams using the PlantUML source.

It works with both lualatex and pdflatex. Both engines need -shell-escape so that the package can call PlantUML. See docs/decisions/0001-support-pdflatex-via-shell-escape.md for why pdfLaTeX is driven directly via shell escape (issue #1).

Preconditions

  1. Environment variable PLANTUML_JAR set to the location of plantuml.jar. You get it from https://sourceforge.net/projects/plantuml/files/plantuml.jar/download. Not needed when rendering png/svg through a PlantUML server (see Rendering via a PlantUML server). If neither a jar nor a server is available, the diagram is replaced by a visible placeholder rather than aborting the build.
  2. Windows: Environment variable GRAPHVIZ_DOT set to the location of dot.exe. Example: C:\Program Files (x86)\Graphviz2.38\bin\dot.exe. You can install graphviz using choco install graphviz.
  3. lualatex or pdflatex available, called with the command line parameter -shell-escape.
  4. In case you want to have the images as PDFs (and not using TikZ or PNG), ensure that inkscape.exe and pdfcrop are in your path. You can get inkscape using choco install inkscape. pdfcrop should be part of your latex distribution.

Examples

Minimal Example

LaTeX source:

\documentclass{scrartcl}
\usepackage{plantuml}
\begin{document}
\begin{plantuml}
Alice -> Bob: test
\end{plantuml}
\end{document}

@startuml and @enduml are optional: when the diagram body omits them, PlantUML adds them automatically (issue #4), so the examples here leave them out. You may still write them explicitly if you prefer.

Compilation: lualatex -shell-escape example-minimal (or pdflatex -shell-escape example-minimal)

Result:

Minimal example

Rendering from a File

Use \plantumlinput{<file>} to render a diagram stored in an external PlantUML source file, analogous to minted's \inputminted and listings' \lstinputlisting (issue #3):

\documentclass{scrartcl}
\usepackage{plantuml}
\begin{document}
\plantumlinput{example-input-file.puml}
\end{document}

It honors the output mode and reuses the same caching, server, and -output-directory handling as the plantuml environment. The file is read relative to the current working directory, so paths in subdirectories (e.g. \plantumlinput{diagrams/foo.puml}) work when compiling from the project root. See example-input-file.tex.

Example Class Relations Rendered Using SVG

LaTeX source:

\documentclass{scrartcl}
\usepackage{graphics}
\usepackage{epstopdf}
\epstopdfDeclareGraphicsRule{.svg}{pdf}{.pdf}{
  inkscape "#1" --export-text-to-path --export-filename="\OutputFile"
}
\usepackage[output=svg]{plantuml}
\begin{document}
\begin{plantuml}
class Car

Driver - Car : drives >
Car *- Wheel : have 4 >
Car -- Person : < owns
\end{plantuml}
\end{document}

For older Inkscape use this LaTeX source:

\documentclass{scrartcl}
\usepackage{graphics}
\usepackage{epstopdf}
\epstopdfDeclareGraphicsRule{.svg}{pdf}{.pdf}{
  inkscape -z --file=#1 --export-pdf=\OutputFile
}
\usepackage[output=svg]{plantuml}
\begin{document}
\begin{plantuml}
class Car

Driver - Car : drives >
Car *- Wheel : have 4 >
Car -- Person : < owns
\end{plantuml}
\end{document}

Compilation: lualatex -shell-escape example-class-relations (or pdflatex -shell-escape example-class-relations)

Result:

Class relations rendered using SVG

Rendering via a PlantUML server

Instead of a local plantuml.jar, png and svg diagrams can be rendered by a PlantUML server over HTTP. This needs only curl — no Java and no local PlantUML installation — which is handy on CI and shared build machines (see issue #6).

Point the package at a server with the server option:

\usepackage[output=svg, server=https://www.plantuml.com/plantuml]{plantuml}

Alternatively set the PLANTUML_SERVER environment variable (the package option takes precedence over it):

export PLANTUML_SERVER=https://www.plantuml.com/plantuml

You can run your own server, for example with Docker:

docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
# then use server=http://localhost:8080

Notes:

  • Only output=png and output=svg use the server. output=latex (TikZ, the default) cannot be produced by a server and always uses the local plantuml.jar, so keep PLANTUML_JAR set if you need latex output.
  • See example-server--png.tex and example-server--svg.tex for complete examples.
  • The diagram source is sent hex-encoded in the request URL, so a very large diagram may hit the server's URL-length limit.

Caching

Generated diagrams are cached by a hash of their source, similar to minted and memoize. Each diagram is written to plantuml-<hash>-converted-to.<ext>, and PlantUML (or the server) is invoked only when no file for that hash exists yet. Unchanged diagrams — as well as repeated or reordered ones — reuse the cached output, so recompiles are fast and only edited diagrams are regenerated. The -converted-to suffix means the standard TeX .gitignore already ignores these files (via *-converted-to.*), so no extra entry is needed. Delete the plantuml-*-converted-to.* files to clear the cache.

Global Preamble

The default PlantUML style is colorful, which is not ideal for printouts. Instead of repeating skinparam settings in every diagram, set a global preamble once that is applied to all diagrams (issue #5).

Write it inline with the plantumlpreamble environment:

\begin{plantumlpreamble}
skinparam monochrome true
skinparam backgroundColor white
skinparam defaultFontName sans-serif
\end{plantumlpreamble}

…or keep it in a file and point at it with \plantumlpreamblefile{<file>}. Either form affects every diagram that follows (set it once near the top of the document). The preamble is folded into the diagram cache key, so changing it regenerates the diagrams. See example-preamble.tex.

The local jar applies the preamble to every diagram via PlantUML's -config. The PlantUML server has no such option, so there the preamble is prepended to the source instead; this styles the usual marker-less diagrams, but a server diagram that spells out its own @startuml/@enduml keeps the default style (render it through the local jar if you need the preamble applied).

Installation

Your latex distribution should take care.

For manual installation, copy plantuml.* to your local texmf folder in the sub directory tex/latex/plantuml. See the discussion at tex.sx for the concrete location of the folder on your system.

Development

The release is built using GitHub Actions (workflow file) using release.sh.

Release preparation:

  1. Adapt copyright year (line 1)
  2. Adapt as date and version number (line 6) in plantuml.sty.
  3. Adapt CHANGELOG.md.
  4. Set a git tag and push.

Alternative Solutions

TikZ-UML is a very powerful package based on TikZ. More alternative solutions are collected at the CTAN topic UML.

License

SPDX-License-Identifier: LPPL-1.3c+

Similar Projects

Discover other similar projects and AI models.

RepositoryTeX
kevinraymond/florilegium

Procedurally generated Delft-blue page margins for LuaLaTeX, with plants, visitors, shells and Gothic tracery sampled from genomes, and a TikZ library that draws them in pure TikZ under pdfLaTeX.

1.7k
Nov 29, 2026
RepositoryJava
plantuml/plantuml

Generate diagrams from textual description

13.5k
Nov 30, 2026
RepositoryJavaScript
yuzutech/kroki

Creates diagrams from textual descriptions!

4.4k
Nov 30, 2026
RepositoryHTML
tupadr3/plantuml-icon-font-sprites

plantuml-font-icon-sprites

691
May 9, 2024
RepositoryJavaScript
plantuml-stdlib/Azure-PlantUML

PlantUML sprites, macros, and other includes for Azure services

493
Dec 18, 2023
RepositoryJavaScript
danielyaa5/puml-for-markdown

Render PlantUML diagrams in GitHub Markdown READMEs and docs: clickable diagram images from .puml files that link to each other, with no images to commit. CLI and GitHub Action.

344
Nov 20, 2026
RepositoryJavaScript
plantuml/plantuml.js

PlantUML that runs completely on javascript without needing java/servers

314
Apr 3, 2023
RepositoryJava
talsma-ict/umldoclet

Automatically generate PlantUML diagrams in javadoc

257
Nov 30, 2026
RepositoryJava
joaopauloaramuni/projeto-de-software

Repo Projeto de Software

176
Oct 25, 2026