I have a similar issue as the one in this post, but I have file header arguments so the ditaa source blocks results don't get added to a pdf via org-export dispatcher:


#+PROPERTY: header-args :eval never-export


I'm creating the diagrams in a separate file because they are too big, but I would like to include them in the source blocks so I can evaluate them interactively. My goal:


#+RESULTS: file:my-ditaa-diagram.svg


So far, two approaches to the problem have failed:

1 . writing a ditaa source block, include file in :file header-arg, evaluate empty block


#+BEGIN_SRC ditaa :file ./diagrams/ditaa-test.txt :cmdline --svg -E

#+RESULTS: [[file:./diagrams/ditaa-test.txt]]

  1. invoking the shell to run ditaa as I would do so in the commandline interface:
#+BEGIN_SRC sh :var file="./diagrams/ditaa-test.txt" :var ditaa="~/.emacs.d/ditaa/ditaa-0.11.0-standalone.jar"
java -jar "$ditaa" -Eo --svg "$file"

The second approach sent this error message when I evaluated the source block: Error: Unable to access jarfile ~/.emacs.d/ditaa/ditaa-0.11.0-standalone.jar

I cannot reproduce this error when I actually run ditaa in the commandline. That is, I can create the diagrams when I shoot up the terminal and write that same line in my command prompt.

Since I have too many diagrams, my work would slow down if I would have to build them everytime, move them to the same working directory as my Org file, and then including them one by one in my org file. Ideally, I would like to build them seperately, include them in my source block and then just evaluate them (C-c C-c instead of java -jar dita.jar myfile.txt -Eo --svg).

Given that: I have large ditaa diagrams but would like to interactively export the results to my org buffer; I have tried the solution in the link to a similar post but failed; have tried to solve my problem as sketched in point 1 and 2 in the text above; need to create SVG images and be able to export them to the same working directory (even though my diagrams are in a seperate ./diagrams/ folder relative to my working org file + a weird LaTeX svg package quirk requires that the SVG images are in the same path as the file that includes them).

How can I evaluate a ditaa diagram from an included file and export the results in the same file path and not export results to PDF?


I have tried the answer provided here: https://lists.gnu.org/archive/html/emacs-orgmode/2011-12/msg00272.html. With this code snippet:

#+NAME: Diagram
#+BEGIN_SRC ditaa :file diagram.svg :cmdline --svg -E :exports code
#+INCLUDE: ./diagrams/diagram.txt

#+RESULTS: Diagram

And I get an SVG exported to my buffer file path but I don't get the diagram rendered... instead I get a rendered SVG with text #+INCLUDE: ./diagrams/diagram.txt

Your Answer

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