Deutsches Lilypond Forum (Archiv)

Allgemein => Hilfe beim Einstieg in Lilypond => Thema gestartet von: ingmar am Dienstag, 8. September 2015, 21:22

Titel: Templates für Staff
Beitrag von: ingmar am Dienstag, 8. September 2015, 21:22
Ich beziehe mich auf den Thread \markup-Funktion mit Argument? (https://liarchiv.joonet.de/index.php?topic=2061.0). Mir scheint das Folgende ein ganz ähnlicher Fall, hat aber nix mit \markup zu tun. Aber vielleicht gibt es auch eine ganz andere, einfachere  Lösung.

Ich möchte zwei verschiedene Staff-Größen verwenden:
\version "2.18.2"

MUSIC-I = \relative c'' { c4 d e f g1 }
MUSIC-II = \relative c' { c4 b c d e1 }
MUSIC-III = \relative c { c4 g c g c1 }

\score {
\new StaffGroup { <<
\new Staff \with {
instrumentName = "erstes"
fontSize = #-4
\override StaffSymbol.staff-space = #(magstep -4)
\override StaffSymbol.thickness = #(magstep -4)
} { \clef "violin" \MUSIC-I }

\new Staff \with { instrumentName = "zweites" } { \clef "alto" \MUSIC-II }

\new Staff \with {
instrumentName = "drittes"
fontSize = #-4
\override StaffSymbol.staff-space = #(magstep -4)
\override StaffSymbol.thickness = #(magstep -4)
} { \clef "bass" \MUSIC-III }
>> }
}
Offensichtlich ist es unübersichtlich und fehlerträchtig, jedesmal diese umständlichen, aber stets gleichen Größenbeschreibungen ausführen zu müssen. Ich stelle mir vor, in einer Art Stylesheet den \with-Teil vorzuhalten und anschließend nur schreiben zu müssen:

\new Staff \with { \SMALLSIZE \instrumentName = "zweites" } { \clef "violin" \MUSIC-I }
\new Staff \with { \REGULARSIZE \instrumentName = "zweites" } { \clef "alto" \MUSIC-II }
\new Staff \with { \SMALLSIZE \instrumentName = "drittes" } { \clef "bass" \MUSIC-III }
...oder so ähnlich.

Wie fange ich das am besten an?

Danke, Gruß, : - )
--ingmar      
Titel: Re: Templates für Staff
Beitrag von: harm6 am Mittwoch, 9. September 2015, 02:21
\version "2.18.2"

%%http://lsr.di.unimi.it/LSR/Item?id=862

staffSize = #(define-music-function (parser location new-size) (number?)
  #{
    \set fontSize = #new-size
    \override StaffSymbol.staff-space = #(magstep new-size)
    \override StaffSymbol.thickness = #(magstep new-size)
  #})
 
SMALLSIZE =
\with { \staffSize #-4 }

REGULARSIZE = {}

\version "2.18.2"

MUSIC-I = \relative c'' { c4 d e f g1 }
MUSIC-II = \relative c' { c4 b c d e1 }
MUSIC-III = \relative c { c4 g c g c1 }

\score {
\new StaffGroup { <<
\new Staff \with {
instrumentName = "erstes"
fontSize = #-4
\override StaffSymbol.staff-space = #(magstep -4)
\override StaffSymbol.thickness = #(magstep -4)
} { \clef "violin" \MUSIC-I }

\new Staff \with { instrumentName = "zweites" } { \clef "alto" \MUSIC-II }

\new Staff \with {
instrumentName = "drittes"
fontSize = #-4
\override StaffSymbol.staff-space = #(magstep -4)
\override StaffSymbol.thickness = #(magstep -4)
} { \clef "bass" \MUSIC-III }
>> }
}

\new StaffGroup <<
  \new Staff \with { \SMALLSIZE instrumentName = "erstes" } { \clef "violin" \MUSIC-I }
  \new Staff \with { \REGULARSIZE instrumentName = "zweites" } { \clef "alto" \MUSIC-II }
  \new Staff \with { \SMALLSIZE instrumentName = "drittes" } { \clef "bass" \MUSIC-III }
>>

HTH,
  Harm