emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] orgtbl in languages that do not support block comments


From: Matthew Fidler
Subject: [Orgmode] orgtbl in languages that do not support block comments
Date: Thu, 13 Jan 2011 13:37:04 -0600

All,

I have written org-table-comment.el (at http://www.emacswiki.org/emacs/download/org-table-comment.el) which should allows you to create org-tables in languages that do not have
block comments.  For example in elisp:

;; |------+----------------+----+-------|
;; |      |                |    | <5>   |
;; | This | is             | a  | table |
;; | that | may be created | in | orgtbl-comment-mode |
;; |------+----------------+----+-------|

or

;; |------+----------------+----+---------------------|
;; | This | is             | a  | table               |
;; | that | may be created | in | orgtbl-comment-mode |
;; |------+----------------+----+---------------------|

It also supports single-comment radio tables, for example in LaTeX
the following now works if you are using the overlays driver for
org-table-comment:

% BEGIN RECEIVE ORGTBL salesfigures
% END RECEIVE ORGTBL salesfigures

% #+ORGTBL: SEND salesfigures orgtbl-to-latex
% |-------+------+---------+---------|
% | Month | Days | Nr sold | per day |
% |-------+------+---------+---------|
% | Jan   |   23 |      55 |     2.4 |
% | Feb   |   21 |      16 |     0.8 |
% | March |   22 |     278 |    12.6 |
% |-------+------+---------+---------|
% #+TBLFM: $4=$3/$2;.1f

When editing the table, pressing C-c C-c produces the LaTeX table, as follows:

% BEGIN RECEIVE ORGTBL salesfigures
\begin{tabular}{lrrr}
\hline
Month & Days & Nr sold & per day \\
\hline
Jan & 23 & 55 & 2.4 \\
Feb & 21 & 16 & 0.8 \\
March & 22 & 278 & 12.6 \\
\hline
\end{tabular}
% END RECEIVE ORGTBL salesfigures

% #+ORGTBL: SEND salesfigures orgtbl-to-latex
% |-------+------+---------+---------|
% | Month | Days | Nr sold | per day |
% |-------+------+---------+---------|
% | Jan   |   23 |      55 |     2.4 |
% | Feb   |   21 |      16 |     0.8 |
% | March |   22 |     278 |    12.6 |
% |-------+------+---------+---------|
% #+TBLFM: $4=$3/$2;.1f

NOTE: This requires `comment-region' and `uncomment-region' to work
properly in the mode you are using.  Also filling/wrapping in the
mode needs to not wrap the orgbls.

If anyone is interested in testing this and letting me know if it works on other platforms, let me know.

Matt.

reply via email to

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