5

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} 

the two images inserted in the PDF

-- 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} 

2 Answers 2

4

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.

6
  • 1
    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. Commented May 19, 2016 at 9:03
  • 1
    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. Commented May 19, 2016 at 13:52
  • 1
    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. Commented May 19, 2016 at 15:20
  • 1
    I've updated my response. Commented May 19, 2016 at 16:45
  • 1
    Thank you @Emacs User! It's exactly what I was looking for! Commented May 23, 2016 at 8:11
0

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.

2
  • Can you add #+CAPTION: and #+NAME: ? to the generated image? Commented May 19, 2016 at 15:18
  • 1
    see my response for adding captions and names to results Commented May 19, 2016 at 16:46

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.