Re: [O] Include single values from a org-table into a code-block

2012-12-14 Thread Eric Schulte
Florian Adamsky  writes:

> Hello,
>
> at the moment I'm drafting a paper and I would like to insert values
> from a org-table into a code-block. After searching a bit a found a mail
> thread from 2010 [1] which says I have to do the following:
>
> src_emacs-lisp[:var d=test-table[3,1]]{d}
>
> This works fine but only in non code-blocks. But I want to insert these
> values in a LaTeX block, since I want to generate a pgfplot. Is there
> another way to get values from a org-table? Or is it possible to combine
> the above code with a Macro? In the following you'll find an example:
>
> #+Begin_LaTeX
> \begin{tikzpicture}
> %% pgfplot code
> \addplot coordinates {(0, src_emacs-lisp[:var d=test-table[3,1]]{d})};
> \end{tikzpicture}
> #+End_LaTeX
>
> Thanks in advance.
>
> Best,
> Florian 
>
> [1]
> http://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg01104.html
>

You can use a latex code block (however you must enable support for
evaluating latex code blocks).  See the attached example.

#+Options: toc:nil

* Example

Here is a table.

#+Caption: I am the table.
#+name: a-table
| 1 |
| 2 |
| 3 |
| 4 |

#+begin_src latex :var foo=a-table[0,0]
  The first value of this table is foo.
#+end_src

-- 
Eric Schulte
http://cs.unm.edu/~eschulte


[O] Include single values from a org-table into a code-block

2012-12-14 Thread Florian Adamsky
Hello,

at the moment I'm drafting a paper and I would like to insert values
from a org-table into a code-block. After searching a bit a found a mail
thread from 2010 [1] which says I have to do the following:

src_emacs-lisp[:var d=test-table[3,1]]{d}

This works fine but only in non code-blocks. But I want to insert these
values in a LaTeX block, since I want to generate a pgfplot. Is there
another way to get values from a org-table? Or is it possible to combine
the above code with a Macro? In the following you'll find an example:

#+Begin_LaTeX
\begin{tikzpicture}
%% pgfplot code
\addplot coordinates {(0, src_emacs-lisp[:var d=test-table[3,1]]{d})};
\end{tikzpicture}
#+End_LaTeX

Thanks in advance.

Best,
Florian 

[1]
http://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg01104.html