lilypond-user
[Top][All Lists]
Advanced

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

Re: define own variables


From: Mats Bengtsson
Subject: Re: define own variables
Date: Thu, 29 Mar 2007 09:59:21 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20070221)

You have hit upon a fine detail in the Scheme programming language.
One solution is to do
Abstand =
 #(define-music-function (parser location wert)
                          (number?)
 #{
    \overrideProperty
    #"Score.NonMusicalPaperColumn"
    #'line-break-system-details
    #`((fixed-alignment-extra-space . ,$wert))
 #})

(note that the quote on the second last line is a back quote). Another is to
write it as
Abstand =
 #(define-music-function (parser location wert)
                          (number?)
 #{
    \overrideProperty
    #"Score.NonMusicalPaperColumn"
    #'line-break-system-details
    #(list (cons 'fixed-alignment-extra-space $wert))
 #})

which is less cryptic if you know some basics of LISP/Scheme.

  /Mats

Roland Goretzki wrote:
Hi,

Using version 2.10.20 I've tried to define an own variable, but it
doesn't seem to work, although lilypond doesn't give an error or
warning.

In the attached .ly -file I'm using a variable "manualBeam" taken from
the documentation, and this does work as expected.

I'm no programmer, so I can't see, why my own variable "Abstand" doesn't
work.

In the example there ar four outcommented lines, which do the same as
I'm wanting with my variable "Abstand".

Incommenting these and outcommenting the following line shows, what I
want to do.

The variale would be better for many calls of
"\overrideProperty #"Score.NonMusic ..."
to make the source better readable.

Could somebody help me, please?

Best Regards           Roland
------------------------------------------------------------------------

\version "2.10.20"

global = { s1*2 \bar "|." }

manualBeam =
  #(define-music-function (parser location beg end)
                           (number? number?)
  #{ \once \override Beam #'positions = #(cons $beg $end) #})

Abstand =
  #(define-music-function (parser location wert)
                           (number?)
  #{
     \overrideProperty
     #"Score.NonMusicalPaperColumn"
     #'line-break-system-details
     #'((fixed-alignment-extra-space . $wert))
  #})

rechts = \context Staff \relative c'{
  \context Voice = "rechts"
\manualBeam #3 #6
  c8 d e f s2
%\overrideProperty
%#"Score.NonMusicalPaperColumn"
%#'line-break-system-details
%#'((fixed-alignment-extra-space . 7))
  \Abstand #7
  \break
}

links =  \context Staff \relative c{
  \context Voice = "links"
  c
}

\score {
  \context PianoStaff
  <<
    \context Staff = "up" << \global \clef violin \rechts >>
    \context Staff = "down" << \global \clef bass \links >>
  >>
}
------------------------------------------------------------------------

_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user

--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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