emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: Torsten Wagner <torsten.wagner@gmail.com>
Cc: Emacs-orgmode@gnu.org
Subject: [babel] Meta-LaTeX-Python-Environment
Date: Thu, 29 Oct 2009 11:52:25 -0400	[thread overview]
Message-ID: <87y6mudwp2.fsf_-_@stats.ox.ac.uk> (raw)
In-Reply-To: <4edb2bbc0910270629q23323792r4d15bd952c81d376@mail.gmail.com> (Torsten Wagner's message of "Tue, 27 Oct 2009 22:29:39 +0900")

Hi Torsten,

Torsten Wagner <torsten.wagner@gmail.com> writes:

<...>
> I used the following simple example:

<...>
> #+srcname: test()
> #+begin_src python  :results latex

<...>

> As you can see, the result is wrapped now in LaTeX source code blocks.
> However, if I export the file by
> M-x org-export l
> the resulting LaTeX file still contains the source code itself (the part in the 
> verbatim environment.

Yes, you need ':exports results' as well as ':results latex'. The
':results latex' is necessary to specify that the *result* of the block
is latex code. The ':exports results' is necessary in order to tell it
only to include the result in the export product.

<...>
> Wished export-result (trimmed to relevant part):
> ...
> \usepackage{color}
> \definecolor{gray}{gray}{0.95}
> ...
> \section{Simple Test of org-babel}
> \label{sec-1}
> \colorbox{gray}{
> This is a Test: if a =1 and b = 2 then a + b = 3 right ?!
> }
> ...
>

> As you can see, I like to indicate the source block results resp. the LaTeX 
> source code blocks in a way which indicate clearly that they belong to the 
> "official" output. E.g. by adding a slight gray background.

OK, so I think what you want is that the results are

(a) latex code, and
(b) in a box, set apart as different from the main text

Well, org-babel doesn't do anything like that with latex results by
default, so you'd have to do it yourself. How about defining a source
block function which does the job of putting your latex results in a
box, and calling it with #+lob ? The following exports to latex with the
results in a red box. (Please pull the latest org-mode as this required
a change that I've just made.)

--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \usepackage{color}

* Simple Test of org-babel
#+srcname: test()
#+begin_src python :exports none
  a = 1
  b = 2
  c = a+b
  "This is a Test: if a =" + str(a) + " and b = " + str(b) + " then a + b = " + str(c) + " right ?!" 
#+end_src

#+lob: putinbox(body=test()) :results latex :exports results

* Library code
  This could go in a separate file, as long as the file is added to the
  Library of Babel.
#+srcname: putinbox(body)
#+begin_src latex :exports none
\colorbox{red}{
body
}
#+end_src
--8<---------------cut here---------------end--------------->8---


>
> As mentioned before, I like to have mainly three ways of export 
> 1. Export everything

:exports both

> 2. Export everything except the source codes itself

:exports results

> 3. Export a particular LaTeX source code session (e.g. by using the tangle 
> function)

tangle


Hth,

Dan

>
> Nevertheless, I will try the other very good ideas in this thread. Maybe this 
> works for me already.
>
> Best regards and thanks again 
>
> Torsten
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2009-10-29 15:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26  4:27 org-babel: Meta-LaTeX-Python-Environment Torsten Wagner
2009-10-27  0:24 ` Dan Davison
2009-10-27  8:23   ` Thomas S. Dye
2009-10-27 14:57     ` Torsten Wagner
2009-10-27 22:55       ` Eric Schulte
2009-10-28  0:40         ` Thomas S. Dye
2009-10-28 15:19           ` Eric Schulte
2009-10-28 16:10             ` [babel] " Dan Davison
2009-10-28 16:49               ` Dan Davison
2009-10-28 16:52               ` Thomas S. Dye
2009-10-28 17:15                 ` Eric Schulte
2009-10-28 18:46                   ` Thomas S. Dye
2009-10-28 22:19                     ` Eric Schulte
2009-10-29  6:55                       ` Thomas S. Dye
2009-10-28 16:25             ` Thomas S. Dye
2009-10-27 13:29   ` Torsten Wagner
2009-10-29 15:52     ` Dan Davison [this message]
     [not found]   ` <4edb2bbc0910270625ybce9255nf569b5e250d061e1@mail.gmail.com>
2009-10-28 16:57     ` Dan Davison
2009-10-29  4:52       ` [babel]org-babel: Meta-LaTeX-Python-Environment Torsten Wagner

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=87y6mudwp2.fsf_-_@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=Emacs-orgmode@gnu.org \
    --cc=torsten.wagner@gmail.com \
    /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).