emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org-babel generated images and +ATTR_LATEX


From: Mark Edgington
Subject: [O] org-babel generated images and +ATTR_LATEX
Date: Wed, 23 Oct 2013 14:32:00 -0400

Hello all,

I have noticed that it seems not possible to evaluate a babel block of code which generates an image, and to have a #+ATTR_LATEX line exist which immediately precedes the generated link to the image.  In other words, If there's already a #+ATTR_LATEX line, I need to move it after the block is evaluated, or else it doesn't immediately precede the generated link.

For example, if I have the following...

#+begin_src python :exports none :results file
    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    fig=plt.figure(figsize=(3,2))
    plt.plot([1,3,2])
    fig.tight_layout()
    figname = '/tmp/myfig.jpg'
    plt.savefig(figname)
    return(figname) # return this to org-mode
#+end_src

#+RESULTS:
#+ATTR_LATEX: :float figure :placement [htb!] :width 0.38\textwidth

... when I evaluate the code-block, the image-link gets inserted directly after the #+RESULTS line, and before the #+ATTR_LATEX line.  Without the +ATTR_LATEX line, directly preceding the image-link, no image is inserted into the PDF which is created when exporting via the latex-exporter.

So, it would be ideal if either:
 (1) #+ATTR_LATEX lines applied to whatever image link which appears next, even if there are additional lines starting with # that are between the image-link and the #+ATTR_LATEX line,
OR (2) when evaluating an org-babel block, the results were placed *after* any #... lines that follow a #+RESULTS line.

Does this make sense, or am I possibly not understanding something about how to make it so that I don't have to modify my document anywhere else after I change and evaluate an org-babel block?  (currently I need to relocate the #+ATTR_LATEX line any time I evaluate an image-generating block)

I'm using the latest org-mode (8.2.1-117-gaff4f1).

Regards,

Mark

reply via email to

[Prev in Thread] Current Thread [Next in Thread]