emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Export tables as matrices (change tbl-export function on the fly)


From: Rasmus
Subject: [O] Export tables as matrices (change tbl-export function on the fly)
Date: Wed, 14 Nov 2012 15:49:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Hi,

I'm doing some stuff where the natural output of my tables are
matrices.  I found a decent translation  function here ¹.  However,
I'm not very successful in making org use it. 

I tried to add
#+begin_src org 
* heading
  :PROPERTIES:
  :TABLE_EXPORT_FORMAT: orgtbl-to-latex-matrix
  :END:
#+end src
to the relevant section of my document, but this does not seem to be
the correct usage. 

I also tried to radio tables.  The problem is that when I do

#+NAME: P
#+ORGTBL: SEND P orgtbl-to-latex-matrix
|1|

I cannot send P to R/Octave.  When I swap the ORGTBL and NAME around,
I can't send it to a radio table.  I also tried with TBLNAME. 

Anyway, the optimal would be to have Org just use a different
translation mechanism on the fly.  Is that possible?

Thanks,
Rasmus

Footnotes: 
 ¹   http://www.patokeefe.com/archives/742

#+begin_src emacs-lisp
(defun orgtbl-to-latex-matrix (table params)
  "Convert the Orgtbl mode TABLE to a LaTeX Matrix."
  (interactive)
  (let* ((params2
          (list
           :tstart (concat "\\[\n\\begin{bmatrix}")
           :tend "\\end{bmatrix}\n\\]"
           :lstart "" :lend " \\\\" :sep " & "
           :efmt "%s\\,(%s)" :hline "\\hline")))
    (orgtbl-to-generic table (org-combine-plists params2 params))))



(defcustom orgtbl-latex-matrix-string  "% BEGIN RECEIVE ORGTBL %n
% END RECEIVE ORGTBL %n
\\begin{comment}
#+ORGTBL: SEND %n orgtbl-to-latex-matrix :splice nil :skip 0

\\end{comment}\n"
  "Template for the latex matrix orgtbl translator
All occurrences of %n in a template will be replaced with the name of the
table, obtained by prompting the user."
  :type 'string
  :group 'org-table)
#+end_src

-- 
C is for Cookie




reply via email to

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