From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Export tables as matrices (change tbl-export function on the fly) Date: Wed, 14 Nov 2012 17:21:27 +0100 Message-ID: <87y5i4yx2w.fsf@gmail.com> References: <877gpojl2s.fsf@pank.iue.private> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYfmc-0005c5-H1 for emacs-orgmode@gnu.org; Wed, 14 Nov 2012 11:25:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TYfmZ-0000H8-Bl for emacs-orgmode@gnu.org; Wed, 14 Nov 2012 11:25:46 -0500 Received: from mail-wi0-f177.google.com ([209.85.212.177]:56356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYfmZ-0000H2-0N for emacs-orgmode@gnu.org; Wed, 14 Nov 2012 11:25:43 -0500 Received: by mail-wi0-f177.google.com with SMTP id c10so267980wiw.12 for ; Wed, 14 Nov 2012 08:25:42 -0800 (PST) In-Reply-To: <877gpojl2s.fsf@pank.iue.private> (rasmus@gmx.us's message of "Wed, 14 Nov 2012 15:49:47 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rasmus Cc: emacs-orgmode@gnu.org Hello, Rasmus writes: > I'm doing some stuff where the natural output of my tables are > matrices. I found a decent translation function here=C2=A0=C2=B9. Howe= ver, > I'm not very successful in making org use it.=20 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. Untested. #+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\\)}" tab= le))) (let ((default-env (format "\\\\\\(begin\\|end\\){\\(%s\\)}.*" org-e-latex-default-table-environment))) (when (string-match default-env table) (concat "\\[\n" (org-trim (replace-regexp-in-string "\\\\\\(begin\\|end\\){\\(center\\)}" "" (replace-regexp-in-string default-env "\\\\\\1{bmatrix}" table))) "\n\\]"))))) (add-to-list 'org-export-filter-table-functions 'my-latex-table-to-matrix) #+end_src Regards, --=20 Nicolas Goaziou