lilypond-user
[Top][All Lists]
Advanced

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

Re: Omit footnotes and footnote text from score


From: YTG 123
Subject: Re: Omit footnotes and footnote text from score
Date: Wed, 28 Feb 2024 00:18:13 +0200
User-agent: Mozilla Thunderbird

Hello William,

Consider an alternative approach using tags, like what was recommended to me in a slightly different situation (thread linked and attached).

--- Begin Message --- Subject: Re: Books with alternative lyrics minimizing code duplication? Date: Fri, 24 Nov 2023 21:47:15 -0600
On Fri 24 Nov 2023 at 16:23:52 (+0200), YTG 123 wrote:
> 
> I have alternative versions of lyrics text, which I would like to
> export in different files (or \book blocks). The music, order of
> staves, etc. is identical.
> 
> Ideally, I would want to do this as cleanly and with as little code
> duplication as possible.

Perhaps an easy way to do this is as in the attached files.

Place all the lyrics for one version in one file (o-sing.ily),
using different variable names for all the different sections,
books etc in the piece. (I've just used the voice names for brevity.)

Now write a corresponding file (sing-ye.ily) with the alternative
lyrics, but using all the same corresponding variable names.

Merely include the appropriate lyrics filename in the master file
to produce the appropriate output file(s).

This method uses one simple modification of the master file to
change all the lyrics in all the output files (by removing the
%% in my master file example).

If even that amount of modification of source files is not possible,
then you can instead use the same filename for the two versions
of the lyrics, but place them in two different directories (and
also a different directory from the master file). Then select
which lyrics file is included in the run by using an appropriate
--include=<directoryname> in the LilyPond command line.

Cheers,
David.

Attachment: o-sing.ily
Description: Text document

Attachment: sing-ye.ily
Description: Text document

Attachment: sing.ly
Description: Text document


--- End Message ---
--- Begin Message --- Subject: Re: Books with alternative lyrics minimizing code duplication? Date: Fri, 24 Nov 2023 11:54:32 -0500
Hi,

On Fri, Nov 24, 2023 at 9:25 AM YTG 123 <ytg1234.pm.me@gmail.com> wrote:
Hello,

I have alternative versions of lyrics text, which I would like to export
in different files (or \book blocks). The music, order of staves, etc.
is identical.

Ideally, I would want to do this as cleanly and with as little code
duplication as possible.

I do something a bit like this on a regular basis - generating multiple versions from the same music. In my case, instead of doing different lyrics I'm doing some instrument specific formatting and such. But the basic idea is pretty similar. Perhaps something like this?

\version "2.25.10"

music = { c'4 d' e' }
lyricsOne = \lyricmode { do re mi }
lyricsTwo = \lyricmode { a b c }

% Header info common to all versions
main_header =
\header {
  title = "Main Title"
  composer = "Written by Foo Bar"
}

% Here is the main body of the score, so we can call it as needed
main_score = <<
  \new Staff {
    \new Voice = "VOne" {
      \music
    }
  }
  \tag #'(showLyricsOne) {
    \new Lyrics  \lyricsto "VOne" {
      \lyricsOne
    }
  }
  \tag #'(showLyricsTwo) {
    \new Lyrics  \lyricsto "VOne" {
      \lyricsTwo
    }
  }
>>

% With what I usually do everything from here down is in a separate file, that includes in everything above

\book {
  \paper {
    output-suffix = "both_lyrics"
  }
  \header {
    pdftitle = "Song Title - Both Lyrics"
    subtitle = "Both Lyrics"
  }
  \main_header
  \score {
    \main_score
    \layout {
      % As needed
    }
  }
}

\book {
  \paper {
    output-suffix = "first_lyrics"
  }
  \header {
    pdftitle = "Song Title - First Lyrics"
    subtitle = "First Lyrics"
  }
  \main_header
  \score {
    \keepWithTag #'showLyricsOne
    %\removeWithTag #'showLyricsTwo
    \main_score
    \layout {
      % As needed
    }
  }
}

\book {
  \paper {
    output-suffix = "second_lyrics"
  }
  \header {
    pdftitle = "Song Title - Second Lyrics"
    subtitle = "Second Lyrics"
  }
  \main_header
  \score {
    \keepWithTag #'showLyricsTwo
    %\removeWithTag #'showLyricsOne
    \main_score
    \layout {
      % As needed
    }
  }
}

As a source file named example1.ly this produces 3 PDFs: example1-both_lyrics.pdf, example1-first_lyrics.pdf and example1-second_lyrics.pdf  
http://lilypond.org/doc/v2.25/Documentation/notation/output-file-names
goes over how to control the output file names.

Using pdftitle in a \header block to set the displayed PDF title gets covered in 
http://lilypond.org/doc/v2.25/Documentation/notation/creating-output-file-metadata

In this example I'm using tags to control which lyrics get shown when. There are 2 ways to use them: \keepWithTag and \removeWithTag  Details on how they both get used are in
http://lilypond.org/doc/v2.25/Documentation/notation/using-tags
Short version: \keepWithTag keeps music with that tag and untagged music, while \removeWithTag keeps everything but the music with the selected tag. There's more to it than that - especially if you get into using multiple tags at the same time. But this example is simple enough that it could work either way - swap the two commented tag commands in each score to try it out, and you'll see that the output is the same.
--
Michael


--- End Message ---

reply via email to

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