emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Torsten Wagner <torsten.wagner@gmail.com>
Cc: nicholas.dokos@hp.com, Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: [babel] create tikz pictures in an floating LaTeX environment
Date: Fri, 07 Oct 2011 10:13:55 -0400	[thread overview]
Message-ID: <6991.1317996835@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Torsten Wagner <torsten.wagner@gmail.com> of "Fri, 07 Oct 2011 23:02:07 +0900." <CAPaq-gMVft++WRzBXfwijqcJ-2kMc1NN+tBGJn5KtWayrwS-Cw@mail.gmail.com>

Torsten Wagner <torsten.wagner@gmail.com> wrote:

> Hi all,
> Hi Eric (hehehe because most likely you read it ;) )
> 
> I try for the first time to write an entire article in org-mode.
> I do so, because with the tags :export: :noexport: I can easily keep
> my personal notes and todos "hidden" and the final export will be just
> what I want to publish.
> Furthermore, I'm interested to do my data evaluation in python blocks
> within the org-file itself, keeping all nicely together.
> 
> At the moment I try to add a tikz picture to the manuscript. I
> followed the example at
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html
> However, I have some problems. I can generate the picture by using the
> following code.
> 
> #+srcname: mypicture
> #+begin_src latex :file fig/mypicture.pdf :packages '(("" "tikz"))
> :border 1em :fit
>   \begin{tikzpicture}[line width=1pt,text centered, inner sep = 2]
>       \draw[fill=red!50] (0,0) rectangle  ++(5,1);
>       \draw[fill=yellow!50] (1,1) rectangle  ++(1,0.25);
>       \draw[fill=yellow!50] (3,1) rectangle  ++(1,0.25);
>       \draw[fill=green!50] (0.75,1) rectangle  ++(1.5,-0.4);
>       \draw[fill=green!50] (2.75,1) rectangle  ++(1.5,-0.4);
>   \end{scope}
>   \end{tikzpicture}
> #+end_src
> 
> Now, I want to include this in a floating figure environment
> This troubles me a bit.
> I tried to make a second latex src block which includes the
> environment and an \includegraphic pointing to the generated pdf file.
> However, I always find a link of the filename in addtion. I guess this
> is the result of the first (above) source code block. The pdf contains
> a line similar like
> [[file:fig/mypicture.pdf ]]
> 


``:results output silent'' should suppress that I think.

Nick

> I switched over to use the org-mode way of including a figure and
> replaced the latex second src code block by
> 
> #+CAPTION:    my great picture
> #+LABEL:      fig:my_picture
> #+ATTR_LaTeX:
> [[file:fig/mypicture.pdf]]
> 
> This worked out too and was identically to the fist approach, however,
> there was still the result line in the output.
> I tried to add exports: none  and volia the line was gone. However,
> the source code block was not exported at all and hence the picture
> not updated at all (it simply used the old generated pdf)
> 
> I tried to be ueber-smart and replaced the static link
> [[file:fig/mypicture.pdf]]
> by
> #+call:  mypicture
> in the hope it would be executed and result in
> [[file:fig/mypicture.pdf]]
> finally getting the same like with the static link. However, this did
> not work out at all. No figure.
> 
> Could someone help me to sort this out. Ideally, I would like to do a
> rather logical combination and end up with the following:
> 
> #+CAPTION:    my great picture
> #+LABEL:      fig:my_picture
> #+ATTR_LaTeX:
> #+srcname: mypicture
> #+begin_src latex :file fig/mypicture.pdf :packages '(("" "tikz"))
> :border 1em :fit
>   \begin{tikzpicture}[line width=1pt,text centered, inner sep = 2]
>       \draw[fill=red!50] (0,0) rectangle  ++(5,1);
>       \draw[fill=yellow!50] (1,1) rectangle  ++(1,0.25);
>       \draw[fill=yellow!50] (3,1) rectangle  ++(1,0.25);
>       \draw[fill=green!50] (0.75,1) rectangle  ++(1.5,-0.4);
>       \draw[fill=green!50] (2.75,1) rectangle  ++(1.5,-0.4);
>   \end{scope}
>   \end{tikzpicture}
> #+end_src
> 
> avoiding to call/type  the filename/link over and over again.
> 
> Thanks for helping
> 
> Torsten
> 

  reply	other threads:[~2011-10-07 14:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 14:02 [babel] create tikz pictures in an floating LaTeX environment Torsten Wagner
2011-10-07 14:13 ` Nick Dokos [this message]
2011-10-07 15:14   ` Eric Schulte
2011-10-07 21:26     ` Darlan Cavalcante Moreira
2011-10-07 21:44       ` Tom Prince
2011-10-08  6:32       ` Achim Gratz
2011-10-08 14:45     ` Torsten Wagner
2011-10-08 19:49       ` Eric Schulte
2011-10-09  7:30       ` Christian Moe
2011-10-08 14:29   ` Torsten Wagner

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=6991.1317996835@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=torsten.wagner@gmail.com \
    /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).