This is the official manual for the latest Org-mode release.

Table of Contents

Next: , Previous: A LaTeX example, Up: Tables in arbitrary syntax

A.6.3 Translator functions

Orgtbl mode has several translator functions built-in: orgtbl-to-csv (comma-separated values), orgtbl-to-tsv (TAB-separated values) orgtbl-to-latex, orgtbl-to-html, orgtbl-to-texinfo, orgtbl-to-unicode and orgtbl-to-orgtbl. These all use a generic translator, orgtbl-to-generic, which, in turn, delegates translations to various export back-ends.

In particular, properties passed into the function (i.e., the ones set by the ‘ORGTBL SEND’ line) take precedence over translations defined in the function. So if you would like to use the LaTeX translator, but wanted the line endings to be ‘\\[2mm]’ instead of the default ‘\\’, you could just overrule the default with

     #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"

For a new language, you can use the generic function to write your own converter function. For example, if you have a language where a table is started with ‘!BTBL!’, ended with ‘!ETBL!’, and where table lines are started with ‘!BL!’, ended with ‘!EL!’, and where the field separator is a TAB, you could define your generic translator like this:

     (defun orgtbl-to-language (table params)
       "Convert the orgtbl-mode TABLE to language."
         '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")

Please check the documentation string of the function orgtbl-to-generic for a full list of parameters understood by that function, and remember that you can pass each of them into orgtbl-to-latex, orgtbl-to-texinfo, and any other function using the generic function.

Of course you can also write a completely new function doing complicated things the generic translator cannot do. A translator function takes two arguments. The first argument is the table, a list of lines, each line either the symbol hline or a list of fields. The second argument is the property list containing all parameters specified in the ‘#+ORGTBL: SEND’ line. The function must return a single string containing the formatted table. If you write a generally useful translator, please post it on so that others can benefit from your work.