emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Failed to create radio tables


From: Nick Dokos
Subject: Re: [Orgmode] Failed to create radio tables
Date: Sat, 10 Jul 2010 15:26:41 -0400

Angel Popov <address@hidden> wrote:

> Hi, 
> I am following example on radio tables but it looks that it does not work.
> I copied
> 
>      % BEGIN RECEIVE ORGLST to-buy
>      % END RECEIVE ORGLST to-buy
>      \begin{comment}
>      #+ORGLIST: SEND to-buy orgtbl-to-latex
>      - a new house
>      - a new computer
>        + a new keyboard
>        + a new mouse
>      - a new life
>      \end{comment}
> 
> and when I C-c C-c on '- a new house' nothing happend
> 

Well, you are not following the example exactly (App. A.5.2 of the Org
manual): you are trying to extend it to lists and I'm not sure that you
can do that.  So let me go back to the example in the manual and explain
the rationale:

The idea is that specifying tables in Org is easy, but specifying tables
in LaTeX is harder. It would be convenient if you could use Org mode
syntax for tables *in your LaTeX file* and have the LaTeX table
generated automatically from that.  That's what radio tables do for you:
in your LaTeX file, you include the table in Org syntax *as a comment* and
then you use orgtbl facilities to automatically generate your LaTeX
table.

So here's my LaTeX file with the example table:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\begin{document}
Here's a table of stuff:

% BEGIN RECEIVE ORGTBL to-buy
% END RECEIVE ORGTBL to-buy


\begin{comment}
The Org table is inside a LaTeX comment.

#+ORGTBL: SEND to-buy orgtbl-to-latex
| foo | bar |
|-----+-----|
|   1 |   2 |
|   3 |   4 |
\end{comment}

\end{document}
--8<---------------cut here---------------end--------------->8---

When you edit this file, the major mode of the buffer is going to be
LaTeX-mode, not Org-mode. This is where orgtbl-mode comes in: it's a
minor mode, so you can enable it in your LaTeX-mode buffer:

M-x orgtbl-mode <RET>

and then you have the orgtbl facilities available in the buffer where
you are editing your LaTeX file. Now put your cursor somewhere in the
Org table and say C-c C-c - presto, change-o, you get this:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\begin{document}
Here's a table of stuff:

% BEGIN RECEIVE ORGTBL to-buy
\begin{tabular}{rr}
foo & bar \\
\hline
1 & 2 \\
3 & 4 \\
\end{tabular}
% END RECEIVE ORGTBL to-buy


\begin{comment}
The Org table is inside a LaTeX comment.

#+ORGTBL: SEND to-buy orgtbl-to-latex
| foo | bar |
|-----+-----|
|   1 |   2 |
|   3 |   4 |
\end{comment}

\end{document}
--8<---------------cut here---------------end--------------->8---

Process this with LaTeX and you get a nicely typeset table, without
having to worry much about the finicky LaTeX syntax. Plus, if you
need to change the table, you change the Org table in the comment,
press C-c C-c again and the change is propagated automatically to the
LaTeX table.

In addition, if you enable orgtbl-mode before you even start, then you
have all the nice shortcuts for *editing* the Org table in the first
place. In fact, it's handy to have orgtbl-mode *always* enabled when you
edit LaTeX files. You can do that by using the appropriate hook.  For
example, if you use AucTeX, add the following line to your .emacs (after
the place where AucTeX is initialized, so that it has a chance to define
the hook):

  (add-hook 'LaTeX-mode-hook 'orgtbl-mode)


AFAIK, you *cannot* do something similar with lists (which is what
you seem to have tried with your modifications to the example), but lists
are much easier to deal with directly in LaTeX.

Hope this makes things clearer,
Nick



reply via email to

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