[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: Sun, 18 Nov 2012 15:05:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)


> That's because you use "booktabs" by default. It creates horizontal
> rules, and the filter hence doesn't apply.

Aha.  Is this (again) a misunderstanding because I though of org
source?  I tried to identify org tables with rules.

> Since e-latex back-end doesn't strip anything in regular LaTeX
> snippets or environments, it should be the same here. Switching to
> math mode won't happen automatically, so the user can act
> appropriately.

I guess it's fine for most applications.

> :environment value is a string. It can be set to anything.

Probably the best approach. 

> That's not a problem, Org handles alignment per column already:
>     | <c> | <c> |
>     | a   | b   |
>     | c   | d   |

I had no idea.  That's very cool.

> Then the backend can add the alignment as an optional argument in math
> mode only when the name of the environment ends with a star and the
> alignment string is one character long.

In the LATEX_ATTR or as in the example above?  The former I assume.

> To circumvent the problem, org-e-latex.el can use a defconst to store
> table/matrix environments requiring "\cr" instead of "\\" at the end of
> each row. It will, as a starter, only contain "bordermatrix".

OK.  How about just making a list of strings (with typical member
STRING) which are known to have the format
\STRING{matrix-like-output}?  Then one can add whichever crazy
environment that might be needed to this list.  And users can easily
add their favorite flavor of e.g. bordermatrix.  

A short experiment seems to suggest that \cr works in place of \\.

> Any name to suggest for it?

I prefer the approach where the exists a list of macro-matrices, maybe
with delimiter and/or line separator. Then the the value of
:environment can be checked against this list.
E.g. org-e-latex-matrix-macro-environments.  By default:

     '(("bordermatrix" "\cr"))

And I'd personally extend it to 

    '(("bordermatrix" "\cr") ("kbordermatrix" "\\"))

NOTE: probably it's not nice to store line seperator and such here,
and indeed

      '("bordermatrix" "kbordermatix")

seems like a nicer (as in simpler) list.

> Ok. Then the sanest approach is to allow :math-mode to be set to nil,
> t or `inline'. When `inline', as you suggest, it replaces \[...\] with
> \(...\) and ignores any label. But it still uses whatever environment is
> provided in :environment, that is, it won't make any guess about which
> one to use.

Yeah, you're right.  Less guessing is better guessing.  'Display'
might be same t.

> Also, instead of using a single `org-e-latex-default-table-environment',
> its value can be a plist like the following:
>    (:table-mode "tabular" :math-mode "bmatrix" :inline-math-mode 
> "smallmatrix")

Yeah, that would be nice.  Would it extend to the options in
ATTR_LATEX?  I.e. would it be nice (?) to be able to specify
   - environment
   - math-environment
   - inline-math-environment
in one option line s.t. I could easily switch from table to matrix to
inline matrix?  E.g.

#+ATTR_LATEX: :math-environment "Bmatrix" :math-mode t
prints a display matrix 
#+ATTR_LATEX: :math-environment "Bmatrix" :math-mode nil
prints a table.

I don't know whether this is just making things more confusing or
whether it would be useful. . . 

Also, at least a prefix string would be very useful as that's how
matrices are usually named.  E.g. 

#+ATTR_LATEX: :math-mode t :prefix "P="

is translated to 


Dung makes an excellent fertilizer

reply via email to

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