Lilypond: Undesireable extra horizontal space with chords and lyrics
I'm working on a simple chords + lyrics (with bar lines) sheet. I'm getting a lot of extra space between a bar line and the following chord+lyric, seemingly depending on the length of the lyric in the previous measure.
Here's a simple example:
And here's the code:
version "2.18.2"
paper {
indent = #0
ragged-right = ##t
ragged-bottom = ##t
}
chordNames = chordmode {
c1 f g c break
c g d a d g:7 c
}
words = lyricmode {
This_is_a_line1 with both_short_and_very_very_very_long lyrics
On_this line_the lyrics_are all_more or_less the_same length
}
score {
<<
new ChordNames chordNames
new Lyrics words
>>
layout {
context {
ChordNames
consists "Bar_engraver"
override BarLine.bar-extent = #'(-0.25 . 2)
}
context {
Lyrics
consists "Bar_engraver"
hide BarLine
override LyricText.self-alignment-X = #LEFT
}
}
}
If I eliminate the Bar_engraver for the lyrics, i.e.:
%context {
% Lyrics
% consists "Bar_engraver"
% hide BarLine
% override LyricText.self-alignment-X = #LEFT
%}
then the extra space in the lyrics goes away, but not the extra space in the chords, and the lyrics no longer align correctly with the bar lines for the chords, although they do align correctly with the chords themselves:
Does anyone know what's going on here and how to fix it? I've tried tweaking dozens of different variables with no luck. I also tried using Lilypond 2.19.62, which had somewhat different spacing, but still had the same problem.
1 Comments
Sorted by latest first Latest Oldest Best
Your example seems too hard for Lilypond's automatic spacing of notes and lyrics to deal with - possibly because there are no notes at all so it doesn't have much information to work with!
The fix is to switch automatic spacing off. Add this to the layout block:
context {
Score
override SpacingSpanner packed-spacing = ##t
}
Terms of Use Privacy policy Contact About Cancellation policy © freshhoot.com2026 All Rights reserved.