all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Org-babel-lilypond always renders full pages
@ 2020-03-29 21:11 Oliver Heck
  2020-03-29 23:58 ` Jonathan Gregory
  0 siblings, 1 reply; 17+ messages in thread
From: Oliver Heck @ 2020-03-29 21:11 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I am trying to use org-babel-lilypond and basically got it running. But 
somehow I always get full lilypond pages back instead of a small snippet.
This is what I have in my org-file:

#+NAME: Lilypond
#+BEGIN_SRC lilypond :file test.png
   \relative c'' { c d e f }
#+END_SRC


I read through the documentation on 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html 
but cannot find a clue.

Any idea what I am doing wrong here?

Cheers,
Oliver

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-29 21:11 Org-babel-lilypond always renders full pages Oliver Heck
@ 2020-03-29 23:58 ` Jonathan Gregory
  2020-03-30  4:34   ` Oliver Heck
  2020-03-30  6:55   ` Oliver Heck
  0 siblings, 2 replies; 17+ messages in thread
From: Jonathan Gregory @ 2020-03-29 23:58 UTC (permalink / raw)
  To: emacs-orgmode

Hi

On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:

> Hi,
>
> I am trying to use org-babel-lilypond and basically got it running.
> But somehow I always get full lilypond pages back instead of a small
> snippet.
> This is what I have in my org-file:
>
> #+NAME: Lilypond
> #+BEGIN_SRC lilypond :file test.png
>   \relative c'' { c d e f }
> #+END_SRC
>
>
> I read through the documentation on
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
> but cannot find a clue.
>
> Any idea what I am doing wrong here?
>
> Cheers,
> Oliver

The lilypond manual suggests using \paper variables to reduce the white
space around the score. In particular, you should set oddFooterMarkup
and oddHeaderMarkup to false.

\paper{
  indent=0\mm
  line-width=120\mm
  oddFooterMarkup=##f
  oddHeaderMarkup=##f
  bookTitleMarkup = ##f
  scoreTitleMarkup = ##f
}

http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs

--
Jonathan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-29 23:58 ` Jonathan Gregory
@ 2020-03-30  4:34   ` Oliver Heck
  2020-03-30  5:35     ` stardiviner
  2020-03-31 13:43     ` Jonathan Gregory
  2020-03-30  6:55   ` Oliver Heck
  1 sibling, 2 replies; 17+ messages in thread
From: Oliver Heck @ 2020-03-30  4:34 UTC (permalink / raw)
  To: emacs-orgmode

Hi Jonathan,

that works fine. Thank you!

Can I set this as default header somewhere in the org file or will I 
have to include it to every snippet (I will have a lot of them).

Oliver

On 30.03.20 01:58, Jonathan Gregory wrote:
> Hi
> 
> On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
> 
>> Hi,
>>
>> I am trying to use org-babel-lilypond and basically got it running.
>> But somehow I always get full lilypond pages back instead of a small
>> snippet.
>> This is what I have in my org-file:
>>
>> #+NAME: Lilypond
>> #+BEGIN_SRC lilypond :file test.png
>>    \relative c'' { c d e f }
>> #+END_SRC
>>
>>
>> I read through the documentation on
>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
>> but cannot find a clue.
>>
>> Any idea what I am doing wrong here?
>>
>> Cheers,
>> Oliver
> 
> The lilypond manual suggests using \paper variables to reduce the white
> space around the score. In particular, you should set oddFooterMarkup
> and oddHeaderMarkup to false.
> 
> \paper{
>    indent=0\mm
>    line-width=120\mm
>    oddFooterMarkup=##f
>    oddHeaderMarkup=##f
>    bookTitleMarkup = ##f
>    scoreTitleMarkup = ##f
> }
> 
> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs
> 
> --
> Jonathan
> 

-- 
--
If you are thinking without writing, you only think you are thinking. 
(Leslie Lamport)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-30  4:34   ` Oliver Heck
@ 2020-03-30  5:35     ` stardiviner
  2020-03-30  5:54       ` Oliver Heck
  2020-03-30  5:58       ` stardiviner
  2020-03-31 13:43     ` Jonathan Gregory
  1 sibling, 2 replies; 17+ messages in thread
From: stardiviner @ 2020-03-30  5:35 UTC (permalink / raw)
  To: Oliver Heck; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


You might want to try this:

#+begin_src emacs-lisp
(add-to-list 'org-babel-default-header-args:lilypond
             '((:prologue . "\paper{
  indent=0\mm
  line-width=120\mm
  oddFooterMarkup=##f
  oddHeaderMarkup=##f
  bookTitleMarkup = ##f
  scoreTitleMarkup = ##f
}")))
#+end_src

Oliver Heck <oliver.heck@posteo.de> writes:

