Nicolas Goaziou <n.goaz...@gmail.com> writes: > Hello, > > Rasmus <ras...@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\\)}.*" 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