From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: latex code block evaluation Date: Mon, 11 Feb 2013 09:19:29 -0700 Message-ID: <877gme6cxa.fsf@gmail.com> References: <87mwvc58za.fsf@bye.fritz.box> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:48058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4w6b-0007sD-1U for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 11:19:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4w6Y-0007Q6-QQ for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 11:19:44 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:62277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4w6Y-0007Pl-KX for emacs-orgmode@gnu.org; Mon, 11 Feb 2013 11:19:42 -0500 Received: by mail-pa0-f52.google.com with SMTP id fb1so3084226pad.11 for ; Mon, 11 Feb 2013 08:19:41 -0800 (PST) In-Reply-To: <87mwvc58za.fsf@bye.fritz.box> (henry atting's message of "Sun, 10 Feb 2013 19:17:45 +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: henry atting Cc: emacs-orgmode@gnu.org henry atting writes: > I have this latex code block: > > #+begin_src latex :file foo.pdf > \documentclass{article} > \begin{document} > ...some text... > \end{document} > #+end_src > > After evaluation the resulting file looks like this: > > > article ...some text... > > I do not understand this. As far as I know it is possible to define the > latex documentclass within a code block. Currently the machinery used to generate images of inline latex equations is used to evaluate latex code blocks. So e.g., the following works as "expected". #+begin_src latex :file write-fisher.pdf :results raw \begin{equation*} P_{i} = \frac{(2N)!}{i! (2N-i)!} p^{i}q^{2N-i} \end{equation*} #+end_src #+RESULTS: [[file:write-fisher.pdf]] In this case it is all a matter of balancing what the majority of users think is "expected". If specifying a particular document class is important, than I am sure that it shouldn't be hard to update the org-babel-execute:latex function to check for the presence of \begin{document} and handle those cases differently (in a similar way to how org-babel-execute:C checks for a main function). If specifying the document class is not required your example could be converted to the (arguably preferable) example below. #+begin_src latex :file foo.pdf :results raw ...some text... #+end_src #+RESULTS: [[file:foo.pdf]] Cheers, -- Eric Schulte http://cs.unm.edu/~eschulte