lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Footer text from header


From: Johannes Roeßler
Subject: Re: Footer text from header
Date: Tue, 19 Mar 2024 19:15:12 +0100
User-agent: Mozilla Thunderbird

Hi Aaron,

thx for your input - I'm aware of separating those information in include files, just tried to make a minimal example :)

And I aim to separate content from style - but in order to have the right (and changing) footer text for each piece in a book environment, I need to get this information from the header and can't define it in the common \paper env - or do I miss something?

And defining and adding your idea with the \as-string command seems not to work:

-----8<------------------
\version "2.24.0"

#(define-markup-command
  (as-string layout props arg) (markup?)
  (interpret-markup layout props (markup->string arg)))


{a4}

\header {

  title =
  \markup
  \fill-line {
    \override #'(font-name . "Calluna")
    \abs-fontsize #22 "Title"
    \null
  }

  composer = "Composer"

}

\paper {

  oddFooterMarkup = \markup \as-string {
    \fill-line {
      \tiny {
        {"Edited by Joei"}
        \line  {\fromproperty #'header:composer " - "  \fromproperty #'header:title }
       "Copyright 2024"
      }
    }
  }
}
-----8<------------------


Best regards
Joei



On 2024-03-19 9:35 am, Johannes Roeßler wrote:
Hi,

I'd like to make an automatic footer, using infos from the header block.

What do I have to change, to get rid of (or override) the format from the title?

-----8<------------------

\version "2.24.0"

{a4}

\header {

  title =
  \markup
  \fill-line {
    \override #'(font-name . "Calluna")
    \abs-fontsize #22 "Title"
    \null
  }

  composer = "Composer"

}

\paper {

  oddFooterMarkup = \markup {
    \fill-line {
      \tiny {
        {"Edited by Joei"}
        \line  {\fromproperty #'header:composer " - " \fromproperty #'header:title }
       "Copyright 2024"
      }
    }
  }
}

------>8-------

It should be possible to strip markup down to a simple string with the Scheme function markup->string.

%%%%
\version "2.22.0"

foo = \markup \huge \bold "Hello"

#(define-markup-command
  (as-string layout props arg) (markup?)
  (interpret-markup layout props (markup->string arg)))

\markup \foo

\markup \as-string \foo
%%%%

However, the best approach would be to separate content from styling.  When you define things like title, specify only the simple string value.  Place all formatting/styling commands instead within the paper variables like bookTitleMarkup, scoreTitleMarkup, oddHeaderMarkup, etc.

Reference the file titling-init.ly within your LilyPond installation to see what the default values are for these markup paper variables.  Copy-and-paste the default definitions and adjust to your needs.  NOTE: These are the sort of things that are best put into include files, so you can reuse them and easily standardize your formatting across many scores.


-- Aaron Hill



Virenfrei.www.avast.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]