> Hi Jonathan,
>
> that works fine. Thank you!
>
> Can I set this as default header somewhere in the org file or will I have to
> include it to every snippet (I will have a lot of them).
>
> Oliver
>
> On 30.03.20 01:58, Jonathan Gregory wrote:
>> Hi
>> On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
>> 
>>> Hi,
>>>
>>> I am trying to use org-babel-lilypond and basically got it running.
>>> But somehow I always get full lilypond pages back instead of a small
>>> snippet.
>>> This is what I have in my org-file:
>>>
>>> #+NAME: Lilypond
>>> #+BEGIN_SRC lilypond :file test.png
>>>    \relative c'' { c d e f }
>>> #+END_SRC
>>>
>>>
>>> I read through the documentation on
>>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
>>> but cannot find a clue.
>>>
>>> Any idea what I am doing wrong here?
>>>
>>> Cheers,
>>> Oliver
>> The lilypond manual suggests using \paper variables to reduce the white
>> space around the score. In particular, you should set oddFooterMarkup
>> and oddHeaderMarkup to false.
>> \paper{
>>    indent=0\mm
>>    line-width=120\mm
>>    oddFooterMarkup=##f
>>    oddHeaderMarkup=##f
>>    bookTitleMarkup = ##f
>>    scoreTitleMarkup = ##f
>> }
>> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs
>> --
>> Jonathan
>> 
>
> -- 


- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6BhTYUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsP5FAf/cxuPIpA7asX7esGCgZo3p+xJEbaj
sblsus9U586m6uwrGDyCAlNFCTsIFNx5cby1HKHQ7pI5EswrQxu7rve4qpqspqbI
ifw615Q5Q6cwCEPC1DTSQp6w7m6qHrDu1TrgL8bhvgPciaf9GH9uHszpuYi259R4
/66iyCyYEK55JAfFmoYpXhMoY1PsUHt2E8/PCHnbkys8Cbg1b2P9IUCNHq2XoiF2
1vFoGtVHGaGx48bmqztg/J4xTkJpj0VgeEMF3d/reT05ToZsYoa4mCFj/TWv+6q7
/zahVFf1KempQgM1KLbBvfRXzw8J8h9f2N9rCurdtFnr/03T2T5uEx+zqw==
=9fTG
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-30  5:35     ` stardiviner
@ 2020-03-30  5:54       ` Oliver Heck
  2020-03-30  5:58       ` stardiviner
  1 sibling, 0 replies; 17+ messages in thread
From: Oliver Heck @ 2020-03-30  5:54 UTC (permalink / raw)
  To: numbchild; +Cc: emacs-orgmode

This throws an error:

org-babel-exp process emacs-lisp at position 1...
org-babel-exp process lilypond at position 480...
sort: Wrong type argument: stringp, (:prologue . "paper{
   indent=0mm
   line-width=120mm
   oddFooterMarkup=##f
   oddHeaderMarkup=##f
   bookTitleMarkup = ##f
   scoreTitleMarkup = ##f
}")


On 30.03.20 07:35, stardiviner wrote:
> You might want to try this:
> 
> #+begin_src emacs-lisp
> (add-to-list 'org-babel-default-header-args:lilypond
>               '((:prologue . "\paper{
>    indent=0\mm
>    line-width=120\mm
>    oddFooterMarkup=##f
>    oddHeaderMarkup=##f
>    bookTitleMarkup = ##f
>    scoreTitleMarkup = ##f
> }")))
> #+end_src
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-30  5:35     ` stardiviner
  2020-03-30  5:54       ` Oliver Heck
@ 2020-03-30  5:58       ` stardiviner
  2020-03-31 13:48         ` Jonathan Gregory
  1 sibling, 1 reply; 17+ messages in thread
From: stardiviner @ 2020-03-30  5:58 UTC (permalink / raw)
  To: numbchild; +Cc: Oliver Heck, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


stardiviner <numbchild@gmail.com> writes:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> You might want to try this:
>
> #+begin_src emacs-lisp
> (add-to-list 'org-babel-default-header-args:lilypond
>              '((:prologue . "\paper{
>   indent=0\mm
>   line-width=120\mm
>   oddFooterMarkup=##f
>   oddHeaderMarkup=##f
>   bookTitleMarkup = ##f
>   scoreTitleMarkup = ##f
> }")))
> #+end_src
>

I found this custom setting lilypond header arguments will not work. Because this code function:

#+begin_src emacs-lisp
(defun org-babel-lilypond-get-header-args (mode)
  "Default arguments to use when evaluating a lilypond source block.
These depend upon whether we are in Arrange mode i.e. MODE is t."
  (cond (mode
         '((:tangle . "yes")
           (:noweb . "yes")
           (:results . "silent")
           (:cache . "yes")
           (:comments . "yes")))
        (t
         '((:results . "file")
           (:exports . "results")))))

(defun org-babel-lilypond-set-header-args (mode)
  "Set org-babel-default-header-args:lilypond
dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE."
  (setq org-babel-default-header-args:lilypond
        (org-babel-lilypond-get-header-args mode)))
#+end_src

It always reset and return one result of two conditions.

I think this is a bug.

> Oliver Heck <oliver.heck@posteo.de> writes:
>
>> Hi Jonathan,
>>
>> that works fine. Thank you!
>>
>> Can I set this as default header somewhere in the org file or will I have to
>> include it to every snippet (I will have a lot of them).
>>
>> Oliver
>>
>> On 30.03.20 01:58, Jonathan Gregory wrote:
>>> Hi
>>> On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
>>> 
>>>> Hi,
>>>>
>>>> I am trying to use org-babel-lilypond and basically got it running.
>>>> But somehow I always get full lilypond pages back instead of a small
>>>> snippet.
>>>> This is what I have in my org-file:
>>>>
>>>> #+NAME: Lilypond
>>>> #+BEGIN_SRC lilypond :file test.png
>>>>    \relative c'' { c d e f }
>>>> #+END_SRC
>>>>
>>>>
>>>> I read through the documentation on
>>>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
>>>> but cannot find a clue.
>>>>
>>>> Any idea what I am doing wrong here?
>>>>
>>>> Cheers,
>>>> Oliver
>>> The lilypond manual suggests using \paper variables to reduce the white
>>> space around the score. In particular, you should set oddFooterMarkup
>>> and oddHeaderMarkup to false.
>>> \paper{
>>>    indent=0\mm
>>>    line-width=120\mm
>>>    oddFooterMarkup=##f
>>>    oddHeaderMarkup=##f
>>>    bookTitleMarkup = ##f
>>>    scoreTitleMarkup = ##f
>>> }
>>> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs
>>> --
>>> Jonathan
>>> 
>>
>> -- 
>
>
> - -- 
> [ stardiviner ]
>        I try to make every word tell the meaning what I want to express.
>
>        Blog: https://stardiviner.github.io/
>        IRC(freenode): stardiviner, Matrix: stardiviner
>        GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>       
> -----BEGIN PGP SIGNATURE-----
>
> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6BhTYUHG51bWJjaGls
> ZEBnbWFpbC5jb20ACgkQG13xyVromsP5FAf/cxuPIpA7asX7esGCgZo3p+xJEbaj
> sblsus9U586m6uwrGDyCAlNFCTsIFNx5cby1HKHQ7pI5EswrQxu7rve4qpqspqbI
> ifw615Q5Q6cwCEPC1DTSQp6w7m6qHrDu1TrgL8bhvgPciaf9GH9uHszpuYi259R4
> /66iyCyYEK55JAfFmoYpXhMoY1PsUHt2E8/PCHnbkys8Cbg1b2P9IUCNHq2XoiF2
> 1vFoGtVHGaGx48bmqztg/J4xTkJpj0VgeEMF3d/reT05ToZsYoa4mCFj/TWv+6q7
> /zahVFf1KempQgM1KLbBvfRXzw8J8h9f2N9rCurdtFnr/03T2T5uEx+zqw==
> =9fTG
> -----END PGP SIGNATURE-----


- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6Bio0UHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsOTyAf/ZfHNkxoCvCFYI8RoPF6Wp0Ye26/a
5pTDWBSY3qwVx7r9MH3fHArV6I5fUomkxi+wMrclXxAaPX91xoKwCHJ5ZeOmLXHx
pFygrW4odWC3wWA/5vmeM3VC5j16AJfWpqCWeCRa4ylUAJK4YTTAc9BKVqeOjR7S
Vt7GW8cLOCUaRfM7ZSgNkhNcryS/a2ImotOdxLCTzZ9j1Y+IlPCjDyAWzBT1sdIL
e4qhqr9mYjbGhh07FBweUKT6qQEFev2ZDbq6DJIsA7MK9SigpcGkU3b34J6ake3o
HymaRkhiTIRgbdspE5j5LCH0ecwoJGpgv1GpFHlcVZPEtHobATzlUj2pUA==
=0S80
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-29 23:58 ` Jonathan Gregory
  2020-03-30  4:34   ` Oliver Heck
@ 2020-03-30  6:55   ` Oliver Heck
  1 sibling, 0 replies; 17+ messages in thread
