From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [babel] create tikz pictures in an floating LaTeX environment Date: Fri, 07 Oct 2011 09:14:20 -0600 Message-ID: <8762k0suk3.fsf@gmail.com> References: <6991.1317996835@alphaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:40506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCC85-000438-JT for emacs-orgmode@gnu.org; Fri, 07 Oct 2011 11:14:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCC80-0001Vm-Q4 for emacs-orgmode@gnu.org; Fri, 07 Oct 2011 11:14:29 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:63102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCC80-0001Vd-No for emacs-orgmode@gnu.org; Fri, 07 Oct 2011 11:14:24 -0400 Received: by qyl38 with SMTP id 38so722468qyl.0 for ; Fri, 07 Oct 2011 08:14:24 -0700 (PDT) In-Reply-To: <6991.1317996835@alphaville.dokosmarshall.org> (Nick Dokos's message of "Fri, 07 Oct 2011 10:13:55 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Org Mode Mailing List Nick Dokos writes: > Torsten Wagner 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's solution should work well. Also, (if you're exporting to LaTeX) couldn't you just combine the tikz picture and the wrapping figure environment into a single begin_latex block? Best -- Eric > > 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 >> > -- Eric Schulte http://cs.unm.edu/~eschulte/