[Top][All Lists]

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

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

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

Nicolas Goaziou <address@hidden> writes:

> Hello,
> Rasmus <address@hidden> 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"
                   default-env "\\\\\\1{bmatrix}" table))))
(add-to-list 'org-export-filter-table-functions 'my-latex-table-to-matrix)


Dung makes an excellent fertilizer

reply via email to

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