[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\\)}.*"
org-e-latex-default-table-environment)))
(when (string-match default-env table)
(concat "\\[\n"
(org-trim
(replace-regexp-in-string "\n\n" "\n"
(replace-regexp-in-string
"\\\\\\(begin\\|end\\){\\(center\\|table\\)}\\|\\\\toprule\\|\\\\bottomrule\\|\[[htbH]+?\]"
""
(replace-regexp-in-string
default-env "\\\\\\1{bmatrix}" table))))
"\n\\]\n")))))
(add-to-list 'org-export-filter-table-functions 'my-latex-table-to-matrix)
#+end_src
--
Dung makes an excellent fertilizer
- [O] Export tables as matrices (change tbl-export function on the fly), Rasmus, 2012/11/14
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Nicolas Goaziou, 2012/11/14
- Re: [O] Export tables as matrices (change tbl-export function on the fly),
Rasmus <=
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Rasmus Pank Roulund, 2012/11/17
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Nicolas Goaziou, 2012/11/17
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Rasmus, 2012/11/17
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Nicolas Goaziou, 2012/11/18
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Rasmus, 2012/11/18
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Nicolas Goaziou, 2012/11/18
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Rasmus, 2012/11/18
- Re: [O] Export tables as matrices (change tbl-export function on the fly), Nicolas Goaziou, 2012/11/18