Some other changes:

- encapsulate the piece-break machinery in a function
- deal with pieces in c major :-)
- reset clef/key change settings
- etc.

Lukas

Am 07.01.22 um 17:20 schrieb Leo Correia de Verdier:
Adding

        \once \override Staff.KeySignature. break-visibility = ##(#f #f #f)
        \once \override Staff.Clef.break-visibility = ##(#f #f #f)
        \once \omit Score.BarNumber

Together with \stopStaff helps avoids some of the strangeness if the new 
piece’s start happens to coincide with a line break. The spacing still looks a 
bit off though.


6 jan. 2022 kl. 23:14 skrev Valentin Petzel <[email protected]>:

Hi Ruzsa,

Maybe this would be a slight improvement.
Cheers,
Valentin

Am Donnerstag, 6. Jänner 2022, 17:10:09 CET schrieb Ruzsa Krisztián:
Hi everyone,

I'd like to copy the layout of a small tune book. New pieces don't always
start in a new line, it usually occurs that the next song starts somewhere
in the middle of the line. Titles are placed before each piece (not above
the staff)

I found two helpful topics in the archive but couldn't find a solution for
properly adding a title for the new piece:
https://lists.gnu.org/archive/html/lilypond-user/2013-12/msg01027.html
https://www.mail-archive.com/[email protected]/msg118603.html

I'm trying to change some notes (see attachment) to add a new title, but I'm
wondering if there's a nicer solution that can help me place the new title
more precisely (to match the first title that was added as an
"instrumentName").

Thank you in advance for any help.

Krisztián

\version "2.22"

newPiece =
#(define-music-function (title) (markup?)
   #{
     \once \override Staff.BarLine.extra-spacing-width = #'(0 . 7)
     \stopStaff
     \newSpacingSection
     \once \override Staff.KeyCancellation.break-visibility = #all-invisible
     \once \override Staff.Clef.break-visibility = #all-invisible
     \key c \major
     \set Timing.currentBarNumber = 0
     \partial 32
     \once \override Rest.stencil = #ly:text-interface::print
     \once \override Rest.Y-extent = #grob::always-Y-extent-from-stencil
     \once \override Rest.Y-offset = #ly:self-alignment-interface::y-aligned-on-self
     \once \override Rest.X-extent = #'()
     \once \override Rest.self-alignment-Y = #CENTER
     \once \override Rest.minimum-distance = #0
     \once \override Rest.extra-spacing-width = #'(0 . 2)
     \once \override Rest.text = #title
     r32 \noBreak
     \newSpacingSection

     \once \override Score.BreakAlignment.break-align-orders =
     #(make-vector 3 '(
                        left-edge
                        staff-bar
                        clef
                        key-signature
                        time-signature
                        ))
     \bar ""
     \startStaff
     \set Staff.forceClef = ##t
     \once \override Staff.Clef.full-size-change = ##t
     \once \set Staff.printKeyCancellation = ##f
   #})

\new Staff \with {
  instrumentName = \markup \center-column { 1. "Title" }
}
{
  \key g \major
  \repeat unfold 30 c'2 \bar "|."

  \newPiece \markup \center-column { 2. "Other Title" }

  \clef bass
  \time 3/4
  \key es \major
  \repeat unfold 20 c'2.
  \clef bass
  \bar "|."
}

Reply via email to