Lilypond: controlling clef and key signature visibility, aligning markup

StackOverflow https://stackoverflow.com/questions/18818803

  •  28-06-2022
  •  | 
  •  

Pregunta

My effort to create a document with six incipits from different pieces is running into a couple of problems. Can anyone help? I am pasting my code below (I've reduced the example somewhat for the purposes of asking the question).

Problem 1: How can I hide the clefs and key signatures from the ends of the lines? The commands in \score are not behaving as I thought they would based on the documentation.

Problem 2: How can I align the text markup to the start of the lines? I want "No. 1" etc. left-aligned to the very start of the staff.

Extra query: Does anyone know why using \partial breaks the beaming in the measure preceding the partial measure? Is there a general fix for this? (Short of hard-coding the proper beaming with [ ].)

Any assistance gratefully received!

=========================

\version "2.16.2"

notes = {
  \bar""\mark\markup\normalsize{No. 1}
  \clef bass
  \time 6/8
  \key g \major
  \partial 8 \once \stemUp d=8 |
  g( d e) e( c d) |
  \partial 8*5 d g d b g
  \bar""
  \break

  \mark\markup\normalsize{No. 2}
  \clef bass
  \time 3/8
  \key d \minor
  \partial 8 a=8 |
  d,4 bes'8 | 
  \partial 4 cis,4
  \bar""
  \break

  \mark\markup\normalsize{No. 3}
  \clef bass
  \time 3/8
  \key c \major
  \partial 8 g=8 |
  c8 c,16( d e f) |
  \partial 4 g8( a)
  \bar""
  \break

  \mark\markup\normalsize{No. 4}
  \clef bass
  \time 12/8
  \key es \major
  \partial 8 es8 |
  es( d es) bes( c d) es( d es) g( f g) |
  \break

  \mark\markup\normalsize{No. 5}
  \clef bass
  \time 3/8
  %\key c \minor
  \partial 8 g=8 |
  es8. f16 d8 |
  \partial 16*3 es8.
  \bar""
  \break

  \mark\markup\normalsize{No. 6}
  \clef alto
  \time 6/8
  \key d \major
  \partial 8 a='8 |
  << { d,4. e8 fis g |\noBreak
       fis d a' \stemDown a16( g fis g) a8 \stemUp |\noBreak
       d, a d e fis g |\noBreak } \\
     { fis,4. a8 s s |
       d, s8*5 |
       fis8 s s a s s | } \\
     { s2. |
       a8 s8*5 |
       s2. | } >>
  fis'8 d a d,4
}

\score {
  \relative c <<
    \new Staff \notes
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
    \override Staff.Clef #'break-visibility = #begin-of-line-visible
    \override Staff.Clef #'explicitClefVisibility = #begin-of-line-visible
    \override Staff.TimeSignature #'break-visibility = #begin-of-line-
visible
    \override Staff.KeySignature #'break-visibility = #begin-of-line-visible
    \override Staff.KeySignature #'explicitKeySignatureVisibility = #begin-
of-line-visible
    \override Staff.KeyCancellation #'break-visibility = #all-invisible
    \override Staff.KeyCancellation #'explicitKeySignatureVisibility = #all-
invisible
  >>
  \layout {
  }
}

\paper {
  paper-height = 250\pt%7in=504pt max.
  line-width = 432\pt
  paper-width = 432\pt
  left-margin = 0\pt
  top-margin = 0\pt
  bottom-margin = 0\pt
  indent = 0
  head-separation = 0\pt
  page-top-space = 0\pt
  after-title-space = 0\pt
  before-title-space = 0\pt
  between-system-padding = 0\pt
  between-system-space = 0\pt
  between-title-space = 0\pt
  foot-separation = 0\pt
  ragged-bottom = ##f
  ragged-right = ##t
}

\book {
  #(set-global-staff-size 13)
}

\header {
  tagline = ""%removed
  title = ""
}
¿Fue útil?

Solución

Here is the solution to both of your questions:

1) I compiled your code above and the cautionary clefs are already hidden for me. The time signature problems will be solved by using \set Staff.explicitKeySignatureVisibility = #begin-of-line-visible.

2) To solve this, you can align the \mark\markup texts with clefs, then shift it by an horizontal amount.

Simply replace your \score for this one:

\score {
  \relative c <<
    \new Staff \notes
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
    \override Staff.Clef #'break-visibility = #begin-of-line-visible
    \override Staff.Clef #'explicitClefVisibility = #begin-of-line-visible
    \override Staff.TimeSignature #'break-visibility = #begin-of-line-visible
    \set Staff.explicitKeySignatureVisibility = #begin-of-line-visible % this will do the job with the time signatures
    \override Staff.KeyCancellation #'break-visibility = #all-invisible
    \override Staff.KeyCancellation #'explicitKeySignatureVisibility = #all-invisible
  >>
  \layout {
  }
}

