From: "Vladimir Alexiev" <vladimir.alexiev@ontotext.com>
To: emacs-orgmode@gnu.org
Subject: How to define file-local preamble for graphviz dot?
Date: Fri, 1 Aug 2014 19:28:01 +0300 [thread overview]
Message-ID: <11526.9980895848$1406910543@news.gmane.org> (raw)
I have a bunch of dot settings that I want to set globally. I hacked it like this:
(setq va/org-dot-preamble "digraph g {
rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2
node [fontname=courier fontsize=10 margin=\"0.02,0.01\" shape=box width=0.1 height=0.1]
edge [fontname=courier fontsize=8 labelfontname=courier labelfontsize=8]")
(defadvice org-babel-expand-body:dot (before add-preamble (body params) activate)
"add DOT=va/org-dot-preamble as :var in params, so $dot is replaced with it"
(setq params (cons (cons ':var (cons 'DOT va/org-dot-preamble))
params)))
And then I start dot code blocks with "$dot", which is replaced with the above string:
#+begin_src dot :results silent file :file ./img/SymmetricProperty.png
$dot
x -> y [label="q"]
y -> x [label="q" color=red]
}
#+end_src
I can override a dot param by adding a different value after the common inclusion $dot, e.g.:
$dot ranksep=0.7
The problem is
*** how can I make this per-file?
Neither #+BIND nor emacs "Local Variables:" does the trick.
Bonus if I can do it per-heading :-)
dot can take these settings from the command line, eg
-G "rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2"
-N "fontname=courier fontsize=10 margin=\"0.02,0.01\" shape=box width=0.1 height=0.1"
-E "fontname=courier fontsize=8 labelfontname=courier labelfontsize=8"
So I could try to mess with the :cmdline slot of org-babel-default-header-args:dot ... is this evaluated locally?
next reply other threads:[~2014-08-01 16:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 16:28 Vladimir Alexiev [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-08-05 14:30 How to define file-local preamble for graphviz dot? Vladimir Alexiev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='11526.9980895848$1406910543@news.gmane.org' \
--to=vladimir.alexiev@ontotext.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).