emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: Export tables as matrices (change tbl-export function on the fly)
Date: Wed, 14 Nov 2012 17:21:27 +0100	[thread overview]
Message-ID: <87y5i4yx2w.fsf@gmail.com> (raw)
In-Reply-To: <877gpojl2s.fsf@pank.iue.private> (rasmus@gmx.us's message of "Wed, 14 Nov 2012 15:49:47 +0100")


Rasmus <rasmus@gmx.us> writes:

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

Using the new exporter, something like should replace any table using
default environment (i.e. no special attribute) and without horizontal
rules with bmatrix environment. It should also insert it in math mode


#+begin_src emacs-lisp
(defun my-latex-table-to-matrix (table backend info)
  (when (and (memq backend '(e-latex e-beamer))
             (not (string-match "^\\\\[A-Za-z]+$" table))
             (not (string-match "\\begin{\\(table*\\|sidewaystable\\)}" table)))
    (let ((default-env (format "\\\\\\(begin\\|end\\){\\(%s\\)}.*"
      (when (string-match default-env table)
        (concat "\\[\n"
                  "\\\\\\(begin\\|end\\){\\(center\\)}" ""
                   default-env "\\\\\\1{bmatrix}" table)))

(add-to-list 'org-export-filter-table-functions 'my-latex-table-to-matrix)


Nicolas Goaziou

  reply	other threads:[~2012-11-14 16:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 14:49 Export tables as matrices (change tbl-export function on the fly) Rasmus
2012-11-14 16:21 ` Nicolas Goaziou [this message]
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:

  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=87y5i4yx2w.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \


* 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


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