From: Oliver Heck @ 2020-03-30  6:55 UTC (permalink / raw)
  To: emacs-orgmode

Actually it is sufficient to have
   \paper{ oddFooterMarkup=##f }
for my needs.

But now I get the rendered pictures very large in the LaTeX-PDF export. 
I added
   (setq org-latex-image-default-width "")
to my .spacemacs file but that does not change anything.

I am quite new to emacs so please excuse my beginner questions.

Thanks,
Oliver

On 30.03.20 01:58, Jonathan Gregory wrote:
> Hi
> 
> On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
> 
>> Hi,
>>
>> I am trying to use org-babel-lilypond and basically got it running.
>> But somehow I always get full lilypond pages back instead of a small
>> snippet.
>> This is what I have in my org-file:
>>
>> #+NAME: Lilypond
>> #+BEGIN_SRC lilypond :file test.png
>>    \relative c'' { c d e f }
>> #+END_SRC
>>
>>
>> I read through the documentation on
>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
>> but cannot find a clue.
>>
>> Any idea what I am doing wrong here?
>>
>> Cheers,
>> Oliver
> 
> The lilypond manual suggests using \paper variables to reduce the white
> space around the score. In particular, you should set oddFooterMarkup
> and oddHeaderMarkup to false.
> 
> \paper{
>    indent=0\mm
>    line-width=120\mm
>    oddFooterMarkup=##f
>    oddHeaderMarkup=##f
>    bookTitleMarkup = ##f
>    scoreTitleMarkup = ##f
> }
> 
> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs
> 
> --
> Jonathan
> 

-- 
--
If you are thinking without writing, you only think you are thinking. 
(Leslie Lamport)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-30  4:34   ` Oliver Heck
  2020-03-30  5:35     ` stardiviner
@ 2020-03-31 13:43     ` Jonathan Gregory
  2020-03-31 14:54       ` Oliver Heck
  1 sibling, 1 reply; 17+ messages in thread
From: Jonathan Gregory @ 2020-03-31 13:43 UTC (permalink / raw)
  To: emacs-orgmode

Hi Oliver

On 30 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:

> Hi Jonathan,
>
> that works fine. Thank you!
>
> Can I set this as default header somewhere in the org file or will I
> have to include it to every snippet (I will have a lot of them).
>
> Oliver

You can use the Noweb Reference Syntax[1]

#+name: paper
#+begin_src text :exports none
\paper{ oddFooterMarkup=##f }
#+end_src

#+name: Lilypond
#+begin_src lilypond :file test.png
<<paper>>
\relative c'' { c d e f }
#+end_src

You can also append the extra header to the
org-babel-default-header-args:lilypond variable:

(advice-add 'org-babel-lilypond-set-header-args :filter-return
	    (lambda (_mode)
	      (setq org-babel-default-header-args:lilypond
		    (append org-babel-default-header-args:lilypond
			    '((:epilogue . "\\paper{ oddFooterMarkup=##f }"))))))


> On 30.03.20 01:58, Jonathan Gregory wrote:
>> Hi
>>
>> On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
>>
>>> Hi,
>>>
>>> I am trying to use org-babel-lilypond and basically got it running.
>>> But somehow I always get full lilypond pages back instead of a small
>>> snippet.
>>> This is what I have in my org-file:
>>>
>>> #+NAME: Lilypond
>>> #+BEGIN_SRC lilypond :file test.png
>>>    \relative c'' { c d e f }
>>> #+END_SRC
>>>
>>>
>>> I read through the documentation on
>>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
>>> but cannot find a clue.
>>>
>>> Any idea what I am doing wrong here?
>>>
>>> Cheers,
>>> Oliver
>>
>> The lilypond manual suggests using \paper variables to reduce the white
>> space around the score. In particular, you should set oddFooterMarkup
>> and oddHeaderMarkup to false.
>>
>> \paper{
>>    indent=0\mm
>>    line-width=120\mm
>>    oddFooterMarkup=##f
>>    oddHeaderMarkup=##f
>>    bookTitleMarkup = ##f
>>    scoreTitleMarkup = ##f
>> }
>>
>> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs
>>
>> --
>> Jonathan
>>
>
> --


--
Jonathan

Footnotes:
[1]  https://orgmode.org/manual/Noweb-Reference-Syntax.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-30  5:58       ` stardiviner
@ 2020-03-31 13:48         ` Jonathan Gregory
  2020-03-31 21:36           ` adam
  2020-04-02  8:35           ` stardiviner
  0 siblings, 2 replies; 17+ messages in thread
From: Jonathan Gregory @ 2020-03-31 13:48 UTC (permalink / raw)
  To: numbchild; +Cc: Oliver Heck, emacs-orgmode

Hi

On 30 Mar 2020, stardiviner <numbchild@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> stardiviner <numbchild@gmail.com> writes:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>>
>> You might want to try this:
>>
>> #+begin_src emacs-lisp
>> (add-to-list 'org-babel-default-header-args:lilypond
>>              '((:prologue . "\paper{
>>   indent=0\mm
>>   line-width=120\mm
>>   oddFooterMarkup=##f
>>   oddHeaderMarkup=##f
>>   bookTitleMarkup = ##f
>>   scoreTitleMarkup = ##f
>> }")))
>> #+end_src
>>
>
> I found this custom setting lilypond header arguments will not work. Because this code function:
>
> #+begin_src emacs-lisp
> (defun org-babel-lilypond-get-header-args (mode)
>   "Default arguments to use when evaluating a lilypond source block.
> These depend upon whether we are in Arrange mode i.e. MODE is t."
>   (cond (mode
>          '((:tangle . "yes")
>            (:noweb . "yes")
>            (:results . "silent")
>            (:cache . "yes")
>            (:comments . "yes")))
>         (t
>          '((:results . "file")
>            (:exports . "results")))))
>
> (defun org-babel-lilypond-set-header-args (mode)
>   "Set org-babel-default-header-args:lilypond
> dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE."
>   (setq org-babel-default-header-args:lilypond
>         (org-babel-lilypond-get-header-args mode)))
> #+end_src
>
> It always reset and return one result of two conditions.
>
> I think this is a bug.

So are all org-babel-default-header-args:LANG custom variables? In the
ob-lilypond.el library the headers are hard-coded.

[...]

--
Jonathan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-31 13:43     ` Jonathan Gregory
@ 2020-03-31 14:54       ` Oliver Heck
  0 siblings, 0 replies; 17+ messages in thread
From: Oliver Heck @ 2020-03-31 14:54 UTC (permalink / raw)
  To: emacs-orgmode

Thanks, Jonathan, but the first advise does not work.

Where would I put the elisp code you proposed?

Oliver

On 31.03.20 15:43, Jonathan Gregory wrote:
> Hi Oliver
> 
> On 30 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
> 
>> Hi Jonathan,
>>
>> that works fine. Thank you!
>>
>> Can I set this as default header somewhere in the org file or will I
>> have to include it to every snippet (I will have a lot of them).
>>
>> Oliver
> 
> You can use the Noweb Reference Syntax[1]
> 
> #+name: paper
> #+begin_src text :exports none
> \paper{ oddFooterMarkup=##f }
> #+end_src
> 
> #+name: Lilypond
> #+begin_src lilypond :file test.png
> <<paper>>
> \relative c'' { c d e f }
> #+end_src
> 
> You can also append the extra header to the
> org-babel-default-header-args:lilypond variable:
> 
> (advice-add 'org-babel-lilypond-set-header-args :filter-return
> 	    (lambda (_mode)
> 	      (setq org-babel-default-header-args:lilypond
> 		    (append org-babel-default-header-args:lilypond
> 			    '((:epilogue . "\\paper{ oddFooterMarkup=##f }"))))))
> 
> 
>> On 30.03.20 01:58, Jonathan Gregory wrote:
>>> Hi
>>>
>>> On 29 Mar 2020, Oliver Heck <oliver.heck@posteo.de> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am trying to use org-babel-lilypond and basically got it running.
>>>> But somehow I always get full lilypond pages back instead of a small
>>>> snippet.
>>>> This is what I have in my org-file:
>>>>
>>>> #+NAME: Lilypond
>>>> #+BEGIN_SRC lilypond :file test.png
>>>>     \relative c'' { c d e f }
>>>> #+END_SRC
>>>>
>>>>
>>>> I read through the documentation on
>>>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
>>>> but cannot find a clue.
>>>>
>>>> Any idea what I am doing wrong here?
>>>>
>>>> Cheers,
>>>> Oliver
>>>
>>> The lilypond manual suggests using \paper variables to reduce the white
>>> space around the score. In particular, you should set oddFooterMarkup
>>> and oddHeaderMarkup to false.
>>>
>>> \paper{
>>>     indent=0\mm
>>>     line-width=120\mm
>>>     oddFooterMarkup=##f
>>>     oddHeaderMarkup=##f
>>>     bookTitleMarkup = ##f
>>>     scoreTitleMarkup = ##f
>>> }
>>>
>>> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs
>>>
>>> --
>>> Jonathan
>>>
>>
>> --
> 
> 
> --
> Jonathan
> 
> Footnotes:
> [1]  https://orgmode.org/manual/Noweb-Reference-Syntax.html
> 

-- 
--
If you are thinking without writing, you only think you are thinking. 
(Leslie Lamport)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-31 13:48         ` Jonathan Gregory
@ 2020-03-31 21:36           ` adam
  2020-04-01  9:02             ` Oliver Heck
  2020-04-02  8:35           ` stardiviner
  1 sibling, 1 reply; 17+ messages in thread
From: adam @ 2020-03-31 21:36 UTC (permalink / raw)
  To: Jonathan Gregory, numbchild; +Cc: Oliver Heck, emacs-orgmode

On Tue, 2020-03-31 at 10:48 -0300, Jonathan Gregory wrote:
> Hi
> 
> On 30 Mar 2020, stardiviner <numbchild@gmail.com> wrote:
> 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> > 
> > 
> > stardiviner <numbchild@gmail.com> writes:
> > 
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA256
> > > 
> > > 
> > > You might want to try this:
> > > 
> > > #+begin_src emacs-lisp
> > > (add-to-list 'org-babel-default-header-args:lilypond
> > >              '((:prologue . "\paper{
> > >   indent=0\mm
> > >   line-width=120\mm
> > >   oddFooterMarkup=##f
> > >   oddHeaderMarkup=##f
> > >   bookTitleMarkup = ##f
> > >   scoreTitleMarkup = ##f
> > > }")))
> > > #+end_src
> > > 
> > 
> > I found this custom setting lilypond header arguments will not work. Because this code
> > function:
> > 
> > #+begin_src emacs-lisp
> > (defun org-babel-lilypond-get-header-args (mode)
> >   "Default arguments to use when evaluating a lilypond source block.
> > These depend upon whether we are in Arrange mode i.e. MODE is t."
> >   (cond (mode
> >          '((:tangle . "yes")
> >            (:noweb . "yes")
> >            (:results . "silent")
> >            (:cache . "yes")
> >            (:comments . "yes")))
> >         (t
> >          '((:results . "file")
> >            (:exports . "results")))))
> > 
> > (defun org-babel-lilypond-set-header-args (mode)
> >   "Set org-babel-default-header-args:lilypond
> > dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE."
> >   (setq org-babel-default-header-args:lilypond
> >         (org-babel-lilypond-get-header-args mode)))
> > #+end_src
> > 
> > It always reset and return one result of two conditions.
> > 
> > I think this is a bug.
> 
> So are all org-babel-default-header-args:LANG custom variables? In the
> ob-lilypond.el library the headers are hard-coded.
> 
> [...]
> 
> --
> Jonathan
> 


Hi all.  This is very interesting. 


I quickly tried setting the   org-babel-default-header-args:LANG   using exactly 
the src emacs-lisp  example block above.  

However that variable remained nil before and after org export lilypond to PDF. 
Am sure I must have done something wrong. 

Thank you for drawing my attention to that variable, as it seems the right place 
for  lilypond  headers and options too. 


Off-topic:  Oliver is exporting/engraving to a fixed-resolution png. An alternative 
is to export scalable vector graphics of the score to PDF. 

   
 
   

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-31 21:36           ` adam
@ 2020-04-01  9:02             ` Oliver Heck
  2020-04-01 23:23               ` adam
  0 siblings, 1 reply; 17+ messages in thread
From: Oliver Heck @ 2020-04-01  9:02 UTC (permalink / raw)
  To: emacs-orgmode

> Off-topic:  Oliver is exporting/engraving to a fixed-resolution png. An alternative
> is to export scalable vector graphics of the score to PDF.

PDF does scale better, but it does not help because I need the original 
size embedded.

Logically it works fine when full staves are rendered (at least they all 
have an identical scaling factor then), but I often have very small 
snippets like single bars or fretboard diagrams.

Oliver

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-04-01  9:02             ` Oliver Heck
@ 2020-04-01 23:23               ` adam
  0 siblings, 0 replies; 17+ messages in thread
From: adam @ 2020-04-01 23:23 UTC (permalink / raw)
  To: Oliver Heck, emacs-orgmode

On Wed, 2020-04-01 at 11:02 +0200, Oliver Heck wrote:
> > Off-topic:  Oliver is exporting/engraving to a fixed-resolution png. An alternative
> > is to export scalable vector graphics of the score to PDF.
> 
> PDF does scale better, but it does not help because I need the original 
> size embedded.
> 
> Logically it works fine when full staves are rendered (at least they all 
> have an identical scaling factor then), but I often have very small 
> snippets like single bars or fretboard diagrams.
> 
> Oliver
> 

Understood, Oliver.  And I'm sorry for crashing in. 


FYI,  I have had the most success in using the pdf-example.org  of this page, 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html 

as that exports EPS to PDF, not what you're after. 

I've cut  pdf-example.org down and include an import from  midi2ly  as shown here. 

This helps, as the imported ly file has its \layout { .. } block which 
is informative and allows further editing along with the imported score.  


* Importing from MIDI 
Lorem ipsum dolor sit amet, consectetur ... etc 

#+LaTeX: \linebreak
#+ATTR_LaTeX: width=17cm
#+begin_src lilypond :file patterns-1.eps :noweb yes

\include "patterns1-midi.ly"

#+end_src

#+RESULTS:
[[file:patterns-1.eps]]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-03-31 13:48         ` Jonathan Gregory
  2020-03-31 21:36           ` adam
@ 2020-04-02  8:35           ` stardiviner
  2020-04-02 22:56             ` Jonathan Gregory
  1 sibling, 1 reply; 17+ messages in thread
From: stardiviner @ 2020-04-02  8:35 UTC (permalink / raw)
  To: Jonathan Gregory; +Cc: Oliver Heck, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Jonathan Gregory <jgrg@autistici.org> writes:

> Hi
>
> On 30 Mar 2020, stardiviner <numbchild@gmail.com> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>>
>> stardiviner <numbchild@gmail.com> writes:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA256
>>>
>>>
>>> You might want to try this:
>>>
>>> #+begin_src emacs-lisp
>>> (add-to-list 'org-babel-default-header-args:lilypond
>>>              '((:prologue . "\paper{
>>>   indent=0\mm
>>>   line-width=120\mm
>>>   oddFooterMarkup=##f
>>>   oddHeaderMarkup=##f
>>>   bookTitleMarkup = ##f
>>>   scoreTitleMarkup = ##f
>>> }")))
>>> #+end_src
>>>
>>
>> I found this custom setting lilypond header arguments will not work. Because this code function:
>>
>> #+begin_src emacs-lisp
>> (defun org-babel-lilypond-get-header-args (mode)
>>   "Default arguments to use when evaluating a lilypond source block.
>> These depend upon whether we are in Arrange mode i.e. MODE is t."
>>   (cond (mode
>>          '((:tangle . "yes")
>>            (:noweb . "yes")
>>            (:results . "silent")
>>            (:cache . "yes")
>>            (:comments . "yes")))
>>         (t
>>          '((:results . "file")
>>            (:exports . "results")))))
>>
>> (defun org-babel-lilypond-set-header-args (mode)
>>   "Set org-babel-default-header-args:lilypond
>> dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE."
>>   (setq org-babel-default-header-args:lilypond
>>         (org-babel-lilypond-get-header-args mode)))
>> #+end_src
>>
>> It always reset and return one result of two conditions.
>>
>> I think this is a bug.
>
> So are all org-babel-default-header-args:LANG custom variables? In the
> ob-lilypond.el library the headers are hard-coded.
>
> [...]

Yes, it's hard-coded in that function definition. So setting that header
arguments variable will not work at all.

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6Fo7oUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsP2cQf7Bj8/dS+k/P5Hu5sF9gccS8mzrIWL
aLrJ/lFtkkwP7IbAUTYxW3zNAISHSa285oCha2gWzqT8Vc2Vv/NIhpwVKOvq5Ifg
L9FRQuftP3hHekdVAcSwPFMV0ejXPI3vItCzgDhk1+G3BcMwphW37LfOT5v0Sj0D
47cGBhgobPhX4Q3vtPonCdtSgt+bhEsi0Xxa+uNmfhOEEhVflEgvcSLcXtPs5cuv
zkUZhJXCmPx/qFlMT0DphsGk/KLX/NXTfLFQvZ0lA30Vl2Hypnsa6L32MIlZZJOU
rIRgYOwGsFxCCSZfRm6SosVhSApZmJCR9BbjPwVYOlnScJJr8uXsw9ofTA==
=cyEM
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-04-02  8:35           ` stardiviner
@ 2020-04-02 22:56             ` Jonathan Gregory
  2020-04-05  3:10               ` stardiviner
  0 siblings, 1 reply; 17+ messages in thread
From: Jonathan Gregory @ 2020-04-02 22:56 UTC (permalink / raw)
  To: numbchild; +Cc: Oliver Heck, emacs-orgmode

Hi

On 02 Apr 2020, stardiviner <numbchild@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> Jonathan Gregory <jgrg@autistici.org> writes:
>
>> Hi
>>
>> On 30 Mar 2020, stardiviner <numbchild@gmail.com> wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA256
>>>
>>>
>>> stardiviner <numbchild@gmail.com> writes:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA256
>>>>
>>>>
>>>> You might want to try this:
>>>>
>>>> #+begin_src emacs-lisp
>>>> (add-to-list 'org-babel-default-header-args:lilypond
>>>>              '((:prologue . "\paper{
>>>>   indent=0\mm
>>>>   line-width=120\mm
>>>>   oddFooterMarkup=##f
>>>>   oddHeaderMarkup=##f
>>>>   bookTitleMarkup = ##f
>>>>   scoreTitleMarkup = ##f
>>>> }")))
>>>> #+end_src
>>>>
>>>
>>> I found this custom setting lilypond header arguments will not work. Because this code function:
>>>
>>> #+begin_src emacs-lisp
>>> (defun org-babel-lilypond-get-header-args (mode)
>>>   "Default arguments to use when evaluating a lilypond source block.
>>> These depend upon whether we are in Arrange mode i.e. MODE is t."
>>>   (cond (mode
>>>          '((:tangle . "yes")
>>>            (:noweb . "yes")
>>>            (:results . "silent")
>>>            (:cache . "yes")
>>>            (:comments . "yes")))
>>>         (t
>>>          '((:results . "file")
>>>            (:exports . "results")))))
>>>
>>> (defun org-babel-lilypond-set-header-args (mode)
>>>   "Set org-babel-default-header-args:lilypond
>>> dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE."
>>>   (setq org-babel-default-header-args:lilypond
>>>         (org-babel-lilypond-get-header-args mode)))
>>> #+end_src
>>>
>>> It always reset and return one result of two conditions.
>>>
>>> I think this is a bug.
>>
>> So are all org-babel-default-header-args:LANG custom variables? In the
>> ob-lilypond.el library the headers are hard-coded.
>>
>> [...]
>
> Yes, it's hard-coded in that function definition. So setting that header
> arguments variable will not work at all.

OK, I had a closer look and none of the other libraries set
org-babel-default-header-args:LANG in the file itself. IOW ob-lilypond
is the only one that does this, and it does this to allow toggling
between two modes (basic and arrange) and setting the header args
relative to the mode used. But there's a cost to resetting
org-babel-default-header-args:lilypond which is it prevents users from
making modifications to it.

I'm not sure how to deal with this. Maybe others can chime in.

--
Jonathan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-04-02 22:56             ` Jonathan Gregory
@ 2020-04-05  3:10               ` stardiviner
  2020-04-06 21:39                 ` Nick Dokos
  0 siblings, 1 reply; 17+ messages in thread
From: stardiviner @ 2020-04-05  3:10 UTC (permalink / raw)
  To: Jonathan Gregory; +Cc: Oliver Heck, emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Jonathan Gregory <jgrg@autistici.org> writes:

> Hi
>
> On 02 Apr 2020, stardiviner <numbchild@gmail.com> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>>
>> Jonathan Gregory <jgrg@autistici.org> writes:
>>
>>> Hi
>>>
>>> On 30 Mar 2020, stardiviner <numbchild@gmail.com> wrote:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA256
>>>>
>>>>
>>>> stardiviner <numbchild@gmail.com> writes:
>>>>
>>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>>> Hash: SHA256
>>>>>
>>>>>
>>>>> You might want to try this:
>>>>>
>>>>> #+begin_src emacs-lisp
>>>>> (add-to-list 'org-babel-default-header-args:lilypond
>>>>>              '((:prologue . "\paper{
>>>>>   indent=0\mm
>>>>>   line-width=120\mm
>>>>>   oddFooterMarkup=##f
>>>>>   oddHeaderMarkup=##f
>>>>>   bookTitleMarkup = ##f
>>>>>   scoreTitleMarkup = ##f
>>>>> }")))
>>>>> #+end_src
>>>>>
>>>>
>>>> I found this custom setting lilypond header arguments will not work. Because this code function:
>>>>
>>>> #+begin_src emacs-lisp
>>>> (defun org-babel-lilypond-get-header-args (mode)
>>>>   "Default arguments to use when evaluating a lilypond source block.
>>>> These depend upon whether we are in Arrange mode i.e. MODE is t."
>>>>   (cond (mode
>>>>          '((:tangle . "yes")
>>>>            (:noweb . "yes")
>>>>            (:results . "silent")
>>>>            (:cache . "yes")
>>>>            (:comments . "yes")))
>>>>         (t
>>>>          '((:results . "file")
>>>>            (:exports . "results")))))
>>>>
>>>> (defun org-babel-lilypond-set-header-args (mode)
>>>>   "Set org-babel-default-header-args:lilypond
>>>> dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE."
>>>>   (setq org-babel-default-header-args:lilypond
>>>>         (org-babel-lilypond-get-header-args mode)))
>>>> #+end_src
>>>>
>>>> It always reset and return one result of two conditions.
>>>>
>>>> I think this is a bug.
>>>
>>> So are all org-babel-default-header-args:LANG custom variables? In the
>>> ob-lilypond.el library the headers are hard-coded.
>>>
>>> [...]
>>
>> Yes, it's hard-coded in that function definition. So setting that header
>> arguments variable will not work at all.
>
> OK, I had a closer look and none of the other libraries set
> org-babel-default-header-args:LANG in the file itself. IOW ob-lilypond
> is the only one that does this, and it does this to allow toggling
> between two modes (basic and arrange) and setting the header args
> relative to the mode used. But there's a cost to resetting
> org-babel-default-header-args:lilypond which is it prevents users from
> making modifications to it.
>
> I'm not sure how to deal with this. Maybe others can chime in.

Can report this bug to ob-lilypond.el maintainer. I have not found any contact
info like email in source code file. Does anyone can get in touch with the
maintainer?

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6JTCUUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsPRbAf6Al3017uS7rUl7qNyOJ1PBxVGvzlL
vxtM5yaa3N+zuDgiHpQHKtXGyTqPrkWLQDrg1ncogPr/P+AV2oGu0uoE797Fn3lI
mCKj6dJXRnnX3g88ag7A0zKb/8LWoZxHh1aKKdMJ88jkS0Kqw2pnAKbYBQkOnAWq
Ymd2/i2G/ZN5dR+DRmotbed8eUt5uMRGdwZR7EPFtlWcB7/i6d/thJLmNbGqyYTI
gB16b9gxr8D+h27Wb7tX+7NhSLzkRsaQuGORm0f6aRzBWEydZK3QUSLwDqQ3wYjX
hMT7aIuzFeZs8fTyX1/QFE69I7iGIRpvFdygm/+smAxxvkbURSQZyvQnew==
=Jx8T
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Org-babel-lilypond always renders full pages
  2020-04-05  3:10               ` stardiviner
@ 2020-04-06 21:39                 ` Nick Dokos
  0 siblings, 0 replies; 17+ messages in thread
From: Nick Dokos @ 2020-04-06 21:39 UTC (permalink / raw)
  To: emacs-orgmode

stardiviner <numbchild@gmail.com> writes:

>
> Can report this bug to ob-lilypond.el maintainer. I have not found any contact
> info like email in source code file. Does anyone can get in touch with the
> maintainer?
>

Isn't ob-lilypond.el part of Org mode proper (i.e. not contrib)? If
so, this is the place to report bugs for it. The maintainer is the
usual suspects :-) (but I'm sure they would appreciate any help anybody
can offer).

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-04-06 21:40 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-29 21:11 Org-babel-lilypond always renders full pages Oliver Heck
2020-03-29 23:58 ` Jonathan Gregory
2020-03-30  4:34   ` Oliver Heck
2020-03-30  5:35     ` stardiviner
2020-03-30  5:54       ` Oliver Heck
2020-03-30  5:58       ` stardiviner
2020-03-31 13:48         ` Jonathan Gregory
2020-03-31 21:36           ` adam
2020-04-01  9:02             ` Oliver Heck
2020-04-01 23:23               ` adam
2020-04-02  8:35           ` stardiviner
2020-04-02 22:56             ` Jonathan Gregory
2020-04-05  3:10               ` stardiviner
2020-04-06 21:39                 ` Nick Dokos
2020-03-31 13:43     ` Jonathan Gregory
2020-03-31 14:54       ` Oliver Heck
2020-03-30  6:55   ` Oliver Heck

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.