2015-02-23 9:56 GMT+01:00 Jim Long <lilyp...@umpquanet.com>: > I'm experimenting with defining and using custom contexts. > > I have not succeeded in applying the example at: > > http://lilypond.org/doc/v2.18/Documentation/notation/defining-new-contexts > > to my tiny example below attempting the creation of a custom > ChordNames context. The '\new XChords' line throws a warning: > > GNU LilyPond 2.18.2 > Processing `foo.ly' > Parsing... > Interpreting music... > Preprocessing graphical objects... > Interpreting music... > warning: cannot find or create new `XChords' > Preprocessing graphical objects... > Finding the ideal number of pages... > Fitting music on 1 page... > Drawing systems... > Layout output to `foo.ps'... > Converting to `./foo.pdf'... > Success: compilation successfully completed > > > How can I modify the second score's source to have the scores > engrave the same in the output file? > > Thank you! > > Jim > > > \version "2.18.2" > > \score { > \layout { > \context { > \ChordNames > \override ChordName.font-size = #12 > } % context > } % layout > << > \new ChordNames \chordmode { c1 } > \new Staff \chordmode { c1 } > >> > } > > > \score { > \layout { > \context { > \name XChords > \alias ChordNames > \override ChordName.font-size = #12 > \type "Engraver_group" > } % context > } % layout > << > \new XChords \chordmode { c1 } > \new Staff \chordmode { c1 } > >> > }
Try the following, comments inline: \score { << \new XChords \chordmode { c1 } \new Staff \chordmode { c1 } >> \layout { \context { %% copies settings from ChordNames %% No need to create a new context from scratch \ChordNames \name XChords \alias ChordNames \override ChordName.font-size = #12 } %% let Score accept XChords, likely need to let it be accepted by other %% context as well. I.e. do the same for Pianostaff, GrandStaff, ChoirStaff, %% maybe more, have a look in engraver-init.ly to see which contexts %% accept the default ChordNames \context { \Score \accepts XChords } } % layout } HTH, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user