From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Edgington Subject: org-babel generated images and +ATTR_LATEX Date: Wed, 23 Oct 2013 14:32:00 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013a0ad071a46004e96cbda3 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZ3EP-0007Qy-IA for emacs-orgmode@gnu.org; Wed, 23 Oct 2013 14:32:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZ3EO-0005vZ-6i for emacs-orgmode@gnu.org; Wed, 23 Oct 2013 14:32:33 -0400 Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]:42881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZ3EN-0005vT-Vg for emacs-orgmode@gnu.org; Wed, 23 Oct 2013 14:32:32 -0400 Received: by mail-ob0-f178.google.com with SMTP id wm4so1252160obc.9 for ; Wed, 23 Oct 2013 11:32:31 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode --089e013a0ad071a46004e96cbda3 Content-Type: text/plain; charset=ISO-8859-1 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 --089e013a0ad071a46004e96cbda3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello all,

I have noticed= that it seems not possible to evaluate a babel block of code which generat= es an image, and to have a #+ATTR_LATEX line exist which immediately preced= es the generated link to the image.=A0 In other words, If there's alrea= dy 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 p= ython :exports none :results file
=A0=A0=A0 import matplotlib
=A0=A0= =A0 matplotlib.use('Agg')
=A0=A0=A0 import matplotlib.pyplot as = plt
=A0=A0=A0 fig=3Dplt.figure(figsize=3D(3,2))
=A0=A0=A0 plt.plot([1,3,2])
=A0=A0=A0 fig.tight_layout()
=A0=A0=A0 fi= gname =3D '/tmp/myfig.jpg'
=A0=A0=A0 plt.savefig(figname)
=A0= =A0=A0 return(figname) # return this to org-mode
#+end_src

=
#+RESULTS:
#+ATTR_LATEX: :float figure :placement [htb!] :width 0.3= 8\textwidth

... when I evaluate the code-block, the image-link gets inse= rted directly after the #+RESULTS line, and before the #+ATTR_LATEX line.= =A0 Without the +ATTR_LATEX line, directly preceding the image-link, no ima= ge is inserted into the PDF which is created when exporting via the latex-e= xporter.

So, it would be ideal if either:
=A0(1) #+ATTR_LATEX line= s applied to whatever image link which appears next, even if there are addi= tional 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 plac= ed *after* any #... lines that follow a #+RESULTS line.

D= oes 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 af= ter I change and evaluate an org-babel block?=A0 (currently I need to reloc= ate 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
--089e013a0ad071a46004e96cbda3--