emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "Martin Schöön" <martin.schoon@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Trouble with Tables and Python
Date: Tue, 15 Apr 2014 21:29:41 -0400	[thread overview]
Message-ID: <CAJ51ETpiXW9gVjDwpQ0gek0Z4Am-nD0BtbAs_iqQ3jwXMJRjRw@mail.gmail.com> (raw)
In-Reply-To: <CAHxk2pChMGqxvizmovd3gqHGZt3nRb5AKTQ_iHuN4r+Xg-HwDg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3947 bytes --]

I should probably confess to having this in my .emacs files:

;; language specific headers. I think this comes before the defaults
(setq org-babel-default-header-args:emacs-lisp
      (cons '(:results . "value replace")
        (assq-delete-all :results org-babel-default-header-args)))

;; set default :results to output
(setq org-babel-default-header-args
      (cons '(:results . "output replace")
        (assq-delete-all :results org-babel-default-header-args)))

;; set default exports to both code and results
(setq org-babel-default-header-args
      (cons '(:exports . "both")
        (assq-delete-all :exports org-babel-default-header-args)))

These things change the default behaviors for the results. I almost always
want output as results, and not value (the regular default), except when
coding in emacs-lisp where the value make sense to me.

That would certainly be a point of confusion ;)

I also find you want :results output raw

if you are printing a table or printing org. This is something I have never
found satisfying, especially for long tables or outputs it is tedious to
have to delete the old output by hand before rerunning it. I have not found
any other sets of options that do what I want, e.g. changing raw to org
results in the section being wrapped in #+begin_org/end_org, which is
usually not what I want. I usually do want the raw output.

I hope that clarifies where some of your differences might be coming from.

John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Tue, Apr 15, 2014 at 5:18 PM, Martin Schöön <martin.schoon@gmail.com>wrote:

> This is my first post here...
>
> I have been using org-mode as a pure TODO-tool for some time but this
> winter I realised it could be used for much more and I have been
> experimenting with mixing in LaTeX and Python for fun and because I find
> literate programming a particularly sane idea (I am a HW engineer).
>
> Less than I week ago I started to look into using tables for input and
> output to/from Python scripts. I was inspired by something I found at
> http://kitchingroup.cheme.cmu.edu/ . The enclosed example 1 file is a
> pruned version of the org-file I found there. If I run the embedded Python
> script using C-c C-c I don't get the table shown in the example. Instead I
> get "none" on the row following "#+RESULTS:"
>
> If I change ":results raw" to ":results output" I do get the table but
> 'wrapped' in "#+begin_example" and "#+end_example" as shown in  the
> enclosed example 2 file. I have done some further testing/changes in that
> file (adding some stuff to the top of the file and changing the formatting
> of the print statements) none of which changed the extra wrapping of the
> table. When I export to LaTeX -> PDF the table does not show up in the
> end result.
>
> Let's move over to the third example file and the real mystery. This all
> my own code. Reading data from the first table works just fine and the same
> goes for the calculations. The output table, however, is different from
> that of example 2. The 'wrapper' is gone but each row is starting with ":
> ". Where does that come from? Why does it differ from example 2? If my
> results differ from someone else's (different install/versions etc) --
> OK. But how can I get differences like this on my own? To my  un-trained
> eyes the print statements of examples 2 and 3 look very similar. (But, the
> first things that go blind are the eyes... probably something blatantly
> obvious once pointed out to me.)
>
> OS: #! Linux (Based on Debian stable, 64-bit)
> Emacs: 23.4.1
> Org-mode: 8.2.5h
> Python: 2.7.3
>
> TIA,
> --
> Martin Schöön
>
> http://hem.bredband.net/b262106/index.html
>

[-- Attachment #2: Type: text/html, Size: 5440 bytes --]

  parent reply	other threads:[~2014-04-16  1:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 21:18 Trouble with Tables and Python Martin Schöön
2014-04-15 22:46 ` Nick Dokos
2014-04-16  1:29 ` John Kitchin [this message]
2014-04-16 18:58   ` Martin Schöön
2014-04-18 13:09   ` Sebastien Vauban

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=CAJ51ETpiXW9gVjDwpQ0gek0Z4Am-nD0BtbAs_iqQ3jwXMJRjRw@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=martin.schoon@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).