On 28 Jul 2023, Ihor Radchenko wrote:
I am slightly confused because there seems to be a need to
define some page settings manually to get "embedded" images. In
the examples in
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html#org2c29903,
there is no mention that we need to define page geometry. Yet,
the section is claiming that base mode "can embed LilyPond
snippets into an Org-mode file".
It is confusing, I agree, and I'm still learning as we move
forward. I guess the question is should basic mode *always*
generate cropped images? If the answer is yes, and it looks like
it is, then maybe we should include paper settings in the
ob-lilypond file.
The basic-mode term is not very helpful. Perhaps
[inline/cropped/embedded]-mode would have been more descriptive in
terms of what it does. Anyway, hard-coding paper settings would
simplify things a bit, but I'm not sure that hard-coding the
version is a good idea and may produce errors with older
installations.
Noweb and babel references are not allowed in header args. And
ob-emacs-lisp also does not support :prologue.
I see, so there's no built-in way to auto-insert a boilerplate
without using the <<>> reference *inside* source blocks.
Anyway, let's not worry about this for now.
There is, but you will have to use direct Elisp to get :prologue
string:
#+name: test
#+begin_src emacs-lisp
(message "This is test")
#+end_src
#+begin_src emacs-lisp :prologue (org-sbe test)
(+ 1 2)
#+end_src
Interesting. I didn't know about org-sbe. Looks useful. I'll look
into it when I find time. In the meantime, we can use:
#+PROPERTY: header-args:lilypond :noweb yes :exports results
:prologue (org-sbe version-and-paper)
if we replace "lilypond" with "org" in the version-and-paper
block. Prologue is useful also for those of us who keep their
settings in a separate file:
#+PROPERTY: header-args:lilypond :exports results :prologue
"\\include \"settings.ly\""
Thanks!
--
Jonathan