[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \tocItem within \score block, using header properties
From: |
Joel C. Salomon |
Subject: |
Re: \tocItem within \score block, using header properties |
Date: |
Sun, 11 Dec 2022 13:48:50 -0500 |
On Tue, Dec 6, 2022 at 1:07 PM Jean Abou Samra <jean@abou-samra.fr> wrote:
> > A \tocItem needs a bottom context to be interpreted,
> > like a Voice, Dynamics, TabVoice or such. In this case,
> > you don't want anything to be printed from it, so you
> > can use this lesser known context type Devnull. Some
> > people do it with a Dynamics as well. Devnull works
> > with everything you might want to take out of the
> > individual parts: \time, \tempo, \mark, etc.
Thanks, that works beautifully.
> > For not repeating the title between \header and \tocItem,
> > you could try this approach:
I realized I'm reusing the same text in so many ways, it was cleaner
to just use a string variable.
--Joel
\version "2.23.80"
titleI = "Piece Title"
upperI = \relative c' { c4 d e f }
lowerI = \relative c {\clef bass f e d c }
scoreI = \score {
\header {
piece = \titleI
}
\new PianoStaff <<
\new Devnull { \tocItem \markup \titleI }
\new Staff = "upper" \upperI
\new Staff = "lower" \lowerI
>>
}
midiI = \score {
\header {
midititle = \markup{ "Project Name:" \titleI }
}
\new PianoStaff <<
\new Staff = "upper" \upperI
\new Staff = "lower" \lowerI
>>
\midi {}
}
% Print each score as its own file
\book {
\bookOutputName #(markup->string #{ \markup {"Proj01" \titleI} #})
\scoreI
}
% Print all scores together as one
\book {
\markuplist \table-of-contents
\scoreI
}