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




Reply via email to