[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question on \tag and variable-expansion for the label used
From: |
David Kastrup |
Subject: |
Re: Question on \tag and variable-expansion for the label used |
Date: |
Thu, 25 Jul 2013 23:44:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Wim van Dommelen <address@hidden> writes:
> Hi,
>
> I'm trying to automate and simplify some things. And I tried to
> automate also my \tag construct in a file tiogether with some
> variable-
> expansion for the label used. Take for example this compiling example:
>
> \version "2.17.22"
>
> VoiceI = \relative f {
> \tag #'Bassoon \clef bass
> c4-\tag #'score ^"score-text"
> d e f g a b c
> }
>
> % My instrument:
> instrumentOne = "Bassoon"
> instrumentone = "bassoon"
>
> \score {
> \new Staff \with {
> instrumentName = \markup { \concat { \instrumentOne "-1 " } }
> midiInstrument = \instrumentone
> } {
> \keepWithTag #'(\instrumentOne score) \VoiceI % this
> one does NOT work
It does work, but does something different from what you expect. After
# you are in Scheme mode. You can choose to write what you want in
Scheme, which would be either
#(list instrumentOne 'score)
or
#`(,instrumentOne score)
or in LilyPond, namely
\keepWithTag \instrumentOne.score
Either case, assigning a string to instrumentOne is a mistake. You need
to write either
instrumentOne = Bassoon
or
instrumentOne = #'Bassoon
or this can't work, at least not without invoking the string->symbol
function. The LilyPondishest solution in 2.17 would likely be
\version "2.17.22"
VoiceI = \relative f {
\tag bassoon \clef bass
c4-\tag score ^"score-text"
d e f g a b c
}
% My instrument:
instrumentone = bassoon
instrumentOne = "Bassoon"
\score {
\new Staff \with {
instrumentName = \markup { \concat { \instrumentOne "-1 " } }
midiInstrument = \instrumentOne
} {
\keepWithTag \instrumentone.score \VoiceI
\keepWithTag bassoon.score \VoiceI % this works
}
\layout {}
}
Note that I have renamed the symbol to lowercase 'bassoon in order to
keep the confusing naming system somewhat under control. I also bank on
midiInstrument name being case insensitive (I seem to remember that this
was the case even though I did not figure out why).
--
David Kastrup