all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Vikas Rawal <vikaslists@agrarianresearch.org>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>,
	"Charles C. Berry" <ccberry@ucsd.edu>
Subject: Re: adding attributes to tables in results
Date: Sat, 21 Nov 2015 13:52:27 -0500	[thread overview]
Message-ID: <m2lh9rdw2c.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <FD38A251-94CB-4D19-9417-26FA29571AB7@agrarianresearch.org>

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.

Now, I am generating reports that show what each person has reviewed. In
the report, I make a table for each person in a code block that
constructs the data for that person. I don't want to manually modify the
results because there will be a lot of tables, and I have to update this
reasonably often.

HEre is what generates the table, it is a function that returns a list
of results which on its own renders as a table just fine.

#+BEGIN_SRC emacs-lisp :exports results
(happ-reviewer-table "jkitchin@andrew.cmu.edu")
#+END_SRC

would ideally output something like:

#+RESULTS:
#+tblname: kitchin-reviews
#+attr_latex: :environment longtable
#+caption: Reviews by Kitchin
| the | table | I | generated|

from a data result from my function that looked like:

(table
 '("#+tblname: kitchin-reviews" "#+attr_latex: :environment longtable"
 "#+caption: Reviews by Kitchin")
 '(the table I generated))

i.e. of the form (table attrs data)

And even better, on rerunning the code it would correctly replace it. I
usually accomplish this with :results raw and some tedious printing to
get what I want. That way is annoying to rerun because of the manual
removal of the output.

I just made up the syntax, and no doubt there are many other ways to
achieve it. That is what I had in mind though.

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.






Vikas Rawal writes:

> John,
>
> Just curious. What advantage do you see in adding these attributes to the code block, and not directly to the result?
>
> Vikas
>
>
>
>> On 21-Nov-2015, at 11:34 pm, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>
>> Thanks. That gets me pretty close to what I want.
>>
>> Charles C. Berry writes:
>>
>>> On Sat, 21 Nov 2015, John Kitchin wrote:
>>>
>>>> Hi everyone,
>>>>
>>>> I am trying to figure out a way to automatically add some attributes to
>>>> tables generated from code blocks.
>>>>
>>>
>>> With ob-org loaded:
>>>
>>> #+BEGIN_SRC emacs-lisp
>>> (require 'ob-org)
>>> #+END_SRC
>>>
>>> this src block (n.b. there is a backslash escaped n in the #+HEADER line
>>> just before the #+ATTR - I hope it doesn't linewrap in email or gnus
>>> readers)
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> #+HEADER: :wrap "src org :exports results :results replace \n#+ATTR_LATEX: :environment longtable"
>>> #+BEGIN_SRC emacs-lisp :exports results
>>> (list  (+ 2 4) 4 5)
>>> #+END_SRC
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> exports as
>>>
>>> --8<---------------cut here---------------start------------->8---
>>>
>>> \begin{longtable}{rrr}
>>> 6 & 4 & 5\\
>>> \end{longtable}
>>> \end{document}
>>>
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>>
>>> 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
>>

--
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

  reply	other threads:[~2015-11-21 18:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21 13:55 adding attributes to tables in results John Kitchin
2015-11-21 17:40 ` Charles C. Berry
2015-11-21 18:04   ` John Kitchin
2015-11-21 18:09     ` Vikas Rawal
2015-11-21 18:52       ` John Kitchin [this message]
2015-11-21 20:04         ` Charles C. Berry
2015-11-21 21:45           ` John Kitchin

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

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

  git send-email \
    --in-reply-to=m2lh9rdw2c.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=vikaslists@agrarianresearch.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.