Re: Footer text from header

2024-03-19 Thread Aaron Hill

On 2024-03-19 1:50 pm, Johannes Roeßler wrote:

thx again Aaron,

I tried it with
%%%
 \line  {\fromproperty #'header:composer " - "  \as-string 
\fromproperty #'header:title }

%%%
- then the title (in the footnote) was empty.

But you gave so many valuable insights, that I'll use it to make it in 
a better way - very instructive,

thank you very much!



Aha!  \as-string (as I defined it) is not going to work with 
\fromproperty.  The problem is that \fromproperty needs to be 
interpretted to get its contents.  \as-string is processing too soon, so 
it will not work.  Also, once markup is interpretted, it becomes a 
stencil.  And that is basically useless for our purposes.


One solution would be to customize \fromproperty itself:


\version "2.22.0"

%% Based on code from define-markup-commands.scm:
#(define-markup-command
  (frompropertystring layout props symbol) (symbol?)
  (let ((m (chain-assoc-get symbol props)))
(if (markup? m)
(interpret-markup
  layout
  (cons (list (cons symbol `(,property-recursive-markup 
,symbol))) props)

  (markup->string m))
empty-stencil)))

\header {
  asdf = \markup \with-color #red \bold \line { "Hello," "World!" }

  title = \markup \fromproperty #'header:asdf
  subtitle = \markup \frompropertystring #'header:asdf
}

\score { { b'1 } }


Again, this is probably not the best approach.  For instance, a nested 
\fromproperty within a field is going to fail much the same way.  So, 
then we are looking at redefining \fromproperty itself to be able to 
call markup->string as needed.  Doable, but it really starts to feel 
like a clunky hack.


I think the best approach is to avoid putting markup around data that 
needs to be accessed in different ways.  Keep the fields as simple text, 
so there is no need for an \as-string or \frompropertystring command.



-- Aaron Hill



Re: Footer text from header

2024-03-19 Thread Johannes Roeßler

thx again Aaron,

I tried it with
%%%
 \line  {\fromproperty #'header:composer " - "  \as-string 
\fromproperty #'header:title }

%%%
- then the title (in the footnote) was empty.

But you gave so many valuable insights, that I'll use it to make it in a 
better way - very instructive,

thank you very much!

Best
Joei


On 2024-03-19 11:15 am, Johannes Roeßler wrote:
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?


You should be able to define oddFooterMarkup in a suitably generic 
manner.  All of the related markup paper variables are intended to 
work this way, so anything specific to a score lives in a \header block.



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


The idea is that \as-string strips any commands for the markup you 
provide it.  But the usage you wrote is not what was intended. 
\as-string would be used just before the \fromproperty commands. 
Something closer to this:



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


NOTE: You should probably be using \header fields for copyright and 
editor.


Here's a more complete example with the goal of keeping the \header 
blocks free of \markup commands:




\version "2.22.0"

\paper {
  bookTitleMarkup = \markup
    \override #'(baseline-skip . 1.75) \column {
  \fill-line {
    \override #'(font-name . "Lobster") \line {
  \fontsize #6 \fromproperty #'header:title
  \fontsize #3 \fromproperty #'header:subtitle
    }
    \bold \fromproperty #'header:composer
  }
  \override #'(thickness . 2) \draw-hline
    }

  oddFooterMarkup = \markup \tiny \fill-line {
    \line { Edited by \fromproperty #'header:editor }
    \line {
  \fromproperty #'header:composer
  – % en-dash
  \fromproperty #'header:title
    }
    \fromproperty #'header:copyright
  }
}

\header {
  editor = "Anon E. "
}

%% - - -

\header {
  title = "Lorem Ipsum"
  subtitle = "(dolor sit amet)"
  composer = \markup { "John Doe" \smallCaps (asdf) }
  copyright = "© 2024 John Doe Music"
}

\score { { b'1 } }



In this case, the composer's affiliation with the fictitious ASDF 
group is written in small caps.  This markup command belongs in the 
\header block as we would ideally want it included anywhere that field 
is referenced.  Now, that is only one way to achieve things, as we 
could have just as easily defined a new header field instead:



\header {
  title = "Lorem Ipsum"
  subtitle = "(dolor sit amet)"
  composer = "John Doe"
  affiliation = "ASDF"
  copyright = "© 2024 John Doe Music"
}


Of course, the \paper block would need to be updated to support this 
new field.  (I'll leave that as an exercise for the reader.)


It will be up to you to determine where you are going to strike the 
balance between markup in the \paper block versus the \header block.  
As in the example above, I think that it is perfectly fine to mix a 
little bit of useful formatting in the metadata, especially if such a 
thing is going to be relatively rare across the majority of your 
scores.  Otherwise, anything that is shared should ideally be defined 
once, in some globally-referenced resource.


It can be a little tricky to plan out how to build your \paper markup 
variables, so that they function well when fields are defined or left 
undefined.  In the example I provided, the subtitle can be safely 
omitted.  However, note that I opted to put the parentheses within the 
subtitle field itself.  Had I put them in the \paper block, then you'd 
find an empty set of parens next to any title that did not also 
include a subtitle; not really what you'd want.  So, either one would 
need some clever custom \markup commands to automatically do the work, 
or we just "cheat" and put the parens in the header field.  Again, it 
comes back to that balancing act.


(The careful reader should observe that due to how the footer was 
defined, editor is effectively not an optional field.  The text 
"Edited by" will still appear even when the editor field is 
undefined.  I would encourage you to consider how you could improve 
this, assuming such flexibility is necessary.  The advanced exercise 
involves showing "Edited by" only when the editor field is defined 
without moving such text to the field itself.  Of course, consider 
your own real-world scenario.  Are you the editor for all of your 
scores?  If so, there may be no need to add complexity where it is 
otherwise wasted effort.)



-- Aaron Hill




--
Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
www.avast.com

Re: Footer text from header

2024-03-19 Thread Aaron Hill

On 2024-03-19 11:15 am, Johannes Roeßler wrote:
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?


You should be able to define oddFooterMarkup in a suitably generic 
manner.  All of the related markup paper variables are intended to work 
this way, so anything specific to a score lives in a \header block.



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


The idea is that \as-string strips any commands for the markup you 
provide it.  But the usage you wrote is not what was intended.  
\as-string would be used just before the \fromproperty commands.  
Something closer to this:



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


NOTE: You should probably be using \header fields for copyright and 
editor.


Here's a more complete example with the goal of keeping the \header 
blocks free of \markup commands:




\version "2.22.0"

\paper {
  bookTitleMarkup = \markup
\override #'(baseline-skip . 1.75) \column {
  \fill-line {
\override #'(font-name . "Lobster") \line {
  \fontsize #6 \fromproperty #'header:title
  \fontsize #3 \fromproperty #'header:subtitle
}
\bold \fromproperty #'header:composer
  }
  \override #'(thickness . 2) \draw-hline
}

  oddFooterMarkup = \markup \tiny \fill-line {
\line { Edited by \fromproperty #'header:editor }
\line {
  \fromproperty #'header:composer
  – % en-dash
  \fromproperty #'header:title
    }
    \fromproperty #'header:copyright
  }
}

\header {
  editor = "Anon E. "
}

%% - - -

\header {
  title = "Lorem Ipsum"
  subtitle = "(dolor sit amet)"
  composer = \markup { "John Doe" \smallCaps (asdf) }
  copyright = "© 2024 John Doe Music"
}

\score { { b'1 } }



In this case, the composer's affiliation with the fictitious ASDF group 
is written in small caps.  This markup command belongs in the \header 
block as we would ideally want it included anywhere that field is 
referenced.  Now, that is only one way to achieve things, as we could 
have just as easily defined a new header field instead:



\header {
  title = "Lorem Ipsum"
  subtitle = "(dolor sit amet)"
  composer = "John Doe"
  affiliation = "ASDF"
  copyright = "© 2024 John Doe Music"
}


Of course, the \paper block would need to be updated to support this new 
field.  (I'll leave that as an exercise for the reader.)


It will be up to you to determine where you are going to strike the 
balance between markup in the \paper block versus the \header block.  As 
in the example above, I think that it is perfectly fine to mix a little 
bit of useful formatting in the metadata, especially if such a thing is 
going to be relatively rare across the majority of your scores.  
Otherwise, anything that is shared should ideally be defined once, in 
some globally-referenced resource.


It can be a little tricky to plan out how to build your \paper markup 
variables, so that they function well when fields are defined or left 
undefined.  In the example I provided, the subtitle can be safely 
omitted.  However, note that I opted to put the parentheses within the 
subtitle field itself.  Had I put them in the \paper block, then you'd 
find an empty set of parens next to any title that did not also include 
a subtitle; not really what you'd want.  So, either one would need some 
clever custom \markup commands to automatically do the work, or we just 
"cheat" and put the parens in the header field.  Again, it comes back to 
that balancing act.


(The careful reader should observe that due to how the footer was 
defined, editor is effectively not an optional field.  The text "Edited 
by" will still appear even when the editor field is undefined.  I would 
encourage you to consider how you could improve this, assuming such 
flexibility is necessary.  The advanced exercise involves showing 
"Edited by" only when the editor field is defined without moving such 
text to the field itself.  Of course, consider your own real-world 
scenario.  Are you the editor for all of your scores?  If so, there may 
be no need to add complexity where it is otherwise wasted effort.)



-- Aaron Hill



Re: Footer text from header

2024-03-19 Thread Johannes Roeßler

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




--
Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
www.avast.com

Re: Footer text from header

2024-03-19 Thread Aaron Hill

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



Footer text from header

2024-03-19 Thread Johannes Roeßler

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---

Best regards
Joei


--
Diese E-Mail wurde von Avast-Antivirussoftware auf Viren geprüft.
www.avast.com

Re: [large/complex projects] conditional header values and/or book name

2024-01-27 Thread Kieren MacMillan
 Hi Sam,

Thanks for these thoughts!

> I'm not sure if this fits under your umbrella of having a single top level 
> file, but what about this?
> 
>  song-FV.ly
> definedVariables = data
> \include song.ily
> 
>  song-SV.ly
> definedVariables = data
> \include song.ily
> 
>  song.ily
> \include [.ily files containing the notes, edition-engraver tweaks, etc.]

Different versions will share some tweaks and also have individual/unshared 
tweaks, so I can’t quite tell yet whether this structure would be sufficient 
(never mind optimal).

> \header {
>   [header parameters shared by both versions]
>   [differing header parameters defined in global variables]
> }
> 
> \score {
>   [contexts built from variables defined in \include-d files]
> }
> 
> 
> Optionally, you could use the output names and book blocks so that you can 
> compile the whole work from a FullVersion.ly and ShortVersion.ly which are 
> basically a series of includes of the applicable songs.

The full book (e.g. “Piano/Conductor Score” will definitely be a series of 
includes of applicable songs. I’m trying to figure out how to structure all 
this with the least amount of duplication (in note code, tweak code, and score 
code).

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: [large/complex projects] conditional header values and/or book name

2024-01-23 Thread Sam Speer
Kieren,

I'm not sure if this fits under your umbrella of having a single top level
file, but what about this?

 song-FV.ly
definedVariables = data
\include song.ily

 song-SV.ly
definedVariables = data
\include song.ily

 song.ily
\include [.ily files containing the notes, edition-engraver tweaks, etc.]

\header {
  [header parameters shared by both versions]
  [differing header parameters defined in global variables]
}

\score {
  [contexts built from variables defined in \include-d files]
}


Optionally, you could use the output names and book blocks so that you can
compile the whole work from a FullVersion.ly and ShortVersion.ly which are
basically a series of includes of the applicable songs.

Hope some of these ideas help or at least spark others,
Sam


Re: [large/complex projects] conditional header values and/or book name

2024-01-23 Thread Kieren MacMillan
Hi Timothy,

> How about setting up some Scheme variables that are later used to build 
> variants of the score?

OOO I like this!

There are some further complications coming up that might render this 
unfeasible/impractical… but it’s a great suggestion, and I can definitely see 
where to use it in some of my less complex and/or complicated projects and 
workflows.

Thanks!
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: [large/complex projects] conditional header values and/or book name

2024-01-23 Thread Timothy Lanfear


On 22/01/2024 19:09, Kieren MacMillan wrote:

Is there a more efficient construct where the book name and header variables 
could be “injected” or “conditionalled” in? Or is that just overcomplicating 
this particular problem-space? (n.b., In future questions, the problem-space is 
naturally more complicated without any help from me!)

Thanks,
Kieren.


How about setting up some Scheme variables that are later used to build 
variants of the score?


\version "2.24.2"

#(define variant 'full)
% or #(define variant 'short)

#(define bookname (format #f "MyScore_~a" variant))
#(define N (if (eq? variant 'full) 10 5))

notes = { c'4 d' e' f' }

final_score =
  <<
    \new Staff \notes
  >>

\header {
  composer = "Kieren MacMillan"
}

\book {
  \bookOutputName \bookname
  \header {
    title = #(format #f "~a. Song" N)
  }
  \score { \final_score }
}

--
Timothy Lanfear, Bristol, UK.


[large/complex projects] conditional header values and/or book name

2024-01-22 Thread Kieren MacMillan
Hi all,

I have a big engraving use case — I’m neck-deep in an example of it right now! 
— and I’m hoping to do some brainstorming towards an optimal 
structure/toolchain/workflow, so any thoughts are appreciated.

One of the things I do most often is compose for musical theatre. Because of 
the way that particular industry works, there is a very large and complex set 
of inputs and outputs. I’m hoping to refine my tools and process(es) to give me 
the most flexible output options with the least effort and friction on the 
input side. 

There might be a large number of posts under this “rubric”, but I’ll keep it to 
one question per thread.

So without further ado…


QUESTION #1:

Let’s say I have a song which appears identically in both the “Full Version” 
and “Short Version” of the musical. The number of the song/cue within the show 
might change, but it might not — for example, the opening number would likely 
be #1 in both versions, but the finale could be #25 in the Full version and #17 
in the Short Version. And furthermore, for this specific question, let’s say I 
need to output one file per song (as opposed to a complete score containing the 
whole show).

If I’d prefer not to involve make (or similar extra-Lilypond tools) in my 
solution, is there any way to improve on simply having a single “top-level” 
(score-generating) file structured as follows:

%%  START FILE CONTENTS
\include [.ily files containing the notes, edition-engraver tweaks, etc.]

final_score =
  <<
[contexts built from variables defined in \include-d files]
  >>

\header {
  [header parameters shared by both versions]
}

\book {
  \bookOutputName "MySong_full"
  \header {
[header parameters specific to the Full Version, e.g., song number]
  }
  \score { \final_score }
}

\book {
  \bookOutputName "MySong_short"
  \header {
[header parameters specific to the Short Version, e.g., song number]
  }
  \score { \final_score }
}
%%  END FILE CONTENTS

Is there a more efficient construct where the book name and header variables 
could be “injected” or “conditionalled” in? Or is that just overcomplicating 
this particular problem-space? (n.b., In future questions, the problem-space is 
naturally more complicated without any help from me!)

Thanks,
Kieren.


Re: tagline = ##f does not work in score header block

2023-09-13 Thread Knute Snortum
On Wed, Sep 13, 2023 at 12:34 AM Jean Abou Samra  wrote:

> Suppose tagline "worked" in \score blocks. What would this code print?
>
> \version "2.24.2"
>
> \score {
>   \header {
> tagline = "Tagline 1"
>   }
>   { c' }
> }
>
> \score {
>   \header {
> tagline = "Tagline 2"
>   }
>   { d' }
> }
>
> \score {
>   \header {
> tagline = "Tagline 3"
>   }
>   { e' }
> }
>
>
>
> A tagline is not specific to a score, it's put on the last page of
> an entire bookpart, so the behavior is expected (and logical).
>

When you explain it, it seems obvious now.  Thanks.


--
Knute Snortum


Re: tagline = ##f does not work in score header block

2023-09-13 Thread Jean Abou Samra

> Well, I could imagine that the last 'tagline' entry wins.


It is at least not more consistent than the existing behavior, which
is also documented. Ergo, I see no bug here.

Best,
Jean




signature.asc
Description: This is a digitally signed message part


Re: tagline = ##f does not work in score header block

2023-09-13 Thread Werner LEMBERG


> Another observation: tagline is not in either the command index or
> the index in the Notation Manual.  The documentation I could find on
> tagline was pretty sparse (unless I missed something).

I've added index entries in

  https://gitlab.com/lilypond/lilypond/-/merge_requests/2104


Werner



Re: tagline = ##f does not work in score header block

2023-09-13 Thread Werner LEMBERG

> Suppose tagline "worked" in \score blocks. What would this code print?
>
> \version "2.24.2"
>
> \score {
>   \header {
> tagline = "Tagline 1"
>   }
>   { c' }
> }
>
> \score {
>   \header {
> tagline = "Tagline 2"
>   }
>   { d' }
> }
>
> \score {
>   \header {
> tagline = "Tagline 3"
>   }
>   { e' }
> }

Well, I could imagine that the last 'tagline' entry wins.


Werner


Re: tagline = ##f does not work in score header block

2023-09-13 Thread Jean Abou Samra
Le mardi 12 septembre 2023 à 15:38 -0700, Knute Snortum a écrit :
> Hi everyone.
> 
> I have a few observations that I'd like to share.  Nothin too urgent.
> 
> If you put tagline = ##f in a header block, it will work everywhere except in 
> the score block. 


Suppose tagline "worked" in \score blocks. What would this code print?

\version "2.24.2"

\score {
  \header {
tagline = "Tagline 1"
  }
  { c' }
}

\score {
  \header {
tagline = "Tagline 2"
  }
  { d' }
}

\score {
  \header {
tagline = "Tagline 3"
  }
  { e' }
}



A tagline is not specific to a score, it's put on the last page of
an entire bookpart, so the behavior is expected (and logical).



signature.asc
Description: This is a digitally signed message part


Re: tagline = ##f does not work in score header block

2023-09-12 Thread William Rehwinkel via LilyPond user discussion

Dear Knute,

Searching `lilypond "tagline"` on google I found 
https://lilypond.org/doc/v2.23/Documentation/notation/creating-titles-headers-and-footers 
where it is stated "The default LilyPond footer text can be changed by 
adding a tagline in the top-level \header block." (it seems this is 
slightly incorrect because it can be put in some lower-level sections 
like bookpart, maybe that is unintentional).


For the second part, it seems like none of the values that you can 
modify in a header block are in the command index, but 
https://lilypond.org/doc/v2.25/Documentation/notation/default-layout-of-bookpart-and-score-titles 
shows all of them.


This raises the question of how someone who is new to lilypond would 
figure out that it is called "tagline", I suppose either they would find 
it in the list of header values in the documentation, or find it through 
some search on google.


-Will

On 9/12/23 18:38, Knute Snortum wrote:

Hi everyone.

I have a few observations that I'd like to share.  Nothin too urgent.

If you put tagline = ##f in a header block, it will work everywhere 
except in the score block.  Here is a MWE to illustrate this:


\version "2.25.7"

% \header { tagline = ##f } % <-- this works

\book {
   % \header { tagline = ##f } % <-- this works
   \bookpart {
     % \header { tagline = ##f } % <-- this works
     \score {
       \header { tagline = ##f } % <-- this does not work
       \new Staff { c''4 4 4 4  }
     }
   }
}

For me the solution looks like I'm going to put a header block in a 
bookpark block surrounding my score block, and put tagline = ##f there.


Another observation: tagline is not in either the command index or the 
index in the Notation Manual.  The documentation I could find on tagline 
was pretty sparse (unless I missed something).


I could fill out an issue if you think it rises to that.

--
Knute Snortum



--
+ --- +
|   William Rehwinkel - Oberlin College and   |
|  Conservatory '24   |
|will...@williamrehwinkel.net |
| PGP key:|
| https://ftp.williamrehwinkel.net/pubkey.txt |
+ --- +


OpenPGP_signature
Description: OpenPGP digital signature


tagline = ##f does not work in score header block

2023-09-12 Thread Knute Snortum
Hi everyone.

I have a few observations that I'd like to share.  Nothin too urgent.

If you put tagline = ##f in a header block, it will work everywhere except
in the score block.  Here is a MWE to illustrate this:

\version "2.25.7"

% \header { tagline = ##f } % <-- this works

\book {
  % \header { tagline = ##f } % <-- this works
  \bookpart {
% \header { tagline = ##f } % <-- this works
    \score {
  \header { tagline = ##f } % <-- this does not work
  \new Staff { c''4 4 4 4  }
}
  }
}

For me the solution looks like I'm going to put a header block in a
bookpark block surrounding my score block, and put tagline = ##f there.

Another observation: tagline is not in either the command index or the
index in the Notation Manual.  The documentation I could find on tagline
was pretty sparse (unless I missed something).

I could fill out an issue if you think it rises to that.

--
Knute Snortum


Re: Markup block that "interrupts" the header?

2023-08-23 Thread Michael Werner
Hi Joseph,

On Mon, Aug 21, 2023 at 8:08 PM Joseph Srednicki 
wrote:

> Hello:
>
> When coding organ pieces, I want the registration to appear following the
> header.
>
> In the following example, I inserted the registration in a markup block
> before the score block. When Lilypond renders the music, there is a large
> gap between the lines containing the composer's name and the opus number.
> The markup block containing the registration seems to "interrupt" the
> header.
>
> What is the recommended best way to code what I am trying to accomplish so
> that the markup block does not interrupt the header?
>
> I searched for an example but did not find appropriate results. If I
> missed something in the documentation or Lilypond snippets that will
> address this situation, please feel free to send me the link.
>

Short version: check
http://lilypond.org/doc/v2.24/Documentation/notation/custom-titles-headers-and-footers

Longer version:

One option that you might consider would be to define your own custom
header field for the registration. This can then be placed as desired in
the order of the various header fields. The page I linked above gives more
details on how to do that - it can be done at either the book level or for
each individual score. I modified your example to do this at the score
level, as such:

\version "2.24.0"
\language "english"

\paper {
  scoreTitleMarkup = \markup {
\column {
  \if \should-print-all-headers { \bookTitleMarkup \hspace #1 }
  \fill-line {
\fromproperty #'header:piece
\fromproperty #'header:opus
  }
  \fromproperty #'header:myRegistration  % By placing the definition
here it follows along below the Opus entry, so as to not displace it
}
  }
}

\header {
  title = \markup {\fontsize # -3 "Organ Piece"}
  subtitle = \markup {II.}
  composer = \markup {\fontsize # -3 "Composer Name (1685-1759)"}
  opus = \markup {\fontsize # -3 "Opus 3, No. 2"}
  tagline = ##f
  myRegistration = \markup {  % And here we give the info for the new
myRegistration header field, in the same way as any other header
\tiny {
  \left-column {
\line { "Registration:" }
\line { "I-II-III: Fonds 8, 4, Mixtures" }
\line { "Pd.: Fonds 16, 8, I-II-III" }
  } % end left-column
} % end tin
  } % end markup
}

global = {
  \key f \major
  \numericTimeSignature
  \time 4/4
}

tu = \markup {"Tutti"}

rightOne = \relative c'' {
  \global
  \once \override Score.MetronomeMark.Y-offset = #+10
  \tempo \markup {"Allegro"} 4=100
  \partial 8 c8^\markup \raise #2.5 {"Tutti"} | % pickup
}

rightTwo = \relative c' {
  \global
  \partial 8 s8 | % pickup
}

leftOne = \relative c'' {
  \global
  \clef treble
  \partial 8 r8 | % pickup
}

leftTwo = \relative c'' {
  \global
  \partial 8 s8 | % pickup
}

pedal = \relative c {
  \global
  \partial 8 r8 | % pickup
}


\score {
  <<
\new PianoStaff <<
  \new Staff = "right" << \rightOne \\ \rightTwo >>
  \new Staff = "left" { \clef bass << \leftOne \\ \leftTwo >> }
>>
\new Staff = "pedal" { \clef bass \pedal }
  >>
}

The custom headers can also be done at the book level, but all the gory
details can be found in the docs, starting with the page I linked above.
Hope that's enough to at least get you started. There's likely better
and/or more elegant ways to do this - I'm certainly no expert. But this
does at least seem to work, so may at least serve as a starting point.

One other point - if this solution works well enough for you, might
consider splitting the \paper block with the custom headers definitions out
into an include file of some kind. That may help keep things consistent.

-- 
Michael


Re: Markup block that "interrupts" the header?

2023-08-22 Thread Knute Snortum
You could "fake" the opus by putting it in markup instead of the header
(see attached).

--
Knute Snortum



On Mon, Aug 21, 2023 at 5:08 PM Joseph Srednicki 
wrote:

> Hello:
>
> When coding organ pieces, I want the registration to appear following the
> header.
>
> In the following example, I inserted the registration in a markup block
> before the score block. When Lilypond renders the music, there is a large
> gap between the lines containing the composer's name and the opus number.
> The markup block containing the registration seems to "interrupt" the
> header.
>
> What is the recommended best way to code what I am trying to accomplish so
> that the markup block does not interrupt the header?
>
> I searched for an example but did not find appropriate results. If I
> missed something in the documentation or Lilypond snippets that will
> address this situation, please feel free to send me the link.
>
> Thanks to anyone who is willing to provide an answer.
>
>
\version "2.24.0"
\language "english"

\header {
  title = \markup {\fontsize # -3 "Organ Piece"}
  subtitle = \markup {II.}
  composer = \markup {\fontsize # -3 "Composer Name (1685-1759)"}
  opus = ##f % <--- change here
  tagline = ##f
}

global = {
  \key f \major
  \numericTimeSignature
  \time 4/4
}

tu = \markup {"Tutti"}

rightOne = \relative c'' {
  \global
  \once \override Score.MetronomeMark.Y-offset = #+10
  \tempo \markup {"Allegro"} 4=100
  \partial 8 c8^\markup \raise #2.5 {"Tutti"} | % pickup
}

rightTwo = \relative c' {
  \global
  \partial 8 s8 | % pickup
}

leftOne = \relative c'' {
  \global
  \clef treble
  \partial 8 r8 | % pickup
}

leftTwo = \relative c'' {
  \global
  \partial 8 s8 | % pickup
}

pedal = \relative c {
  \global
  \partial 8 r8 | % pickup
}

\markup{
  \tiny{
\left-column {
  \fill-line { "Registration:" \right-align { \fontsize # -1 "Opus 3, No. 2" } } % <-- change here
  \line{"I-II-III: Fonds 8, 4, Mixtures"}
  \line{"Pd.: Fonds 16, 8, I-II-III"}
} % end left-column
  } % end tin
} % end markup

\score {
  <<
\new PianoStaff <<
  \new Staff = "right" << \rightOne \\ \rightTwo >>
  \new Staff = "left" { \clef bass << \leftOne \\ \leftTwo >> }
>>
\new Staff = "pedal" { \clef bass \pedal }
  >>
}

Markup block that "interrupts" the header?

2023-08-21 Thread Joseph Srednicki
Hello:
When coding organ pieces, I want the registration to appear following the 
header. 
In the following example, I inserted the registration in a markup block before 
the score block. When Lilypond renders the music, there is a large gap between 
the lines containing the composer's name and the opus number. The markup block 
containing the registration seems to "interrupt" the header.
What is the recommended best way to code what I am trying to accomplish so that 
the markup block does not interrupt the header?
I searched for an example but did not find appropriate results. If I missed 
something in the documentation or Lilypond snippets that will address this 
situation, please feel free to send me the link.

Thanks to anyone who is willing to provide an answer.
Joe Srednicki
\version "2.24.0"\language "english"
\header {  title = \markup {\fontsize # -3 "Organ Piece"}  subtitle = \markup 
{II.}  composer = \markup {\fontsize # -3 "Composer Name (1685-1759)"}  opus = 
\markup {\fontsize # -3 "Opus 3, No. 2"}  tagline = ##f}
global = {  \key f \major  \numericTimeSignature  \time 4/4}
tu = \markup {"Tutti"}
rightOne = \relative c'' {  \global  \once \override 
Score.MetronomeMark.Y-offset = #+10  \tempo \markup {"Allegro"} 4=100  \partial 
8 c8^\markup \raise #2.5 {"Tutti"} | % pickup}
rightTwo = \relative c' {  \global  \partial 8 s8 | % pickup}
leftOne = \relative c'' {  \global  \clef treble  \partial 8 r8 | % pickup}
leftTwo = \relative c'' {  \global  \partial 8 s8 | % pickup}
pedal = \relative c {  \global  \partial 8 r8 | % pickup}
\markup{  \tiny{    \left-column {      \line{"Registration:"}      
\line{"I-II-III: Fonds 8, 4, Mixtures"}      \line{"Pd.: Fonds 16, 8, 
I-II-III"}    } % end left-column  } % end tin} % end markup
\score {  <<    \new PianoStaff <<      \new Staff = "right" << \rightOne \\ 
\rightTwo >>      \new Staff = "left" { \clef bass << \leftOne \\ \leftTwo >> } 
   >>    \new Staff = "pedal" { \clef bass \pedal }  >>}




Re: Where did the \header number go?

2023-08-20 Thread Rik Kabel


On 8/20/2023 11:35 AM, Jean Abou Samra wrote:

Le dimanche 20 août 2023 à 10:54 -0400, Rik Kabel a écrit :


Hello list,

I have a few pieces that have been engraved for my choir with 2.18.10 
that include catalog numbers entered as




\header {
  ...
  number = \markup { \fontsize #4 \sans \ellipse 11B }
  ...
}

The number variable seems to be gone with current versions, and I can 
find no mention of the change.


Has another feature taken its place?




I could not see any effect of adding number = "foo" to a \header block 
in 2.18.0, and I did not find any trace of this in the source code of 
that version either?


Maybe you redefined a title using one of the xxxTitleMarkup variables, 
and you used \fromproperty #'header:number there?


Or maybe you're just confusing this with the 'opus' variable?


Sorry for the noise.

The number was set in a bookTitleMarkup block in the paper definition.

--
RIk


Re: Where did the \header number go?

2023-08-20 Thread David Kastrup
Jean Abou Samra  writes:

> Le dimanche 20 août 2023 à 10:54 -0400, Rik Kabel a écrit :
>>  
>> Hello list,
>>  
>> I have a few pieces that have been engraved for my choir with 2.18.10 that
>> include catalog numbers entered as
>>  
>> >  
>> > \header {
>> >   ...
>> >   number = \markup { \fontsize #4 \sans \ellipse 11B }
>> >   ...
>> > }
>> >  
>>  
>> The number variable seems to be gone with current versions, and I can find no
>> mention of the change.
>>  
>> Has another feature taken its place?
>>  
>
>
> I could not see any effect of adding number = "foo" to a \header block
> in 2.18.0, and I did not find any trace of this in the source code of
> that version either?

git log -S header:number

turns up empty, and that is the usual way to access such a variable.  So
it is unlikely that this ever had been a part of LilyPond.

> Maybe you redefined a title using one of the xxxTitleMarkup variables, and you
> used \fromproperty #'header:number there?
>
> Or maybe you're just confusing this with the 'opus' variable?

I guess the latter.

-- 
David Kastrup



Re: Where did the \header number go?

2023-08-20 Thread Jean Abou Samra
Le dimanche 20 août 2023 à 10:54 -0400, Rik Kabel a écrit :
>  
> Hello list,
>  
> I have a few pieces that have been engraved for my choir with 2.18.10 that
> include catalog numbers entered as
>  
> >  
> > \header {
> >   ...
> >   number = \markup { \fontsize #4 \sans \ellipse 11B }
> >   ...
> > }
> >  
>  
> The number variable seems to be gone with current versions, and I can find no
> mention of the change.
>  
> Has another feature taken its place?
>  


I could not see any effect of adding number = "foo" to a \header block in
2.18.0, and I did not find any trace of this in the source code of that version
either?

Maybe you redefined a title using one of the xxxTitleMarkup variables, and you
used \fromproperty #'header:number there?

Or maybe you're just confusing this with the 'opus' variable?



signature.asc
Description: This is a digitally signed message part


Where did the \header number go?

2023-08-20 Thread Rik Kabel

Hello list,

I have a few pieces that have been engraved for my choir with 2.18.10 
that include catalog numbers entered as


   \header {
  ...
  number = \markup { \fontsize #4 \sans \ellipse 11B }
  ...
   }

The number variable seems to be gone with current versions, and I can 
find no mention of the change.


Has another feature taken its place?

--
Rik


Re: Lilypond-book-preamble introducing page break after custom header

2023-03-15 Thread Jean Abou Samra
Le mercredi 15 mars 2023 à 22:49 +0100, Jean Abou Samra a écrit :
> - 
> use `-dseparate-page-formats=pdf` if you want to get one output file per page 
> (or per system if also using lilypond-book-preamble.ly),
> 
> 
> - 
> use `-dtall-page-formats=pdf` if you want to get squashed pages.

P.S. Can also be done in the .ly file itself with `#(ly:set-option 
'separate-page-formats 'pdf)` or `#(ly:set-option 'tall-page-formats 'pdf)`.


signature.asc
Description: This is a digitally signed message part


Re: Lilypond-book-preamble introducing page break after custom header

2023-03-15 Thread Jean Abou Samra
Le mercredi 15 mars 2023 à 17:32 -0400, Fr. Samuel Springuel a écrit :
> The attached file compiles differently under 2.22 and 2.24: 2.24 introduces a 
> page break that isn’t present in 2.22.  This is causing some havoc in my 
> lyluatex tool chain.  Any idea what’s causing the problem and how to fix it?

This change was on purpose.

lilypond-book-preamble.ly arranges so that LilyPond's notion of pages is 
changed to make each system or markup a page of its own (except explicit 
`\book`s).

In 2.22, lilypond-book sets the EPS backend to be used, and the EPS backend 
caused two things:

* Separate-page output: one file "document-pagenumber.pdf" per page. Since 
lilypond-book-preamble.ly also turns systems into pages, that effectively means 
one page per system.

* Tall-page output: the main "document.pdf" output file is just all pages 
squashed together.

In 2.24, it doesn't do that anymore. It mostly makes the “system as page” 
setting. Furthermore, the EPS backend has been removed in favor of separate 
options:

- use `-dseparate-page-formats=pdf` if you want to get one output file per page 
(or per system if also using lilypond-book-preamble.ly),

- use `-dtall-page-formats=pdf` if you want to get squashed pages.


signature.asc
Description: This is a digitally signed message part


Lilypond-book-preamble introducing page break after custom header

2023-03-15 Thread Fr. Samuel Springuel
The attached file compiles differently under 2.22 and 2.24: 2.24 introduces a 
page break that isn’t present in 2.22.  This is causing some havoc in my 
lyluatex tool chain.  Any idea what’s causing the problem and how to fix it?

convert-ly doesn’t change anything in the file when upgrading the version.

✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036

PAX ☧ ΧΡΙΣΤΟΣ


Alan-Rees-OSB.ly
Description: Binary data


Re: Changing Header Mid-Score

2022-12-12 Thread Pierre-Luc Gauthier
There is this thread :
https://lists.gnu.org/archive/html/lilypond-user/2019-08/msg00082.html

HTH

Le dim. 11 déc. 2022, à 17 h 35, Jean Abou Samra  a écrit :
>
> Le 11/12/2022 à 18:44, Lukas-Fabian Moser a écrit :
> > Am 11.12.22 um 10:32 schrieb Jacques Menu:
> >> Thumbs up, Jean, this is worth being in the LPNR!
> >
> > If I'm not mistaken, this marvelous code could easily be generalized
> > to provide a command (during music) which sets arbitrary variables
> > that may be retrieved in header/footer definitions, and which could be
> > made part of core LilyPond.
> >
> > My list of "stuff to do for LilyPond over the holidays" is already
> > overlong, and I'm sure I couldn't do it half as well, but I'm putting
> > it on my list anyway - unless Jean himself feels enticed to do it
> > himself?
>
>
> If you are motivated, have at it. I have enough to do for LilyPond as it
> is. Feel free to open an issue to discuss the details.
>
> For what it's worth, if integrating something like this into LilyPond,
> you can modify Page_breaking::draw_page in lily/page-breaking.cc so that
> it passes these "extra" titling variables to make-page from scm/page.scm
> directly. Then the markup can be directly interpreted with the final
> variables from the start, obviating this "gauge" argument to
> \scene-text. *But*, there is another caller of make-page, in
> Page_breaking::page_height. The latter is called from various parts of
> the page breaker while it is figuring out the best page breaking
> configuration. I'm not exactly sure if it's possible and/or desirable
> for the page breaker to pass the systems to Page_breaking::page_height
> and not just the page number + whether it's the last page. However, even
> if the gauge has to be retained for the sake of that, having the right
> stencils already after page breaking instead of using these
> "delay-stencil-evaluation" stencils would already be simpler.
>
> Best,
> Jean
>


-- 
Pierre-Luc Gauthier



Re: Changing Header Mid-Score

2022-12-11 Thread Jean Abou Samra

Le 11/12/2022 à 18:44, Lukas-Fabian Moser a écrit :

Am 11.12.22 um 10:32 schrieb Jacques Menu:

Thumbs up, Jean, this is worth being in the LPNR!


If I'm not mistaken, this marvelous code could easily be generalized 
to provide a command (during music) which sets arbitrary variables 
that may be retrieved in header/footer definitions, and which could be 
made part of core LilyPond.


My list of "stuff to do for LilyPond over the holidays" is already 
overlong, and I'm sure I couldn't do it half as well, but I'm putting 
it on my list anyway - unless Jean himself feels enticed to do it 
himself?



If you are motivated, have at it. I have enough to do for LilyPond as it 
is. Feel free to open an issue to discuss the details.


For what it's worth, if integrating something like this into LilyPond, 
you can modify Page_breaking::draw_page in lily/page-breaking.cc so that 
it passes these "extra" titling variables to make-page from scm/page.scm 
directly. Then the markup can be directly interpreted with the final 
variables from the start, obviating this "gauge" argument to 
\scene-text. *But*, there is another caller of make-page, in 
Page_breaking::page_height. The latter is called from various parts of 
the page breaker while it is figuring out the best page breaking 
configuration. I'm not exactly sure if it's possible and/or desirable 
for the page breaker to pass the systems to Page_breaking::page_height 
and not just the page number + whether it's the last page. However, even 
if the gauge has to be retained for the sake of that, having the right 
stencils already after page breaking instead of using these 
"delay-stencil-evaluation" stencils would already be simpler.


Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: \tocItem within \score block, using header properties

2022-12-11 Thread Joel C. Salomon
On Tue, Dec 6, 2022 at 1:07 PM Jean Abou Samra  wrote:
> > A \tocItem needs a bottom context to be interpreted,
> > like a Voice, Dynamics, TabVoice or such. In this case,
> > you don't want anything to be printed from it, so you
> > can use this lesser known context type Devnull. Some
> > people do it with a Dynamics as well. Devnull works
> > with everything you might want to take out of the
> > individual parts: \time, \tempo, \mark, etc.

Thanks, that works beautifully.

> > For not repeating the title between \header and \tocItem,
> > you could try this approach:

I realized I'm reusing the same text in so many ways, it was cleaner
to just use a string variable.

--Joel

\version "2.23.80"

titleI = "Piece Title"

upperI = \relative c' { c4 d e f }
lowerI = \relative c {\clef bass f e d c }

scoreI = \score {
  \header {
piece = \titleI
  }
  \new PianoStaff <<
\new Devnull { \tocItem \markup \titleI }
\new Staff = "upper" \upperI
\new Staff = "lower" \lowerI
  >>
}

midiI = \score {
  \header {
midititle = \markup{ "Project Name:" \titleI }
  }
  \new PianoStaff <<
\new Staff = "upper" \upperI
\new Staff = "lower" \lowerI
  >>
  \midi {}
}

% Print each score as its own file
\book {
  \bookOutputName #(markup->string #{ \markup {"Proj01" \titleI} #})
  \scoreI
}

% Print all scores together as one
\book {
  \markuplist \table-of-contents

  \scoreI
}



Re: Changing Header Mid-Score

2022-12-11 Thread Lukas-Fabian Moser



Am 11.12.22 um 10:32 schrieb Jacques Menu:

Thumbs up, Jean, this is worth being in the LPNR!


If I'm not mistaken, this marvelous code could easily be generalized to 
provide a command (during music) which sets arbitrary variables that may 
be retrieved in header/footer definitions, and which could be made part 
of core LilyPond.


My list of "stuff to do for LilyPond over the holidays" is already 
overlong, and I'm sure I couldn't do it half as well, but I'm putting it 
on my list anyway - unless Jean himself feels enticed to do it himself?


Lukas




Re: Changing Header Mid-Score

2022-12-11 Thread Jacques Menu
Thumbs up, Jean, this is worth being in the LPNR!

JM

> Le 11 déc. 2022 à 04:05, brin solomon  a écrit :
> 
> 
> 
> On Sat, Dec 10, 2022 at 6:09 AM Jean Abou Samra  <mailto:j...@abou-samra.fr>> wrote:
>> Le 09/12/2022 à 23:04, Kieren MacMillan a écrit :
>> > As far as I know:
>> > 1. a separate bookpart is required to change the properties that the 
>> > titling mechanism can read; and
>> > 2. a bookpart will always force a page break.
>> >
>> > Cue Jean providing code to contradict my claim in 3… 2… 1…  ;)
>> 
>> 
>> [Although 2.23 is the unstable release series, the stable
>> release 2.24 is going to come out of it very soon, so I
>> will stick with it.]
>> 
>> 
>> For a start, you can use \if \on-page #2 to print some
>> text only on page 2, so you could get along manually with
>> 
>>\if \on-page #1 ...
>>\if \on-page #2 ...
>>...
>> 
>> 
>> Doing that automatically is ... not exactly straightforward,
>> but possible too.
>> 
>> 
>> \version "2.23.82"
>> 
>> sceneMark = \tweak details.is-scene-mark ##t \textMark \etc
>> 
>> \layout {
>>\context {
>>  \Score
>>  \consists
>>#(lambda (context)
>>   (let ((scene-text ""))
>> (make-engraver
>>  (acknowledgers
>>   ((text-mark-interface engraver grob source-engraver)
>>(when (assq-ref (ly:grob-property grob 'details)
>>'is-scene-mark)
>>  (set! scene-text (ly:grob-property grob 'text)
>>  ((stop-translation-timestep engraver)
>>   (let ((col (ly:context-property context 
>> 'currentCommandColumn)))
>> (ly:grob-set-nested-property!
>>  col
>>  '(details scene-text)
>>  scene-text))
>>}
>> }
>> 
>> #(define-markup-command (scene-text layout props gauge) (markup?)
>> (let ((page-number (chain-assoc-get 'page:page-number props))
>>   (gauge-stil (interpret-markup layout props gauge)))
>>   (ly:make-stencil
>>`(delay-stencil-evaluation
>>  ,(delay
>>(ly:stencil-expr
>> (interpret-markup
>>  layout
>>  props
>>  (hashv-ref (ly:output-def-lookup layout 
>> 'page-number-scene-text-table)
>> page-number)
>>(ly:stencil-extent gauge-stil X)
>>(ly:stencil-extent gauge-stil Y
>> 
>> \paper {
>>oddHeaderMarkup = \markup
>>\fill-line {
>>  ""
>>  \unless \on-first-page-of-part \fontsize #2 \concat {
>>\fromproperty #'header:title
>>": "
>>%% The argument to \scene-text is used to approximate the dimensions
>>%% of the final text.
>>\scene-text "Act X, Scene X"
>>  }
>>  \if \should-print-page-number \fromproperty #'page:page-number-string
>>}
>>evenHeaderMarkup = \markup
>>\fill-line {
>>  \if \should-print-page-number \fromproperty #'page:page-number-string
>>  \unless \on-first-page-of-part \fontsize #2 \concat {
>>\fromproperty #'header:title
>>": "
>>\scene-text "Act X, Scene X"
>>  }
>>  ""
>>}
>>#(use-modules (srfi srfi-1))
>>page-post-process =
>>  #(lambda (paper pages)
>> (for-each
>>  (lambda (page)
>>(let* ((page-number (ly:prob-property page 'page-number))
>>   (lines (ly:prob-property page 'lines))
>>   (table (or (ly:output-def-lookup paper 
>> 'page-number-scene-text-table #f)
>>  (let ((table (make-hash-table)))
>>(ly:output-def-set-variable! paper 
>> 'page-number-scene-text-table table)
>>table)))
>>   (first-system
>>(any (lambda (line)
>>   (ly:prob-property line 'system-grob #f))
>> lines))
>>   (scene-text
>>(if first-system
>>(let ((first-column (ly:spanner-bound 
>> first-system LEFT)))
>>  (assq-ref (ly:grob-property first-column 'details)
>>'scene-text))
>>"")))
>>  (hashv-set! table page-number scene-text)))
>>  pages))
>> }
>> 
>> 
>> %%% EXAMPLE
>> 
>> \header {
>>title = "Silly Opera"
>> }
>> 
>> {
>>\sceneMark "Act I, Scene i"
>>c'1 1 1
>>\pageBreak
>>c'1 1 1
>>\pageBreak
>>c'1 1 \sceneMark "Act I, Scene ii" 1
>>\pageBreak
>>c'1 1 1
>> }
>> 
>> 
>> 
>> 
>> Cheers,
>> Jean
>> 
> 
> 
> Hi Jean,
> 
> Wow, this is really phenomenal! Thank you so much for this code! This should 
> work perfectly for what I need.
> 
> Many many thanks,
> brin



Re: Changing Header Mid-Score

2022-12-10 Thread brin solomon
On Sat, Dec 10, 2022 at 6:09 AM Jean Abou Samra  wrote:

> Le 09/12/2022 à 23:04, Kieren MacMillan a écrit :
> > As far as I know:
> > 1. a separate bookpart is required to change the properties that the
> titling mechanism can read; and
> > 2. a bookpart will always force a page break.
> >
> > Cue Jean providing code to contradict my claim in 3… 2… 1…  ;)
>
>
> [Although 2.23 is the unstable release series, the stable
> release 2.24 is going to come out of it very soon, so I
> will stick with it.]
>
>
> For a start, you can use \if \on-page #2 to print some
> text only on page 2, so you could get along manually with
>
>\if \on-page #1 ...
>\if \on-page #2 ...
>...
>
>
> Doing that automatically is ... not exactly straightforward,
> but possible too.
>
>
> \version "2.23.82"
>
> sceneMark = \tweak details.is-scene-mark ##t \textMark \etc
>
> \layout {
>\context {
>  \Score
>  \consists
>#(lambda (context)
>   (let ((scene-text ""))
> (make-engraver
>  (acknowledgers
>   ((text-mark-interface engraver grob source-engraver)
>(when (assq-ref (ly:grob-property grob 'details)
>'is-scene-mark)
>  (set! scene-text (ly:grob-property grob 'text)
>  ((stop-translation-timestep engraver)
>   (let ((col (ly:context-property context
> 'currentCommandColumn)))
> (ly:grob-set-nested-property!
>  col
>  '(details scene-text)
>  scene-text))
>}
> }
>
> #(define-markup-command (scene-text layout props gauge) (markup?)
> (let ((page-number (chain-assoc-get 'page:page-number props))
>   (gauge-stil (interpret-markup layout props gauge)))
>   (ly:make-stencil
>`(delay-stencil-evaluation
>  ,(delay
>(ly:stencil-expr
> (interpret-markup
>  layout
>  props
>  (hashv-ref (ly:output-def-lookup layout
> 'page-number-scene-text-table)
> page-number)
>(ly:stencil-extent gauge-stil X)
>(ly:stencil-extent gauge-stil Y
>
> \paper {
>oddHeaderMarkup = \markup
>\fill-line {
>  ""
>  \unless \on-first-page-of-part \fontsize #2 \concat {
>\fromproperty #'header:title
>": "
>%% The argument to \scene-text is used to approximate the dimensions
>%% of the final text.
>\scene-text "Act X, Scene X"
>  }
>  \if \should-print-page-number \fromproperty #'page:page-number-string
>}
>evenHeaderMarkup = \markup
>\fill-line {
>  \if \should-print-page-number \fromproperty #'page:page-number-string
>  \unless \on-first-page-of-part \fontsize #2 \concat {
>\fromproperty #'header:title
>": "
>\scene-text "Act X, Scene X"
>  }
>  ""
>}
>#(use-modules (srfi srfi-1))
>page-post-process =
>  #(lambda (paper pages)
> (for-each
>  (lambda (page)
>(let* ((page-number (ly:prob-property page 'page-number))
>   (lines (ly:prob-property page 'lines))
>   (table (or (ly:output-def-lookup paper
> 'page-number-scene-text-table #f)
>  (let ((table (make-hash-table)))
>(ly:output-def-set-variable! paper
> 'page-number-scene-text-table table)
>table)))
>   (first-system
>(any (lambda (line)
>   (ly:prob-property line 'system-grob #f))
> lines))
>       (scene-text
>(if first-system
>(let ((first-column (ly:spanner-bound
> first-system LEFT)))
>  (assq-ref (ly:grob-property first-column 'details)
>'scene-text))
>"")))
>  (hashv-set! table page-number scene-text)))
>  pages))
> }
>
>
> %%% EXAMPLE
>
> \header {
>title = "Silly Opera"
> }
>
> {
>\sceneMark "Act I, Scene i"
>c'1 1 1
>\pageBreak
>c'1 1 1
>\pageBreak
>c'1 1 \sceneMark "Act I, Scene ii" 1
>\pageBreak
>c'1 1 1
> }
>
>
>
>
> Cheers,
> Jean
>
>
Hi Jean,

Wow, this is really phenomenal! Thank you so much for this code! This
should work perfectly for what I need.

Many many thanks,
brin


Re: Changing Header Mid-Score

2022-12-10 Thread Jean Abou Samra

Le 09/12/2022 à 23:04, Kieren MacMillan a écrit :

As far as I know:
1. a separate bookpart is required to change the properties that the titling 
mechanism can read; and
2. a bookpart will always force a page break.

Cue Jean providing code to contradict my claim in 3… 2… 1…  ;)



[Although 2.23 is the unstable release series, the stable
release 2.24 is going to come out of it very soon, so I
will stick with it.]


For a start, you can use \if \on-page #2 to print some
text only on page 2, so you could get along manually with

  \if \on-page #1 ...
  \if \on-page #2 ...
  ...


Doing that automatically is ... not exactly straightforward,
but possible too.


\version "2.23.82"

sceneMark = \tweak details.is-scene-mark ##t \textMark \etc

\layout {
  \context {
    \Score
    \consists
  #(lambda (context)
 (let ((scene-text ""))
   (make-engraver
    (acknowledgers
 ((text-mark-interface engraver grob source-engraver)
  (when (assq-ref (ly:grob-property grob 'details)
  'is-scene-mark)
    (set! scene-text (ly:grob-property grob 'text)
    ((stop-translation-timestep engraver)
 (let ((col (ly:context-property context 
'currentCommandColumn)))

   (ly:grob-set-nested-property!
    col
    '(details scene-text)
    scene-text))
  }
}

#(define-markup-command (scene-text layout props gauge) (markup?)
   (let ((page-number (chain-assoc-get 'page:page-number props))
 (gauge-stil (interpret-markup layout props gauge)))
 (ly:make-stencil
  `(delay-stencil-evaluation
    ,(delay
  (ly:stencil-expr
   (interpret-markup
    layout
    props
    (hashv-ref (ly:output-def-lookup layout 
'page-number-scene-text-table)

   page-number)
  (ly:stencil-extent gauge-stil X)
  (ly:stencil-extent gauge-stil Y

\paper {
  oddHeaderMarkup = \markup
  \fill-line {
    ""
    \unless \on-first-page-of-part \fontsize #2 \concat {
  \fromproperty #'header:title
  ": "
  %% The argument to \scene-text is used to approximate the dimensions
  %% of the final text.
  \scene-text "Act X, Scene X"
    }
    \if \should-print-page-number \fromproperty #'page:page-number-string
  }
  evenHeaderMarkup = \markup
  \fill-line {
    \if \should-print-page-number \fromproperty #'page:page-number-string
    \unless \on-first-page-of-part \fontsize #2 \concat {
  \fromproperty #'header:title
  ": "
  \scene-text "Act X, Scene X"
    }
    ""
  }
  #(use-modules (srfi srfi-1))
  page-post-process =
    #(lambda (paper pages)
   (for-each
    (lambda (page)
  (let* ((page-number (ly:prob-property page 'page-number))
 (lines (ly:prob-property page 'lines))
 (table (or (ly:output-def-lookup paper 
'page-number-scene-text-table #f)

    (let ((table (make-hash-table)))
  (ly:output-def-set-variable! paper 
'page-number-scene-text-table table)

  table)))
 (first-system
  (any (lambda (line)
 (ly:prob-property line 'system-grob #f))
   lines))
 (scene-text
  (if first-system
  (let ((first-column (ly:spanner-bound 
first-system LEFT)))

    (assq-ref (ly:grob-property first-column 'details)
  'scene-text))
  "")))
    (hashv-set! table page-number scene-text)))
    pages))
}


%%% EXAMPLE

\header {
  title = "Silly Opera"
}

{
  \sceneMark "Act I, Scene i"
  c'1 1 1
  \pageBreak
  c'1 1 1
  \pageBreak
  c'1 1 \sceneMark "Act I, Scene ii" 1
  \pageBreak
  c'1 1 1
}




Cheers,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Re: Changing Header Mid-Score

2022-12-09 Thread Kieren MacMillan
Hi Brin,

> I was hoping to find a way that didn't force a page break (or even 
> necessarily a line break) between scenes. Is that something that's possible, 
> or is the page break required?

As far as I know:
1. a separate bookpart is required to change the properties that the titling 
mechanism can read; and
2. a bookpart will always force a page break.

Cue Jean providing code to contradict my claim in 3… 2… 1…  ;)

Best,
Kieren.


Re: Changing Header Mid-Score

2022-12-09 Thread brin solomon
On Fri, Dec 9, 2022 at 3:40 PM Kieren MacMillan 
wrote:

> Hi Brin,
>
> > It seems I may have been overzealous in paring down my minimal example
>
> That's better than erring on the other side…  ;)
>
> > I actually am breaking the big score file down into scenes/sub-scenes
> that can then be stitched together later in various combinations. But I'm
> missing the step of how to get the header at the top of the page to reflect
> what the current scene is at a given moment, since evenHeaderMarkup and
> oddHeaderMarkup in the paper block don't seem to be able to pull
> title/subtitle information from any except the top-level \header block. So
> now I feel like I'm missing something that's right in front of my face! Can
> you point me to the missing piece?
>
> Put each contiguous chunk of pages in a \bookpart.
> A page break will automagically appear between each \bookpart.
> The header inside the \bookpart will be what the titling blocks use.
> A silly MWE is included below.
>
> Hope that helps!
> Kieren.
>

Hi Kieren,

Thanks for this example! This definitely feels close to what I'm looking
for, but I was hoping to find a way that didn't force a page break (or even
necessarily a line break) between scenes. Is that something that's
possible, or is the page break required?

Many thanks,
brin


Re: Changing Header Mid-Score

2022-12-09 Thread Kieren MacMillan
Hi Brin,

> It seems I may have been overzealous in paring down my minimal example

That's better than erring on the other side…  ;)

> I actually am breaking the big score file down into scenes/sub-scenes that 
> can then be stitched together later in various combinations. But I'm missing 
> the step of how to get the header at the top of the page to reflect what the 
> current scene is at a given moment, since evenHeaderMarkup and 
> oddHeaderMarkup in the paper block don't seem to be able to pull 
> title/subtitle information from any except the top-level \header block. So 
> now I feel like I'm missing something that's right in front of my face! Can 
> you point me to the missing piece?

Put each contiguous chunk of pages in a \bookpart.
A page break will automagically appear between each \bookpart.
The header inside the \bookpart will be what the titling blocks use.
A silly MWE is included below.

Hope that helps!
Kieren.

%  SNIPPET BEGINS
\version "2.22.2"

\header {
  dedication = \markup { \smallCaps "Title of Opera" }
}

"Act 1, Scene 1" = {
  \repeat unfold 50 { c''1 } 
}

"Act 1, Scene 2" = {
  \repeat unfold 50 { d''1 } 
}

\bookpart {
  \header {
title = "Act 1, Scene 1"
  }
  \score {
\new Staff \"Act 1, Scene 1"
  }
}
 
\bookpart {
  \header {
title = "Act 1, Scene 2"
  }
  \score {
\new Staff \"Act 1, Scene 2"
  }
}
%  SNIPPET ENDS



Re: Changing Header Mid-Score

2022-12-09 Thread brin solomon
On Fri, Dec 9, 2022 at 2:56 PM Kieren MacMillan 
wrote:

> Hi Brin,
>
> > I am working on an opera and would like to use text in the header to
> help the performers keep track of where they are in the score. So ideally,
> the header on each page should say something like "Title of Opera: Act I,
> scene ii", with the scene reflecting whatever the current scene is. Since
> there aren't musical stops between the scenes, I would like the scenes to
> flow into one another in the same \score block (so that a scene might start
> in the middle of a line of music, say), which is pretty standard from the
> opera scores and parts I'm used to.
>
> Having engraved many of my own musicals, operas, and the like, I can say
> that breaking things into scenes — or even smaller chunks — is really
> useful, and gives you ultimate flexibility: you can break the scene
> wherever you want (e.g., the middle of a line of music), keeping each
> “building block” separate, and then “stitch them together” in any number of
> score formats/outputs.
>
> At that point, having the header reflect the exact “building block” in
> question is really simple.
>
> Just my 2¢ (from twenty years of Lilypond-ing my music dramas) — hope it’s
> helpful!
> Kieren.


Hi Kieren,

This is helpful, thanks! It seems I may have been overzealous in paring
down my minimal example: I actually am breaking the big score file down
into scenes/sub-scenes that can then be stitched together later in various
combinations. But I'm missing the step of how to get the header at the top
of the page to reflect what the current scene is at a given moment, since
evenHeaderMarkup and oddHeaderMarkup in the paper block don't seem to be
able to pull title/subtitle information from any except the top-level
\header block. So now I feel like I'm missing something that's right in
front of my face! Can you point me to the missing piece?

Many thanks,
brin


Re: Changing Header Mid-Score

2022-12-09 Thread Kieren MacMillan
Hi Brin,

> I am working on an opera and would like to use text in the header to help the 
> performers keep track of where they are in the score. So ideally, the header 
> on each page should say something like "Title of Opera: Act I, scene ii", 
> with the scene reflecting whatever the current scene is. Since there aren't 
> musical stops between the scenes, I would like the scenes to flow into one 
> another in the same \score block (so that a scene might start in the middle 
> of a line of music, say), which is pretty standard from the opera scores and 
> parts I'm used to.

Having engraved many of my own musicals, operas, and the like, I can say that 
breaking things into scenes — or even smaller chunks — is really useful, and 
gives you ultimate flexibility: you can break the scene wherever you want 
(e.g., the middle of a line of music), keeping each “building block” separate, 
and then “stitch them together” in any number of score formats/outputs.

At that point, having the header reflect the exact “building block” in question 
is really simple.

Just my 2¢ (from twenty years of Lilypond-ing my music dramas) — hope it’s 
helpful!
Kieren.


Changing Header Mid-Score

2022-12-09 Thread brin solomon
Hello!

I am working on an opera and would like to use text in the header to help
the performers keep track of where they are in the score. So ideally, the
header on each page should say something like "Title of Opera: Act I, scene
ii", with the scene reflecting whatever the current scene is. Since there
aren't musical stops between the scenes, I would like the scenes to flow
into one another in the same \score block (so that a scene might start in
the middle of a line of music, say), which is pretty standard from the
opera scores and parts I'm used to.

Looking at the "Custom titles headers and footers" section of the 2.22.2
user manual, I can see how to create a custom header for the whole
document, but I can't figure out a way to pull information for the header
from specific moments in a \score block, or even how to pull information
for the header from a \score block when there are multiple \scores in a
given \book. Does anyone have any ideas on how to make this happen? I've
attached a minimal file that indicates the kind of headers I want over the
course of a few dummy pages. Any help would be greatly appreciated!

Thanks in advance,
brin
\version "2.22.2"

\header {
  dedication = \markup { \smallCaps "Title of Opera" }
}

\score {
  \new Staff {
c1^"Act I, scene i starts here" |
\repeat unfold 50 { c1 } | \pageBreak
c1^"Header on this page should read “Title of Opera: Act I, scene i”" |
\repeat unfold 50 { c } | \pageBreak
c \bar "||"
c^"Act I, scene ii starts here, header on this page should read “Title of Opera: Act I, scene ii”" |
\repeat unfold 50 { c } |
  }
}

title-test.pdf
Description: Adobe PDF document


Re: \tocItem within \score block, using header properties

2022-12-06 Thread Jean Abou Samra



Le 06/12/2022 à 19:05, Jean Abou Samra a écrit :

Le 06/12/2022 à 18:10, Joel C. Salomon a écrit :

The requirement that `\tocItem` is either outside the `\score` block
or within a music variable is making it awkward for me to keep it near
where the score `\header` block defines the piece title.  And I have
entirely failed to figure out a way to re-use the piece title.

Minimal example below, showing different ways I've tried.

Is there a cleaner way to accomplish this?





Try

\version "2.23.82"

upperI = \relative c' {
  c4 d e f
}
lowerI = \relative c {\clef bass f e d c }

scoreI =
\score {
  \header {
    piece = "Piece Title"
  }
  <<
    \new Devnull { \tocItem \markup "Piece Title" }
    \new PianoStaff <<
  \new Staff = "upper" \upperI
  \new Staff = "lower" \lowerI
    >>
  >>
}

\book {
  \markuplist \table-of-contents
  \scoreI
}



A \tocItem needs a bottom context to be interpreted,
like a Voice, Dynamics, TabVoice or such. In this case,
you don't want anything to be printed from it, so you
can use this lesser known context type Devnull. Some
people do it with a Dynamics as well. Devnull works
with everything you might want to take out of the
individual parts: \time, \tempo, \mark, etc.

For not repeating the title between \header and \tocItem,
you could try this approach:


\version "2.23.82"

withPiece =
#(define-scheme-function (mkup score) (markup? ly:score?)
   (let* ((music (ly:score-music score))
  (n (display-scheme-music music))



Sorry, the line above was for debugging, you can remove it.



(new-music #{ { \new Devnull \tocItem #mkup #music } #})
      (new-score (ly:make-score new-music))
  (header (let ((h (ly:score-header score)))
    (if (null? h)
    (make-module)
    h
 (for-each (lambda (odef)
 (ly:score-add-output-def! new-score odef))
   (ly:score-output-defs score))
 (module-define! header 'piece mkup)
 (ly:score-set-header! new-score header)
 new-score))

upperI = \relative c' {
  c4 d e f
}
lowerI = \relative c {\clef bass f e d c }

scoreI =
\withPiece \markup "Piece Title" \score {
  \new PianoStaff <<
    \new Staff = "upper" \upperI
    \new Staff = "lower" \lowerI
  >>
}

\book {
  \markuplist \table-of-contents
  \scoreI
}


Best,
Jean






OpenPGP_signature
Description: OpenPGP digital signature


Re: \tocItem within \score block, using header properties

2022-12-06 Thread Jean Abou Samra

Le 06/12/2022 à 18:10, Joel C. Salomon a écrit :

The requirement that `\tocItem` is either outside the `\score` block
or within a music variable is making it awkward for me to keep it near
where the score `\header` block defines the piece title.  And I have
entirely failed to figure out a way to re-use the piece title.

Minimal example below, showing different ways I've tried.

Is there a cleaner way to accomplish this?





Try

\version "2.23.82"

upperI = \relative c' {
  c4 d e f
}
lowerI = \relative c {\clef bass f e d c }

scoreI =
\score {
  \header {
    piece = "Piece Title"
  }
  <<
    \new Devnull { \tocItem \markup "Piece Title" }
    \new PianoStaff <<
  \new Staff = "upper" \upperI
  \new Staff = "lower" \lowerI
    >>
  >>
}

\book {
  \markuplist \table-of-contents
  \scoreI
}



A \tocItem needs a bottom context to be interpreted,
like a Voice, Dynamics, TabVoice or such. In this case,
you don't want anything to be printed from it, so you
can use this lesser known context type Devnull. Some
people do it with a Dynamics as well. Devnull works
with everything you might want to take out of the
individual parts: \time, \tempo, \mark, etc.

For not repeating the title between \header and \tocItem,
you could try this approach:


\version "2.23.82"

withPiece =
#(define-scheme-function (mkup score) (markup? ly:score?)
   (let* ((music (ly:score-music score))
  (n (display-scheme-music music))
  (new-music #{ { \new Devnull \tocItem #mkup #music } #})
      (new-score (ly:make-score new-music))
  (header (let ((h (ly:score-header score)))
    (if (null? h)
    (make-module)
    h
 (for-each (lambda (odef)
 (ly:score-add-output-def! new-score odef))
   (ly:score-output-defs score))
 (module-define! header 'piece mkup)
 (ly:score-set-header! new-score header)
 new-score))

upperI = \relative c' {
  c4 d e f
}
lowerI = \relative c {\clef bass f e d c }

scoreI =
\withPiece \markup "Piece Title" \score {
  \new PianoStaff <<
    \new Staff = "upper" \upperI
    \new Staff = "lower" \lowerI
  >>
}

\book {
  \markuplist \table-of-contents
  \scoreI
}


Best,
Jean




OpenPGP_signature
Description: OpenPGP digital signature


\tocItem within \score block, using header properties

2022-12-06 Thread Joel C. Salomon
The requirement that `\tocItem` is either outside the `\score` block
or within a music variable is making it awkward for me to keep it near
where the score `\header` block defines the piece title.  And I have
entirely failed to figure out a way to re-use the piece title.

Minimal example below, showing different ways I've tried.

Is there a cleaner way to accomplish this?

—Joel

\version "2.23.80"

upperI = \relative c' {
  \tocItem \markup "Piece Title" % works, but is an awkward place
  c4 d e f }
lowerI = \relative c {\clef bass f e d c }

scoreI = \score {
  \header {
piece = "Piece Title"
  }
  \new PianoStaff <<
  %  \tocItem \markup \fromproperty #'header:piece % doesn't work
  %  \tocItem \markup "Piece Title" % works, but creates extra staff
\new Staff = "upper" \upperI
\new Staff = "lower" \lowerI
  >>
}

\book {
  \markuplist \table-of-contents
  %  \tocItem \markup "Piece Title" % breaks locality
  \scoreI
}



Re: Access header-modules from inside markup-command

2022-06-28 Thread Colin Campbell



On 2022-06-27 17:27, Thomas Morley wrote:


I try to code sort of a tablature for Akkordzither.

Instead of longish descriptions best look at the image at the bottom of
https://gitlab.com/Thomas_Morley/zither-ly/-/tree/development



This looks very much like klavarskribo. I wonder if Wilbert Berendsen 
has tried anything like it?



Cheers,

Colin




Re: Access header-modules from inside markup-command

2022-06-28 Thread Jean Abou Samra

Le 28/06/2022 à 01:27, Thomas Morley a écrit :

I try to code sort of a tablature for Akkordzither.

Instead of longish descriptions best look at the image at the bottom of
https://gitlab.com/Thomas_Morley/zither-ly/-/tree/development



Wow, that's quite challenging!



Obviously I need sort of a TabStaff running top to bottom as opposed
to the usual left to right.

If I use a portrait-paper-size, I can use the default header and need
to rotate the TabStaff. Not knowing how to do it different, I did so
putting the TabStaff into \markup.
This is the master-branch of above linked repo.
Alas, I can't ensure consistent line-width of the TabStaff, because
LilyPond does not accepts settings for line-width exceeding
paper-dimensions. Furthermore, LilyPond not only warns, but rejects my
attempts to set such a line-width.
LilyPond accepts the max width of the page, though because of said
rotation I need up to page-height. This is a show-stopper!



This doesn't work:

\version "2.23.11"

\paper {
  line-width = 29\cm
}

\markup \rotate #90 \score {
  \layout {
    ragged-right = ##f
  }
  { c'1 }
}


This does:

\version "2.23.11"

\markup \rotate #90 \score {
  \layout {
    line-width = 29\cm
    ragged-right = ##f
  }
  { c'1 }
}

This also does:

\version "2.23.11"

\paper {
  line-width = 29\cm
  check-consistency = ##f
}

\markup \rotate #90 \score {
  \layout {
    ragged-right = ##f
  }
  { c'1 }
}

Hope that helps,
Jean




Re: Access header-modules from inside markup-command

2022-06-27 Thread Thomas Morley
Am Mo., 27. Juni 2022 um 13:23 Uhr schrieb Jean Abou Samra :
>
>
>
> Le 27/06/2022 à 12:12, Thomas Morley a écrit :
> > Hi,
> >
> > https://lsr.di.unimi.it/LSR/Item?id=467 provides a markup-command to
> > access header-entries for use in arbitrary markup.
> > Alas it's limited to $defaultheader.
> > Although there is a comment to add/access other headers like from
> > \score, \bookpar explicit \book, I found no way to do so.
> > I tried to look up '$current-book/'$current-bookpart in parser (and
> > apply ly:book-header on the result), but to no avail, the  book(part)
> > is not found.
> >
> > How to do so?
> >
> > Below some code to play with (I reformated, renamed the original
> > snippet, adding some condition etc):
> >
> > \version "2.22.1"
> >
> > %% LSR 467
> > #(define-markup-command (with-header layout props markup) (markup?)
> >"Interpret the given markup with the header fields added to the props.
> > This way, one can re-use the same functions (using fromproperty
> > #'header:field) in the header block and as top-level markup."
> > ;; TODO: If we are inside a score, add the score's local header block, too!
> > ;; Currently, I only use the global header block, stored in $defaultheader
> >(let ((scopes (list $defaultheader)))
> >
> > (pretty-print
> >(list
> >  (cons '$current-bookpart (ly:parser-lookup '$current-bookpart))
> >  (cons '$current-book (ly:parser-lookup '$current-book))
> >)
> > )
> >  (if (every module? scopes)
> >  (let* ((alists (map ly:module->alist scopes))
> >     (prefixed-alist
> >  (map
> >(lambda (alist)
> >   (map
> > (lambda (entry)
> >   (cons
> > (symbol-append 'header: (car entry))
> > (cdr entry)))
> > alist))
> >alists))
> > (props
> >   (append
> >     prefixed-alist
> > props
> > (layout-extract-page-properties layout
> >(interpret-markup layout props markup))
> >  (begin
> >(ly:warning "No header-module found, returning point-stencil")
> >point-stencil
> >
> > %{
> > %% (1) \header and \markup at toplevel
> > %% works
> > \header { my-entry = "Whatever" }
> > \markup \with-header \with-color #red \fromproperty #'header:my-entry
> > %}
> >
> > %{
> > %% (2) \header and \markup in explizit book
> > %% How to make it work?
> > \book {
> >\header { my-entry = "Whatever" }
> >\markup \with-header \with-color #red \fromproperty #'header:my-entry
> > }
> > %}
> >
> > % {
> > %% (3) \header and \markup in \bookpart
> > %% %% How to make it work?
> > \bookpart {
> >\header { my-entry = "Whatever" }
> >\markup \with-header \with-color #red \fromproperty #'header:my-entry
> > }
> > %}
> >
> > %{
> > %% (4) \header and \markup in toplevel \score
> > %% %% How to make it work?
> > \score {
> >{ b1-\markup \with-header \with-color #red \fromproperty 
> > #'header:my-entry }
> >\header { my-entry = "Whatever" }
> > }
> > %}
>
>
> I don't have the time to investigate much right now, but I
> think it would be possible by changing the toplevel-score-handler
> and such to set a property in the \layout to the \header, and later
> use that property from the layout argument of the markup command.
>
> This is likely to be a bit fragile, though.

I'll probably try tomorrow...

> What is the use case?
> There may be better ways to achieve what is wanted.

I try to code sort of a tablature for Akkordzither.

Instead of longish descriptions best look at the image at the bottom of
https://gitlab.com/Thomas_Morley/zither-ly/-/tree/development

Obviously I need sort of a TabStaff running top to bottom as opposed
to the usual left to right.

If I use a portrait-paper-size, I can use the default header and need
to rotate the TabStaff. Not knowing how to do it different, I did so
putting the TabStaff into \markup.
This is the master-branch of above linked repo.
Alas, I can't ensure consistent line-width of the TabStaff, because
LilyPond does not accepts settings for line-width exceeding
paper-dimensions. Furthermore, LilyPond not only warns, bu

Re: Access header-modules from inside markup-command

2022-06-27 Thread Jean Abou Samra




Le 27/06/2022 à 12:12, Thomas Morley a écrit :

Hi,

https://lsr.di.unimi.it/LSR/Item?id=467 provides a markup-command to
access header-entries for use in arbitrary markup.
Alas it's limited to $defaultheader.
Although there is a comment to add/access other headers like from
\score, \bookpar explicit \book, I found no way to do so.
I tried to look up '$current-book/'$current-bookpart in parser (and
apply ly:book-header on the result), but to no avail, the  book(part)
is not found.

How to do so?

Below some code to play with (I reformated, renamed the original
snippet, adding some condition etc):

\version "2.22.1"

%% LSR 467
#(define-markup-command (with-header layout props markup) (markup?)
   "Interpret the given markup with the header fields added to the props.
This way, one can re-use the same functions (using fromproperty
#'header:field) in the header block and as top-level markup."
;; TODO: If we are inside a score, add the score's local header block, too!
;; Currently, I only use the global header block, stored in $defaultheader
   (let ((scopes (list $defaultheader)))

(pretty-print
   (list
 (cons '$current-bookpart (ly:parser-lookup '$current-bookpart))
 (cons '$current-book (ly:parser-lookup '$current-book))
   )
)
 (if (every module? scopes)
 (let* ((alists (map ly:module->alist scopes))
(prefixed-alist
 (map
   (lambda (alist)
  (map
(lambda (entry)
  (cons
    (symbol-append 'header: (car entry))
(cdr entry)))
alist))
   alists))
(props
  (append
prefixed-alist
props
(layout-extract-page-properties layout
   (interpret-markup layout props markup))
 (begin
   (ly:warning "No header-module found, returning point-stencil")
   point-stencil

%{
%% (1) \header and \markup at toplevel
%% works
\header { my-entry = "Whatever" }
\markup \with-header \with-color #red \fromproperty #'header:my-entry
%}

%{
%% (2) \header and \markup in explizit book
%% How to make it work?
\book {
   \header { my-entry = "Whatever" }
   \markup \with-header \with-color #red \fromproperty #'header:my-entry
}
%}

% {
%% (3) \header and \markup in \bookpart
%% %% How to make it work?
\bookpart {
   \header { my-entry = "Whatever" }
   \markup \with-header \with-color #red \fromproperty #'header:my-entry
}
%}

%{
%% (4) \header and \markup in toplevel \score
%% %% How to make it work?
\score {
   { b1-\markup \with-header \with-color #red \fromproperty #'header:my-entry }
   \header { my-entry = "Whatever" }
}
%}



I don't have the time to investigate much right now, but I
think it would be possible by changing the toplevel-score-handler
and such to set a property in the \layout to the \header, and later
use that property from the layout argument of the markup command.

This is likely to be a bit fragile, though. What is the use case?
There may be better ways to achieve what is wanted.

Jean



Access header-modules from inside markup-command

2022-06-27 Thread Thomas Morley
Hi,

https://lsr.di.unimi.it/LSR/Item?id=467 provides a markup-command to
access header-entries for use in arbitrary markup.
Alas it's limited to $defaultheader.
Although there is a comment to add/access other headers like from
\score, \bookpar explicit \book, I found no way to do so.
I tried to look up '$current-book/'$current-bookpart in parser (and
apply ly:book-header on the result), but to no avail, the  book(part)
is not found.

How to do so?

Below some code to play with (I reformated, renamed the original
snippet, adding some condition etc):

\version "2.22.1"

%% LSR 467
#(define-markup-command (with-header layout props markup) (markup?)
  "Interpret the given markup with the header fields added to the props.
This way, one can re-use the same functions (using fromproperty
#'header:field) in the header block and as top-level markup."
;; TODO: If we are inside a score, add the score's local header block, too!
;; Currently, I only use the global header block, stored in $defaultheader
  (let ((scopes (list $defaultheader)))

(pretty-print
  (list
(cons '$current-bookpart (ly:parser-lookup '$current-bookpart))
(cons '$current-book (ly:parser-lookup '$current-book))
  )
)
(if (every module? scopes)
(let* ((alists (map ly:module->alist scopes))
   (prefixed-alist
(map
  (lambda (alist)
 (map
   (lambda (entry)
 (cons
   (symbol-append 'header: (car entry))
   (cdr entry)))
   alist))
  alists))
   (props
 (append
   prefixed-alist
   props
   (layout-extract-page-properties layout
  (interpret-markup layout props markup))
(begin
      (ly:warning "No header-module found, returning point-stencil")
      point-stencil

%{
%% (1) \header and \markup at toplevel
%% works
\header { my-entry = "Whatever" }
\markup \with-header \with-color #red \fromproperty #'header:my-entry
%}

%{
%% (2) \header and \markup in explizit book
%% How to make it work?
\book {
  \header { my-entry = "Whatever" }
  \markup \with-header \with-color #red \fromproperty #'header:my-entry
}
%}

% {
%% (3) \header and \markup in \bookpart
%% %% How to make it work?
\bookpart {
  \header { my-entry = "Whatever" }
  \markup \with-header \with-color #red \fromproperty #'header:my-entry
}
%}

%{
%% (4) \header and \markup in toplevel \score
%% %% How to make it work?
\score {
  { b1-\markup \with-header \with-color #red \fromproperty #'header:my-entry }
  \header { my-entry = "Whatever" }
}
%}


Thanks,
  Harm



Re: Score header and top-level markup

2022-06-06 Thread Simon Albrecht

Hi Jean,

thanks once more for the speedy and helpful reply!

On 06/06/2022 14:43, Jean Abou Samra wrote:

How can I change that?


That sounds like an XY question.


Sorry about that. I meant to imply: How do I swap the placement of the 
headers?




What is the use case?
Having a large, left-aligned header for an entire sonata, which is 
easiest achieved using toplevel markup, and then using the header 
mechanism for the movement headers (which I intended to include a common 
composer field, but I’m reconsidering that).


There are lots of ways. You could integrate the specific
title into the general title. You could integrate the general
title into the specific title. You could also put the specific
title in \score-level \header fields. 



I got confused about scores generating their own headers because I had 
forgotten


\paper { print-all-headers = ##t }

when trying score-level headers. I now got it to work properly.

Best, Simon




Re: Score header and top-level markup

2022-06-06 Thread Jean Abou Samra




Le 06/06/2022 à 14:32, Simon Albrecht a écrit :

Hi everyone,

%%%
\version "2.23.9"

\bookpart {
  \markup \fontsize #10 "general title"
  \header {
    title = "specific title"
  }
  \score {
    { 1 }
  }
}


why does "general title" appear below "specific title" and not above?



The placement of the \header block does not matter. It
can be after all scores, or before, or in the middle.
It just applies to the bookpart. You've given the bookpart
a title, so LilyPond prints it in front of all the rest.
This is similar to

\score {
  \header {
    piece = piece
  }
  { c' }
}

giving the same output as

\score {
  { c' }
  \header {
    piece = piece
  }
}




How can I change that?


That sounds like an XY question. What is the use case?

There are lots of ways. You could integrate the specific
title into the general title. You could integrate the general
title into the specific title. You could also put the specific
title in \score-level \header fields.

Best,
Jean





Score header and top-level markup

2022-06-06 Thread Simon Albrecht

Hi everyone,

%%%
\version "2.23.9"

\bookpart {
  \markup \fontsize #10 "general title"
  \header {
    title = "specific title"
  }
  \score {
    { 1 }
  }
}


why does "general title" appear below "specific title" and not above? 
How can I change that?


Best, Simon




Re: Adding to header using module-define! and alist with markups

2021-12-03 Thread Nate Whetsell
臘‍♂️

That did it, thank you!

> On Dec 3, 2021, at 12:07 PM, Jean Abou Samra  wrote:
> 
> Le 03/12/2021 à 18:04, Nate Whetsell a écrit :
>> Thanks for your help!
>> 
>> Using \justify as
>> 
>> ```
>> \paper {
>>  scoreTitleMarkup = \markup {
>>\column {
>>  \fromproperty #'header:piece
>>  \justify { #'header:instruction }
>>}
>>  }
>> }
>> ```
>> 
>> may be on the right track, but this results in (for all cases):
>> 
>> ```
>> test.ly :7:17: error: not a markup
>>  \justify {
>> #'header:instruction }
>> ```
>> 
>> Hopefully I’m missing something simple.
> 
> \justify { \fromproperty #'header:instruction } ?
> 
> Best,
> Jean
> 




Re: Adding to header using module-define! and alist with markups

2021-12-03 Thread Jean Abou Samra

Le 03/12/2021 à 18:04, Nate Whetsell a écrit :

Thanks for your help!

Using \justify as

```
\paper {
 scoreTitleMarkup = \markup {
   \column {
     \fromproperty #'header:piece
     \justify { #'header:instruction }
   }
 }
}
```

may be on the right track, but this results in (for all cases):

```
test.ly :7:17: error: not a markup
     \justify {
                #'header:instruction }
```

Hopefully I’m missing something simple.


\justify { \fromproperty #'header:instruction } ?

Best,
Jean




Re: Adding to header using module-define! and alist with markups

2021-12-03 Thread Nate Whetsell
Thanks for your help!

Using \justify as

```
\paper {
 scoreTitleMarkup = \markup {
   \column {
 \fromproperty #'header:piece
 \justify { #'header:instruction }
   }
 }
}
```

may be on the right track, but this results in (for all cases):

```
test.ly:7:17: error: not a markup
 \justify { 
#'header:instruction }
```

Hopefully I’m missing something simple.

> On Dec 2, 2021, at 11:35 AM, David Kastrup  wrote:
> 
> Nate Whetsell mailto:nathan.whets...@gmail.com>> 
> writes:
> 
>> Thanks, but unfortunately using a backtick and commas seems to produce the 
>> same output. If it’s helpful, here’s the same example with a backtick and 
>> commas:
>> 
>> ```
>> \version "2.22.0"
>> 
>> \paper {
>> scoreTitleMarkup = \markup {
>>   \column {
>> \fromproperty #'header:piece
>> \justify-field #'header:instruction
>>   }
>> }
>> }
> 
> Well, \justify-field just takes a string, like \justify-string does.
> Maybe it should check for markup lists and pass them through \justify .
> 
> -- 
> David Kastrup



Re: Adding to header using module-define! and alist with markups

2021-12-02 Thread David Kastrup
Nate Whetsell  writes:

> Thanks, but unfortunately using a backtick and commas seems to produce the 
> same output. If it’s helpful, here’s the same example with a backtick and 
> commas:
>
> ```
> \version "2.22.0"
>
> \paper {
>  scoreTitleMarkup = \markup {
>\column {
>  \fromproperty #'header:piece
>  \justify-field #'header:instruction
>}
>  }
> }

Well, \justify-field just takes a string, like \justify-string does.
Maybe it should check for markup lists and pass them through \justify .

-- 
David Kastrup



Re: Adding to header using module-define! and alist with markups

2021-12-02 Thread Nate Whetsell
Thanks, but unfortunately using a backtick and commas seems to produce the same 
output. If it’s helpful, here’s the same example with a backtick and commas:

```
\version "2.22.0"

\paper {
 scoreTitleMarkup = \markup {
   \column {
 \fromproperty #'header:piece
 \justify-field #'header:instruction
   }
 }
}

#(define instructions `(
 ; Using a LilyPond code block does not work.
 (1 . ,#{
   \markup {
 "Does not work"
 \score {
   \new Staff { c'1 }
   \layout { ragged-right = ##t indent = 0 }
 }
   }
 #})
 ; Using the Scheme form of a markup expression does not work.
 (2 . ,(markup #:line (#:simple "Does not work")))
 ; Using a string works.
 (3 . "Works")))

\book {
 #(do ((study-number 1 (1+ study-number)))
     ((> study-number 3))
   (let ((header (make-module)))
 (module-define! header 'piece (number->string study-number))
 (let* (
 (instruction (assoc study-number instructions))
 (score (scorify-music #{ { c'1 } #})))
   (begin
 (if instruction (module-define! header 'instruction (cdr instruction)))
 (ly:score-set-header! score header)
 (add-score score)
}
```

> On Dec 2, 2021, at 11:02 AM, David Kastrup  wrote:
> 
> Nate Whetsell mailto:nathan.whets...@gmail.com>> 
> writes:
> 
>> I’m trying to programmatically add items to score headers from an alist. 
>> This works when an item consists of just a string. I can’t seem to get this 
>> to work when an item is a markup, no matter how the markup is entered. Is 
>> there some way to store markups in an alist, and then use those markups in a 
>> header?
>> 
>> Below is an example illustrating the issue I’m having. Any help would be 
>> greatly appreciated!
>> 
>> Thanks,
>> Nate
>> 
>> ```
>> \version "2.22.0"
>> 
>> \paper {
>>  scoreTitleMarkup = \markup {
>>\column {
>>  \fromproperty #'header:piece
>>  \justify-field #'header:instruction
>>}
>>  }
>> }
>> 
>> #(define instructions '(
>>  ; Using a LilyPond code block does not work.
>>  (1 . #{
>>\markup {
>>  "Does not work"
> 
> ' introduces a non-evaluated constant expression but you need to
> evaluate #{ ... #} to get a markup.  So try
> 
> #(define instructions `( ;; note backtick instead of forward tick
>  (1 . ,#{   ;; note comma to evaluate one part of the
> ;; quasi-quoted list
> 
> -- 
> David Kastrup



Re: Adding to header using module-define! and alist with markups

2021-12-02 Thread David Kastrup
Nate Whetsell  writes:

> I’m trying to programmatically add items to score headers from an alist. This 
> works when an item consists of just a string. I can’t seem to get this to 
> work when an item is a markup, no matter how the markup is entered. Is there 
> some way to store markups in an alist, and then use those markups in a header?
>
> Below is an example illustrating the issue I’m having. Any help would be 
> greatly appreciated!
>
> Thanks,
> Nate
>
> ```
> \version "2.22.0"
>
> \paper {
>   scoreTitleMarkup = \markup {
> \column {
>   \fromproperty #'header:piece
>   \justify-field #'header:instruction
> }
>   }
> }
>
> #(define instructions '(
>   ; Using a LilyPond code block does not work.
>   (1 . #{
> \markup {
>   "Does not work"

' introduces a non-evaluated constant expression but you need to
evaluate #{ ... #} to get a markup.  So try

#(define instructions `( ;; note backtick instead of forward tick
  (1 . ,#{   ;; note comma to evaluate one part of the
 ;; quasi-quoted list

-- 
David Kastrup



Adding to header using module-define! and alist with markups

2021-12-02 Thread Nate Whetsell
I’m trying to programmatically add items to score headers from an alist. This 
works when an item consists of just a string. I can’t seem to get this to work 
when an item is a markup, no matter how the markup is entered. Is there some 
way to store markups in an alist, and then use those markups in a header?

Below is an example illustrating the issue I’m having. Any help would be 
greatly appreciated!

Thanks,
Nate

```
\version "2.22.0"

\paper {
  scoreTitleMarkup = \markup {
\column {
  \fromproperty #'header:piece
  \justify-field #'header:instruction
}
  }
}

#(define instructions '(
  ; Using a LilyPond code block does not work.
  (1 . #{
\markup {
  "Does not work"
  \score {
\new Staff { c'1 }
\layout { ragged-right = ##t indent = 0 }
  }
}
  #})
  ; Using the Scheme form of a markup expression does not work.
  (2 . (markup #:line (#:simple "Does not work")))
  ; Using a string works.
  (3 . "Works")))

\book {
  #(do ((study-number 1 (1+ study-number)))
  ((> study-number 3))
(let ((header (make-module)))
  (module-define! header 'piece (number->string study-number))
  (let* (
  (instruction (assoc study-number instructions))
  (score (scorify-music #{ { c'1 } #})))
(begin
  (if instruction (module-define! header 'instruction (cdr 
instruction)))
  (ly:score-set-header! score header)
  (add-score score)
}
```





Re: Header inside the score context

2021-11-29 Thread Paolo Prete
On Mon, Nov 29, 2021 at 5:59 AM David Wright 
wrote:

> On Wed 24 Nov 2021 at 19:44:59 (+0100), Paolo Prete wrote:
>
>
>
> If you do this regularly, I would suggest that that's just
> what you do, copy your source through a simple filter to a
> temporary file and compile that.
>
> [cut]


Hello David,

Your tip about a filter is an *excellent* idea and, I think, the only
proper way to manage this task for *many* reasons.
I'm adding it to my editor right now (a new release will follow ASAP).

Thanks sincerely for your help!

Cheers,

Paolo

>
>


Re: Header inside the score context

2021-11-28 Thread David Wright
On Wed 24 Nov 2021 at 19:44:59 (+0100), Paolo Prete wrote:

> > and then comment or comment out parts of the score that I don't need to
> > render. So, for example, if I need to render only section 2, I would
> > comment section 3 and section 1 but I have to comment the markup block
> > separately as well: this is unwanted, because the markup belongs to section
> > 1 context. Instead, it would be more appropriate to exclude automatically
> > the markup block when section one is not included.
> > Note that putting the sections into separate files, as you suggested, does
> > not solve the problem: instead of commenting blocks of code, I would have
> > to exclude both the file associated to the markup and the file associated
> > to section 1, if I want to render section 2.
> > Now, if I try to by-pass the problem with a \book context, I can embed the
> > markup into section 1:

> I see what you mean (thanks for your further explanation) but it would not
> work for what I want to achieve. I try to explain why.
> My example is focused on _rendering_. With your procedure, I would
> statically fix portions to be rendered separately, and each portion would
> be a separate file. This is good when writing parts, or when writing
> movements of a composition. But in my case, all the sections dynamically
> vary because they represents what to be rendered.
> This means that, for example, when a section takes too much time to be
> rendered, I can decide to shrink it. Then, for example, I fix a problem,  I
> verify the problem has fixed (---> rendering) and then I enlarge it to its
> original size ( == amount of rendered measures). This is what I do very
> often (it saves much time!) and this is why I comment/comment out portions
> of the score.

>From the description above, it seems as if you're manually
preprocessing your code by inserting %{ and %} strings at
appropriate places for the compilation concerned.

If you do this regularly, I would suggest that that's just
what you do, copy your source through a simple filter to a
temporary file and compile that.

Directives such as:

%%% PAOLO %%% +foo -bar

could turn on/off copying the source at multiple points so that
inclusions of related material occur when you run, say,

filter foo baz

Such a filter is very easy to construct because you have total
control over what it sees and reacts to. And I think it would
be less error-prone that fiddling with %{ %} strings.

Feel free to ignore this method.

Cheers,
David.



Re: Header inside the score context

2021-11-24 Thread Paolo Prete
Hello Valentin,

I see what you mean (thanks for your further explanation) but it would not
work for what I want to achieve. I try to explain why.
My example is focused on _rendering_. With your procedure, I would
statically fix portions to be rendered separately, and each portion would
be a separate file. This is good when writing parts, or when writing
movements of a composition. But in my case, all the sections dynamically
vary because they represents what to be rendered.
This means that, for example, when a section takes too much time to be
rendered, I can decide to shrink it. Then, for example, I fix a problem,  I
verify the problem has fixed (---> rendering) and then I enlarge it to its
original size ( == amount of rendered measures). This is what I do very
often (it saves much time!) and this is why I comment/comment out portions
of the score.

Best,
P



On Wed, Nov 24, 2021 at 7:07 PM Valentin Petzel  wrote:

> Hello Paolo,
>
> you've missunderstood what I meant. If you have each section in a separate
> file you can simly compile that file instead of uncommenting stuff. And you
> can have header and first section in the same file.
>
> Cheers,
> Valentin
>
> 24.11.2021 18:08:50 Paolo Prete :
>
> Hello Valentin,
>
> thanks for your help!
>
> I try to explain better what I need to do. Suppose that my score is
> divided into three sections. The first one has not only notes, but a title
> too.
> I need to render the sections all together or individually. The first
> obvious way to do that is write the score in the form:
>
>
> %
> \markup { "My-Title" }
> {
> % SECTION 1 (title + notes)
> { c'1 c' d' d'\pageBreak }
>
> %SECTION 2
> { c'1 c' d' d'\sustainOn\pageBreak }
>
> %SECTION 3
> { c'1 c'\sustainOff d' d' }
>
> }
> %
>
> and then comment or comment out parts of the score that I don't need to
> render. So, for example, if I need to render only section 2, I would
> comment section 3 and section 1 but I have to comment the markup block
> separately as well: this is unwanted, because the markup belongs to section
> 1 context. Instead, it would be more appropriate to exclude automatically
> the markup block when section one is not included.
> Note that putting the sections into separate files, as you suggested, does
> not solve the problem: instead of commenting blocks of code, I would have
> to exclude both the file associated to the markup and the file associated
> to section 1, if I want to render section 2.
> Now, if I try to by-pass the problem with a \book context, I can embed the
> markup into section 1:
>
> %
> \book {
>
> % SECTION 1 (title + notes)
> \markup { "My-Title" }
> { c'1 c' d' d'\pageBreak }
>
> %SECTION 2
> { c'1 c' d' d'\sustainOn\pageBreak }
>
> %SECTION 3
> { c'1 c'\sustainOff d' d' }
>
> }
> %
>
> In this way, I could embed the markup into section 1, but it won't work
> for another reason: the presence of the pedal needs that all the sections
> belong to the same context. Note too that if I tweak sections of a score
> into separate scores, I would have a logical mismatch between the syntax
> used for blocks of code and what that blocks of code effectively represent,
> which is unwanted too.
>
> Hope this is more clear. Unfortunately the problem is tricky (and I hope
> I'm wrong, so that there is already a right approach for it)
>
> Best,
>
> Paolo
>
>
>
>
> On Wed, Nov 24, 2021 at 5:00 PM Valentin Petzel 
> wrote:
>
>> Hello Paolo,
>>
>> I don’t really understand what you want to do. But if you only want
>> render
>> parts of your project I advise against commenting out and commenting in
>> stuff.
>> Instead (since you have a new section there anyway) put the different
>> sections
>> into different scores (you can tweak the second score so that it does not
>> in
>> fact look like it’s a new score) in different files. Then you could have
>> a
>> file header.ly which contains the header, a file secI.ly which contains
>> the
>> first section, secII.ly which contains the second section and so on. And
>> then
>> you could simply do
>>
>> \include "header.ly"
>> \include "secI.ly"
>> \include "secII.ly"
>>
>> and so on. If you want to render one section you just need to render the
>> particular file.
>>
>> If you don’t want separate scores you could do use files which define the
>> different parts in variables and stitch them together in the score.
>>
>> Like if you have a duetto with flauto dolce and bass tuba for example
>> (marvellous combination!) you could have in
>> secI.

Re: Header inside the score context

2021-11-24 Thread Valentin Petzel
Hello Paolo,

you've missunderstood what I meant. If you have each section in a separate file 
you can simly compile that file instead of uncommenting stuff. And you can have 
header and first section in the same file.

Cheers,
Valentin

24.11.2021 18:08:50 Paolo Prete :

> Hello Valentin,
> 
> thanks for your help!
> 
> I try to explain better what I need to do. Suppose that my score is divided 
> into three sections. The first one has not only notes, but a title too. 
> I need to render the sections all together or individually. The first obvious 
> way to do that is write the score in the form:
> 
> 
> %
> \markup { "My-Title" }
> {
> % SECTION 1 (title + notes)
> { c'1 c' d' d'\pageBreak }
> 
> %SECTION 2
> { c'1 c' d' d'\sustainOn\pageBreak }
> 
> %SECTION 3
> { c'1 c'\sustainOff d' d' }
> 
> }
> %
> 
> and then comment or comment out parts of the score that I don't need to 
> render. So, for example, if I need to render only section 2, I would comment 
> section 3 and section 1 but I have to comment the markup block separately as 
> well: this is unwanted, because the markup belongs to section 1 context. 
> Instead, it would be more appropriate to exclude automatically the markup 
> block when section one is not included.
> Note that putting the sections into separate files, as you suggested, does 
> not solve the problem: instead of commenting blocks of code, I would have to 
> exclude both the file associated to the markup and the file associated to 
> section 1, if I want to render section 2.
> Now, if I try to by-pass the problem with a \book context, I can embed the 
> markup into section 1:
> 
> %
> \book {
> 
> % SECTION 1 (title + notes)
> \markup { "My-Title" }
> { c'1 c' d' d'\pageBreak }
> 
> %SECTION 2
> { c'1 c' d' d'\sustainOn\pageBreak }
> 
> %SECTION 3
> { c'1 c'\sustainOff d' d' }
> 
> }
> %
> 
> In this way, I could embed the markup into section 1, but it won't work for 
> another reason: the presence of the pedal needs that all the sections belong 
> to the same context. Note too that if I tweak sections of a score into 
> separate scores, I would have a logical mismatch between the syntax used for 
> blocks of code and what that blocks of code effectively represent, which is 
> unwanted too. 
> 
> Hope this is more clear. Unfortunately the problem is tricky (and I hope I'm 
> wrong, so that there is already a right approach for it)
> 
> Best,
> 
> Paolo
> 
> 
> 
> 
> On Wed, Nov 24, 2021 at 5:00 PM Valentin Petzel  wrote:
>> Hello Paolo,
>> 
>> I don’t really understand what you want to do. But if you only want render
>> parts of your project I advise against commenting out and commenting in 
>> stuff.
>> Instead (since you have a new section there anyway) put the different 
>> sections
>> into different scores (you can tweak the second score so that it does not in
>> fact look like it’s a new score) in different files. Then you could have a
>> file header.ly[http://header.ly] which contains the header, a file secI.ly 
>> which contains the
>> first section, secII.ly which contains the second section and so on. And then
>> you could simply do
>> 
>> \include "header.ly[http://header.ly];
>> \include "secI.ly"
>> \include "secII.ly"
>> 
>> and so on. If you want to render one section you just need to render the
>> particular file.
>> 
>> If you don’t want separate scores you could do use files which define the
>> different parts in variables and stitch them together in the score.
>> 
>> Like if you have a duetto with flauto dolce and bass tuba for example
>> (marvellous combination!) you could have in
>> secI.ly:
>> FluteSecI = { music }
>> TubaSecI = { music }
>> 
>> And similar in secI.ly. Then in the score you can stitch them together like
>> Flute = { \FluteSecI \pageBreak \FluteSecI }
>> And similar.
>> 
>> Then to get an output in your separate file you can create a separate score,
>> only containing the section (which is something you could probably quickly do
>> using templates.
>> 
>> You can then assign this score to a variable like thisscore=\score{...} and
>> then do something like
>> #(if (not (defined? 'included)) (add-score thisscore))
>> 
>> Then you can do #(define included 0) (or whatever value) before you include
>> these files, and thus these scores will not be output if you compile the full
>> score, but if you compile the files themselves they are.
>> 
>> Cheers,
>> Valentin
>> 
>> 

Re: Header inside the score context

2021-11-24 Thread Paolo Prete
Hello Valentin,

thanks for your help!

I try to explain better what I need to do. Suppose that my score is divided
into three sections. The first one has not only notes, but a title too.
I need to render the sections all together or individually. The first
obvious way to do that is write the score in the form:


%
\markup { "My-Title" }
{
% SECTION 1 (title + notes)
{ c'1 c' d' d'\pageBreak }

%SECTION 2
{ c'1 c' d' d'\sustainOn\pageBreak }

%SECTION 3
{ c'1 c'\sustainOff d' d' }

}
%

and then comment or comment out parts of the score that I don't need to
render. So, for example, if I need to render only section 2, I would
comment section 3 and section 1 but I have to comment the markup block
separately as well: this is unwanted, because the markup belongs to section
1 context. Instead, it would be more appropriate to exclude automatically
the markup block when section one is not included.
Note that putting the sections into separate files, as you suggested, does
not solve the problem: instead of commenting blocks of code, I would have
to exclude both the file associated to the markup and the file associated
to section 1, if I want to render section 2.
Now, if I try to by-pass the problem with a \book context, I can embed the
markup into section 1:

%
\book {

% SECTION 1 (title + notes)
\markup { "My-Title" }
{ c'1 c' d' d'\pageBreak }

%SECTION 2
{ c'1 c' d' d'\sustainOn\pageBreak }

%SECTION 3
{ c'1 c'\sustainOff d' d' }

}
%

In this way, I could embed the markup into section 1, but it won't work for
another reason: the presence of the pedal needs that all the sections
belong to the same context. Note too that if I tweak sections of a score
into separate scores, I would have a logical mismatch between the syntax
used for blocks of code and what that blocks of code effectively represent,
which is unwanted too.

Hope this is more clear. Unfortunately the problem is tricky (and I hope
I'm wrong, so that there is already a right approach for it)

Best,

Paolo




On Wed, Nov 24, 2021 at 5:00 PM Valentin Petzel  wrote:

> Hello Paolo,
>
> I don’t really understand what you want to do. But if you only want render
> parts of your project I advise against commenting out and commenting in
> stuff.
> Instead (since you have a new section there anyway) put the different
> sections
> into different scores (you can tweak the second score so that it does not
> in
> fact look like it’s a new score) in different files. Then you could have a
> file header.ly which contains the header, a file secI.ly which contains
> the
> first section, secII.ly which contains the second section and so on. And
> then
> you could simply do
>
> \include "header.ly"
> \include "secI.ly"
> \include "secII.ly"
>
> and so on. If you want to render one section you just need to render the
> particular file.
>
> If you don’t want separate scores you could do use files which define the
> different parts in variables and stitch them together in the score.
>
> Like if you have a duetto with flauto dolce and bass tuba for example
> (marvellous combination!) you could have in
> secI.ly:
> FluteSecI = { music }
> TubaSecI = { music }
>
> And similar in secI.ly. Then in the score you can stitch them together like
> Flute = { \FluteSecI \pageBreak \FluteSecI }
> And similar.
>
> Then to get an output in your separate file you can create a separate
> score,
> only containing the section (which is something you could probably quickly
> do
> using templates.
>
> You can then assign this score to a variable like thisscore=\score{...}
> and
> then do something like
> #(if (not (defined? 'included)) (add-score thisscore))
>
> Then you can do #(define included 0) (or whatever value) before you
> include
> these files, and thus these scores will not be output if you compile the
> full
> score, but if you compile the files themselves they are.
>
> Cheers,
> Valentin
>
>
> Am Mittwoch, 24. November 2021, 13:01:11 CET schrieb Paolo Prete:
> > Hello,
> >
> > Given a header like this:
> >
> > 
> > \markuplist {
> >
> > \fill-line {
> >   \override #'(font-name . "Liberation Sans")
> >   \override #'(font-size . 6)
> >   "Author"
> > }
> >
> > \vspace #4
> >
> > \fill-line {
> >   \override #'(font-name . "Liberation Sans")
> >   \override #'(font-size . 15)
> >   "Title"
> > }
> >
> > \vspace #2
> >
> > \fill-line {
> >   \override #'(font-name . "Liberation Sans")
> >   \override #'(font-size . 10)
> >   "Subtitle"
> > }
> >
> > \vspace #6
> >
> > }
> >
> > {

Re: Header inside the score context

2021-11-24 Thread Valentin Petzel
Hello Paolo,

I don’t really understand what you want to do. But if you only want render 
parts of your project I advise against commenting out and commenting in stuff. 
Instead (since you have a new section there anyway) put the different sections 
into different scores (you can tweak the second score so that it does not in 
fact look like it’s a new score) in different files. Then you could have a 
file header.ly which contains the header, a file secI.ly which contains the 
first section, secII.ly which contains the second section and so on. And then 
you could simply do

\include "header.ly"
\include "secI.ly"
\include "secII.ly"

and so on. If you want to render one section you just need to render the 
particular file.

If you don’t want separate scores you could do use files which define the 
different parts in variables and stitch them together in the score.

Like if you have a duetto with flauto dolce and bass tuba for example 
(marvellous combination!) you could have in
secI.ly:
FluteSecI = { music }
TubaSecI = { music }

And similar in secI.ly. Then in the score you can stitch them together like
Flute = { \FluteSecI \pageBreak \FluteSecI }
And similar.

Then to get an output in your separate file you can create a separate score, 
only containing the section (which is something you could probably quickly do 
using templates.

You can then assign this score to a variable like thisscore=\score{...} and 
then do something like
#(if (not (defined? 'included)) (add-score thisscore))

Then you can do #(define included 0) (or whatever value) before you include 
these files, and thus these scores will not be output if you compile the full 
score, but if you compile the files themselves they are.

Cheers,
Valentin


Am Mittwoch, 24. November 2021, 13:01:11 CET schrieb Paolo Prete:
> Hello,
> 
> Given a header like this:
> 
> 
> \markuplist {
> 
> \fill-line {
>   \override #'(font-name . "Liberation Sans")
>   \override #'(font-size . 6)
>   "Author"
> }
> 
> \vspace #4
> 
> \fill-line {
>   \override #'(font-name . "Liberation Sans")
>   \override #'(font-size . 15)
>   "Title"
> }
> 
> \vspace #2
> 
> \fill-line {
>   \override #'(font-name . "Liberation Sans")
>   \override #'(font-size . 10)
>   "Subtitle"
> }
> 
> \vspace #6
> 
> }
> 
> {
> 
> %section 1
> c'1 c' c' \break c' c'
> 
> \pageBreak
> 
> %section 2
> e'1 e' f' \break f' f'
> 
> }
> 
> %
> 
> ... I would like to put it inside the score context. Is it possible ?
> In this way, given that the above header is only bound to the first page of
> the score, if I want to render only page 2 I would not need two block
> comments  (page 1 and header), but I would use only one block comment.
> 
> (Maybe by using the following hacky way to have multiple marks on the same
> bar:
> https://lilypond.org/doc/v2.23/Documentation/snippets/expressive-marks
> (Creating simultaneous rehearsal marks) ?)
> 
> Thanks!
> 
> P

signature.asc
Description: This is a digitally signed message part.


Header inside the score context

2021-11-24 Thread Paolo Prete
Hello,

Given a header like this:


\markuplist {

\fill-line {
  \override #'(font-name . "Liberation Sans")
  \override #'(font-size . 6)
  "Author"
}

\vspace #4

\fill-line {
  \override #'(font-name . "Liberation Sans")
  \override #'(font-size . 15)
  "Title"
}

\vspace #2

\fill-line {
  \override #'(font-name . "Liberation Sans")
  \override #'(font-size . 10)
  "Subtitle"
}

\vspace #6

}

{

%section 1
c'1 c' c' \break c' c'

\pageBreak

%section 2
e'1 e' f' \break f' f'

}

%

... I would like to put it inside the score context. Is it possible ?
In this way, given that the above header is only bound to the first page of
the score, if I want to render only page 2 I would not need two block
comments  (page 1 and header), but I would use only one block comment.

(Maybe by using the following hacky way to have multiple marks on the same
bar:
https://lilypond.org/doc/v2.23/Documentation/snippets/expressive-marks
(Creating simultaneous rehearsal marks) ?)

Thanks!

P


Re: Question about the header structure of the very first page of the score

2021-11-23 Thread Paolo Prete
Thank you, I'll surely proceed in this way.

On Tue, Nov 23, 2021 at 2:46 AM Mark Probert  wrote:

>
> Hi, Paolo.
>
> Here is a version that could work in that way, with modification. It
> shows one way to achieve the result by ignoring the headers and doing
> it all in text with associated font changes:
>
>
[...]


Question about the header structure of the very first page of the score

2021-11-22 Thread Paolo Prete
Hello,

in Italy it's very common to have a printed score with the very first page
formatted as this image shows:

https://www.stretta-music.com/media/images/712/776712_detail-00.jpg

Basically, it is a sequence of fields, all horizontally centered, following
this order, from top to bottom:

1) composer
2) title
3) subtitle
4) subsubtitle
5) (optional) copyright

How can I obtain the same structure in LilyPond?
Note that all the fields have different fonts (and font-sizes)

The title + subtitle + subsubtitle structure of LP would be enough but I
also need to place the name of the composer at the top of the page.

Thanks for your help!

P


Re: Produce \header in function

2021-11-19 Thread Павел

Thanks David! It works.

19.11.2021 14:24, David Kastrup пишет:

Павел  writes:


Hello lilyponders! I want to produce \header block in my function, to
use my function instead \header block. But I can't seem to find the
correct syntax for this. It doesn't work like that:

genheader = #(define-music-function
     (mystring) ( string? ) #{
     \header { piece = \markup\bold #mystring }
     #})

A header is not music.  Use define-scheme-function instead.





Re: Produce \header in function

2021-11-19 Thread David Kastrup
Павел  writes:

> Hello lilyponders! I want to produce \header block in my function, to
> use my function instead \header block. But I can't seem to find the
> correct syntax for this. It doesn't work like that:
>
> genheader = #(define-music-function
>     (mystring) ( string? ) #{
>     \header { piece = \markup\bold #mystring }
>     #})

A header is not music.  Use define-scheme-function instead.

-- 
David Kastrup



Produce \header in function

2021-11-19 Thread Павел
Hello lilyponders! I want to produce \header block in my function, to 
use my function instead \header block. But I can't seem to find the 
correct syntax for this. It doesn't work like that:


genheader = #(define-music-function
    (mystring) ( string? ) #{
    \header { piece = \markup\bold #mystring }
    #})




Re: Instruction text between header and staff

2021-10-04 Thread Kieren MacMillan
p.s.

>> I'm trying to add some instruction text in my score. I would like to 
>> position it between the header and the music, but I cannot seem to figure 
>> out how to do this, as markup cannot be placed inside a score block. I also 
>> tried taking the header out of the score block which still seemed to produce 
>> the exact same result.

For this, just use a new header property, and define your scoreTitleMarkup 
accordingly:

%%%  SNIPPET 3 BEGINS
\version "2.18.2"

\header {
  title = "A Piece"
  composer = "Someone"
}

\paper {
  scoreTitleMarkup = \markup \column {
 \fill-line {
  \null
  \fontsize #4 \bold \fromproperty #'header:piece
  \fromproperty #'header:opus
}
\vspace #2
\fromproperty #'header:instructions
\vspace #2
  }
  markup-markup-spacing.padding = 8
  markup-score-spacing.padding = 8
}

first = \relative c'' { \repeat unfold 32 { c4 } }

\header {
  piece = "I"
  instructions = "Here are some instructions on how you should play my piece."  
}

\score {
  \new Staff { \first }
  \layout { indent = 0.0 }
}
%%%  SNIPPET 3 ENDS

Hope that helps!
Kieren.


Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: kie...@kierenmacmillan.info




Re: Instruction text between header and staff

2021-10-04 Thread Kieren MacMillan
Hi Erika,

> I'm trying to add some instruction text in my score. I would like to position 
> it between the header and the music, but I cannot seem to figure out how to 
> do this, as markup cannot be placed inside a score block. I also tried taking 
> the header out of the score block which still seemed to produce the exact 
> same result.
> 
> (Another minor issue I had was the spacing between the title and the header. 
> I wanted a bit more space in between, which I was able to obtain by adding an 
> arranger field but leaving it blank. If someone has a better solution to 
> suggest, I'd be happy to hear that as well.)

There are multiple ways you can do this.


1. Use \vspace with your markup:

%%%  SNIPPET 1 BEGINS
\version "2.18.2"

\header {
  title = "A Piece"
  composer = "Someone"
}

\paper {
  scoreTitleMarkup = \markup {
 \fill-line {
  \null
  \fontsize #4 \bold \fromproperty #'header:piece
  \fromproperty #'header:opus
}
  }
}

first = \relative c'' { \repeat unfold 32 { c4 } }

\header {
  piece = "I"
}

\markup \vspace #2
\markup {
  Here are some instructions on how you should play my piece.
}
\markup \vspace #2

\score {
  \new Staff { \first }
  \layout { indent = 0.0 }
}
%%%  SNIPPET 1 ENDS


2. Use the spacing parameters:

%%%  SNIPPET 2 BEGINS
\version "2.18.2"

\header {
  title = "A Piece"
  composer = "Someone"
}

\paper {
  scoreTitleMarkup = \markup {
 \fill-line {
  \null
  \fontsize #4 \bold \fromproperty #'header:piece
  \fromproperty #'header:opus
}
  }
  markup-markup-spacing.padding = 8
  markup-score-spacing.padding = 8
}

first = \relative c'' { \repeat unfold 32 { c4 } }

\header {
  piece = "I"
}

\markup {
  Here are some instructions on how you should play my piece.
}

\score {
  \new Staff { \first }
  \layout { indent = 0.0 }
}
%%%  SNIPPET 2 ENDS


There are other solutions, of course, but hopefully one of these puts you on 
the right track.

Hope this helps!
Kieren.


Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: kie...@kierenmacmillan.info




Re: Instruction text between header and staff

2021-10-04 Thread Knute Snortum
On Mon, Oct 4, 2021 at 8:13 AM Erika Pirnes  wrote:
>
> I'm trying to add some instruction text in my score. I would like to position 
> it between the header and the music, but I cannot seem to figure out how to 
> do this, as markup cannot be placed inside a score block. I also tried taking 
> the header out of the score block which still seemed to produce the exact 
> same result.
>
> (Another minor issue I had was the spacing between the title and the header. 
> I wanted a bit more space in between, which I was able to obtain by adding an 
> arranger field but leaving it blank. If someone has a better solution to 
> suggest, I'd be happy to hear that as well.)
>
> Here's my minimal example:
>
> \version "2.18.2"
>
> \header {
>   title = "A Piece"
>   composer = "Someone"
>   arranger = " "
> }
>
> \paper {
>   scoreTitleMarkup = \markup {
>  \fill-line {
>   \null
>   \fontsize #4 \bold \fromproperty #'header:piece
>   \fromproperty #'header:opus
> }
>   }
> }
>
> first = \relative c''{\repeat unfold 32 {c4}}
>
> \header {piece = "I"}
>
> \markup {
>   Here are some instructions on how you should play my piece.
> }
>
> \score {
>   \new Staff {\first}
>   \layout {indent = 0.0}
> }
>
>
> Thank you,
> Erika

Well, you could attach the markup to the first note...

%%%
first = \relative c''{
  c4^\markup {
Here are some instructions on how you should play my piece.
  }
  c c c
  \repeat unfold 28 {c4}
}
%%%

--
Knute Snortum



Instruction text between header and staff

2021-10-04 Thread Erika Pirnes
I'm trying to add some instruction text in my score. I would like to position 
it between the header and the music, but I cannot seem to figure out how to do 
this, as markup cannot be placed inside a score block. I also tried taking the 
header out of the score block which still seemed to produce the exact same 
result.

(Another minor issue I had was the spacing between the title and the header. I 
wanted a bit more space in between, which I was able to obtain by adding an 
arranger field but leaving it blank. If someone has a better solution to 
suggest, I'd be happy to hear that as well.)

Here's my minimal example:

\version "2.18.2"

\header {
  title = "A Piece"
  composer = "Someone"
  arranger = " "
}

\paper {
  scoreTitleMarkup = \markup {
 \fill-line {
  \null
  \fontsize #4 \bold \fromproperty #'header:piece
  \fromproperty #'header:opus
}
  }
}

first = \relative c''{\repeat unfold 32 {c4}}

\header {piece = "I"}

\markup {
  Here are some instructions on how you should play my piece.
}

\score {
  \new Staff {\first}
  \layout {indent = 0.0}
}


Thank you,
Erika


Re: header material too close to staff

2021-02-02 Thread Christian Masser
Thank you for that cheat sheet! Is this part of the official documentation
or your own work?

All the best
Christian


Noeck  schrieb am Mo., 1. Feb. 2021, 23:46:

> Hi David,
>
> you are looking for markup-system-spacing:
>
> \paper {
>   markup-system-spacing.basic-distance = #10
> }
>
> Flexible vertical spacing \paper variables:
>
> http://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-paper-variables
>
> Cheat Sheet:
> https://joramberger.de/files/LilypondSpacing.pdf
>
> Best,
> Joram
>
>


Re: header material too close to staff

2021-02-01 Thread David Zelinsky
Thanks, Joram.  This is helpful.


Noeck  writes:

> Hi David,
>
> you are looking for markup-system-spacing:
>
> \paper {
>   markup-system-spacing.basic-distance = #10
> }
>
> Flexible vertical spacing \paper variables:
> http://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-paper-variables
>
> Cheat Sheet:
> https://joramberger.de/files/LilypondSpacing.pdf
>
> Best,
> Joram



Re: header material too close to staff

2021-02-01 Thread Noeck
Hi David,

you are looking for markup-system-spacing:

\paper {
  markup-system-spacing.basic-distance = #10
}

Flexible vertical spacing \paper variables:
http://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-paper-variables

Cheat Sheet:
https://joramberger.de/files/LilypondSpacing.pdf

Best,
Joram



Re: header material too close to staff

2021-02-01 Thread David Zelinsky
Thank you!  I could have sworn I tried almost exactly that and got
errors.  But this does work!

And thanks for the amazingly quick response!

-David


"Hwaen Ch'uqi"  writes:

> Greetings David,
>
> You can invoke the \column and \vspace commands inside markup, like this:
>
> \header {
>   piece = \markup \column {
> "blah blah"
> \vspace #2
>   }
> }
>
> hth,
>
> Hwaen Ch'uqi
>
>
> On 2/1/21, David Zelinsky  wrote:
>> Is there a way to put some space between the header material and the
>> first staff?  None of my searching as produced anything relevant.
>>
>> Here's an example:
>>
>> -
>>
>> \version "2.20.0"
>> \include "english.ly"
>>
>> \score {
>>   {
>> c''' c''' c''' c'''
>>   }
>> }
>> \header {
>>   piece = "blah blah blah blah blah blah"
>> }
>>
>> -
>>
>>
>>
>>



Re: header material too close to staff

2021-02-01 Thread Hwaen Ch'uqi
Greetings David,

You can invoke the \column and \vspace commands inside markup, like this:

\header {
  piece = \markup \column {
"blah blah"
\vspace #2
  }
}

hth,

Hwaen Ch'uqi


On 2/1/21, David Zelinsky  wrote:
> Is there a way to put some space between the header material and the
> first staff?  None of my searching as produced anything relevant.
>
> Here's an example:
>
> -
>
> \version "2.20.0"
> \include "english.ly"
>
> \score {
>   {
> c''' c''' c''' c'''
>   }
> }
> \header {
>   piece = "blah blah blah blah blah blah"
> }
>
> -
>
>
>
>



Re: header material too close to staff

2021-02-01 Thread David Zelinsky
> Is there a way to put some space between the header material and the
> first staff?  None of my searching as produced anything relevant.
>
> Here's an example:
>
> -
>
> \version "2.20.0"
> \include "english.ly"
>
> \score {
>   {
> c''' c''' c''' c'''
>   }
> }
> \header {
>   piece = "blah blah blah blah blah blah"
> }
>
> -


Oops, sorry folks, my fingers accidentally clicked SEND before I was
ready.  I meant top explain further:

The notes above the staff are almost touching the text of the "piece".

If instead of "piece" I use "title", which centers a title at the top of
the page, it's just as bad.

How can I add some padding between the text and the notes?

Attached what I see for the rendering of the above.

-- 
David Zelinsky
d...@dedekind.net



test.pdf
Description: Adobe PDF document


header material too close to staff

2021-02-01 Thread David Zelinsky
Is there a way to put some space between the header material and the
first staff?  None of my searching as produced anything relevant.

Here's an example:

-

\version "2.20.0"
\include "english.ly"

\score {
  {
c''' c''' c''' c'''
  }
}
\header {
  piece = "blah blah blah blah blah blah"
}

-





Re: enteredby header

2021-01-30 Thread Thomas Morley
Hi,

please keep the discussion on the list, others may want to participate
cc-ing the list again

Am Sa., 30. Jan. 2021 um 21:58 Uhr schrieb Kuredant :
>
> On 1/31/2021 4:45 AM, Thomas Morley wrote:
> > Am Sa., 30. Jan. 2021 um 17:06 Uhr schrieb Kuredant :
> >> Hello,
> >>
> >> The "enteredby" header field is mentioned in
> >> https://lilypond.org/doc/v2.23/Documentation/snippets/titles#titles-demonstrating-all-headers.
> >>
> >> However, I can't find any reference to this field in the PDF output.
> >> Does anyone know how this field is used by LilyPond?
> >>
> >>
> > \header initiates a special module.
> > In general, one could assign whatever value to wharever key, like:
> >
> > \header {
> >foo = "FOO"
> >bar = "BAR"
> >buzz = "BUZZ"
> > }
> >
> > Those values may be used by other code, p.e. \bookTitleMarkup or
> > page-headers/footers, etc.
> >
> > I'm not aware "enteredby" is currently used by LilyPond, maybe mutopia
> > used it ... not sure, though.
> >
> > Anyway, here an example with custom header settings and a
> > bookTitleMarkup looking at it.
> >
> > myBookTitleMarkup =
> >\markup
> >  \column {
> >\large \bold
> >\fill-line {
> >  \fromproperty #'header:foo
> >  \fromproperty #'header:bar
> >  \fromproperty #'header:buzz
> >}
> >\bold \fill-line { \fromproperty #'header:enteredby }
> >  }
> >
> > \paper {
> >bookTitleMarkup = \myBookTitleMarkup
> > }
> >
> > \header {
> >foo = "FOO"
> >bar = "BAR"
> >buzz = "BUZZ"
> >enteredby = "Harm"
> > }
> >
> > { R1 }
> >
> > Cheers,
> >Harm
> >
> > P.S.
> > there's a typo in the linked snippet: metre should read meter, which
> > indeed is called by the default bookTitleMarkup.
> > Now corrected inside LSR
> > http://lsr.di.unimi.it/LSR/Item?id=279
>
> Thanks for the info.
>
> If it was used by Mutopia, it doesn't seem to be anymore:
> https://www.mutopiaproject.org/contribute.html#update
>
> Since this snippet lists "all header fields with special meanings",
> wouldn't it be better to remove "enteredby"?
>

Well, in our code base we've currently 6 uses of setting "enteredby",
I'm not sure, if we should remove them.

Anyway, the title of the snippet "Demonstrating all headers" is
misleading. It tries to demonstrate all possible header-settings,
which will cause _printed_ output with default bookTitleMarkup, though
"texidoc", "enteredby" and "source" are not called by bookTitleMarkup
and thus not printed.
There are even a lot more established header-settings with special
meaning, but without printed output, see NR 3.2.3 Creating output file
metadata

Currently I've no good idea, how to improve docs/snippets or if this
is needed at all...

Cheers,
  Harm



Re: enteredby header

2021-01-30 Thread Thomas Morley
Am Sa., 30. Jan. 2021 um 17:06 Uhr schrieb Kuredant :
>
> Hello,
>
> The "enteredby" header field is mentioned in
> https://lilypond.org/doc/v2.23/Documentation/snippets/titles#titles-demonstrating-all-headers.
>
> However, I can't find any reference to this field in the PDF output.
> Does anyone know how this field is used by LilyPond?
>
>

\header initiates a special module.
In general, one could assign whatever value to wharever key, like:

\header {
  foo = "FOO"
  bar = "BAR"
  buzz = "BUZZ"
}

Those values may be used by other code, p.e. \bookTitleMarkup or
page-headers/footers, etc.

I'm not aware "enteredby" is currently used by LilyPond, maybe mutopia
used it ... not sure, though.

Anyway, here an example with custom header settings and a
bookTitleMarkup looking at it.

myBookTitleMarkup =
  \markup
\column {
  \large \bold
  \fill-line {
\fromproperty #'header:foo
\fromproperty #'header:bar
\fromproperty #'header:buzz
  }
  \bold \fill-line { \fromproperty #'header:enteredby }
}

\paper {
  bookTitleMarkup = \myBookTitleMarkup
}

\header {
  foo = "FOO"
  bar = "BAR"
  buzz = "BUZZ"
  enteredby = "Harm"
}

{ R1 }

Cheers,
  Harm

P.S.
there's a typo in the linked snippet: metre should read meter, which
indeed is called by the default bookTitleMarkup.
Now corrected inside LSR
http://lsr.di.unimi.it/LSR/Item?id=279



enteredby header

2021-01-30 Thread Kuredant

Hello,

The "enteredby" header field is mentioned in 
https://lilypond.org/doc/v2.23/Documentation/snippets/titles#titles-demonstrating-all-headers.


However, I can't find any reference to this field in the PDF output. 
Does anyone know how this field is used by LilyPond?





Re: Margin between Header and Music

2020-11-23 Thread Marc Shepherd
That's it...thanks!

On Mon, Nov 23, 2020 at 9:19 AM Knute Snortum  wrote:

> I think that would be "markup-system".
>
> --
> Knute Snortum
>
>
>
> On Mon, Nov 23, 2020 at 6:01 AM Marc Shepherd  wrote:
>
>> What parameter controls the minimum amount of space between the bottom of
>> the header and the first line of music?
>>
>> --
>> Marc Shepherd
>>
>

-- 
Marc Shepherd


Re: Margin between Header and Music

2020-11-23 Thread Noeck
Dear Marc,

it's markup-system.minimum-distance

(or basic-distance or padding – depending on what want)

https://joramberger.de/files/LilypondSpacing.pdf

HTH
Joram



Re: Margin between Header and Music

2020-11-23 Thread Knute Snortum
I think that would be "markup-system".

--
Knute Snortum



On Mon, Nov 23, 2020 at 6:01 AM Marc Shepherd  wrote:

> What parameter controls the minimum amount of space between the bottom of
> the header and the first line of music?
>
> --
> Marc Shepherd
>


Re: Margin between Header and Music

2020-11-23 Thread Xavier Scheuer
On Mon, 23 Nov 2020 at 15:01, Marc Shepherd  wrote:
>
> What parameter controls the minimum amount of space between the bottom of
the header and the first line of music?

Hello,

markup-system-spacing.minimum-distance

See NR 4.1.4 Flexible vertical spacing \paper variables > List of flexible
vertical spacing \paper variables
http://lilypond.org/doc/v2.20/Documentation/notation/flexible-vertical-spacing-paper-variables.html#list-of-flexible-vertical-spacing-paper-variables

Default is
markup-system-spacing = #'((basic-distance . 5)
  (padding . 0.5)
  (stretchability . 30))

Cheers,
Xavier

-- 
Xavier Scheuer 


Margin between Header and Music

2020-11-23 Thread Marc Shepherd
What parameter controls the minimum amount of space between the bottom of
the header and the first line of music?

-- 
Marc Shepherd


Re: Function operating on header

2020-03-14 Thread Timothy Lanfear



On 14/03/2020 19:14, Noeck wrote:


So I did another try and used the footer markup, but I can't use
fromproperty in Scheme code. This is what I tried:

\version "2.20.0"

\header { title = "Title" }
\paper {
   oddFooterMarkup = \markup \fill-line {
 \null
 #(if
   (string-null? (markup->string #{
 \markup \fromproperty 'header:license #}))
   #{ \markup \with-url
  #(string-append "http://url/; (markup->string #{
\markup \fromproperty 'header:license #}) "/4.0")
  \fromproperty 'header:license #} "")
 % the lines above should finally produce this if license is defined:
 % \with-url "http://url/cc by-sa/4.0" "cc by-sa"
 \null
   }
}

\header {
   license = "cc by-sa"
}

{ b }

Cheers,
Joram


You just forgot a # before 'header:license

\markup \fromproperty #'header:license


--
Timothy Lanfear, Bristol, UK.




Re: Function operating on header

2020-03-14 Thread Noeck
Hi,

Am 13.03.20 um 20:36 schrieb Noeck:
>> Finally, \fromproperty is important as it defers the evaluation of the
>> property.  Using \title would give you the current value whereas
>> \fromproperty #'header:title can accommodate changes to the property.
> And that’s exactly why \fromproperty is the wrong tool for me here as I
> want to change the header fields based on what is there now not later.

I spoke too soon here. It would actually be nice to put the includes first.
Can I use fromproperty also in Scheme code? Or does the late evaluation
contradict with the usage in Scheme?

So I did another try and used the footer markup, but I can't use
fromproperty in Scheme code. This is what I tried:

\version "2.20.0"

\header { title = "Title" }
\paper {
  oddFooterMarkup = \markup \fill-line {
\null
#(if
  (string-null? (markup->string #{
\markup \fromproperty 'header:license #}))
  #{ \markup \with-url
 #(string-append "http://url/; (markup->string #{
   \markup \fromproperty 'header:license #}) "/4.0")
 \fromproperty 'header:license #} "")
% the lines above should finally produce this if license is defined:
    % \with-url "http://url/cc by-sa/4.0" "cc by-sa"
\null
  }
}

\header {
  license = "cc by-sa"
}

{ b }

Cheers,
Joram



Re: Function operating on header

2020-03-13 Thread Timothy Lanfear

Because that is just a tiny example. I would like to create links to CC

licenses based on a license field etc.
What I am lacking here still, is how to do \with-url in Scheme or a
mechanism to show parts only under a certain condition:

\markup { "Text" ??if \license then \with-url #"url" "License" endif?? }


How about something like this? Comment out  "licence =  ..." to remove 
the copyright statement.


\version "2.20.0"

\header {
  licence = "CC-BY-NC 4.0"
  copyright =
    #(if (defined? 'licence)
  (markup
    #:line
    (#:with-url "https://creativecommons.org/licenses/by-nc/4.0/; 
licence)))

}

\score {
  c''1
}


--
Timothy Lanfear, Bristol, UK.




Re: Function operating on header

2020-03-13 Thread Noeck
Dear Aaron,

thank you for your mail.

> It may be your intention, but markup->string strips out formatting. 

Yes, it is my intention. I want to work with strings and not markup as I
want to completely separate the formatting from the header fields.

> Next, why use strings and string-append at all?

Because that is just a tiny example. I would like to create links to CC
licenses based on a license field etc.
What I am lacking here still, is how to do \with-url in Scheme or a
mechanism to show parts only under a certain condition:

\markup { "Text" ??if \license then \with-url #"url" "License" endif?? }

> Finally, \fromproperty is important as it defers the evaluation of the
> property.  Using \title would give you the current value whereas
> \fromproperty #'header:title can accommodate changes to the property.

And that’s exactly why \fromproperty is the wrong tool for me here as I
want to change the header fields based on what is there now not later.

Cheers,
Joram





Re: Function operating on header

2020-03-13 Thread David Kastrup
Aaron Hill  writes:

> On 2020-03-12 11:49 am, Noeck wrote:
>> Thanks Francisco! That's great news!
>> It also works across separate header blocks and even from within
>> included files. And it is easier to turn it into a string than for the
>> \fromproperty mechanism. So this works for me:
>> \header {
>>   title = "my title"
>>   composer = "will be replaced"
>> }
>> % can also be included via \include
>> \header {
>>   composer = \markup { Composer of \italic
>> #(string-append "»" (markup->string title) "«") }
>> % instead of string-append, I can now work with the string
>> }
>> % end of include
>> { b }
>
> It may be your intention, but markup->string strips out formatting.
> For markup that is just simple text, you would not notice any loss.
> But it is best to keep markup as markup in order to preserve
> formatting.  You never know when your simple text today needs to
> become more complex later.
>
> Next, why use strings and string-append at all?  \markup already
> supports the ability to concatenate multiple arguments into one.  A 
> simple markup list (i.e. #{ \markup { one two three } #}) joins items
> using word-space to separate them.

Uh, there is so much wrong in that statement... { one two three } is the
markup list here, and the three items are three separate items in that
list, not joined by anything.  That's what makes it a _list_.

Now \markup  is a shorthand for \markup \line 
and it's the \line that joins a markup list into a single markup (of
course there are other such commands with different results) using
word-space as separator.

> If no spacing is desired, use \concat.

Yes, that is another one for turning a markup list into a single markup.

-- 
David Kastrup



Re: Function operating on header

2020-03-12 Thread Aaron Hill

On 2020-03-12 11:49 am, Noeck wrote:

Thanks Francisco! That's great news!

It also works across separate header blocks and even from within
included files. And it is easier to turn it into a string than for the
\fromproperty mechanism. So this works for me:

\header {
  title = "my title"
  composer = "will be replaced"
}

% can also be included via \include
\header {
  composer = \markup { Composer of \italic
#(string-append "»" (markup->string title) "«") }
% instead of string-append, I can now work with the string
}
% end of include

{ b }


It may be your intention, but markup->string strips out formatting.  For 
markup that is just simple text, you would not notice any loss.  But it 
is best to keep markup as markup in order to preserve formatting.  You 
never know when your simple text today needs to become more complex 
later.


Next, why use strings and string-append at all?  \markup already 
supports the ability to concatenate multiple arguments into one.  A 
simple markup list (i.e. #{ \markup { one two three } #}) joins items 
using word-space to separate them.  If no spacing is desired, use 
\concat.  Anything more complex should really be done with custom markup 
functions, so as to preserve the formatting and flexibility of markup 
over pure text.


Finally, \fromproperty is important as it defers the evaluation of the 
property.  Using \title would give you the current value whereas 
\fromproperty #'header:title can accommodate changes to the property.  
Consider the following:



\version "2.20.0"

\header {
  title = "Title"
  subtitle = \markup { Sub \title }
  subsubtitle = \markup { Subsub \fromproperty #'header:title }
}

\header { title = "Title (changed)" }

\markup { Lorem ipsum dolor sit amet }


In the above, the subtitle does not reflect the change to the title.  In 
general, you should prefer to use \fromproperty so that the order of 
defining properties does not matter.  However, if you can ensure 
properties are set properly, there should be nothing wrong with using 
\title directly.



-- Aaron Hill



Re: Function operating on header

2020-03-12 Thread Noeck
Thanks Francisco! That's great news!

It also works across separate header blocks and even from within
included files. And it is easier to turn it into a string than for the
\fromproperty mechanism. So this works for me:


\header {
  title = "my title"
  composer = "will be replaced"
}

% can also be included via \include
\header {
  composer = \markup { Composer of \italic
#(string-append "»" (markup->string title) "«") }
% instead of string-append, I can now work with the string
}
% end of include

{ b }

Cheers,
Joram


Am 12.03.20 um 17:42 schrieb Francisco Vila:
> This shows that header fields behave just like plain markups and can be
> used inside other markups:
>
> \header {
>   title="The title"
>   composer=\markup{Composer of \italic\title }
> }
>   { b }
>
>
> On 7/3/20 18:50, Timothy Lanfear wrote:
>> On 07/03/2020 14:52, Noeck wrote:
>>>> Thank you, Timothy,
>>>>
>>>> this is how far I got already. It is probably a step in the right
>>>> direction. But there are two issues with it:
>>>>
>>>> 1) I would like to use some Scheme code on the fields (with if etc),
>>>>     so I need the 'header:author as a string and #(markup->string …)
>>>>     did not work.
>>>> 2) Can this be put in a command which I can move to a separate file?
>>>>     Like \evaluateHeaders
>>>>
>>>> Cheers,
>>>> Joram
>>
>> Ok, so here is an example of a function to create a bookpart
>> consisting of a single blank page by clearing all the header
>> variables. It should give some clues about how to construct a header
>> in Scheme,
>>
>>
>> \version "2.19.80"
>>
>> % Print a blank page
>> blankpage = #(define-void-function () ()
>>   (let ((bookpart #{ \bookpart { \paper { page-count = 1
>> print-page-number = ##f } \markup \null } #})
>>     (header   (make-module))
>>     (props    '(dedication title subtitle subsubtitle instrument
>>     poet composer meter arranger opus piece copyright)))
>>     (for-each (lambda (prop) (module-define! header prop #f)) props)
>>     (ly:book-set-header! bookpart header)
>>     (ly:book-add-bookpart! $current-book bookpart)))
>>
>>



Re: Function operating on header

2020-03-12 Thread Francisco Vila
This shows that header fields behave just like plain markups and can be 
used inside other markups:


\header {
  title="The title"
  composer=\markup{Composer of \italic\title }
}
  { b }


On 7/3/20 18:50, Timothy Lanfear wrote:

On 07/03/2020 14:52, Noeck wrote:

Thank you, Timothy,

this is how far I got already. It is probably a step in the right
direction. But there are two issues with it:

1) I would like to use some Scheme code on the fields (with if etc),
    so I need the 'header:author as a string and #(markup->string …)
    did not work.
2) Can this be put in a command which I can move to a separate file?
    Like \evaluateHeaders

Cheers,
Joram


Ok, so here is an example of a function to create a bookpart 
consisting of a single blank page by clearing all the header 
variables. It should give some clues about how to construct a header 
in Scheme,



\version "2.19.80"

% Print a blank page
blankpage = #(define-void-function () ()
  (let ((bookpart #{ \bookpart { \paper { page-count = 1 
print-page-number = ##f } \markup \null } #})

    (header   (make-module))
    (props    '(dedication title subtitle subsubtitle instrument
    poet composer meter arranger opus piece copyright)))
    (for-each (lambda (prop) (module-define! header prop #f)) props)
    (ly:book-set-header! bookpart header)
    (ly:book-add-bookpart! $current-book bookpart)))



--
Francisco Vila, Ph.D. - Badajoz (Spain)
paconet.org , lilypond.es




Re: Function operating on header

2020-03-07 Thread Timothy Lanfear

On 07/03/2020 14:52, Noeck wrote:

Thank you, Timothy,

this is how far I got already. It is probably a step in the right
direction. But there are two issues with it:

1) I would like to use some Scheme code on the fields (with if etc),
so I need the 'header:author as a string and #(markup->string …)
did not work.
2) Can this be put in a command which I can move to a separate file?
Like \evaluateHeaders

Cheers,
Joram


Ok, so here is an example of a function to create a bookpart consisting 
of a single blank page by clearing all the header variables. It should 
give some clues about how to construct a header in Scheme,



\version "2.19.80"

% Print a blank page
blankpage = #(define-void-function () ()
  (let ((bookpart #{ \bookpart { \paper { page-count = 1 
print-page-number = ##f } \markup \null } #})

    (header   (make-module))
    (props    '(dedication title subtitle subsubtitle instrument
    poet composer meter arranger opus piece copyright)))
    (for-each (lambda (prop) (module-define! header prop #f)) props)
    (ly:book-set-header! bookpart header)
    (ly:book-add-bookpart! $current-book bookpart)))


--
Timothy Lanfear, Bristol, UK.




Re: Function operating on header

2020-03-07 Thread Noeck
> Does this solve your problem?
> …
>   copyright = \markup \concat { "© " \fromproperty #'header:author }

Thank you, Timothy,

this is how far I got already. It is probably a step in the right
direction. But there are two issues with it:

1) I would like to use some Scheme code on the fields (with if etc),
   so I need the 'header:author as a string and #(markup->string …)
   did not work.
2) Can this be put in a command which I can move to a separate file?
   Like \evaluateHeaders

Cheers,
Joram



  1   2   3   4   5   6   7   8   >