Re: Layout chord diagrams

Simon Albrecht <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.general
Message-ID <[email protected]>
Hi Nel,

On 10/08/2026 17:55, Lee wrote:
> Hi,
>
> I've been trying to use Lily to produce guitar chord diagrams - both 
> left and right.
>
> I'm pretty much there but wondered what is the best way to add spacing 
> between the chord rows and include text centred : Right above the 
> second chord row.
>
> It's quite a big file hence attached.
>
> I've had a play with markup with no joy.

You can’t use methods for \markup because this is inside of one \score 
{}. So you need “Flexible vertical spacing paper variables”, which is 
explained in Notation Reference 26.4. The basic introduction in Learning 
Manual 5.6 only covers spacing within systems, which would matter if you 
wanted more space between the tabs and chord names.

I have attached your file with a suggestion for this, and I’ve taken the 
liberty of suggesting a few more changes, mostly to make the file easier 
to read according to standards in the community.

The \set majorSevenSymbol command is only needed once, it persists. You 
could even move this to a layout block, as well as the hiding of the bar 
numbers, which I have also demonstrated.

I would recommend not to abbreviate the \override command, since it is a 
very basic construct. For example if you use Frescobaldi or another 
editor with syntax highlighting, it will understand to show it in the 
right way.

HTH (Hope that helps),
Simon
left.ly (text/x-lilypond, 2 KB)
\version "2.26.0"

\language "english"

\include "predefined-guitar-fretboards.ly"

\header {
  title = "lefty/righty chords that are customised"
}

\paper {
  system-system-spacing.minimum-distance = 16
}

\markup \vspace #1



\storePredefinedDiagram #default-fret-table \chordmode { e:m9 }
#guitar-tuning
"o;2-1;4-4;o;o;o;"


\storePredefinedDiagram #default-fret-table \chordmode { d:7sus4 }
#guitar-tuning
"x;x;o;2-2;1-1;3-3;"



\storePredefinedDiagram #default-fret-table \chordmode { c:maj7/g }
#guitar-tuning
"3-3;3-4;2-2;o;o;o;"


\storePredefinedDiagram #default-fret-table \chordmode { b:m7 }
#guitar-tuning
"x;2-1;4-3;2-1;3-2;2-1;"


\storePredefinedDiagram #default-fret-table \chordmode { f:maj7/c }
#guitar-tuning
"x;3-3;3-4;2-2;1-1;o;"


\storePredefinedDiagram #default-fret-table \chordmode { g:6 }
#guitar-tuning
"x;7-3;7-4;6-2;5-1;o;"


\storePredefinedDiagram #default-fret-table \chordmode { d:7.9+  }
#guitar-tuning
"x;5-2;4-1;5-3;6-4;x;"


\storePredefinedDiagram #default-fret-table \chordmode { d:7.9-  }
#guitar-tuning
"x;5-2;4-1;5-3;4-1;x;"


\storePredefinedDiagram #default-fret-table \chordmode { f:9^7 }
#guitar-tuning
"1-5;x;3-1;2-2;1-3;3-1;"






chordnames = \chordmode  {
  %\override Score.BarNumber.break-visibility = ##(#f #f #f)
  e:m9
  a
  %\set majorSevenSymbol = \markup { maj7 }
  c:maj7/g
  b:min7
  f:maj7/c
  g:6
  d:7.9+
  d:7.9-
  c
  d:7sus4
  e:m7
  %\set additionalPitchPrefix = #"add"
  f:9^7
}




melody = {
  \override FretBoard.fret-diagram-details.handedness = #-1  %set left handed

  \override ChordName.font-size = #-2
  \chordnames
  \break
  \override FretBoard.fret-diagram-details.handedness = #1 % set right handed

  \chordnames

}

\score {
  <<
    \new FretBoards \melody
    \new ChordNames \melody
  >>
  \layout {
    indent = 0
    \context {
      \ChordNames
      additionalPitchPrefix = "add"
      majorSevenSymbol = "maj7"
    }
    \context {
      \NoteNames
      printOctaveNames = ##f
    }
    \context {
      \Score
      \omit BarNumber
    }
  }

}
left.pdf (application/pdf, 58.8 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.