Hello David,

I attach a file which should do what you want, and add some comments below:

Am 09.10.2014 um 23:50 schrieb Flaming Hakama by Elaine:
Hello,

I was wondering if anyone had suggestions for a text formatting challenge I've been unable to solve.

The format I like to use for header markup (for pages after page 1) is to have the page number centered with em dashes around it, and then split the title, with half on the left and half on the right.

The following code is what I am using, but I am not very happy with it.

The issues I'd like to solve are:

o How do I get the left/right sides of the title to right/left align next to the page number? I am doing it with literal spaces, but this is very unsatisfactory.
If you use \fill-line with three markups in its argument, the first is flush-left, the second is centered (at least approximately), and the third is flush-right. So use the poet as one markup, the whole split-title-and-page-number complex as one second markup (by enclosing it in \line), and the composer as third argument.

o How do I get an actual em dash rather than use "--"? I know that the code is \char ##x2014, but I cannot figure out how to use that in this header \on-the-fly context.
It’s easier anyway if you apply \on-the-fly to the entire markup as I did in the attached essay. And \char ##x2014 is inserted in precisely the same way as any other markup string.

o Is there a way to encapsulate this in a function, so I can just say something like:
\setSplitTitle "Example: Split" "Centered Title"
See <http://lilypond.org/doc/v2.18/Documentation/extending/new-markup-command-definition>. If you want a command which does not need to be wrapped into \markup {}, use #(define-scheme-function ), which should also be explained in the Extending Manual.

HTH,
Simon
\version "2.18.2"

title-left = "Example: Split"
title-right = "Centered Title"
em-dash = \markup \char ##x2014

\header {
  title = \markup { \fontsize #2 \bold { \title-left \title-right } }
  poet = "poet"
  composer = "composer"
}

\paper {
  print-page-number = ##t
  print-first-page-number = ##f
  oddHeaderMarkup = \markup {
    \on-the-fly #print-page-number-check-first
    \fill-line {
      \fromproperty #'header:poet
      \line { 
        \title-left
        \em-dash
        \fromproperty #'page:page-number-string
        \em-dash
        \title-right
      }
      \fromproperty #'header:composer
    }
  }
  evenHeaderMarkup = \oddHeaderMarkup
}

\book {
  \score {
    \new Staff {
      \relative c' { c1 \pageBreak c }
    }
  }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to