I want to create diagrams. Preferable in LaTeX. Normally, I use the PlantUML language.

  • 1
    You have at least two options: 1) Build your diagrams with the software of your choice, save them as PDF, PNG and include them via en.wikibooks.org/wiki/LaTeX/Importing_Graphics. 2) See tex.stackexchange.com/questions/875/…. 3)? I do not know whether PlantUML supports a TeX, or TikZ output (which probably would be preferable as this leads to typographic consistency). Commented Apr 23, 2018 at 23:07
  • You also have the uml ans pst-umlwhich might help (I don't about plantUML). Both rely on pstricks. Also a metauml package, which relies on metapost.
    – Bernard
    Commented Apr 23, 2018 at 23:14
  • 3
    From plantuml.com/latex: Starting from version 7997, PlantUML allows to generate diagrams into LaTeX, thanks to Tikz package. Note that this is still beta, and many things don't probably work. Since we do not want to spend time on features not used, we will wait for users to report bugs here. You just have to use the flag -tlatex with the command line, or format="latex" with the ANT task.
    – Marijn
    Commented Apr 24, 2018 at 15:43

4 Answers 4


It is possible to use the PlantUML language direcly inside LaTeX using the plantuml package.

Here is a minimal example:

  Alice -> Bob: Hello
  Alice <- Bob: Hi!

For building LaTeX with PlantUML the PLANTUML_JAR environment variable has to be set and Java must be installed.

To build this document, run lualatex --shell-escape documentname

The result should look like this:

Result with a PlantUML diagram

A more detailed example can be found here: https://koppor.github.io/plantuml/


# to get tikz, install pgf
tlmgr install pgf
tlmgr install koma-script
tlmgr install xkeyval
tlmgr install adjustbox
tlmgr install collectbox
tlmgr install luacode
tlmgr install luatexbase
  • 5
    Unfortunately this package does not work with pdflatex as of June 2020. Commented Jul 4, 2020 at 11:29
  • 1
    This is a really useful post, I hope you don't mind me adding to it. I went through dependency hell and don't want people to give up. Commented Apr 22, 2021 at 3:33

I use the website https://www.planttext.com/ to export to/download as SVG (which btw includes the plantuml code as XML comment) and after that save as PDF with inkscape. This can be used with \includegraphics


You could also write the plantuml diagrams localy and convert them via plantuml -teps your-file to lossless eps files. These can be directly included in latex via the \includegraphics command.

This way you do not have to go the way via inkscape.

  • Peraphs it is better this link plantuml.com/latex.
    – Sebastiano
    Commented Mar 6, 2020 at 17:04
  • No the with plantuml latex format generated tikz pictures have some spacing/padding/marigin issues and do not support all formatting.
    – Ohmen
    Commented Mar 8, 2020 at 9:43
  • Thank you very much for your explanation.
    – Sebastiano
    Commented Mar 8, 2020 at 10:02

I have worked out a solution that works with pdflatex as well. It produces vector graphics. I tested it with Ubuntu Linux 20.04 LTS and TeX Live. Should work with macOS as well.

My code requires, that you have installed:

  • PlantUML (thus, also Java)
  • Inkscape (converting svg to pdf)

Due to calling external commands, you have to use the -shell-escape option to compile:

pdflatex -shell-escape my-file.tex

Depending of how you installed PlantUML, you might have to call it like this:

\immediate\write18{java -jar /home/NAME/Downloads/plantuml.jar -tsvg #1.txt}

... instead of ...

\immediate\write18{plantuml -tsvg #1.txt}

Here is the full code as minimal example:

\usepackage{graphicx} % enables us to use graphics
\usepackage{fancyvrb} % enables us to write to disk
\usepackage{float}    % enables us to use [H] for figures

% Define an verbatim environment for PlantUML:

% Process a PlantUML code:
    % Call PlantUML to produce a svg vector graphcis:
    \immediate\write18{plantuml -tsvg #1.txt}
    % Call Inkscape to convert the svg to a pdf (pdflatex cannot use svg):
    \immediate\write18{inkscape #1.svg --export-filename=#1.pdf}
    % Include the pdf:
    % Remove all intermediate files:
    \immediate\write18{rm #1.txt #1.svg #1.pdf}


% Note: timeline1 gets used as filename.
%       You must re-use this name for the
%       corresponding \process command!
        [Prototype design] lasts 15 days
        [Test prototype] lasts 10 days
\process{timeline1}{0.8\textwidth}{The proposed timeline.}

        :Hello world;
        :This is on defined on
        several **lines**;
\process{activity1}{5cm}{An activity diagram.}


I hope this is helpful to someone.

  • 1
    It's nice that the PlantUML source goes into LaTeX. Configuring the environment properly is always complex. I have configured PlantUML on Windows 10 to generate PDF -tpdf following plantuml.com/pdf and it doesn't require inkscape. Your solution could work with that, too. Commented Jul 28, 2020 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .