koppor / plantuml

A LuaLaTeX package for PlantUML in LaTeX
https://koppor.github.io/plantuml/
LaTeX Project Public License v1.3c
56 stars 11 forks source link

How to add a \caption properly? #8

Open schnells opened 6 years ago

schnells commented 6 years ago

Hello, I wanted to add a caption to my plantuml. I tried to solve this with wrapping inside a figure. But now I have to problem that the plantuml floats sometimes in really bad ways, even sometimes it places itself between other lstlistings :/.

Is there a way to do better?

\begin{figure}[h]
    \begin{plantuml}

    @startuml
    Alice -> Bob: Authentication Request
    Bob --> Alice: Authentication Response

    Alice -> Bob: Another authentication Request
    Alice <-- Bob: another authentication Response
    @enduml

    \end{plantuml}
    \caption{my caption}
    \label{my label}
\end{figure}
schnells commented 6 years ago

I tried \begin{plantuml}[caption={my caption},captionpos=b] but this does not work

koppor commented 5 years ago

Can you post a MWE for bad positioning? The figure approach is the right one. I assume, you do \begin{listing} without float option. Thus, please either let all listings float or all figures not float (not recommended! - \usepackage{float} offers H to turn off floating)

aradnix commented 5 years ago

I would try to isolate it, making my UML diagram into a separate document using the standalone class to get an image that I can insert as a figure and then make use of all the options of a floating object.

But that may be the most lazy and the least interesting solution.