emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Export tables as matrices (change tbl-export function on the fly)
Date: Wed, 14 Nov 2012 15:49:47 +0100	[thread overview]
Message-ID: <877gpojl2s.fsf@pank.iue.private> (raw)

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	other threads:[~2012-11-14 14:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 14:49 Rasmus [this message]
2012-11-14 16:21 ` Export tables as matrices (change tbl-export function on the fly) Nicolas Goaziou
2012-11-14 18:05   ` Rasmus
2012-11-17 13:26   ` Rasmus Pank Roulund
2012-11-17 15:32     ` Nicolas Goaziou
2012-11-17 18:29       ` Rasmus
2012-11-18  8:53         ` Nicolas Goaziou
2012-11-18 11:50           ` Rasmus
2012-11-18 13:20             ` Nicolas Goaziou
2012-11-18 14:05               ` Rasmus
2012-11-18 19:12                 ` Nicolas Goaziou

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=877gpojl2s.fsf@pank.iue.private \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).