From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: [BUG][babel] ":result output table" doesn't work for python code blocks Date: Wed, 27 Apr 2011 11:09:27 +0100 Message-ID: <87aafc9fag.fsf@pinto.chemeng.ucl.ac.uk> References: <87k4ew2vfu.fsf@are.berkeley.edu> <87oc485jy3.fsf@gmail.com> <87hb9zyf79.fsf@ucl.ac.uk> <877hava3d8.fsf@gmail.com> <87aafksm4y.fsf@ucl.ac.uk> <87zkncolm9.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF1gh-0001DY-UC for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 06:09:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QF1gf-0006Ib-3c for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 06:09:39 -0400 Received: from vscani-d2.ucl.ac.uk ([144.82.108.133]:54682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF1ge-0006I7-Vl for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 06:09:37 -0400 In-Reply-To: <87zkncolm9.fsf@gmail.com> (Eric Schulte's message of "Tue, 26 Apr 2011 13:31:26 -0600") 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: Eric Schulte Cc: emacs-orgmode@gnu.org "Eric Schulte" writes: [...] > > Hi Eric, > > Does the matlab/octave `disp' function display tabular data in the same > manner as it is written literally in source code? Hi Eric! No, unfortunately not. Arrays (tabular data) are written out using only whitespace for formatting: --8<---------------cut here---------------start------------->8--- *** simple example #+srcname: octave-simple #+begin_src octave :results output A = [1, 2; 3, 4]; disp(A) #+end_src #+results: octave-simple : 1 2 : 3 4 --8<---------------cut here---------------end--------------->8--- > This is part of the issue with the "output table" :results combination, > namely what constitutes a table for printed output. In source code the > answer is obvious, namely whatever the language's interpreter would read > as a literal table, however with printed output there are many possible > ways to represent tabular data, but none *is* tabular in the way that > source code can *be* tabular. Yes, that makes sense. > If the printed output is exactly the same as how a table would be > written in matlab/octave source code, then does my patched version work? > If not, then rather than writing another table parser, perhaps the data > could be printed as an Org-mode table, and then the "output raw" > :results combination could be used, or the output could be sent through > another code block to convert the string to a table. That's what I do at the moment, actually. Mind you, org is able to take the output and convert it to a table easily enough with =C-c |= (org-table-create-or-convert-from-region) operating on the output if selected as a region. Would it be possible to post-process the output from babel automatically using this method (maybe with a hook?) with the output selected if ":results output table", say, were specified? That alone would be sufficient for 90% of the cases... Apologies for the sporadic nature of my responses lately: I have been on holiday (much needed!) and purposely without email most of the time! Thanks, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.209.g1a687)