3

I want to include tikz/pgfplots pictures in an org-mode document both for inline visualisation and export.

I have tried approaches given in this emacs-orgmode thread and in the worg documentation dedicated to latex. However, none provided me with a working example.

Based on the sources above I've tried the following:

#+begin_src latex :results output file graphics :file test.svg 
  \begin{tikzpicture}
    \begin{axis}[title=Title, xlabel={X}, ylabel={Y}, legend entries={A,V}]
      \addplot [mark=square, thin, blue] table [x=x, y=y, col sep=comma] {my_csv1.csv};
      \addplot table [x=x, y=y, col sep=comma] {my_csv2.csv};
    \end{axis}
  \end{tikzpicture}
#+end_src

This produces a svg picture with missing features. In comparison, the pdf produced with the same code leads to the expected figure.

Obtained figure with missing features

I understood the process to generate a svg figure with a babel latex source code is different from the one to generate a pdf, hence the disparity. Actually, it seems that htlatex (called under the hood by org-babel-execute:latex) fails to produce the expected svg from the tex code.

How can I generate tikz/pgfplots pictures so they appear first inline in the org-mode document and then export them easily as I export the document to latex?

I'm using spacemacs with emacs 26.3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.