Re: Custom clef horizontal adjustment.

2018-07-02 Thread David Kastrup
dfro  writes:

> In the code snippet below, the custom glyph sometimes collides with
> the notes before it, and sometimes does not. Also, I cannot control
> the distance from notes immediately after the custom glyph, as I can
> with the standard "alto" glyph.
>
> I have tried to experiment and to understand the various Clef object
> properties, but I cannot figure it out. I am sure there is something
> basic about grob behavior that I don't understand, yet.
>
> %CODE START
> % Valentin Villanave's macro for the French-style C clef %%%
>
> altoClef = \markup \postscript #"
> gsave newpath
>    0.004 0.004 scale
>    -200 0 translate
[...]
> fill grestore"

Uh, that's opaque to LilyPond.  It has neither bounding box nor
outline.  Try rewriting in terms of the \path command.

-- 
David Kastrup

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


Custom clef horizontal adjustment.

2018-07-02 Thread dfro

Hello,

I am interested in using custom clef symbols. I am practicing with a 
snippet from the library that replaces the internal "alto" clef glyph 
with a user defined postscript glyph. However, the behavior of the new 
glyph is not the same as the standard "alto" glyph.


In the code snippet below, the custom glyph sometimes collides with the 
notes before it, and sometimes does not. Also, I cannot control the 
distance from notes immediately after the custom glyph, as I can with 
the standard "alto" glyph.


I have tried to experiment and to understand the various Clef object 
properties, but I cannot figure it out. I am sure there is something 
basic about grob behavior that I don't understand, yet.


I am wondering:

How can I get the notes that are before and after to not clash with 
custom clef glyphs?
Why is the (next-note extra-space . 8) property not working with the 
custom clef glyph?


Is there a way to establish the horizontal bounding box of a custom 
postscript glyph?


How does one adjust the spacing to the left of a standard or custom clef 
glyph?


Thanks for any help.

Peace,
David Froseth



%CODE START
% Valentin Villanave's macro for the French-style C clef %%%

altoClef = \markup \postscript #"
gsave newpath
   0.004 0.004 scale
   -200 0 translate
   248 -306 moveto
     248 -492 lineto
     248 -496 245 -500 240 -500 curveto
     218 -500 lineto
     213 -500 210 -496 210 -492 curveto
     210 492 lineto
     210 496 213 500 218 500 curveto
     240 500 lineto
     245 500 248 496 248 492 curveto
     248 292 lineto
     274 270 348 242 370 242 curveto
     404 242 462 228 462 453 curveto
     462 560 476 670 576 670 curveto
     628 670 671 626 671 571 curveto
     671 516 628 471 576 471 curveto
     526 471 530 496 520 503 curveto
     513 502 510 478 510 437 curveto
     510 340 lineto
     510 192 490 94 477 79 curveto
     442 39 332 70 248 70 curveto
     248 -83 lineto
     332 -83 442 -53 477 -93 curveto
     490 -108 510 -206 510 -354 curveto
     510 -451 lineto
     510 -491 513 -516 520 -517 curveto
     530 -509 526 -485 576 -485 curveto
     628 -485 671 -530 671 -584 curveto
     671 -640 628 -684 576 -684 curveto
     476 -684 462 -574 462 -467 curveto
     462 -242 404 -256 370 -256 curveto
     348 -256 274 -283 248 -306 curveto
    closepath
    130 -500 moveto
     8 -500 lineto
     4 -500 0 -496 0 -492 curveto
     0 492 lineto
     0 496 4 500 8 500 curveto
     130 500 lineto
     134 500 138 496 138 492 curveto
     138 -492 lineto
     138 -496 134 -500 130 -500 curveto
    closepath
fill grestore"

%%

\relative c' {

  \numericTimeSignature
  \clef "alto"
  \override Staff.Clef.stencil = #(lambda (grob)
    (grob-interpret-markup grob 
altoClef))

  \override Staff.Clef.space-alist =
  #'( (staff-bar extra-space . 8)
  (time-signature minimum-space . 8)
  (first-note minimum-fixed-space . 8)
  (next-note extra-space . 8)
  (right-edge extra-space . 0))

  %next-note variable in measure 1 does not work,
  %and the note before the last custom symbol in the measure is 
