Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Hi, Torsten, Incidentally, I had to remove \end{scope} (there is no corresponding \begin{scope}) to make your code example work. Could that be causing some of your trouble? Yours, Christian On 10/8/11 4:45 PM, Torsten Wagner wrote: Hi Eric ``: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? Yep Nick solution is working fine. I just wonder what is the order of execution during export. E.g. if I generate the link to a file as output and place it directly under the lines to add a picture in org-mode, I thought the code block would be execute first and the result would replace the function call. The exporter will find a link to a picture and export it as usual. This was the reason I thought the following code should work. #+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 or alternatively #+CAPTION:my great picture #+LABEL: fig:my_picture #+ATTR_LaTeX: #+call: mypicture() As for putting all figure environment and tikz into one latex-code block. First of all I thought that :file fig/mypicture.pdf will generate and process an individual LaTeX file. Thus, I could not use any commands for the main manuscript right? Sure I could skip the :file command however, I would prefer to generate each picture as an individual pdf file. This gives me much more flexibility. I can easily convert them into any other format and share them individually with co-workers. Furthermore, many journals are very strict (and minimal) with there supported LaTeX environment. The tikz package is often not installed on there machines and the upload process would fail. In addition some journals require to upload each figure individually. Thus, I am used already to generate individual pdf-files for each figure and include them into the manuscript by a simple \includegraphic line. Thanks for the help Torsten CC. I notice something else regarding to babel. Please see my next post
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Darlan Cavalcante Moreira darc...@gmail.com writes: It would be nice if org had a begin_tikz block. This block could either create a PDF file or include the tikz code directly in the latex file when exporting to latex (or PDF), and create an SVG file when when exporting to HTML. Of course this block should accept all the usual image options, such as caption and width. A simple search for org LaTeX block would get you to this Worg tutorial: http://orgmode.org/worg/org-tutorials/org-latex-export.html where you will find an intro to the contributed org-special-blocks.el, which almost does what you want already. I don't think it takes option arguments, but you can always define a new environment in your LaTeX setup that is already set up correctly. Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Hi Nicholas, a line similar like [[file:fig/mypicture.pdf ]] ``:results output silent'' should suppress that I think. Yep, thanks that did the job. Nevertheless, I have to add the generated output as a static link to add resp. export it in an org-mode way.. #+CAPTION: My great picture #+LABEL: fig:my_picture #+ATTR_LaTeX: [[fig/mpicture.pdf]] Replacing the manual link by the function call #+call: mypicture() only results again in the line fig/mypicture.pdf (this time without square brackets) Thanks a lot for the help Torsten
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Hi Eric ``: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? Yep Nick solution is working fine. I just wonder what is the order of execution during export. E.g. if I generate the link to a file as output and place it directly under the lines to add a picture in org-mode, I thought the code block would be execute first and the result would replace the function call. The exporter will find a link to a picture and export it as usual. This was the reason I thought the following code should work. #+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 or alternatively #+CAPTION:my great picture #+LABEL: fig:my_picture #+ATTR_LaTeX: #+call: mypicture() As for putting all figure environment and tikz into one latex-code block. First of all I thought that :file fig/mypicture.pdf will generate and process an individual LaTeX file. Thus, I could not use any commands for the main manuscript right? Sure I could skip the :file command however, I would prefer to generate each picture as an individual pdf file. This gives me much more flexibility. I can easily convert them into any other format and share them individually with co-workers. Furthermore, many journals are very strict (and minimal) with there supported LaTeX environment. The tikz package is often not installed on there machines and the upload process would fail. In addition some journals require to upload each figure individually. Thus, I am used already to generate individual pdf-files for each figure and include them into the manuscript by a simple \includegraphic line. Thanks for the help Torsten CC. I notice something else regarding to babel. Please see my next post
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Torsten Wagner torsten.wag...@gmail.com writes: Hi Eric ``: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? Yep Nick solution is working fine. I just wonder what is the order of execution during export. E.g. if I generate the link to a file as output and place it directly under the lines to add a picture in org-mode, I thought the code block would be execute first and the result would replace the function call. The exporter will find a link to a picture and export it as usual. This was the reason I thought the following code should work. Your code example can be reworked as follows and it should export as expected. With a named code block the result may be positioned anywhere in an Org-mode file regardless of the position of the code block. The caption, label and attr_latex lines will be applied to the named result. #+CAPTION:my great picture #+LABEL: fig:my_picture #+ATTR_LaTeX: #+results: mypicture [[file:fig/mypicture.pdf]] This code block may be anywhere in the Org-mode file the result will always be placed at the named results line above. #+srcname: mypicture #+begin_src latex :file fig/mypicture.pdf :packages '(( tikz)) :border 1em :fit :results raw \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 Best -- Eric As for putting all figure environment and tikz into one latex-code block. First of all I thought that :file fig/mypicture.pdf will generate and process an individual LaTeX file. Thus, I could not use any commands for the main manuscript right? Sure I could skip the :file command however, I would prefer to generate each picture as an individual pdf file. This gives me much more flexibility. I can easily convert them into any other format and share them individually with co-workers. Furthermore, many journals are very strict (and minimal) with there supported LaTeX environment. The tikz package is often not installed on there machines and the upload process would fail. In addition some journals require to upload each figure individually. Thus, I am used already to generate individual pdf-files for each figure and include them into the manuscript by a simple \includegraphic line. Thanks for the help Torsten CC. I notice something else regarding to babel. Please see my next post -- Eric Schulte http://cs.unm.edu/~eschulte/
[O] [babel] create tikz pictures in an floating LaTeX environment
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 ]] 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
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Torsten Wagner torsten.wag...@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
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
Nick Dokos nicholas.do...@hp.com writes: Torsten Wagner torsten.wag...@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'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/
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
I have a (very) small personal wiki in org mode where I add stuff that I read/learn that deserve this work. I usually don't need to export it, but recently I was trying to export it to PDF and HTML and I had the same doubt with a block o tikz code. It would be nice if org had a begin_tikz block. This block could either create a PDF file or include the tikz code directly in the latex file when exporting to latex (or PDF), and create an SVG file when when exporting to HTML. Of course this block should accept all the usual image options, such as caption and width. This is just a feature request from a tikz lover. -- Darlan At Fri, 07 Oct 2011 09:14:20 -0600, Eric Schulte wrote: Nick Dokos nicholas.do...@hp.com writes: Torsten Wagner torsten.wag...@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'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/
Re: [O] [babel] create tikz pictures in an floating LaTeX environment
On Fri, 07 Oct 2011 18:26:15 -0300, Darlan Cavalcante Moreira darc...@gmail.com wrote: It would be nice if org had a begin_tikz block. This block could either create a PDF file or include the tikz code directly in the latex file when exporting to latex (or PDF), and create an SVG file when when exporting to HTML. Of course this block should accept all the usual image options, such as caption and width. This is just a feature request from a tikz lover. This would actually be useful for arbitrary latex code. I know in particular that I would love a similiar feature for using Paul Taylor's diagram.sty[fn:1], generetating inline latex, when compiling to PDF, and genertating an SVG when exporting to HTML. It would also be very nice not to have to name every block, just like the inline math doesn't need to be given a name, when using one of the image backends. Tom Footnotes: [fn:1] http://www.paultaylor.eu/diagrams/