# Org mode export to Latex: #+CAPTION: not working as plantUML inserts \includegraphics

How to disable plantUML inserting the images automatically?

Code block inside a org file:

#+NAME: fig:1
#+CAPTION: IETF-draft
[[./draft.png]]

#+begin_src plantuml :file draft.png
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
#+end_src


export to latex : ->C-c C-e l l

Produces two images: 1. As the result of [[./draft.png]] together with CAPTION, NAME.

\begin{figure}[htb]
\centering
\includegraphics[height=0.6\textheight,keepaspectratio,width=.9\linewidth]{./pbk.png}
\caption{\label{fig:pbk-draft}PBK-framework-IETF-draft}
\end{figure}


## 2. The following img is inserted by plantUML automatically ( I want to disable this, how to do this ? }

\includegraphics[height=0.6\textheight,keepaspectratio,width=.9\linewidth]{draft.png}


-- Edited following the request from @Emacs User--

Code block inside a org file:

#+NAME: fig:1
#+CAPTION: IETF-draft
#+begin_src plantuml :file draft.png
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
#+end_src


export to latex : ->C-c C-e l l

Produces just the second image and I lose the control over the CAPTION, FIG NAME references; the latex code is the following:

\includegraphics[height=0.6\textheight,keepaspectratio,width=.9\linewidth]{draft.png}


Name and label the results block, not the source block:

#+BEGIN_SRC plantuml :file draft.png
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
#+END_SRC

#+NAME: fig:draft
#+CAPTION: IETF-draft
#+RESULTS:


To refer to this output in the document, you would use something like this:

See figure [[fig:draft]].


Note the order of name, caption, and results. Also, use names instead of numbers in labels since numbering is provided automatically by the exporter backend.

If you want to avoid creating draft.png file, then look into creating a separate \begin{figure} environment in the org file and to contain the UML. That's a longer solution but there are many examples on SO.

• If I do as you said: The exported latex file looks like : \begin{uml} Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response \end{uml} I also had a look into ob-plantuml.el file, it is different from the original design. emacswiki.org/emacs/org-export-blocks-format-plantuml.el which is obsoleted now. How can I go forward? I am new to lisp, can you help me to disable plantuml inserting the img ? plantuml allows -tlatex option to export it to tizk-picture, i tried to add this option in ob-pl..el but failed. – pksec May 19 '16 at 9:03
• Could you first clarify something: what do you get if you remove the line [[./draft.png]] from your original org file and then export to latex? Please attach a pdf of the output or a screenshot. – Emacs User May 19 '16 at 13:52
• updated my question with more info: The reason for using the first method is to have CAPTION and FIG references. If I just use the Plantuml generated fig, I cannot give CAPTION or FIG name. – pksec May 19 '16 at 15:20
• I've updated my response. – Emacs User May 19 '16 at 16:45
• Thank you @Emacs User! It's exactly what I was looking for! – pksec May 23 '16 at 8:11

I'm using this:

#+BEGIN_SRC plantuml :exports both :file tryout.png


to have only one figure. Depends also on what you expect from UML - maybe insert only one transition, not both.

• Can you add #+CAPTION: and #+NAME: ? to the generated image? – pksec May 19 '16 at 15:18
• see my response for adding captions and names to results – Emacs User May 19 '16 at 16:46