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

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
> 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
> automatically.

this one seems to work better for me, but might be more ugly . . .

#+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"
		 (replace-regexp-in-string "\n\n" "\n"
                  "\\\\\\(begin\\|end\\){\\(center\\|table\\)}\\|\\\\toprule\\|\\\\bottomrule\\|\[[htbH]+?\]" ""
                   default-env "\\\\\\1{bmatrix}" table))))
(add-to-list 'org-export-filter-table-functions 'my-latex-table-to-matrix)


Dung makes an excellent fertilizer

  reply	other threads:[~2012-11-14 18:05 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
2012-11-14 18:05   ` Rasmus [this message]
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=87txssm563.fsf@pank.iue.private \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \


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