Re: incorporating templates w/ conditionals

2017-10-06 Thread Br. Samuel Springuel
I developed something similar based on some suggestions on the list back 
in December of last year.  You can see what I ended up using here:


http://lists.gnu.org/archive/html/lilypond-user/2016-12/msg00636.html

For my actual implementation I further refined the idea as follows:

In an included formatting file (which is used for every file in the 
project) I have the following code block:


#(if (not (defined? 'gender))
 (define gender "neutral"))

heshe = #(cond ((equal? gender "male") #{ \lyricmode { he } #})
   ((equal? gender "female")  #{ \lyricmode{ she } #})
   (else  #{ \lyricmode { \override 
Lyrics.LyricText.font-shape = #'italic he/she \revert 
Lyrics.LyricText.font-shape } #}))


hisher = #(cond ((equal? gender "male") #{ \lyricmode { him } #})
((equal? gender "female")  #{ \lyricmode{ her } #})
(else  #{ \lyricmode { \override 
Lyrics.LyricText.font-shape = #'italic his/her \revert 
Lyrics.LyricText.font-shape } #}))


himher = #(cond ((equal? gender "male") #{ \lyricmode { him } #})
((equal? gender "female")  #{ \lyricmode{ her } #})
(else  #{ \lyricmode { \override 
Lyrics.LyricText.font-shape = #'italic him/her \revert 
Lyrics.LyricText.font-shape } #}))


In this way, the variable gender is always defined and has a default 
value of "neutral".  Simultaneously, I can, in any particular project 
file, define gender manually and that will be respected (the use of the 
defined? conditional means that it doesn't matter whether gender is 
defined before or after file inclusion.


I would imagine that something like this should work for you too.
--
✝
Br. Samuel, OSB
St. Anselm’s Abbey
Washington, DC
(R. Padraic Springuel)

PAX ☧ ΧΡΙΣΤΟΣ

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


re: incorporating templates w/ conditionals

2017-10-06 Thread Reilly Farrell
We're working with a system of .ly files referencing a .ily template file
for formatting beaming behavior.  Now we'd like to apply the formatting to
some .ly files, but not others, and were hoping to accomplish this by means
of conditional statement.

That said, conditional statements in LaTeX have been giving us a bit of
trouble.  For context, we've tried creating a variable called
useBeamTemplates with a default value of true:

useBeamTemplates = ##t

Our next objective would be to set said variable to false in certain .ly
files, and then to place a conditional statement saying "if
useBeamTemplates is true, use formatting template; if false, don't bother"
in the same .ily file as the template code.

We're wondering if anyone with better experience writing conditionals for
templates in a lilypond-book setting can point us in the right direction?

Feedback much appreciated, and thank you for your time!
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user