About your extra question: I found the following quotation in an old documentation of LilyPond (v2.12):

The \partial command is intended to be used only at the beginning of a piece. If you use it after the beginning, some odd warnings may occur.

Maybe this is the reason you are encountering these problems with beaming. I would suggest some workaround, as using invisible rests (entered as sn, where n is the duration). One other possibility for the beaming problem is to control the beaming manually. It is annoying, but it gets the job done :) Ex: replace the musical content of your No. 1, which is:

  \partial 8 \once \stemUp d=8 |
  g( d e) e([ c d)] |
  \partial 8*5 d g d b g

for:

  \partial 8 \once \stemUp d=8 |
  g( d e) e([ c d)] |
  \partial 8*5 d[ g d] b[ g]

I hope this helps.

Otros consejos

So the problem here is that you have one single instrumental staff that is being broken down into 6 pieces, and this causes all sorts of problems with clefs, pickup bars, key signatures. Although the workaround I posted above works well (besides for the clefs), the ideal thing is to have to consider each one of your six examples as a small score. Then you can ask LilyPond to print one below each other. Here is a minimal example:

A = {c'4 d' e' f'}
B = {\clef bass c2 g c1}
C = {e'4 d' cis' fis' | e' d' cis' }

\score {\new Staff \A}
\score {\new Staff \B}
\markup {This text will be added between the scores...}
\score {\new Staff \C}

Which results in:

enter image description here

Note how the last bar of C has only 3 quarter notes and thus is left opened, without any \bar "" command. Also, all problems with clefs, key signatures and pickup bars are vanished now.

And here is your code reworked. I think now it works quite well:

\version "2.16.2"

A = {
  \bar""\mark\markup\normalsize{No. 1}
  \clef bass
  \time 6/8
  \key g \major
  \partial 8 \once \stemUp d=8 |
  g( d e) e( c d) |
  d g d b g
}

B = {
  \mark\markup\normalsize{No. 2}
  \clef bass
  \time 3/8
  \key d \minor
  \partial 8 a'8 |
  d,4 bes'8 | 
  cis,4
}

C = {
  \mark\markup\normalsize{No. 3}
  \clef bass
  \time 3/8
  \key c \major
  \partial 8 g'8 |
  c8 c,16( d e f) |
  g8( a)
}

D = {
  \mark\markup\normalsize{No. 4}
  \clef bass
  \time 12/8
  \key es \major
  \partial 8 es8 |
  es( d es) bes( c d) es( d es) g( f g) |
}

E = {
  \mark\markup\normalsize{No. 5}
  \clef bass
  \time 3/8
  %\key c \minor
  \partial 8 g'8 |
  es8. f16 d8 |
  es8.
}

F = {
  \mark\markup\normalsize{No. 6}
  \clef alto
  \time 6/8
  \key d \major
  \partial 8 a''8 |
  << { d,4. e8 fis g |\noBreak
       fis d a' \stemDown a16( g fis g) a8 \stemUp |\noBreak
       d, a d e fis g |\noBreak } \\
     { fis,4. a8 s s |
       d, s8*5 |
       fis8 s s a s s | } \\
     { s2. |
       a8 s8*5 |
       s2. | } >>
  fis'8 d a d,4
}

\score {
  \relative c <<
    \new Staff \A
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
  >>
  \layout { }
}

\score {
  \relative c <<
    \new Staff \B
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
  >>
  \layout { }
}

\score {
  \relative c <<
    \new Staff \C
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
  >>
  \layout { }
}

\score {
  \relative c <<
    \new Staff \D
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
  >>
  \layout { }
}

\score {
  \relative c <<
    \new Staff \E
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
  >>
  \layout { }
}

\score {
  \relative c <<
    \new Staff \F
    \override Score.RehearsalMark.break-align-symbols = #'(clef) %this will put the \mark\markup texts above the clefs
    \override Score.Clef.break-align-anchor-alignment = #0.3 % %this controls its horizontal displacement. In my test, 0.3 was the ideal value to have the No. x exactly at the beginning of each system
    \override Score.TextScript #'font-family = #'sans
    \override Score.RehearsalMark #'font-family = #'sans
  >>
  \layout { }
}


\paper {
  paper-height = 250\pt%7in=504pt max.
  line-width = 432\pt
  paper-width = 432\pt
  left-margin = 0\pt
  top-margin = 0\pt
  bottom-margin = 0\pt
  indent = 0
  head-separation = 0\pt
  page-top-space = 0\pt
  after-title-space = 0\pt
  before-title-space = 0\pt
  between-system-padding = 0\pt
  between-system-space = 0\pt
  between-title-space = 0\pt
  foot-separation = 0\pt
  ragged-bottom = ##f
  ragged-right = ##t
}

\book {
  #(set-global-staff-size 13)
}

\header {
  tagline = ""%removed
  title = ""
}

Producing:

enter image description here

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top