[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Problems with LaTeX source block
From: |
Andreas Leha |
Subject: |
Re: [O] Problems with LaTeX source block |
Date: |
Mon, 15 Jul 2013 10:57:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Hi Julien,
Julien Cubizolles <address@hidden> writes:
> I'm struggling with LaTeX source blocks and am not sure anymore if one
> can use the :results file header.
>
> I have a csv file to be processed by tikz to get a png picture displayed
> in my org buffer.
>
> Here is what I tried
>
> #+NAME: python-tikz
> #+header: :results file :file py2tikz_sin.png
> #+header: :fit yes :headers '("\\usepackage{tikz,pgfplots}")
> #+BEGIN_SRC latex :exports results
> \begin{tikzpicture}
> \begin{axis}
> \addplot table {sin_py2csv.csv};
> \end{axis}
> \end{tikzpicture}
> 'py2tikz_sin.png'
> #+END_SRC
>
> #+RESULTS: python-tikz
> #+BEGIN_LaTeX
> [[file:py2tikz_sin.png]]
> #+END_LaTeX
>
> Two problems with that: the py2tikz_sin.png file isn't produced (the
> latex code is correct though) and I was under the impression that the
> :results file header should give a #RESULTS without the LaTeX block
> (it's what I get for python blocks anyway).
>
> The data is produced by python (I can get python-babel to work !) and I
> could get a png directly through python-babel but latex-babel should be
> able to do it, right ?
>
> Julien.
try that instead
--8<---------------cut here---------------start------------->8---
#+NAME: python-tikz
#+header: :results raw :file py2tikz_sin.png
#+header: :imagemagick yes :fit yes :headers '("\\usepackage{tikz,pgfplots}")
#+BEGIN_SRC latex :exports results
\begin{tikzpicture}
\node[red!50!black] (a) {A};
\node (b) [right of=a] {B};
\draw[->] (a) -- (b);
\end{tikzpicture}
#+END_SRC
--8<---------------cut here---------------end--------------->8---
for problem one: you are missing the :imagemagick yes header argument,
which is necessary to do the latex->png conversion. Also, the filename
is inserted for you and is, thus, not part of the latex block.
for problem two: :results raw solves that, although I agree,
that :results file should work here.
Regards,
Andreas