emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Latex formatting for an extracted table


From: Brett Presnell
Subject: [O] Latex formatting for an extracted table
Date: Sat, 02 Mar 2019 21:20:55 -0500
User-agent: mu4e 1.1.0; emacs 27.0.50

I've taken to typing scores and brief comments into an org table when
grading my students papers.  In order to extract the scores and comments
for each individual student, I use orgtbl-aggregate as follows (the
student's nickname in this case is assumed to be "tophat", and the table
containing all the scores and comments is names "everyone"):

#+BEGIN: aggregate :table "everyone" :cols "Last First Exercise Pts Comments" 
:cond (equal Nickname "tophat")
#+END

This creates a new table by extracting the Last, First, Exercise, Pts,
and Comments columns (with headers) and only the rows with "tophat" in
the Nickname column.

My problem is that I need to have the following header on each of the
individual tables in order for them to print out properly:

#+ATTR_LATEX: :environment tabularx :width \textwidth :align lllrX

If I start with

#+BEGIN: aggregate :table "everyone" :cols "Last First Exercise Pts Comments" 
:cond (equal Nickname "tophat")
#+ATTR_LATEX: :environment tabularx :width \textwidth :align lllrX
#+END

then C-c C-c causes the table to appear but the ATTR_LATEX line is wiped
out.  If instead I start with

#+ATTR_LATEX: :environment tabularx :width \textwidth :align lllrX
#+BEGIN: aggregate :table "everyone" :cols "Last First Exercise Pts Comments" 
:cond (equal Nickname "tophat")
#+END

then the #+ATTR_LATEX: line is ignored in exporting.

I've been manually pasting the #+ATTR_LATEX: in after extracting the
tables, but there must be a better way to do this.  Any advice will be
appreciated.

FWIW, I realize that I probably don't need orgtbl-aggregate for
this. Also, my ideal solution would be to auto-generate the sub-tables
by looping over the nicknames, simultaneously inserting a section header
with the student's name before each sub-table and a "#+LATEX: \newpage"
line after.  Hints along these lines would be welcome.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]