lilypond-user
[Top][All Lists]
Advanced

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

Re: \keepWithTag #'A {\keepWithTag #'B \music}


From: Gianmaria Lari
Subject: Re: \keepWithTag #'A {\keepWithTag #'B \music}
Date: Sat, 7 May 2016 10:42:43 +0200

Dear David thank you for explaining the problem and pointing me out
the documentation where this is discussed.

Yes, I could organize my code differently but this would be less
clear. Try to have a look to the attached image capture.png.
The first line is the wanted screen output, the second line the wanted
midi output  (that is normally not intended to print).
Now let me discuss how I would like to obtain it.


* * * Score blocks * * *
I would like to write the two score blocks in the following way:

\score
{
  \new Staff = "left" {\keepWithTag #'screenOut \left}
  \layout { }
}

\score
{
  \new Staff = "left" {\keepWithTag #'midiOut \left}
  \midi { }
}


* * * Variables * * *
Because the piece I'm going to write uses a simple and repetitive bass
structure I create the following variables

cbar =  {\xco \keepWithTag #'chordLetter \xcM \xcM \xcM}
fbar =  {\xfo \keepWithTag #'chordLetter \xfM \xfM \xfM}
gsbar = {\xgo \keepWithTag #'chordLetter \xgs \xgs \xgs}

Here you can see I use the keepWithTag keyword because I want some
some specific formatting with some elements. Unfortunately this does
not work because doing in this way is like having the nested
\keepWithTag we are discussing.

* * * Whole code NOT working * * *

This is the whole code (that does not work) in case you want to try
it. (Attached to this mail you can find the AccordionStandardBass.ly
that I'm working on)

version "2.19.40"
\include "AccordionStandardBass.ly"

cbar =  {\xco \keepWithTag #'chordLetter \xcM \xcM \xcM}
fbar =  {\xfo \keepWithTag #'chordLetter \xfM \xfM \xfM}
gsbar = {\xgo \keepWithTag #'chordLetter \xgs \xgs \xgs}

left =
{
  \clef "bass"
  \fbar
  \gsbar
  \cbar
}

\score
{
  \new Staff = "left" {\keepWithTag #'screenOut \left}
  \layout { }
}

\score
{
  \new Staff = "left" {\keepWithTag #'midiOut \left}
  \midi { }
}

* * * Whole code working * * *

Finally this is how I wrote the previous code so that is works. It's a
bit less clear and less straightforward.
The changes are
- the variable definitions written in a "negative form"
- the score block use \keepWithTag #'(screenOut chordLetter)

\version "2.19.40"
\include "AccordionStandardBass.ly"

cbar =  {\xco \xcM \removeWithTag #'chordLetter \xcM \removeWithTag
#'chordLetter \xcM}
fbar =  {\xfo \xfM \removeWithTag #'chordLetter \xfM \removeWithTag
#'chordLetter \xfM}
gsbar = {\xgo \xgs \removeWithTag #'chordLetter \xgs \removeWithTag
#'chordLetter \xgs}


left =
{
  \clef "bass"
  \fbar
  \gsbar
  \cbar
}

\score
{
  \new Staff = "left"  {\keepWithTag #'(screenOut chordLetter) \left}
  \layout { }
}

\score
{
  \new Staff = "left" \with { midiInstrument = "accordion"}
{\keepWithTag #'midiOut \left}
  \midi { }
}

Best regards, g.

Attachment: Capture.PNG
Description: PNG image

Attachment: AccordionStandardBass.ly
Description: Text Data


reply via email to

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