[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] adding attributes to tables in results
From: |
John Kitchin |
Subject: |
Re: [O] adding attributes to tables in results |
Date: |
Sat, 21 Nov 2015 16:45:50 -0500 |
User-agent: |
mu4e 0.9.13; emacs 25.0.50.1 |
Also an interesting approach!
I never execute src blocks on export though (old habit of having
expensive blocks, and the desire to know what the export looks like).
This is close to what I want:
#+name: el_attr
#+BEGIN_SRC emacs-lisp :var data='(1 2 3)
(org-babel-format-result
(concat
"#+tblname: test\n"
"#+ATTR_LATEX: :environment longtable\n"
(orgtbl-to-generic (list data) (list :lstart "|" :lend "|" :sep "|" :fmt
"%s"))))
#+END_SRC
#+RESULTS: el_attr
: #+tblname: test
: |1|2|3|
#+BEGIN_SRC emacs-lisp :exports results :post el_attr(*this*)
(list (+ 1 2) 3 3)
#+END_SRC
#+RESULTS:
: #+tblname: test
: #+ATTR_LATEX: :environment longtable
: |3|3|3|
But I cannot figure out how to get the results in org format. If I put
:results org or raw in I get this output:
#+RESULTS:
#+tblname: test
#+ATTR_LATEX: :environment longtable
|40|51|32|51|32|51|41|
Charles C. Berry writes:
> On Sat, 21 Nov 2015, John Kitchin wrote:
>
>> I am running a search committee of 5 people. As applications come in, an
>> org heading is created for each application, and I run a command to send
>> one of the committee an email with a review rubric in it, and this
>> command creates a subheading to put their review. We have 275
>> applications so far, so I am using code to aggregate results into tables.
>
> Ouch! That is serious work!
>
> [snip]
>>
>> The tip Charles gave works for export, but the tables do not look too
>> good for me in the org-document unless I run C-c ' on them to get them
>> in org, and I also want them functional in the org-buffer too.
>>
>>
>
> Use a different wrapper for executing src block outside of exports.
>
> Something like this (with suitable tuning) should work:
>
> #+BEGIN_SRC emacs-lisp
> (defun ex-aware-wrap ()
> (if org-export-current-backend
> (concat "src org :exports results "
> ":results replace "
> "\n#+ATTR_LATEX: "
> ":environment longtable")
> "example"))
> #+END_SRC
>
> #+BEGIN_SRC emacs-lisp :exports results :wrap (ex-aware-wrap)
> (list (+ 1 2) 3 4)
> #+END_SRC
>
> HTH,
>
> Chuck
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu