[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Conditionally setting variables in \paper section
From: |
Daniel Thompson |
Subject: |
Conditionally setting variables in \paper section |
Date: |
Fri, 30 Aug 2013 14:17:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Folks
I am trying to modify an shared include file the allow it to switch
the score that uses it between A4 "normal" mode and an cut-down A5
form (for an e-book reader).
I can make set-paper-size conditional using a $(if construct but can't
find a way to conditionally set the margins. I've constructed a tiny
example showing what I have trouble with (it no longer shows my motive
but does show my problem).
- --- cut here ---
\version "2.16.2"
\paper {
$(if (ly:get-option 'binder-margins) #{
left-margin = 20
line-width = 180
#})
}
\score \relative { c4 d e f g a b c }
- --- cut here ---
When run "lilypond -dbinder-margins" it issues the following:
- --- cut here ---
test.ly:6:14: error: syntax error, unexpected '=', expecting end of input
left-margin
= 20
test.ly:5:0: error: error in #{ ... #}
$(if (ly:get-option 'binder-margins) #{
test.ly:5:0: error: syntax error, unexpected STRING_IDENTIFIER
$(if (ly:get-option 'binder-margins) #{
- --- cut here ---
It works fine without the -dbinder-margins (but then I don't get the
margins set up for a ring binder).
I've tried many "random" things including replacing the lilypond-style
assignment with #(define left-margin 20) but just cannot make it work.
Any ideas?
Thanks.
Daniel.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iD8DBQFSIJt2rr8Ifkjg/MwRArPqAJ4upYPsnfv12btOzAkVsSC/TCp4RwCfYe1b
6nkrD0jKONnpH11uM+hIWm8=
=del5
-----END PGP SIGNATURE-----
- Conditionally setting variables in \paper section,
Daniel Thompson <=