I'm trying to set a score in Lilypond displaying several short themes each on its own staff. The themes don't span the full horizontal width, and I'd like to center them horizontally. I suspect there must be a way to do so, but haven't found it yet.

There is a command called \tweak self-alignment-X, but it doesn't seem to have any effect. And I'm not even sure of which level to put this in, should it go in \paper, or in \layout or somewhere where I put \new Staff?

2 Answers 2


You can use the Lilypond feature that a complete score can be included in a line of text markup. The only special requirement is that the included score must have a \layout block (but an empty one will do).

So: make a separate score for each theme, the put them in a centered column inside text markup block, like this:

   \version "2.18.2"
   \markup \fill-line { 
      \override #'(baseline-skip . 10) \center-column {
      \line { \score {
         \new Staff { \relative c' { c d e } } \layout {} } }
      \line { \score {
         \new Staff { \relative c' { f g a b } } \layout {} } }
      \line { \score {
         \new Staff { \relative c
         { \time 3/4 \key d \major \clef "bass" d2. } }
         \layout {} } }
   } }

Set the \baseline-skip property to adjust the vertical spacing between the examples.

If you have a lot of themes you will probably want to define some macros for the repetitive parts of the input, of course.

This complete \markup block goes outside of your "real" score (either before or after it). See Chapter 3 of the Notation manual.

Note: the \line { \score { ... } } constructs can be changed to just \score { ... }, as an anonymous user (whose edit was rejected by other users) correctly pointed out. Having built and tested the answer incrementally, I didn't check if it was a minimal solution to the problem. The \line macros may have some value as self-documentation of the input.


You can set a short line width, a null indent and ragged-right to false. Then, each theme could be a simple, separate Score.

\paper {
\header {
  tagline =##f

\score {
  \new Staff \relative {
    \time 24/16 \clef treble \key g \major \tempo "Praeludium XV"
    g'16 b d g d b d b g b g d e g c

\score {
  \new Staff  \relative {
    \time 9/8 \clef treble \key a \minor \tempo "Praeludium XX"
    a'16 b c8 e c a e a c e b16 c d8 f

Result of the above is

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.