Re: Make TOC entries available to LaTeX

2018-05-24 Thread Urs Liska


Am 25. Mai 2018 07:48:58 MESZ schrieb Federico Bruni :
>
>
>Il giorno gio 24 mag 2018 alle 9:09, Urs Liska  
>ha scritto:
>> 
>> This is the function as it ended up in my project files:
>> 
>> % Print table of contents entries to .toc
>> % Based on
>> % 
>>
>http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents
>> % Pointed to by "Thomas Morley"
>> #(define (oly:create-toc-file layout pages)
>>(let*
>> ((label-table (ly:output-def-lookup layout 'label-page-table))
>>  (toc-items (toc-items)))
>> (if (not (null? label-table))
>> (let*
>>  ( ;; We need a page-offset so entries are offset to begin 
>> with p.1
>>;; (for use in \includepdf)
>>   (page-offset (- (ly:output-def-lookup layout 
>> 'first-page-number) 1))
>>   (format-line
>>(lambda (toc-item)
>>  (let*
>>   ((label (car toc-item))
>>(text  (caddr toc-item))
>>(page (- (assoc-ref label-table label) page-offset)))
>>   (format #f "~a,subsection,2,{~a},~a" page text
>label
>>   (formatted-toc-items (map format-line toc-items))
>>   (whole-string (string-join formatted-toc-items ",\n"))
>>   (output-name (ly:parser-output-name))
>>   (outfilename (format "~a.toc" output-name))
>>   (outfile (open-output-file outfilename)))
>>  (if (output-port? outfile)
>>  (display whole-string outfile)
>>  (ly:warning (_ "Unable to open output file ~a for the 
>> TOC information") outfilename))
>>  (close-output-port outfile)
>> 
>> page-offset calculates the offset of the first-page-number versus '1'
>
>> and subtracts that from the actual page number of the TOC entry. That
>
>> means when your score starts on page 16 a TOC item on the third page 
>> of the score will still get a TOC entry with page 3, and \includepdf 
>> will generate the appropriate TOC entry in the enclosing LaTeX 
>> document.
>
>I get an error:
>
>Drawing systemsbrani.ly:35:23: In procedure - in expression (- 
>(assoc-ref label-table label) page-offset):
>brani.ly:35:23: Wrong type argument in position 1: #f
>
>The offending line is:
>
>(page (- (assoc-ref label-table label) page-offset)))

Can you tell what toc-item contains by inserting a display between the lambda 
and let lines immediately before that line?

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Make TOC entries available to LaTeX

2018-05-24 Thread Federico Bruni



Il giorno gio 24 mag 2018 alle 9:09, Urs Liska  
ha scritto:


This is the function as it ended up in my project files:

% Print table of contents entries to .toc
% Based on
% 
http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents

% Pointed to by "Thomas Morley"
#(define (oly:create-toc-file layout pages)
   (let*
((label-table (ly:output-def-lookup layout 'label-page-table))
 (toc-items (toc-items)))
(if (not (null? label-table))
(let*
 ( ;; We need a page-offset so entries are offset to begin 
with p.1

   ;; (for use in \includepdf)
  (page-offset (- (ly:output-def-lookup layout 
'first-page-number) 1))

  (format-line
   (lambda (toc-item)
 (let*
  ((label (car toc-item))
   (text  (caddr toc-item))
   (page (- (assoc-ref label-table label) page-offset)))
  (format #f "~a,subsection,2,{~a},~a" page text label
  (formatted-toc-items (map format-line toc-items))
  (whole-string (string-join formatted-toc-items ",\n"))
  (output-name (ly:parser-output-name))
  (outfilename (format "~a.toc" output-name))
  (outfile (open-output-file outfilename)))
 (if (output-port? outfile)
 (display whole-string outfile)
 (ly:warning (_ "Unable to open output file ~a for the 
TOC information") outfilename))

 (close-output-port outfile)

page-offset calculates the offset of the first-page-number versus '1' 
and subtracts that from the actual page number of the TOC entry. That 
means when your score starts on page 16 a TOC item on the third page 
of the score will still get a TOC entry with page 3, and \includepdf 
will generate the appropriate TOC entry in the enclosing LaTeX 
document.


I get an error:

Drawing systemsbrani.ly:35:23: In procedure - in expression (- 
(assoc-ref label-table label) page-offset):

brani.ly:35:23: Wrong type argument in position 1: #f

The offending line is:

(page (- (assoc-ref label-table label) page-offset)))




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Make TOC entries available to LaTeX

2018-05-24 Thread Federico Bruni



Il giorno gio 24 mag 2018 alle 18:22, Urs Liska  
ha scritto:



Am 24. Mai 2018 14:55:37 MESZ schrieb Federico Bruni 
:



Il giorno gio 24 mag 2018 alle 9:09, Urs Liska 


ha scritto:



 Am 24.05.2018 um 08:52 schrieb Federico Bruni:



 Il giorno gio 26 apr 2018 alle 8:48, Urs Liska
  ha scritto:

 [...]


 3)
 I think the inclusion in the TeX TOC can (now?) be done in a
 simpler way
 using the catchfile package:

 \documentclass{article}
 \usepackage{pdfpages,catchfile}
 \newcommand\includelilypond[1]{%
\begingroup
  \CatchFileDef\currentlilypondtoc{#1.toc}{}



\edef\x{\noexpand\includepdf[pages=-,addtotoc={\currentlilypondtoc}]{#1.pdf}}


 
\expandafter\endgroup\x
 }
 \begin{document}
 \tableofcontents
 \includelilypond{test}
 \end{document}


 (Answer from


https://tex.stackexchange.com/questions/428239/merge-in-manual-toc-entries-in-a-lualatex-document)


 

 There's only one issue: The TOC will create wrong entries when
 LilyPond's
 first page number is not 1. So there should actually be an 
offset



 in place.
 How can I read the value of the first-page-number variable to 
set



 up this
 offset?

 page-post-process has the layout-variable.
 (ly:output-def-lookup layout 'first-page-number) should do the
 trick.


 Thanks, this works.
 What do you think: this example code is much easier to understand
 than the one currently in the manual. Should I propose an 
update?




 +1 for the update!

 Urs, can you show a minimal example using the first-page-number?


 This is the function as it ended up in my project files:

 % Print table of contents entries to .toc
 % Based on
 %


http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents

 % Pointed to by "Thomas Morley"
 #(define (oly:create-toc-file layout pages)
(let*
 ((label-table (ly:output-def-lookup layout 'label-page-table))
  (toc-items (toc-items)))
 (if (not (null? label-table))
 (let*
  ( ;; We need a page-offset so entries are offset to begin
 with p.1
;; (for use in \includepdf)
   (page-offset (- (ly:output-def-lookup layout
 'first-page-number) 1))
   (format-line
(lambda (toc-item)
  (let*
   ((label (car toc-item))
(text  (caddr toc-item))
(page (- (assoc-ref label-table label) 
page-offset)))

   (format #f "~a,subsection,2,{~a},~a" page text

label

   (formatted-toc-items (map format-line toc-items))
   (whole-string (string-join formatted-toc-items ",\n"))
   (output-name (ly:parser-output-name))
   (outfilename (format "~a.toc" output-name))
   (outfile (open-output-file outfilename)))
  (if (output-port? outfile)
  (display whole-string outfile)
  (ly:warning (_ "Unable to open output file ~a for the
 TOC information") outfilename))
  (close-output-port outfile)

 page-offset calculates the offset of the first-page-number versus 
'1'


 and subtracts that from the actual page number of the TOC entry. 
That


 means when your score starts on page 16 a TOC item on the third 
page
 of the score will still get a TOC entry with page 3, and 
\includepdf

 will generate the appropriate TOC entry in the enclosing LaTeX
 document.


 How do you use it all the above in combination with lyluatex?


 I think this should be transparent. lyluatex will assign an 
arbitrary



 first page number (i.e. the page it assumes the score will start),
 then the above function will offset the TOC entries to be based on
 "1", and \includepdf will translate them back to whatever page
 they'll *actually* happen to be on in the end.



Thanks for the detailed explanation.

However, I cannot make it work with lyluatex.
You wrote that you wanted to use lyluatex to include the lilypond 
file

(not the PDF), in order to use the cache system.


I'm not sure this is what you need, but you should look up raw-pdf 
and the section about wrapping commands in the manual.


the
urs


I've read the sections "Providing raw filenames" and "Wrapping Raw PDF 
Filenames" of lyluatex manual and I'm still scratching my head...

Nevermind, I'll use the \includelilypond command of the Usage manual.












___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: check undefined variable scheme

2018-05-24 Thread Gianmaria Lari
Thank you David, Urs and Andrew for the code, the link to the documentation
and the study suggestion!

On Thu, 24 May 2018 at 11:00, Andrew Bernard 
wrote:

> Hi Gianmaria,
>
> The others have beat me to it, but I just wanted to say you should read up
> on closures in Scheme. This will give you are really good grasp of what's
> going on.
>
>
> Andrew
>
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lilypond and Frescobaldi on Fedora 28

2018-05-24 Thread Martin Tarenskeen



On Thu, 24 May 2018, Federico Bruni wrote:


Hi Martin

This has been fixed now, right? (I haven't upgraded to 28 yet)

https://bugzilla.redhat.com/show_bug.cgi?id=1568274


Yes, it's working again :-)


Il giorno dom 6 mag 2018 alle 12:10, Martin Tarenskeen



 Official Fedora 28 version of lilypond 2.19.81 is currently broken. (I
 hope a fix will be found soon)


MT

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Spacing isues in polymetric music

2018-05-24 Thread Ebo H
I am trying to typeset a piece that includes a repeating part that loops 
independently of the other music. I have been partially successful using the 
documentation relating to polymetric music (see example_one.ly which, hopefully 
communicates the musical idea that I am hoping to achieve). This feels like a 
bit of a hack though; if I leave 'Default_bar_line_engraver' out of the bottom 
Staff context bar-lines print as I need, but if I remove it explicitly the 
output is incoherent; if I implicitly include it with "\consists" barlines are 
drawn at seemingly unprecitable locations.
The biggest problems I have, however, are spacing issues (apparent at the 
bar-lines in example_one.ly) that become much more obvious as soon as the music 
becomes more complex (see example_two.ly).

Is there a way to have a staff with note spacing that is independent of the 
others in the same staff group?

Thanks again to the list for the freely offered expertise and thank you to 
Torsten for your help solving my issue with custom glyphs - I do not seem to 
receive direct email notifications from the list (yes, I have checked my junk 
mail) and it seems inappropriate to clutter the list with new 'thank you' 
threads.

Cheers,
delboh

%%% spacing in unmetered staves example
\version "2.19.81"
\include "english.ly"

global = { \numericTimeSignature \time 4/4 }

staffOne = \relative c'{ 
   c4 f g a |
   c f g a | 
   a1~ | 1  
  
}
staffTwo = \relative c { \clef bass
   c2 g'  |
   a4 g4 c,2 |
   a1~ | a1-. |
}
staffLoop =  \relative c'' { 
  \time 10/4
  \bar ".|:"  b4 c d e f g f e d c \bar ":|."
  s4^\markup "ad lib. D.C. al fine" s4
  s1 \bar "|"
}

\score {
  \new StaffGroup
  <<
\new Staff << \staffOne   \global >>
\new Staff << \staffTwo   \global >>
\new Staff \with{
\consists "Timing_translator"
%\consists "Default_bar_line_engraver"
%\remove "Default_bar_line_engraver"
\remove "Time_signature_engraver"
\remove "Clef_engraver"
\hide Stem } \staffLoop
  >>
  \layout {
  \context {
\Score
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
  }
  \context {
\Staff
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
  }
}
}%%% spacing in unmetered staves example
\version "2.19.81"
\include "english.ly"

global = { \numericTimeSignature }

staffOne = \relative c'{ 
 \time 4/4 c16 f g a c4 g e |
 \time 7/4 r2 r4 a32 g f c f16 g a8 c f4 g | 
 \time 4/4 a1~ | 1  
  
}
staffTwo = \relative c { \clef bass
 \time 4/4 c2 g'  |
 \time 7/4 a2. g4 c,2. |
 \time 4/4 a1~ | a1-. |
}
staffLoop =  \relative c'' { 
  \time 10/4
  \bar ".|:"  b4 c d e f g f e d c \bar ":|."
  s4^\markup "ad lib. D.C. al fine"
  s1*2  \bar "|"
}

\score {
  \new StaffGroup
  <<
\new Staff << \staffOne   \global >>
\new Staff << \staffTwo   \global >>
\new Staff \with{
\consists "Timing_translator"
%\consists "Default_bar_line_engraver"
%\remove "Default_bar_line_engraver"
\remove "Time_signature_engraver"
\remove "Clef_engraver"
\hide Stem } \staffLoop
  >>
  \layout {
  \context {
\Score
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
  }
  \context {
\Staff
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
  }
}
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Parenthesis/bracket/brace questions

2018-05-24 Thread Thomas Morley
2018-05-21 17:09 GMT+02:00 Thomas Morley :
> 2018-05-21 15:03 GMT+02:00 Brent Annable :

>> On a side note, in my searches I noticed it's now possible to define
>> different barline types, and the bracket type looks like it would also do
>> the job very well here... [...]
>> (there seems to be some weird spanning behaviour
>> too):
>>
>> \version "2.19.65"
>>
>> \defineBarLine "[" #'("" "[" ".")
>> \defineBarLine "]" #'("]" "" ".")
>>
>> upper = {
>>   c''4 \bar "[" 4 4 \bar "]" 4
>> }
>>
>> lower = {
>>   \clef bass
>>   c4 4 4 4
>> }
>>
>> \score {
>>   \new PianoStaff <<
>> \new Staff {
>>   \upper
>> }
>> \new Staff {
>>   \lower
>> }
>>   >>
>> }
>>
>> Any ideas? I'm stumped.
>>
>> Brent.
>
> Hi Brent,
>
> (1)
> thanks for spotting a bug in the definition of `make-bracket-bar-line'.
> It will need further testings, before I can think of putting up a
> patch, but I propose the fix below:
>

patch is up:
https://sourceforge.net/p/testlilyissues/issues/5329/

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Format LilyMusic as string

2018-05-24 Thread Urs Liska

Hi Jan-Peter,

thanks for that. This was indeed the issue, and -- now knowing it -- I 
can even understand the description in the reference ;-)



Am 24.05.2018 um 17:44 schrieb Jan-Peter Voigt:

ah, and you don't need o #{#}:


... you don't even need the music-function:

lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
    (lambda () (display-lily-music mus))
    ))
test = \lilystring \relative { c'4 }
#(display test)



lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
    (lambda () (displayLilyMusic mus))
    ))
test = \lilystring \relative { c'4 }
#(display test)


Am 24.05.2018 um 17:42 schrieb Jan-Peter Voigt:

lilystring =
#(define-scheme-function (mus)(ly:music?)
    (with-output-to-string
 (lambda () #{ \displayLilyMusic #mus #})
 ))
test = \lilystring \relative { c'4 }
#(display test)



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: System start delimiter for single staff

2018-05-24 Thread David Kastrup
Andrew Bernard  writes:

>> On 25 May 2018 at 01:21, David Kastrup  wrote:
>>
>>>
>>> This is stupid but
>
> Hi David,
>
> Thanks very much. This is exactly what is needed. It was the
> collapse-height concept that I was missing.
>
> This works well. Can you explain in what respect you designate this as
> stupid? It's certainly non-standard practice, but I find it is better to
> accede to these requests from my colleague than argue him out of it!

It's typographic nonsense since it puts a hard visual division at a
point where it does not belong.  This is a lot more obtrusive than a
double bar and is supposed to mean less than a double bar.  It makes it
much harder to visually find a matching repeat sign because the page is
littered with thick bars.

It makes it harder to follow a melody line since the first thing on the
next line is the fat line hitting you in the face.

Musical typography had not developed arbitrary.  Since people are used
to common practice, you need an excellent reason to diverge from it.
What your colleague does, however, is not an improvement but rather a
detraction.

That's why I call it stupid.  LilyPond can be made to do stupid things
as well, of course.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Make TOC entries available to LaTeX

2018-05-24 Thread Urs Liska


Am 24. Mai 2018 14:55:37 MESZ schrieb Federico Bruni :
>
>
>Il giorno gio 24 mag 2018 alle 9:09, Urs Liska  
>ha scritto:
>> 
>> 
>> Am 24.05.2018 um 08:52 schrieb Federico Bruni:
>>> 
>>> 
>>> Il giorno gio 26 apr 2018 alle 8:48, Urs Liska 
>>>  ha scritto:
> [...]
> 
>> 3)
>> I think the inclusion in the TeX TOC can (now?) be done in a 
>> simpler way
>> using the catchfile package:
>> 
>> \documentclass{article}
>> \usepackage{pdfpages,catchfile}
>> \newcommand\includelilypond[1]{%
>>\begingroup
>>  \CatchFileDef\currentlilypondtoc{#1.toc}{}
>> 
>>
>\edef\x{\noexpand\includepdf[pages=-,addtotoc={\currentlilypondtoc}]{#1.pdf}}
>
>> 
>>\expandafter\endgroup\x
>> }
>> \begin{document}
>> \tableofcontents
>> \includelilypond{test}
>> \end{document}
>> 
>> 
>> (Answer from
>>
>https://tex.stackexchange.com/questions/428239/merge-in-manual-toc-entries-in-a-lualatex-document)
>
>> 
>> 
>> There's only one issue: The TOC will create wrong entries when 
>> LilyPond's
>> first page number is not 1. So there should actually be an offset
>
>> in place.
>> How can I read the value of the first-page-number variable to set
>
>> up this
>> offset?
> page-post-process has the layout-variable.
> (ly:output-def-lookup layout 'first-page-number) should do the 
> trick.
 
 Thanks, this works.
 What do you think: this example code is much easier to understand 
 than the one currently in the manual. Should I propose an update?
 
>>> 
>>> +1 for the update!
>>> 
>>> Urs, can you show a minimal example using the first-page-number?
>> 
>> This is the function as it ended up in my project files:
>> 
>> % Print table of contents entries to .toc
>> % Based on
>> % 
>>
>http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents
>> % Pointed to by "Thomas Morley"
>> #(define (oly:create-toc-file layout pages)
>>(let*
>> ((label-table (ly:output-def-lookup layout 'label-page-table))
>>  (toc-items (toc-items)))
>> (if (not (null? label-table))
>> (let*
>>  ( ;; We need a page-offset so entries are offset to begin 
>> with p.1
>>;; (for use in \includepdf)
>>   (page-offset (- (ly:output-def-lookup layout 
>> 'first-page-number) 1))
>>   (format-line
>>(lambda (toc-item)
>>  (let*
>>   ((label (car toc-item))
>>(text  (caddr toc-item))
>>(page (- (assoc-ref label-table label) page-offset)))
>>   (format #f "~a,subsection,2,{~a},~a" page text
>label
>>   (formatted-toc-items (map format-line toc-items))
>>   (whole-string (string-join formatted-toc-items ",\n"))
>>   (output-name (ly:parser-output-name))
>>   (outfilename (format "~a.toc" output-name))
>>   (outfile (open-output-file outfilename)))
>>  (if (output-port? outfile)
>>  (display whole-string outfile)
>>  (ly:warning (_ "Unable to open output file ~a for the 
>> TOC information") outfilename))
>>  (close-output-port outfile)
>> 
>> page-offset calculates the offset of the first-page-number versus '1'
>
>> and subtracts that from the actual page number of the TOC entry. That
>
>> means when your score starts on page 16 a TOC item on the third page 
>> of the score will still get a TOC entry with page 3, and \includepdf 
>> will generate the appropriate TOC entry in the enclosing LaTeX 
>> document.
>> 
>>> How do you use it all the above in combination with lyluatex?
>> 
>> I think this should be transparent. lyluatex will assign an arbitrary
>
>> first page number (i.e. the page it assumes the score will start), 
>> then the above function will offset the TOC entries to be based on 
>> "1", and \includepdf will translate them back to whatever page 
>> they'll *actually* happen to be on in the end.
>> 
>
>Thanks for the detailed explanation.
>
>However, I cannot make it work with lyluatex.
>You wrote that you wanted to use lyluatex to include the lilypond file 
>(not the PDF), in order to use the cache system.

I'm not sure this is what you need, but you should look up raw-pdf and the 
section about wrapping commands in the manual.

the
urs

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: System start delimiter for single staff

2018-05-24 Thread Andrew Bernard
Hi David,

Thanks very much. This is exactly what is needed. It was the
collapse-height concept that I was missing.

This works well. Can you explain in what respect you designate this as
stupid? It's certainly non-standard practice, but I find it is better to
accede to these requests from my colleague than argue him out of it!

Andrew



On 25 May 2018 at 01:21, David Kastrup  wrote:

>
> This is stupid but
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Simple solution for combining an odd number of parts

2018-05-24 Thread crimsonsunrise
Resending due to blocking again.

 Mensagem Original 
Ativo 24 de mai de 2018 12:04, Karlin High escreveu:

On 5/24/2018 9:56 AM, crimsonsunr...@protonmail.com wrote:
> Resending with links to the images.
>
> First case https://spee.ch/c/IMG20180524055531857.jpeg
>
> Similar case but with only two parts
> https://spee.ch/2/IMG20180524055635195.jpeg
>
>  Mensagem Original 
> Ativo 24 de mai de 2018 06:04, escreveu:
>
> I'll provide some pictures, since I don't have access to a scanner right
> now.
> First picture starts with only a3 playing, then the offending line in
> question happens on the third measure.
>
> Second is another example of some of the things this score also has,
> like divisi on one voice that shares the same timing of another combined
> voice in the same staff.
>
> For reference, th piece is Jim Curnow's arrangement on Fanfarre Prelude
> on "Ode to Joy"

Those images should be helpful.

However, I don't have expertise with orchestral works and have travel
plans for the rest of the week. I'll have to bow out of this one and
leave it for my betters on the list.
--
Karlin High
Missouri, USA___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Format LilyMusic as string

2018-05-24 Thread Jan-Peter Voigt

ah, and you don't need o #{#}:

lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
(lambda () (displayLilyMusic mus))
))
test = \lilystring \relative { c'4 }
#(display test)


Am 24.05.2018 um 17:42 schrieb Jan-Peter Voigt:

lilystring =
#(define-scheme-function (mus)(ly:music?)
    (with-output-to-string
     (lambda () #{ \displayLilyMusic #mus #})
     ))
test = \lilystring \relative { c'4 }
#(display test)



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Format LilyMusic as string

2018-05-24 Thread Jan-Peter Voigt

Hi Urs,

I guess you are missing the wrapping lambda:

lilystring =
#(define-scheme-function (mus)(ly:music?)
   (with-output-to-string
(lambda () #{ \displayLilyMusic #mus #})
))
test = \lilystring \relative { c'4 }
#(display test)

HTH
Jan-Peter

Am 24.05.2018 um 17:33 schrieb Urs Liska:
I have a ly:music? argument and want to store the LilyPond 
representation as a string, that is I want to have a string with the 
content that \displayLilyMusic prints to the console.


 From what I know I have to provide a port to which \displayLilyMusic's 
output is redirected and that I can then store. But For some reason 
(well, that includes the "conciseness" of the Guile reference manual 
...) I don't get it done.



\version "2.19.80"
#(define format-ly-music (mus)
   (dont-know-what-to-do-here))

#(define my-var (format-ly-music #{ c' #}))

looks like a MWE for what I need.
 From the reference I would have thought that call-with-output-string 
would be what I need, but I don't get it to work as it complains about 
the "unspecified" argument.


Any pointers?
Thanks in advance
Urs

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: System start delimiter for single staff

2018-05-24 Thread David Kastrup
David Kastrup  writes:

> Andrew Bernard  writes:
>
>> I am attempting to make MS paper for a colleague who idiosyncratically
>> uses a thick bar at the left on single staves. This is simple for a
>> staff group, but how does one do it for a single ungrouped set of
>> staves? Refer to attached sketch.
>
> This is stupid but
>
> \new Staff \with {
>   \consists "System_start_delimiter_engraver"
>   systemStartDelimiter = #'SystemStartBar
>   \override SystemStartBar.collapse-height = 0
>   \override SystemStartBar.thickness = 5
> }
> {
>   \bar "|."
>   c'1
> }

Uh, remove \bar "|." here: it was just an experiment.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Format LilyMusic as string

2018-05-24 Thread Urs Liska
I have a ly:music? argument and want to store the LilyPond 
representation as a string, that is I want to have a string with the 
content that \displayLilyMusic prints to the console.


From what I know I have to provide a port to which \displayLilyMusic's 
output is redirected and that I can then store. But For some reason 
(well, that includes the "conciseness" of the Guile reference manual 
...) I don't get it done.



\version "2.19.80"
#(define format-ly-music (mus)
  (dont-know-what-to-do-here))

#(define my-var (format-ly-music #{ c' #}))

looks like a MWE for what I need.
From the reference I would have thought that call-with-output-string 
would be what I need, but I don't get it to work as it complains about 
the "unspecified" argument.


Any pointers?
Thanks in advance
Urs

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: System start delimiter for single staff

2018-05-24 Thread David Kastrup
Andrew Bernard  writes:

> I am attempting to make MS paper for a colleague who idiosyncratically
> uses a thick bar at the left on single staves. This is simple for a
> staff group, but how does one do it for a single ungrouped set of
> staves? Refer to attached sketch.

This is stupid but

\new Staff \with {
  \consists "System_start_delimiter_engraver"
  systemStartDelimiter = #'SystemStartBar
  \override SystemStartBar.collapse-height = 0
  \override SystemStartBar.thickness = 5
}
{
  \bar "|."
  c'1
}
-- 
David Kastrup
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


System start delimiter for single staff

2018-05-24 Thread Andrew Bernard
I am attempting to make MS paper for a colleague who idiosyncratically uses
a thick bar at the left on single staves. This is simple for a staff group,
but how does one do it for a single ungrouped set of staves? Refer to
attached sketch.

Andrew
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Simple solution for combining an odd number of parts

2018-05-24 Thread Karlin High

On 5/24/2018 9:56 AM, crimsonsunr...@protonmail.com wrote:

Resending with links to the images.

First case https://spee.ch/c/IMG20180524055531857.jpeg

Similar case but with only two parts
https://spee.ch/2/IMG20180524055635195.jpeg

 Mensagem Original 
Ativo 24 de mai de 2018 06:04, < crimsonsunr...@protonmail.com> escreveu:

I'll provide some pictures, since I don't have access to a scanner right 
now.
First picture starts with only a3 playing, then the offending line in 
question happens on the third measure.


Second is another example of some of the things this score also has, 
like divisi on one voice that shares the same timing of another combined 
voice in the same staff.


For reference, th piece is Jim Curnow's arrangement on Fanfarre Prelude 
on "Ode to Joy"


Those images should be helpful.

However, I don't have expertise with orchestral works and have travel 
plans for the rest of the week. I'll have to bow out of this one and 
leave it for my betters on the list.

--
Karlin High
Missouri, USA

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Website down?

2018-05-24 Thread Phil Holmes
Now back up.

--
Phil Holmes


  - Original Message - 
  From: Brent Annable 
  To: Aaron Hill 
  Cc: lilypond-user 
  Sent: Thursday, May 24, 2018 6:17 AM
  Subject: Re: Website down?


  Ok thanks Aaron :-)


  Brent.


  On 24 May 2018 at 15:16, Aaron Hill  wrote:

On 2018-05-23 21:40, Brent Annable wrote:

  Hey all,

  Is the Lilypond website down right now? I can't access lilypond.org, the
  manual or the internals reference from either my laptop or my phone, I get
  the following message:

  Internal Server Error

  The server encountered an internal error or misconfiguration and was 
unable
  to complete your request.

  Please contact the server administrator at [no address given] to inform
  them of the time this error occurred, and the actions you performed just
  before this error.

  More information about this error may be available in the server error 
log.
  --
  Apache/2.4.18 (Ubuntu) Server at lilypond.org Port 80


  Was there planned maintenance or something?


It's been down for most of the day.  Karlin mentioned that archive.org has 
most of the site available in the meantime:

https://web.archive.org/web/20180516024136/http://lilypond.org/

I haven't seen any other announcements or status updates, so I take it the 
server admin is not on this list.

-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user





--


  ___
  lilypond-user mailing list
  lilypond-user@gnu.org
  https://lists.gnu.org/mailman/listinfo/lilypond-user
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Make TOC entries available to LaTeX

2018-05-24 Thread Federico Bruni



Il giorno gio 24 mag 2018 alle 9:09, Urs Liska  
ha scritto:



Am 24.05.2018 um 08:52 schrieb Federico Bruni:



Il giorno gio 26 apr 2018 alle 8:48, Urs Liska 
 ha scritto:

[...]


3)
I think the inclusion in the TeX TOC can (now?) be done in a 
simpler way

using the catchfile package:

\documentclass{article}
\usepackage{pdfpages,catchfile}
\newcommand\includelilypond[1]{%
   \begingroup
 \CatchFileDef\currentlilypondtoc{#1.toc}{}

\edef\x{\noexpand\includepdf[pages=-,addtotoc={\currentlilypondtoc}]{#1.pdf}} 


   \expandafter\endgroup\x
}
\begin{document}
\tableofcontents
\includelilypond{test}
\end{document}


(Answer from
https://tex.stackexchange.com/questions/428239/merge-in-manual-toc-entries-in-a-lualatex-document) 



There's only one issue: The TOC will create wrong entries when 
LilyPond's
first page number is not 1. So there should actually be an offset 
in place.
How can I read the value of the first-page-number variable to set 
up this

offset?

page-post-process has the layout-variable.
(ly:output-def-lookup layout 'first-page-number) should do the 
trick.


Thanks, this works.
What do you think: this example code is much easier to understand 
than the one currently in the manual. Should I propose an update?




+1 for the update!

Urs, can you show a minimal example using the first-page-number?


This is the function as it ended up in my project files:

% Print table of contents entries to .toc
% Based on
% 
http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents

% Pointed to by "Thomas Morley"
#(define (oly:create-toc-file layout pages)
   (let*
((label-table (ly:output-def-lookup layout 'label-page-table))
 (toc-items (toc-items)))
(if (not (null? label-table))
(let*
 ( ;; We need a page-offset so entries are offset to begin 
with p.1

   ;; (for use in \includepdf)
  (page-offset (- (ly:output-def-lookup layout 
'first-page-number) 1))

  (format-line
   (lambda (toc-item)
 (let*
  ((label (car toc-item))
   (text  (caddr toc-item))
   (page (- (assoc-ref label-table label) page-offset)))
  (format #f "~a,subsection,2,{~a},~a" page text label
  (formatted-toc-items (map format-line toc-items))
  (whole-string (string-join formatted-toc-items ",\n"))
  (output-name (ly:parser-output-name))
  (outfilename (format "~a.toc" output-name))
  (outfile (open-output-file outfilename)))
 (if (output-port? outfile)
 (display whole-string outfile)
 (ly:warning (_ "Unable to open output file ~a for the 
TOC information") outfilename))

 (close-output-port outfile)

page-offset calculates the offset of the first-page-number versus '1' 
and subtracts that from the actual page number of the TOC entry. That 
means when your score starts on page 16 a TOC item on the third page 
of the score will still get a TOC entry with page 3, and \includepdf 
will generate the appropriate TOC entry in the enclosing LaTeX 
document.



How do you use it all the above in combination with lyluatex?


I think this should be transparent. lyluatex will assign an arbitrary 
first page number (i.e. the page it assumes the score will start), 
then the above function will offset the TOC entries to be based on 
"1", and \includepdf will translate them back to whatever page 
they'll *actually* happen to be on in the end.




Thanks for the detailed explanation.

However, I cannot make it work with lyluatex.
You wrote that you wanted to use lyluatex to include the lilypond file 
(not the PDF), in order to use the cache system.





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Jan-Peter Voigt

Hi Urs,

Am 24.05.2018 um 12:29 schrieb Urs Liska:
...


Well, with the above changes (where the first was a real issue of 
understanding and the other two just glitches) the MWE works as 
expected. Unfortunately it doesn't seem to work in the real-world 
context. The log still only reports the creation of Score contexts. I'm 
now using

     (list 'assign 'edition-id (list 'ICEID part))
to insert the edition-id (where part is a symbol identifying the current 
part).

The log reports
     (masses three kyrie Score A) ""
lines for each of the movements(scores).

...

in you MWE you assigned the Score-editionID in a global layout block. If 
you there are multiple scores in one compilation they will all receive 
the same editionID. You can either use \new Score \with { \editionID 
movmtpath } or use a layout-block inside: \score{ \layout { \editionID 
... } }. Though I have once tested the second pattern - it should work - 
but I have only tested the first one.


You know that I use my own templating framework 
(https://github.com/openlilylib/lalily-templates). There is a lot of 
code dealing with those issues.


HTH
Jan-Peter

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: TextSpanner: Change text at automatic line break?

2018-05-24 Thread James Harkins
On May 22, 2018 10:51:12 Kieren MacMillan  
wrote:


You should look at David N's incredible spanner-with-inner-texts (or 
similarly named) — I'm pretty sure it’ll do all that (and more).


Aha -- that just might be the droid I'm looking for. Will search.

Thanks!
James

Sent with AquaMail for Android
http://www.aqua-mail.com




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Urs Liska

Hi Jan-Peter,

thanks for the clarifications.


Am 24.05.2018 um 12:05 schrieb Jan-Peter Voigt:

Hi Urs,

here we have three problems:
1. The symbol 'ICEID is a magic token to inherit the edition-id of the 
parent context, so you don't need to add the base path here.


OK, I wasn't really clear about that.

2. \editionID creates a symbol-list, but the name is a string, so you 
have to turn it into a symbol, if you want to use it there.


Yes, I had noticed that too in the meantime.

3. In your MWE you add the editionID to the Staff and not the Score. 
So you can't address compile.with.Score here.


Oh. Stupid mistake.



I quickly adapted your example:

%%%
\version "2.19.80"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\consistToContexts #edition-engraver Score.Staff.Voice

\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff \once \override 
NoteHead.color = #red
\editionMod part 1 1/4 compile.with.Score \once \override 
NoteHead.color = #red


makeStaff =
#(define-music-function (name content)(string? ly:music?)
   ;#{
   ;  \new Staff = $name \with { \editionID #(list (string->symbol 
name)) } { #content }

   ;#})
% {
 (make-music
  'ContextSpeccedMusic 'create-new #t
  'property-operations
  (list
   (list 'assign 'edition-id (list 'ICEID (string->symbol name))) )
  'context-id name 'context-type 'Staff
  'element content))
%}
\displayMusic \makeStaff "hello-staff" { c' d' }

\layout {
  \context {
    \Score
    \editionID ##f compile.with
  }
}
%%%


Well, with the above changes (where the first was a real issue of 
understanding and the other two just glitches) the MWE works as 
expected. Unfortunately it doesn't seem to work in the real-world 
context. The log still only reports the creation of Score contexts. I'm 
now using

    (list 'assign 'edition-id (list 'ICEID part))
to insert the edition-id (where part is a symbol identifying the current 
part).

The log reports
    (masses three kyrie Score A) ""
lines for each of the movements(scores).



BTW you should reconsider using #{ ... #}. It is semantically the same 
and is much easier to read.


Hm, this is part of a pretty complex structure where I have come to find 
the nesting and referencing of Scheme procedures pretty adequate (see 
https://git.openlilylib.org/bfsc/kayser/blob/master/includes/lib/make-staff.ily#L132 
for the state prior to my current attempts).


Best
Urs



HTH
Jan-Peter




Am 24.05.2018 um 11:35 schrieb Urs Liska:

This is a -- similar -- MWE:

\version "2.19.80"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\consistToContexts #edition-engraver Score.Staff.Voice

makeStaff =
#(define-music-function (name content)(string? ly:music?)
  (make-music
   'ContextSpeccedMusic 'create-new #t
   'property-operations
   (list
    (list 'assign 'edition-id (append '(ICEID compile with) (list 
name

   'context-id name 'context-type 'Staff
   'element content))

\makeStaff "hello-staff" { c' d' }

\layout {
   \context {
 \Staff
 \editionID ##f compile.with
   }
}

\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff.A \once 
\override NoteHead.color = #red
\editionMod part 1 0/4 compile.with.Score.A \once \override 
NoteHead.color = #red


However, in this case it seems *both* mods won't have any effect ...

Urs

Am 24.05.2018 um 11:17 schrieb Urs Liska:
I'm trying to "install" the edition engraver in a programmatically 
generated score construction.


I have this code somewhere in the function to create a score:

  (ly:score-add-output-def! score
    #{
  \layout {
    \context {
  \Score
  #(editionID #f movement-path)
    }
  }
    #})

where movement-path is a symbol list identifying the current 
movement's score, e.g. #'(masses three kyrie)


I know this is working because the page-layout openLilyLib package 
properly uses that successfully. So I know each score has its own 
edition-id.


Now in order to make it possible to use \editionMod and friends I 
need to add the \editionID to each staff. I tested


\displayMusic
\new Staff \with { \editionID test } { c' }

and got

(make-music
  'ContextSpeccedMusic
  'create-new
  #t
  'property-operations
  (list (list 'assign
  'edition-id
  (list (quote ICEID) (quote test
  'context-type
  'Staff
  'element
  (make-music
    'SequentialMusic
    'elements
    (list (make-music
    'NoteEvent
    'pitch
    (ly:make-pitch 0 0)
    'duration
    (ly:make-duration 2)

as a result.

So I thought I could inject the edition-id simply with

(list 'assign 'edition-id (append (list 'ICEID) path))

with 'path' being e.g. #'(masses 

Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Jan-Peter Voigt

Hi Urs,

here we have three problems:
1. The symbol 'ICEID is a magic token to inherit the edition-id of the 
parent context, so you don't need to add the base path here.
2. \editionID creates a symbol-list, but the name is a string, so you 
have to turn it into a symbol, if you want to use it there.
3. In your MWE you add the editionID to the Staff and not the Score. So 
you can't address compile.with.Score here.


I quickly adapted your example:

%%%
\version "2.19.80"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\consistToContexts #edition-engraver Score.Staff.Voice

\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff \once \override 
NoteHead.color = #red
\editionMod part 1 1/4 compile.with.Score \once \override NoteHead.color 
= #red


makeStaff =
#(define-music-function (name content)(string? ly:music?)
   ;#{
   ;  \new Staff = $name \with { \editionID #(list (string->symbol 
name)) } { #content }

   ;#})
% {
 (make-music
  'ContextSpeccedMusic 'create-new #t
  'property-operations
  (list
   (list 'assign 'edition-id (list 'ICEID (string->symbol name))) )
  'context-id name 'context-type 'Staff
  'element content))
%}
\displayMusic \makeStaff "hello-staff" { c' d' }

\layout {
  \context {
\Score
\editionID ##f compile.with
  }
}
%%%

BTW you should reconsider using #{ ... #}. It is semantically the same 
and is much easier to read.


HTH
Jan-Peter




Am 24.05.2018 um 11:35 schrieb Urs Liska:

This is a -- similar -- MWE:

\version "2.19.80"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\consistToContexts #edition-engraver Score.Staff.Voice

makeStaff =
#(define-music-function (name content)(string? ly:music?)
  (make-music
   'ContextSpeccedMusic 'create-new #t
   'property-operations
   (list
    (list 'assign 'edition-id (append '(ICEID compile with) (list 
name

   'context-id name 'context-type 'Staff
   'element content))

\makeStaff "hello-staff" { c' d' }

\layout {
   \context {
     \Staff
     \editionID ##f compile.with
   }
}

\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff.A \once \override 
NoteHead.color = #red
\editionMod part 1 0/4 compile.with.Score.A \once \override 
NoteHead.color = #red


However, in this case it seems *both* mods won't have any effect ...

Urs

Am 24.05.2018 um 11:17 schrieb Urs Liska:
I'm trying to "install" the edition engraver in a programmatically 
generated score construction.


I have this code somewhere in the function to create a score:

  (ly:score-add-output-def! score
    #{
  \layout {
    \context {
  \Score
  #(editionID #f movement-path)
    }
  }
    #})

where movement-path is a symbol list identifying the current 
movement's score, e.g. #'(masses three kyrie)


I know this is working because the page-layout openLilyLib package 
properly uses that successfully. So I know each score has its own 
edition-id.


Now in order to make it possible to use \editionMod and friends I need 
to add the \editionID to each staff. I tested


\displayMusic
\new Staff \with { \editionID test } { c' }

and got

(make-music
  'ContextSpeccedMusic
  'create-new
  #t
  'property-operations
  (list (list 'assign
  'edition-id
  (list (quote ICEID) (quote test
  'context-type
  'Staff
  'element
  (make-music
    'SequentialMusic
    'elements
    (list (make-music
    'NoteEvent
    'pitch
    (ly:make-pitch 0 0)
    'duration
    (ly:make-duration 2)

as a result.

So I thought I could inject the edition-id simply with

(list 'assign 'edition-id (append (list 'ICEID) path))

with 'path' being e.g. #'(masses three kyrie violin-one)
This is the current version of that (sub-)function:

 ;; Create a named Staff context with the appropriate
 ;; context modifications.
 ;; content is a variable number of music expressions
 (make-staff
  (lambda (name . content)
    (make-music
 'ContextSpeccedMusic 'create-new #t
 'property-operations
 (list
  (list 'assign 'edition-id (append (list 'ICEID) path))
  (list 'assign 'instrumentName (car instrument-names))
  (list 'assign 'shortInstrumentName (cdr 
instrument-names))

  (list 'assign 'midiInstrument
    (getOption `(kayser instruments ,base-part 
midi-instrument)))
  (list 'assign 'instrumentTransposition 
transposition-from)

  frenched-score
  lyric-mods)
 'context-id name 'context-type 'Staff
 

Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread arnepe
hi Urs,

how about Voice or Score without ".A" - if applicable?
If I copy/paste your examples into oner of my own test MWE's this makes the
difference ...

cheers
Arne



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Programmatically inject an \editionID in a staff

2018-05-24 Thread Urs Liska

This is a -- similar -- MWE:

\version "2.19.80"

\include "oll-core/package.ily"
\loadPackage edition-engraver

\consistToContexts #edition-engraver Score.Staff.Voice

makeStaff =
#(define-music-function (name content)(string? ly:music?)
 (make-music
  'ContextSpeccedMusic 'create-new #t
  'property-operations
  (list
   (list 'assign 'edition-id (append '(ICEID compile with) (list name
  'context-id name 'context-type 'Staff
  'element content))

\makeStaff "hello-staff" { c' d' }

\layout {
  \context {
\Staff
\editionID ##f compile.with
  }
}

\addEdition part
\editionMod part 1 0/4 compile.with.hello-staff.Staff.A \once \override 
NoteHead.color = #red
\editionMod part 1 0/4 compile.with.Score.A \once \override NoteHead.color = 
#red

However, in this case it seems *both* mods won't have any effect ...

Urs

Am 24.05.2018 um 11:17 schrieb Urs Liska:
I'm trying to "install" the edition engraver in a programmatically 
generated score construction.


I have this code somewhere in the function to create a score:

  (ly:score-add-output-def! score
    #{
  \layout {
    \context {
  \Score
  #(editionID #f movement-path)
    }
  }
    #})

where movement-path is a symbol list identifying the current 
movement's score, e.g. #'(masses three kyrie)


I know this is working because the page-layout openLilyLib package 
properly uses that successfully. So I know each score has its own 
edition-id.


Now in order to make it possible to use \editionMod and friends I need 
to add the \editionID to each staff. I tested


\displayMusic
\new Staff \with { \editionID test } { c' }

and got

(make-music
  'ContextSpeccedMusic
  'create-new
  #t
  'property-operations
  (list (list 'assign
  'edition-id
  (list (quote ICEID) (quote test
  'context-type
  'Staff
  'element
  (make-music
    'SequentialMusic
    'elements
    (list (make-music
    'NoteEvent
    'pitch
    (ly:make-pitch 0 0)
    'duration
    (ly:make-duration 2)

as a result.

So I thought I could inject the edition-id simply with

(list 'assign 'edition-id (append (list 'ICEID) path))

with 'path' being e.g. #'(masses three kyrie violin-one)
This is the current version of that (sub-)function:

 ;; Create a named Staff context with the appropriate
 ;; context modifications.
 ;; content is a variable number of music expressions
 (make-staff
  (lambda (name . content)
    (make-music
 'ContextSpeccedMusic 'create-new #t
 'property-operations
 (list
  (list 'assign 'edition-id (append (list 'ICEID) path))
  (list 'assign 'instrumentName (car instrument-names))
  (list 'assign 'shortInstrumentName (cdr 
instrument-names))

  (list 'assign 'midiInstrument
    (getOption `(kayser instruments ,base-part 
midi-instrument)))
  (list 'assign 'instrumentTransposition 
transposition-from)

  frenched-score
  lyric-mods)
 'context-id name 'context-type 'Staff
 'element (make-simultaneous-music content

This works without warnings or errors but doesn't seem to work.

\addEdition part
\editionMod part 1 0/4 masses.three.kyrie.violin-one.Voice.A \once 
\override NoteHead.color = #red
\editionMod part 2 0/4 masses.three.kyrie.Score.A \once \override 
NoteHead.color = #red


Here only the second mod is applied (the one to Score.A), the mod to 
violin-one.Voice.A is ignored.


This is somewhat in line with the edition.log file which only reports a

 (masses three kyrie Score A) ""

context.

Does this information give any indication what I might be doing wrong? 
If I look at the definition of \editionID it doesn't give me any 
further hints.


TIA
Urs


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Programmatically inject an \editionID in a staff

2018-05-24 Thread Urs Liska
I'm trying to "install" the edition engraver in a programmatically 
generated score construction.


I have this code somewhere in the function to create a score:

  (ly:score-add-output-def! score
#{
  \layout {
\context {
  \Score
  #(editionID #f movement-path)
}
  }
#})

where movement-path is a symbol list identifying the current movement's 
score, e.g. #'(masses three kyrie)


I know this is working because the page-layout openLilyLib package 
properly uses that successfully. So I know each score has its own 
edition-id.


Now in order to make it possible to use \editionMod and friends I need 
to add the \editionID to each staff. I tested


\displayMusic
\new Staff \with { \editionID test } { c' }

and got

(make-music
  'ContextSpeccedMusic
  'create-new
  #t
  'property-operations
  (list (list 'assign
  'edition-id
  (list (quote ICEID) (quote test
  'context-type
  'Staff
  'element
  (make-music
    'SequentialMusic
    'elements
    (list (make-music
    'NoteEvent
    'pitch
    (ly:make-pitch 0 0)
    'duration
    (ly:make-duration 2)

as a result.

So I thought I could inject the edition-id simply with

(list 'assign 'edition-id (append (list 'ICEID) path))

with 'path' being e.g. #'(masses three kyrie violin-one)
This is the current version of that (sub-)function:

 ;; Create a named Staff context with the appropriate
 ;; context modifications.
 ;; content is a variable number of music expressions
 (make-staff
  (lambda (name . content)
(make-music
 'ContextSpeccedMusic 'create-new #t
 'property-operations
 (list
  (list 'assign 'edition-id (append (list 'ICEID) path))
  (list 'assign 'instrumentName (car instrument-names))
  (list 'assign 'shortInstrumentName (cdr instrument-names))
  (list 'assign 'midiInstrument
(getOption `(kayser instruments ,base-part 
midi-instrument)))
  (list 'assign 'instrumentTransposition transposition-from)
  frenched-score
  lyric-mods)
 'context-id name 'context-type 'Staff
 'element (make-simultaneous-music content

This works without warnings or errors but doesn't seem to work.

\addEdition part
\editionMod part 1 0/4 masses.three.kyrie.violin-one.Voice.A \once \override 
NoteHead.color = #red
\editionMod part 2 0/4 masses.three.kyrie.Score.A \once \override 
NoteHead.color = #red

Here only the second mod is applied (the one to Score.A), the mod to 
violin-one.Voice.A is ignored.


This is somewhat in line with the edition.log file which only reports a

 (masses three kyrie Score A) ""

context.

Does this information give any indication what I might be doing wrong? 
If I look at the definition of \editionID it doesn't give me any further 
hints.


TIA
Urs


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: check undefined variable scheme

2018-05-24 Thread Andrew Bernard
Hi Gianmaria,

The others have beat me to it, but I just wanted to say you should read up
on closures in Scheme. This will give you are really good grasp of what's
going on.


Andrew
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Simple solution for combining an odd number of parts

2018-05-24 Thread Aaron Hill

On 2018-05-24 01:42, crimsonsunr...@protonmail.com wrote:

There are no downloads available for Windows. The supposed link simply
returns a "not found" error.


When lilypond.org comes back online, you should be able to get the 
latest development version from http://lilypond.org/download/binaries.


Unfortunately, it seems linuxaudio.org is also returning 500 for its 
downloads, otherwise the other option is to download 2.19.80 which is 
the best version available on that mirror.


-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Simple solution for combining an odd number of parts

2018-05-24 Thread crimsonsunrise
Have no idea how to do that and the examples I've seen always involve an even 
number of voices.

 Mensagem Original 
Ativo 24 de mai de 2018 02:15, David Kastrup escreveu:

crimsonsunr...@protonmail.com writes:

> Setting all parts as parallel generates a lot of clashing note
> errors.

Are you using separate Voice contexts with differe \voiceXXX
orientation?

> Is there an easier way of dealing with this issue apart from waiting
> for 2.19?

I don't think that would help in this case anyway.

--
David Kastrup___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: check undefined variable scheme

2018-05-24 Thread Urs Liska



Am 24.05.2018 um 10:46 schrieb David Kastrup:

Urs Liska  writes:


Am 24.05.2018 um 09:56 schrieb Gianmaria Lari:

The following function increase a counter by 1 and return it as string

 #(define count 0)
 #(define (nextcount) (begin
                       (set! count (+ 1 count))
                       (number->string count)
                       )
    )

Is my code ok, or I should write it in a different way?

Two observations:
- You don't need that (begin ...) wrapper because the procedure
definition already behaves as such
- You shouldn't use reserved words for variable names, so I'd use
'counter' instead.

Is it possible to define "count" inside the function just in case it
is undefined?

Yes, see:

\version "2.19.80"

#(define (nextcount)
    (if (not (defined? 'counter)) (ly:parser-define! 'counter 0))
    (set! counter (+ 1 counter))
    (number->string counter)
    )

You actually don't need to define it externally:

 #(define nextcount
   (let ((counter 0))
(lambda ()
 (set! counter (1+ counter))
 (number->string counter

 $(nextcount)

 $(nextcount)

will work just fine.




Ah yes, that's more idiomatic and (thus) elegant.
Gianmaria, if you want to understand what's happening there read 
https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Closure.html#Closure



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Simple solution for combining an odd number of parts

2018-05-24 Thread crimsonsunrise
My case involves different rests that can and will clash on multiple voices, 
two voices sharing melodic lines with the same notes on different rhythms and 
empty rests introduce bar check errors and so on. Which is why I'm not 
providing examples.

 Mensagem Original 
Ativo 24 de mai de 2018 01:25, Karlin High escreveu:

On 5/23/2018 10:29 PM, crimsonsunr...@protonmail.com wrote:
> Is there an easier way of dealing with this issue apart from waiting for
> 2.19?

Tiny examples get better help.

Just to start the process:

% BEGIN LILYPOND CODE
\version "2.19.80"

trOne = { c'4 e' g' r }
trTwo = { c'4 e' r c'' }
trThree = { c'4 r g' c'' }

\score {
\new Staff \new Voice { \voiceOne \trOne }
\new Voice { \voiceTwo \trTwo }
\new Voice { \voiceThree \trThree }
>>

\layout { }
}
% END LILYPOND CODE

Easy way to try a 2.19 version, runs in browser:

--
Karlin High
Missouri, USA___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: check undefined variable scheme

2018-05-24 Thread David Kastrup
Urs Liska  writes:

> Am 24.05.2018 um 09:56 schrieb Gianmaria Lari:
>> The following function increase a counter by 1 and return it as string
>>
>> #(define count 0)
>> #(define (nextcount) (begin
>>                       (set! count (+ 1 count))
>>                       (number->string count)
>>                       )
>>    )
>>
>> Is my code ok, or I should write it in a different way?
>
> Two observations:
> - You don't need that (begin ...) wrapper because the procedure
> definition already behaves as such
> - You shouldn't use reserved words for variable names, so I'd use
> 'counter' instead.
>> Is it possible to define "count" inside the function just in case it
>> is undefined?
>
> Yes, see:
>
> \version "2.19.80"
>
> #(define (nextcount)
>    (if (not (defined? 'counter)) (ly:parser-define! 'counter 0))
>    (set! counter (+ 1 counter))
>    (number->string counter)
>    )

You actually don't need to define it externally:

#(define nextcount
  (let ((counter 0))
   (lambda ()
(set! counter (1+ counter))
(number->string counter

$(nextcount)

$(nextcount)

will work just fine.


-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Simple solution for combining an odd number of parts

2018-05-24 Thread crimsonsunrise
There are no downloads available for Windows. The supposed link simply returns 
a "not found" error.

 Mensagem Original 
Ativo 24 de mai de 2018 01:16, Andrew Bernard escreveu:

Why wait for 2.19? It's been stable for a long time. You would be unlikely to 
encounter bugs.

[Every time I encourage this people jump in a point out all the reasons why not 
to use it, but I hammer it hard all day with really complex scores and have no 
issues. I think it's wonderful.]

It's certainly available to try.

Andrew

On 24 May 2018 at 13:29,  wrote:

I'm currently work on reformatting a piece which has many of its instruments 
combined into a single staff in the conductor score. Problem is, at least two 
groups of instruments (trumpet and clarinet) are grouped in three, with parts 
that are played by 1,2 and 2,3, as well as parts that are only played by 1,2 or 
3. I searched on the issue a bit, and none of the solutions I found give the 
desired results. Chaining two \partcombine statements in a row produces a lot 
of error messages, warnings and wrong formatting in case of the former. Setting 
all parts as parallel generates a lot of clashing note errors. I have no idea 
what to do, other than give up on attempting to make the score look like the 
original and just do all the instrument parts as separate staves instead.

Is there an easier way of dealing with this issue apart from waiting for 2.19?

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: check undefined variable scheme

2018-05-24 Thread Urs Liska



Am 24.05.2018 um 09:56 schrieb Gianmaria Lari:

The following function increase a counter by 1 and return it as string

#(define count 0)
#(define (nextcount) (begin
                      (set! count (+ 1 count))
                      (number->string count)
                      )
   )

Is my code ok, or I should write it in a different way?


Two observations:
- You don't need that (begin ...) wrapper because the procedure 
definition already behaves as such
- You shouldn't use reserved words for variable names, so I'd use 
'counter' instead.
Is it possible to define "count" inside the function just in case it 
is undefined?


Yes, see:

\version "2.19.80"

#(define (nextcount)
   (if (not (defined? 'counter)) (ly:parser-define! 'counter 0))
   (set! counter (+ 1 counter))
   (number->string counter)
   )


#(ly:message "~a" (nextcount))
#(ly:message "~a" (nextcount))

HTH
Urs


Thank you, g.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


check undefined variable scheme

2018-05-24 Thread Gianmaria Lari
The following function increase a counter by 1 and return it as string

#(define count 0)
#(define (nextcount) (begin
  (set! count (+ 1 count))
  (number->string count)
  )
   )

Is my code ok, or I should write it in a different way?
Is it possible to define "count" inside the function just in case it is
undefined?

Thank you, g.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Make TOC entries available to LaTeX

2018-05-24 Thread Urs Liska



Am 24.05.2018 um 08:52 schrieb Federico Bruni:



Il giorno gio 26 apr 2018 alle 8:48, Urs Liska  
ha scritto:

[...]


3)
I think the inclusion in the TeX TOC can (now?) be done in a 
simpler way

using the catchfile package:

\documentclass{article}
\usepackage{pdfpages,catchfile}
\newcommand\includelilypond[1]{%
   \begingroup
 \CatchFileDef\currentlilypondtoc{#1.toc}{}

\edef\x{\noexpand\includepdf[pages=-,addtotoc={\currentlilypondtoc}]{#1.pdf}} 


   \expandafter\endgroup\x
}
\begin{document}
\tableofcontents
\includelilypond{test}
\end{document}


(Answer from
https://tex.stackexchange.com/questions/428239/merge-in-manual-toc-entries-in-a-lualatex-document) 



There's only one issue: The TOC will create wrong entries when 
LilyPond's
first page number is not 1. So there should actually be an offset 
in place.
How can I read the value of the first-page-number variable to set 
up this

offset?

page-post-process has the layout-variable.
(ly:output-def-lookup layout 'first-page-number) should do the trick.


Thanks, this works.
What do you think: this example code is much easier to understand 
than the one currently in the manual. Should I propose an update?




+1 for the update!

Urs, can you show a minimal example using the first-page-number?


This is the function as it ended up in my project files:

% Print table of contents entries to .toc
% Based on
% 
http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents
% Pointed to by "Thomas Morley"
#(define (oly:create-toc-file layout pages)
   (let*
((label-table (ly:output-def-lookup layout 'label-page-table))
 (toc-items (toc-items)))
(if (not (null? label-table))
(let*
 ( ;; We need a page-offset so entries are offset to begin with p.1
   ;; (for use in \includepdf)
  (page-offset (- (ly:output-def-lookup layout 'first-page-number) 1))
  (format-line
   (lambda (toc-item)
 (let*
  ((label (car toc-item))
   (text  (caddr toc-item))
   (page (- (assoc-ref label-table label) page-offset)))
  (format #f "~a,subsection,2,{~a},~a" page text label
  (formatted-toc-items (map format-line toc-items))
  (whole-string (string-join formatted-toc-items ",\n"))
  (output-name (ly:parser-output-name))
  (outfilename (format "~a.toc" output-name))
  (outfile (open-output-file outfilename)))
 (if (output-port? outfile)
 (display whole-string outfile)
 (ly:warning (_ "Unable to open output file ~a for the TOC 
information") outfilename))
 (close-output-port outfile)

page-offset calculates the offset of the first-page-number versus '1' 
and subtracts that from the actual page number of the TOC entry. That 
means when your score starts on page 16 a TOC item on the third page of 
the score will still get a TOC entry with page 3, and \includepdf will 
generate the appropriate TOC entry in the enclosing LaTeX document.



How do you use it all the above in combination with lyluatex?


I think this should be transparent. lyluatex will assign an arbitrary 
first page number (i.e. the page it assumes the score will start), then 
the above function will offset the TOC entries to be based on "1", and 
\includepdf will translate them back to whatever page they'll *actually* 
happen to be on in the end.


Partly related to that but actually for a different reason I have added 
an option 'first-page-number' to lyluatex with which you can force the 
first-page-number value passed to LilyPond. For the use case described 
above this is not relevant but I wanted to mention it anyway (it's only 
in the Git repo, not on CTAN/TeXLive, ATM).  The reason for this is that 
there may be circumstances where when calling lyluatex you don't have 
any idea about the page it will eventually end on. In the project I'm 
working on I use an initial .tex file to *generate* the LilyPond scores 
and *generate* an intermediate .tex file where the scores will 
eventually be included. So when calling LilyPond there is no notion of a 
"current page number" for where the score will eventually be. I want the 
scores to always start on the right page, so I pass "1" as the first 
page number and have the intermediate .tex file conditionally insert an 
empty page.


Best
Urs



I have an almost finished book to give to a guitarist tomorrow!

Thanks in advance
Federico






___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Make TOC entries available to LaTeX

2018-05-24 Thread Federico Bruni



Il giorno gio 26 apr 2018 alle 8:48, Urs Liska  
ha scritto:

[...]


3)
I think the inclusion in the TeX TOC can (now?) be done in a 
simpler way

using the catchfile package:

\documentclass{article}
\usepackage{pdfpages,catchfile}
\newcommand\includelilypond[1]{%
   \begingroup
 \CatchFileDef\currentlilypondtoc{#1.toc}{}

\edef\x{\noexpand\includepdf[pages=-,addtotoc={\currentlilypondtoc}]{#1.pdf}}
   \expandafter\endgroup\x
}
\begin{document}
\tableofcontents
\includelilypond{test}
\end{document}


(Answer from
https://tex.stackexchange.com/questions/428239/merge-in-manual-toc-entries-in-a-lualatex-document)

There's only one issue: The TOC will create wrong entries when 
LilyPond's
first page number is not 1. So there should actually be an offset 
in place.
How can I read the value of the first-page-number variable to set 
up this

offset?

page-post-process has the layout-variable.
(ly:output-def-lookup layout 'first-page-number) should do the trick.


Thanks, this works.
What do you think: this example code is much easier to understand 
than the one currently in the manual. Should I propose an update?




+1 for the update!

Urs, can you show a minimal example using the first-page-number?
How do you use it all the above in combination with lyluatex?

I have an almost finished book to give to a guitarist tomorrow!

Thanks in advance
Federico




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user