From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [babel] suggestion: wrap creation of graphics into try() block Date: Mon, 20 Jan 2014 15:00:26 +0100 Message-ID: <878uua3g91.fsf@med.uni-goettingen.de> References: <52DD2660.3090403@krugs.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5FPC-0002FS-Uc for emacs-orgmode@gnu.org; Mon, 20 Jan 2014 09:00:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5FP6-0008EN-PB for emacs-orgmode@gnu.org; Mon, 20 Jan 2014 09:00:46 -0500 Received: from plane.gmane.org ([80.91.229.3]:48680) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5FP6-0008EH-Hj for emacs-orgmode@gnu.org; Mon, 20 Jan 2014 09:00:40 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W5FP5-0002Vh-GL for emacs-orgmode@gnu.org; Mon, 20 Jan 2014 15:00:39 +0100 Received: from genepi110.genepi.med.uni-goettingen.de ([134.76.140.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Jan 2014 15:00:39 +0100 Received: from andreas.leha by genepi110.genepi.med.uni-goettingen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Jan 2014 15:00:39 +0100 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@gnu.org Rainer M Krug writes: > Hi > > I have two suggestions which are liked to each other. They are based > on R code blocks, but the should be useful for other languages as well. > > I have a document in which I use :session for creating R graphs. These > look like: > > #+begin_src R :file Correlation_1.pdf :results graphics > IFN.mean <- load.IFN.mean() > grid <- load.grid.CASTANEA.average() > image(IFN.mean) > #+end_src > > Everything works fine, unless there is an error in one graph. > > In this case, the device remains open, which leaves open devices at > the end of the export of the document. I experience the same problem. And would love to see that addressed. > > If the code block which should create the graph would be wrapped into > a try() block, so that it would look like the following: > > try( > { > pdf("./Correlation_1.pdf") > IFN.mean <- load.IFN.mean() > grid <- load.grid.CASTANEA.average() > image(IFN.mean) > } > ) > dev.off() > > The device would be closed even if an error occurred during the > execution of the code. > > But still, when exporting to pdf, the call to pdflatex fails as only > a empty pdf is available. So it becomes necessary to go through the > pdf log to identify the graphs which failed. > > In this case it would be useful, to have a placeholder grah in the > final pdf, so that one can see which graphs did not work. > > In addition, this could be used as placeholders (well - they are > placeholders) for to be created graphs, while the text has already > been written. > > So my second suggestion would be to include a placeholder image, which > would be used if the generation of the actual graph fails. It would be > great (but not necessary) if the actual error message would be in the > image. Such an place holder image would be great, indeed. Thanks for bringing this up! Regards, Andreas