emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: henry atting <snd@online.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: latex code block evaluation
Date: Mon, 11 Feb 2013 09:19:29 -0700	[thread overview]
Message-ID: <877gme6cxa.fsf@gmail.com> (raw)
In-Reply-To: <87mwvc58za.fsf@bye.fritz.box> (henry atting's message of "Sun, 10 Feb 2013 19:17:45 +0100")

henry atting <snd@online.de> 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

      parent reply	other threads:[~2013-02-11 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10 18:17 latex code block evaluation henry atting
2013-02-10 21:10 ` Sebastien Vauban
2013-02-11 10:47   ` henry atting
2013-02-11 15:37     ` latex code block evaluation -- Eric? Sebastien Vauban
2013-02-11 16:19 ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877gme6cxa.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=snd@online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).