# Change emacs generated image size in org-mode export

I'm using PlantUML to generate a UML diagram inside an orgmode file. I've looked everywhere, and either I'm using the wrong terms (likely) or I'm missing something (also likely). When I view the raw tex file generated by C-c C-e l p, I get the following:

\includegraphics[width=.9\linewidth]{test.png}


What I need to know is how to change the width that is in the generated tex file. I could do it by manually changing the source image size, and then rerunning latex, but there must be a way that I'm missing to control it from within the orgmode file itself. Any ideas?

Edit: this is the relevant section of the org-mode file:

#+BEGIN_SRC plantuml :file test.png
Bob->Alice : hello
#+END_SRC


You can give to an image an atrribute of :width to specify its width. For example:

#+ATTR_LATEX: :width 0.3\linewidth
[[file:test.png]]


would do the job.

But there is the additional complication here that the image file is generated by a source block. The easiest solution IME is as follows:

• Give the source block a name.
• Generate the results with C-c C-c -- the results block is now decorated with the name you gave to the block.
• Add the #+ATTR_LATEX:  line before the #+RESULTS:  line.

The effect is that the attribute applies to the image, despite the intervening #+RESULTS:  line. When you regenerate the image file, the link ends up in the right place, after the named #+RESULTS:  line.

The final result looks like this:

  #+name: bob-and-alice
#+BEGIN_SRC plantuml :file test.png
Bob->Alice : hello
#+END_SRC

#+ATTR_LATEX: :width 0.3\linewidth
#+RESULTS: bob-and-alice
[[file:test.png]]

• Excellent! Works, and it helps me understand what I was doing wrong! Thanks! – JEPrice Jul 30 at 19:13