emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Florian Adamsky <fa-orgmode@haktar.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Include single values from a org-table into a code-block
Date: Fri, 14 Dec 2012 12:22:52 -0700	[thread overview]
Message-ID: <876244h20j.fsf@gmail.com> (raw)
In-Reply-To: <20121214200842.47bb9a40@asmara> (Florian Adamsky's message of "Fri, 14 Dec 2012 20:08:42 +0100")

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

Florian Adamsky <fa-orgmode@haktar.org> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example.org --]
[-- Type: text/x-org, Size: 207 bytes --]

#+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

[-- Attachment #3: Type: text/plain, Size: 46 bytes --]


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

      reply	other threads:[~2012-12-14 19:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 19:08 Include single values from a org-table into a code-block Florian Adamsky
2012-12-14 19:22 ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=876244h20j.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=fa-orgmode@haktar.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).