clashing.


  | c4 c
  \set Staff.forceClef = ##t
  \clef "alto"

  c4 c \break
  \set Staff.forceClef = ##t
  \clef "alto"

  | c4 c c c

  \time 2/4
  \break
  \override Staff.Clef.stencil = #ly:clef::print
  \override Staff.Clef.space-alist =
  #'((staff-bar extra-space . 8)
 (time-signature minimum-space . 8)
 (first-note minimum-fixed-space . 8)
 (next-note extra-space . 8)
 (right-edge extra-space . 0))
  \set Staff.forceClef = ##t
  \clef "alto"

  | c8 c
  \set Staff.forceClef = ##t
  \clef "alto"

  c c \break

  \set Staff.forceClef = ##t
  \clef "alto"

  | c8 c c c
}

\paper {
  ragged-right = ##t
}

%CODE END


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


Re: Toc with counter

2018-07-02 Thread Pierre Perol-Schneider
How about :

\version "2.19.82"

#(set-default-paper-size "a6")

#(define counter-alist '())

#(define-markup-command (counter layout props name) (string?)
  "Increases and prints out the value of the given counter named @var{name}.
  If the counter does not yet exist, it is initialized with 1."
  (let* ((oldval (assoc-ref counter-alist name))
 (newval (if (number? oldval) (+ oldval 1) 1)))
  (set! counter-alist (assoc-set! counter-alist name newval))
  (interpret-markup layout props
(markup (number->string (round newval))

\markup {
  \column {
"counter :"
\fill-line {
  \counter #"counter" \counter #"counter" \counter #"counter"
  \counter #"counter" \counter #"counter" \counter #"counter"
  \counter #"counter"
}
\null
"\pattern :"
\fill-line { \pattern #7 #X #7 \counter #"pattern" }
\null
"\fill-with-pattern :"
\fill-with-pattern #7 #RIGHT \counter #"fill-with-pattern" \null \null
  }
}


2018-07-02 23:47 GMT+02:00 David Kastrup :

> Pierre Perol-Schneider  writes:
>
> >> ... counter shows only pairs.
> > " counter shows only even numbers"... sorry.
> > Pierre
>
> This is an abomination.
>
> Tracker issue: 5365 (https://sourceforge.net/p/testlilyissues/issues/5365/
> )
> Rietveld issue: 357740043 (https://codereview.appspot.com/357740043)
> Issue description:
>   Avoid multiple evaluation of markups \pattern \fill-with-pattern
>   For markup commands with side effects like counters, that could end
>   up being a nuisance.
>
> Want to write a nice concise regtest?
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \unset with modified default properties

2018-07-02 Thread Saul Tobin
Sure, define-music-function works fine. That part I just copied from the
earlier snippet. That's a side issue, though.

On Mon, Jul 2, 2018 at 2:36 PM David Kastrup  wrote:

> Saul Tobin  writes:
>
> > Indeed, or StaffGroup level if I'm following correctly.
>
> And there is a StaffGroup.
>
> > My issue is that I want to change the default keepAliveInterfaces for
> > one staff within a StaffGroup. (Probably should have just posted this
> > as my initial example, I suppose.)
> >
> > \version "2.19.82"
> >
> > targetstaff = #(define-scheme-function (ctx) (string?)
> >  #{
> >  \set Staff.keepAliveInterfaces = #'()
> >  \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
> >  #})
>
> Why not define-music-function?  This seems like asking for trouble
> unnecessarily.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Toc with counter

2018-07-02 Thread David Kastrup
Pierre Perol-Schneider  writes:

>> ... counter shows only pairs.
> " counter shows only even numbers"... sorry.
> Pierre

This is an abomination.

Tracker issue: 5365 (https://sourceforge.net/p/testlilyissues/issues/5365/)
Rietveld issue: 357740043 (https://codereview.appspot.com/357740043)
Issue description:
  Avoid multiple evaluation of markups \pattern \fill-with-pattern
  For markup commands with side effects like counters, that could end
  up being a nuisance.

Want to write a nice concise regtest?

-- 
David Kastrup

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


Re: \unset with modified default properties

2018-07-02 Thread David Kastrup
Saul Tobin  writes:

> Indeed, or StaffGroup level if I'm following correctly.

And there is a StaffGroup.

> My issue is that I want to change the default keepAliveInterfaces for
> one staff within a StaffGroup. (Probably should have just posted this
> as my initial example, I suppose.)
>
> \version "2.19.82"
>
> targetstaff = #(define-scheme-function (ctx) (string?)
>  #{
>  \set Staff.keepAliveInterfaces = #'()
>  \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
>  #})

Why not define-music-function?  This seems like asking for trouble
unnecessarily.

-- 
David Kastrup

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


Re: \unset with modified default properties

2018-07-02 Thread Saul Tobin
Indeed, or StaffGroup level if I'm following correctly. My issue is that I
want to change the default keepAliveInterfaces for one staff within a
StaffGroup. (Probably should have just posted this as my initial example, I
suppose.)

\version "2.19.82"

targetstaff = #(define-scheme-function (ctx) (string?)
 #{
 \set Staff.keepAliveInterfaces = #'()
 \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
 #})

music = {
  \targetstaff "2"
  c'1 d' e' d'
  \break
  \targetstaff "1"
  R1*4
}

\new StaffGroup <<
  \new Staff = "1" \with {
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##t
instrumentName = "1"
shortInstrumentName = "1"
  } \music
  \new Staff = "2" \with {
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##f
instrumentName = "2"
shortInstrumentName = "2"
keepAliveInterfaces = #'(
  bass-figure-interface
  chord-name-interface
  cluster-beacon-interface
  fret-diagram-interface
  lyric-syllable-interface
  note-head-interface
  tab-note-head-interface
  lyric-interface
  percent-repeat-item-interface
  percent-repeat-interface
  ;; need this, as stanza numbers are items,
and appear only once.
  stanza-number-interface
  ;; all the normal stuff ^
  ;; new stuff v
  multi-measure-rest-interface
  )
  } \music
>>

This is adapted from a snippet posted a while ago on the mailing list:
https://www.mail-archive.com/lilypond-user@gnu.org/msg125650.html.

Does this clarify what I'm trying to do with \unset?

Thanks!

Saul

On Mon, Jul 2, 2018 at 12:24 AM David Kastrup  wrote:

> Saul Tobin  writes:
>
> > Interesting. So if the default property is set at the Staff level, for
> > instance, then changed and \unset at the Voice level, it goes back to the
> > default for the higher-level context. But if in the example \new Staff
> > \with... is changed to \new Voice \with... the original problem arises
> > where \unset reverts to the built-in default.
> >
> > Didn't realize about the \tuplet syntax. That's quite useful. Thanks for
> > the tip!
> >
> > Actually, I just used tupletSpannerDuration because it was convenient to
> > write a tiny example. My practical use case is changing the default
> > keepAliveInterfaces for certain staves.
>
> Ah, that is read at Staff level.  You could set your score-wide default
> at, well, Score level then.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Toc with counter

2018-07-02 Thread Pierre Perol-Schneider
So here's my workaround (simply dividing de counter by 2) :


\version "2.19.82" %% or 2.18

%%% Counter defs
% => http://lsr.di.unimi.it/LSR/Item?id=543

#(define counter-alist '())

#(define-markup-command (counter layout props name) (string?)
  "Increases and prints out the value of the given counter named @var{name}.
  If the counter does not yet exist, it is initialized with 1."
  (let* ((oldval (assoc-ref counter-alist name))
 (newval (if (number? oldval) (+ oldval 1) 1)))
  (set! counter-alist (assoc-set! counter-alist name newval))
  (interpret-markup layout props
;; => here it goes :
(markup (number->string (/ newval 2))

#(define-markup-command (setcounter layout props name value) (string?
number?)
  "Set the given counter named @var{name} to the given @var{value} and
prints
  out the value. The counter does not yet have to exist."
  (set! counter-alist (assoc-set! counter-alist name (- value 1)))
  (interpret-markup layout props (make-counter-markup name)))

%% Test:

\book {
  \bookpart {
\markuplist \table-of-contents
\paper {
  %% comment the following line:
  tocItemMarkup = \tocItemWithDotsMarkup
}
  }
  \bookpart {
\tocItem \markup { "Étude" \counter #"counter" }
{ c' }
  }
  \bookpart {
\tocItem \markup { "Étude" \counter #"counter" }
{ c' }
  }
  \bookpart {
\tocItem \markup { "Étude" \counter #"counter" }
{ c' }
  }
}


Cheers,
Pierre

2018-07-02 22:43 GMT+02:00 Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com>:

> Pretty smart Saul.
> However, dots are crossing the text so the output looks strange.
> Cheers,
> Pierre
>
> 2018-07-02 22:27 GMT+02:00 Saul Tobin :
>
>> Try this:
>>
>> tocItemWithDotsMarkupFixed = \markup {
>>   \fill-line {
>> \fromproperty #'toc:text
>> \fill-with-pattern #1 #RIGHT . "" \fromproperty #'toc:page
>>   }
>> }
>>
>> \paper {
>>   tocItemMarkup = \tocItemWithDotsMarkupFixed
>> }
>>
>> On Mon, Jul 2, 2018 at 12:57 PM Pierre Perol-Schneider <
>> pierre.schneider.pa...@gmail.com> wrote:
>>
>>> Thank you Saul.
>>> I understood that fill-with-pattern initiated the problem but could not
>>> see why. So thank you for your detailed explanation.
>>> Now, if someone has a workaround...
>>>
>>> Cheers,
>>> Pierre
>>>
>>> 2018-07-02 21:12 GMT+02:00 Saul Tobin :
>>>
 If I understand correctly, counter gets incremented whenever
 interpret-markup is called on a markup containing the counter. If you look
 in define-markup-commands.scm, \fill-line calls interpret-markup only once,
 but \fill-with-pattern calls interpret-markup twice, first to find out the
 width of the left and right text, then it calls interpret-markup again on
 the entire line.

 On Mon, Jul 2, 2018 at 9:01 AM Pierre Perol-Schneider <
 pierre.schneider.pa...@gmail.com> wrote:

> > ... counter shows only pairs.
> " counter shows only even numbers"... sorry.
> Pierre
>
> 2018-07-02 17:23 GMT+02:00 Pierre Perol-Schneider <
> pierre.schneider.pa...@gmail.com>:
>
>> Hi All,
>>
>> I'd like to add a counter (LSR 543) in a table of content.
>> However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
>> Any idea how to solve this ?
>>
>> Snippet :
>>
>> 
>> \version "2.19.82" %% or 2.18
>>
>> %%% Counter defs
>> % => http://lsr.di.unimi.it/LSR/Item?id=543
>>
>> #(define counter-alist '())
>>
>> #(define-markup-command (counter layout props name) (string?)
>>   "Increases and prints out the value of the given counter named
>> @var{name}.
>>   If the counter does not yet exist, it is initialized with 1."
>>   (let* ((oldval (assoc-ref counter-alist name))
>>  (newval (if (number? oldval) (+ oldval 1) 1)))
>>   (set! counter-alist (assoc-set! counter-alist name newval))
>>   (interpret-markup layout props
>> (markup (number->string newval)
>>
>> #(define-markup-command (setcounter layout props name value) (string?
>> number?)
>>   "Set the given counter named @var{name} to the given @var{value}
>> and prints
>>   out the value. The counter does not yet have to exist."
>>   (set! counter-alist (assoc-set! counter-alist name (- value 1)))
>>   (interpret-markup layout props (make-counter-markup name)))
>>
>> %% Test:
>>
>> \book {
>>   \bookpart {
>> \markuplist \table-of-contents
>> \paper {
>>   %% comment the following line:
>>   tocItemMarkup = \tocItemWithDotsMarkup
>> }
>>   }
>>   \bookpart {
>> \tocItem \markup { "Étude" \counter #"counter" }
>> { c' }
>>   }
>>   \bookpart {
>> \tocItem \markup { "Étude" \counter #"counter" }
>> { c' }
>>   }
>>   \bookpart {
>> \tocItem \markup { "Étude" \counter #"counter" }
>> { c' }
>>   }
>> }
>> 
>>
>> 

Re: Toc with counter

2018-07-02 Thread Pierre Perol-Schneider
Pretty smart Saul.
However, dots are crossing the text so the output looks strange.
Cheers,
Pierre

2018-07-02 22:27 GMT+02:00 Saul Tobin :

> Try this:
>
> tocItemWithDotsMarkupFixed = \markup {
>   \fill-line {
> \fromproperty #'toc:text
> \fill-with-pattern #1 #RIGHT . "" \fromproperty #'toc:page
>   }
> }
>
> \paper {
>   tocItemMarkup = \tocItemWithDotsMarkupFixed
> }
>
> On Mon, Jul 2, 2018 at 12:57 PM Pierre Perol-Schneider <
> pierre.schneider.pa...@gmail.com> wrote:
>
>> Thank you Saul.
>> I understood that fill-with-pattern initiated the problem but could not
>> see why. So thank you for your detailed explanation.
>> Now, if someone has a workaround...
>>
>> Cheers,
>> Pierre
>>
>> 2018-07-02 21:12 GMT+02:00 Saul Tobin :
>>
>>> If I understand correctly, counter gets incremented whenever
>>> interpret-markup is called on a markup containing the counter. If you look
>>> in define-markup-commands.scm, \fill-line calls interpret-markup only once,
>>> but \fill-with-pattern calls interpret-markup twice, first to find out the
>>> width of the left and right text, then it calls interpret-markup again on
>>> the entire line.
>>>
>>> On Mon, Jul 2, 2018 at 9:01 AM Pierre Perol-Schneider <
>>> pierre.schneider.pa...@gmail.com> wrote:
>>>
 > ... counter shows only pairs.
 " counter shows only even numbers"... sorry.
 Pierre

 2018-07-02 17:23 GMT+02:00 Pierre Perol-Schneider <
 pierre.schneider.pa...@gmail.com>:

> Hi All,
>
> I'd like to add a counter (LSR 543) in a table of content.
> However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
> Any idea how to solve this ?
>
> Snippet :
>
> 
> \version "2.19.82" %% or 2.18
>
> %%% Counter defs
> % => http://lsr.di.unimi.it/LSR/Item?id=543
>
> #(define counter-alist '())
>
> #(define-markup-command (counter layout props name) (string?)
>   "Increases and prints out the value of the given counter named
> @var{name}.
>   If the counter does not yet exist, it is initialized with 1."
>   (let* ((oldval (assoc-ref counter-alist name))
>  (newval (if (number? oldval) (+ oldval 1) 1)))
>   (set! counter-alist (assoc-set! counter-alist name newval))
>   (interpret-markup layout props
> (markup (number->string newval)
>
> #(define-markup-command (setcounter layout props name value) (string?
> number?)
>   "Set the given counter named @var{name} to the given @var{value} and
> prints
>   out the value. The counter does not yet have to exist."
>   (set! counter-alist (assoc-set! counter-alist name (- value 1)))
>   (interpret-markup layout props (make-counter-markup name)))
>
> %% Test:
>
> \book {
>   \bookpart {
> \markuplist \table-of-contents
> \paper {
>   %% comment the following line:
>   tocItemMarkup = \tocItemWithDotsMarkup
> }
>   }
>   \bookpart {
> \tocItem \markup { "Étude" \counter #"counter" }
> { c' }
>   }
>   \bookpart {
> \tocItem \markup { "Étude" \counter #"counter" }
> { c' }
>   }
>   \bookpart {
> \tocItem \markup { "Étude" \counter #"counter" }
> { c' }
>   }
> }
> 
>
> TIA, cheers,
> Pierre
>
>
>
 ___
 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: Toc with counter

2018-07-02 Thread Saul Tobin
Try this:

tocItemWithDotsMarkupFixed = \markup {
  \fill-line {
\fromproperty #'toc:text
\fill-with-pattern #1 #RIGHT . "" \fromproperty #'toc:page
  }
}

\paper {
  tocItemMarkup = \tocItemWithDotsMarkupFixed
}

On Mon, Jul 2, 2018 at 12:57 PM Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com> wrote:

> Thank you Saul.
> I understood that fill-with-pattern initiated the problem but could not
> see why. So thank you for your detailed explanation.
> Now, if someone has a workaround...
>
> Cheers,
> Pierre
>
> 2018-07-02 21:12 GMT+02:00 Saul Tobin :
>
>> If I understand correctly, counter gets incremented whenever
>> interpret-markup is called on a markup containing the counter. If you look
>> in define-markup-commands.scm, \fill-line calls interpret-markup only once,
>> but \fill-with-pattern calls interpret-markup twice, first to find out the
>> width of the left and right text, then it calls interpret-markup again on
>> the entire line.
>>
>> On Mon, Jul 2, 2018 at 9:01 AM Pierre Perol-Schneider <
>> pierre.schneider.pa...@gmail.com> wrote:
>>
>>> > ... counter shows only pairs.
>>> " counter shows only even numbers"... sorry.
>>> Pierre
>>>
>>> 2018-07-02 17:23 GMT+02:00 Pierre Perol-Schneider <
>>> pierre.schneider.pa...@gmail.com>:
>>>
 Hi All,

 I'd like to add a counter (LSR 543) in a table of content.
 However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
 Any idea how to solve this ?

 Snippet :

 
 \version "2.19.82" %% or 2.18

 %%% Counter defs
 % => http://lsr.di.unimi.it/LSR/Item?id=543

 #(define counter-alist '())

 #(define-markup-command (counter layout props name) (string?)
   "Increases and prints out the value of the given counter named
 @var{name}.
   If the counter does not yet exist, it is initialized with 1."
   (let* ((oldval (assoc-ref counter-alist name))
  (newval (if (number? oldval) (+ oldval 1) 1)))
   (set! counter-alist (assoc-set! counter-alist name newval))
   (interpret-markup layout props
 (markup (number->string newval)

 #(define-markup-command (setcounter layout props name value) (string?
 number?)
   "Set the given counter named @var{name} to the given @var{value} and
 prints
   out the value. The counter does not yet have to exist."
   (set! counter-alist (assoc-set! counter-alist name (- value 1)))
   (interpret-markup layout props (make-counter-markup name)))

 %% Test:

 \book {
   \bookpart {
 \markuplist \table-of-contents
 \paper {
   %% comment the following line:
   tocItemMarkup = \tocItemWithDotsMarkup
 }
   }
   \bookpart {
 \tocItem \markup { "Étude" \counter #"counter" }
 { c' }
   }
   \bookpart {
 \tocItem \markup { "Étude" \counter #"counter" }
 { c' }
   }
   \bookpart {
 \tocItem \markup { "Étude" \counter #"counter" }
 { c' }
   }
 }
 

 TIA, cheers,
 Pierre



>>> ___
>>> 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: Toc with counter

2018-07-02 Thread Pierre Perol-Schneider
Thank you Saul.
I understood that fill-with-pattern initiated the problem but could not see
why. So thank you for your detailed explanation.
Now, if someone has a workaround...

Cheers,
Pierre

2018-07-02 21:12 GMT+02:00 Saul Tobin :

> If I understand correctly, counter gets incremented whenever
> interpret-markup is called on a markup containing the counter. If you look
> in define-markup-commands.scm, \fill-line calls interpret-markup only once,
> but \fill-with-pattern calls interpret-markup twice, first to find out the
> width of the left and right text, then it calls interpret-markup again on
> the entire line.
>
> On Mon, Jul 2, 2018 at 9:01 AM Pierre Perol-Schneider <
> pierre.schneider.pa...@gmail.com> wrote:
>
>> > ... counter shows only pairs.
>> " counter shows only even numbers"... sorry.
>> Pierre
>>
>> 2018-07-02 17:23 GMT+02:00 Pierre Perol-Schneider <
>> pierre.schneider.pa...@gmail.com>:
>>
>>> Hi All,
>>>
>>> I'd like to add a counter (LSR 543) in a table of content.
>>> However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
>>> Any idea how to solve this ?
>>>
>>> Snippet :
>>>
>>> 
>>> \version "2.19.82" %% or 2.18
>>>
>>> %%% Counter defs
>>> % => http://lsr.di.unimi.it/LSR/Item?id=543
>>>
>>> #(define counter-alist '())
>>>
>>> #(define-markup-command (counter layout props name) (string?)
>>>   "Increases and prints out the value of the given counter named
>>> @var{name}.
>>>   If the counter does not yet exist, it is initialized with 1."
>>>   (let* ((oldval (assoc-ref counter-alist name))
>>>  (newval (if (number? oldval) (+ oldval 1) 1)))
>>>   (set! counter-alist (assoc-set! counter-alist name newval))
>>>   (interpret-markup layout props
>>> (markup (number->string newval)
>>>
>>> #(define-markup-command (setcounter layout props name value) (string?
>>> number?)
>>>   "Set the given counter named @var{name} to the given @var{value} and
>>> prints
>>>   out the value. The counter does not yet have to exist."
>>>   (set! counter-alist (assoc-set! counter-alist name (- value 1)))
>>>   (interpret-markup layout props (make-counter-markup name)))
>>>
>>> %% Test:
>>>
>>> \book {
>>>   \bookpart {
>>> \markuplist \table-of-contents
>>> \paper {
>>>   %% comment the following line:
>>>   tocItemMarkup = \tocItemWithDotsMarkup
>>> }
>>>   }
>>>   \bookpart {
>>> \tocItem \markup { "Étude" \counter #"counter" }
>>> { c' }
>>>   }
>>>   \bookpart {
>>> \tocItem \markup { "Étude" \counter #"counter" }
>>> { c' }
>>>   }
>>>   \bookpart {
>>> \tocItem \markup { "Étude" \counter #"counter" }
>>> { c' }
>>>   }
>>> }
>>> 
>>>
>>> TIA, cheers,
>>> Pierre
>>>
>>>
>>>
>> ___
>> 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: Toc with counter

2018-07-02 Thread Saul Tobin
If I understand correctly, counter gets incremented whenever
interpret-markup is called on a markup containing the counter. If you look
in define-markup-commands.scm, \fill-line calls interpret-markup only once,
but \fill-with-pattern calls interpret-markup twice, first to find out the
width of the left and right text, then it calls interpret-markup again on
the entire line.

On Mon, Jul 2, 2018 at 9:01 AM Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com> wrote:

> > ... counter shows only pairs.
> " counter shows only even numbers"... sorry.
> Pierre
>
> 2018-07-02 17:23 GMT+02:00 Pierre Perol-Schneider <
> pierre.schneider.pa...@gmail.com>:
>
>> Hi All,
>>
>> I'd like to add a counter (LSR 543) in a table of content.
>> However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
>> Any idea how to solve this ?
>>
>> Snippet :
>>
>> 
>> \version "2.19.82" %% or 2.18
>>
>> %%% Counter defs
>> % => http://lsr.di.unimi.it/LSR/Item?id=543
>>
>> #(define counter-alist '())
>>
>> #(define-markup-command (counter layout props name) (string?)
>>   "Increases and prints out the value of the given counter named
>> @var{name}.
>>   If the counter does not yet exist, it is initialized with 1."
>>   (let* ((oldval (assoc-ref counter-alist name))
>>  (newval (if (number? oldval) (+ oldval 1) 1)))
>>   (set! counter-alist (assoc-set! counter-alist name newval))
>>   (interpret-markup layout props
>> (markup (number->string newval)
>>
>> #(define-markup-command (setcounter layout props name value) (string?
>> number?)
>>   "Set the given counter named @var{name} to the given @var{value} and
>> prints
>>   out the value. The counter does not yet have to exist."
>>   (set! counter-alist (assoc-set! counter-alist name (- value 1)))
>>   (interpret-markup layout props (make-counter-markup name)))
>>
>> %% Test:
>>
>> \book {
>>   \bookpart {
>> \markuplist \table-of-contents
>> \paper {
>>   %% comment the following line:
>>   tocItemMarkup = \tocItemWithDotsMarkup
>> }
>>   }
>>   \bookpart {
>> \tocItem \markup { "Étude" \counter #"counter" }
>> { c' }
>>   }
>>   \bookpart {
>> \tocItem \markup { "Étude" \counter #"counter" }
>> { c' }
>>   }
>>   \bookpart {
>> \tocItem \markup { "Étude" \counter #"counter" }
>> { c' }
>>   }
>> }
>> 
>>
>> TIA, cheers,
>> Pierre
>>
>>
>>
> ___
> 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: Toc with counter

2018-07-02 Thread Pierre Perol-Schneider
> ... counter shows only pairs.
" counter shows only even numbers"... sorry.
Pierre

2018-07-02 17:23 GMT+02:00 Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com>:

> Hi All,
>
> I'd like to add a counter (LSR 543) in a table of content.
> However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
> Any idea how to solve this ?
>
> Snippet :
>
> 
> \version "2.19.82" %% or 2.18
>
> %%% Counter defs
> % => http://lsr.di.unimi.it/LSR/Item?id=543
>
> #(define counter-alist '())
>
> #(define-markup-command (counter layout props name) (string?)
>   "Increases and prints out the value of the given counter named
> @var{name}.
>   If the counter does not yet exist, it is initialized with 1."
>   (let* ((oldval (assoc-ref counter-alist name))
>  (newval (if (number? oldval) (+ oldval 1) 1)))
>   (set! counter-alist (assoc-set! counter-alist name newval))
>   (interpret-markup layout props
> (markup (number->string newval)
>
> #(define-markup-command (setcounter layout props name value) (string?
> number?)
>   "Set the given counter named @var{name} to the given @var{value} and
> prints
>   out the value. The counter does not yet have to exist."
>   (set! counter-alist (assoc-set! counter-alist name (- value 1)))
>   (interpret-markup layout props (make-counter-markup name)))
>
> %% Test:
>
> \book {
>   \bookpart {
> \markuplist \table-of-contents
> \paper {
>   %% comment the following line:
>   tocItemMarkup = \tocItemWithDotsMarkup
> }
>   }
>   \bookpart {
> \tocItem \markup { "Étude" \counter #"counter" }
> { c' }
>   }
>   \bookpart {
> \tocItem \markup { "Étude" \counter #"counter" }
> { c' }
>   }
>   \bookpart {
> \tocItem \markup { "Étude" \counter #"counter" }
> { c' }
>   }
> }
> 
>
> TIA, cheers,
> Pierre
>
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Toc with counter

2018-07-02 Thread Pierre Perol-Schneider
 Hi All,

I'd like to add a counter (LSR 543) in a table of content.
However, when 'tocItemWithDotsMarkup is set, counter shows only pairs.
Any idea how to solve this ?

Snippet :


\version "2.19.82" %% or 2.18

%%% Counter defs
% => http://lsr.di.unimi.it/LSR/Item?id=543

#(define counter-alist '())

#(define-markup-command (counter layout props name) (string?)
  "Increases and prints out the value of the given counter named @var{name}.
  If the counter does not yet exist, it is initialized with 1."
  (let* ((oldval (assoc-ref counter-alist name))
 (newval (if (number? oldval) (+ oldval 1) 1)))
  (set! counter-alist (assoc-set! counter-alist name newval))
  (interpret-markup layout props
(markup (number->string newval)

#(define-markup-command (setcounter layout props name value) (string?
number?)
  "Set the given counter named @var{name} to the given @var{value} and
prints
  out the value. The counter does not yet have to exist."
  (set! counter-alist (assoc-set! counter-alist name (- value 1)))
  (interpret-markup layout props (make-counter-markup name)))

%% Test:

\book {
  \bookpart {
\markuplist \table-of-contents
\paper {
  %% comment the following line:
  tocItemMarkup = \tocItemWithDotsMarkup
}
  }
  \bookpart {
\tocItem \markup { "Étude" \counter #"counter" }
{ c' }
  }
  \bookpart {
\tocItem \markup { "Étude" \counter #"counter" }
{ c' }
  }
  \bookpart {
\tocItem \markup { "Étude" \counter #"counter" }
{ c' }
  }
}


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


Re: Opinions requested on deprecating "annotation" commands

2018-07-02 Thread Urs Liska



Am 01.07.2018 um 20:27 schrieb N. Andrew Walsh:

Hi Urs, List

On Sun, 1 Jul 2018, 00:08 Urs Liska > wrote:


Hi Simon and Craig,

I think it's a good point. And since maybe I'll have to suffer
more than anyone else ;-) I shouldn't wring my hands too much and
just go for that.

I'll consent to slogging through all our Kayser project to update the 
annotations if it means getting this very excellent feature implemented.


That can serve as a litmus test for a scripted conversion ;-) Maybe we 
can even provide a script that assists users to update their documents 
like convert-ly does for regular LilyPond files.
The issue I see here is that currently we have so many open working 
branches, which will complicate the situation significantly. Probably we 
should just do the change to the scholarly.annotate.legacy module until 
we have merged the branches ...


Best
Urs



Cheers,

A


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


Re: \unset with modified default properties

2018-07-02 Thread David Kastrup
Saul Tobin  writes:

> Interesting. So if the default property is set at the Staff level, for
> instance, then changed and \unset at the Voice level, it goes back to the
> default for the higher-level context. But if in the example \new Staff
> \with... is changed to \new Voice \with... the original problem arises
> where \unset reverts to the built-in default.
>
> Didn't realize about the \tuplet syntax. That's quite useful. Thanks for
> the tip!
>
> Actually, I just used tupletSpannerDuration because it was convenient to
> write a tiny example. My practical use case is changing the default
> keepAliveInterfaces for certain staves.

Ah, that is read at Staff level.  You could set your score-wide default
at, well, Score level then.

-- 
David Kastrup

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