lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditionally setting variables in \paper section


From: Daniel Thompson
Subject: Re: Conditionally setting variables in \paper section
Date: Sat, 31 Aug 2013 15:32: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

On 30/08/13 14:49, David Kastrup wrote:
>> 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).
>> 
>> <snip>
> 
> Well, inside of #{ ... #} there is music by default.  If you want
> to have an output block, you need to place it there.  For me,
> 
> \version "2.16.2" \paper { $(if (ly:get-option 'binder-margins) #{ 
> \paper { left-margin = 20 line-width = 5 } #}) } \score { \relative
> { c4 d e f g a b c } }
> 
> appears to do the trick.

Thanks for the help. That's sorted out my problem.

My paper section now looks as shown below and allows me to switch
between A4 (with binder margins) and an small ebook reader (with very
tight margins).

- --- cut here ---
\paper {
$(if (not (ly:get-option 'afive)) #{
  \paper {
    #(set-paper-size "a4")
    left-margin = 20
    line-width = 180
  }
#}
#{
  \paper {
    #(set-paper-size "a5")
    top-margin = 3
    bottom-margin = 3
    left-margin = 5
    line-width = 140.5
  }
#})

  % Align the first line with everything else
  indent = #0
}
- --- cut here ---


Daniel.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iD8DBQFSIf6Krr8Ifkjg/MwRAiKmAJ4i6MoheTLnzdZCkoEnASfSrjevkACgl9FQ
afXQ1ca+H3QiOjpnklhb9Qc=
=3dMR
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]