Re: accidentals and broken bars

2020-08-09 Thread David Kastrup
Kevin Barry  writes:

> On Sun, 2020-08-09 at 06:48 +0200, Werner LEMBERG wrote:
>> Thanks for the explanation.  What about the other way round, this is,
>> adding some information to the invisible bar line that defines a
>> broken bar, and which accidentals could use to print themselves in
>> such cases?
>
> You could try something like
> maybeBreak =
> #(define-music-function (music) (ly:music?)
>#{
>  \bar ""
>  \accidentalStyle forget
>  #music
>  \accidentalStyle modern
>#})
> but that would force accidentals to be reprinted even if the line does
> not get broken.
>
> To get around that you could write some kind of callback for accidentals
> that would remove them when not at the beginning of a line as long as
> they are not new. I tried to do this but got stuck trying to detect if
> an accidental was new at that point in the bar or not. I was trying to
> use the localAlterations property but I was only ever able to see the
> last value of it. If there's a way a grob callback can check a context
> property at the moment of the event that caused the grob I don't know
> it. (I say this just in case anyone else does know how.)

There is no such thing, but an engraver acknowledging a grob can attach
properties to it (or try keeping score of them separately) from the
context it either is working in itself or the context of the engraver
creating the grob.

I think most of the time the handwaving heuristic "let a line break mark
all information not corresponding to the current key signature as
unknown" would work with most accidental rules.

-- 
David Kastrup



Re: accidentals and broken bars

2020-08-09 Thread Kevin Barry
On Sun, 2020-08-09 at 06:48 +0200, Werner LEMBERG wrote:
> Thanks for the explanation.  What about the other way round, this is,
> adding some information to the invisible bar line that defines a
> broken bar, and which accidentals could use to print themselves in
> such cases?

You could try something like
maybeBreak =
#(define-music-function (music) (ly:music?)
   #{
 \bar ""
 \accidentalStyle forget
 #music
 \accidentalStyle modern
   #})
but that would force accidentals to be reprinted even if the line does
not get broken.

To get around that you could write some kind of callback for accidentals
that would remove them when not at the beginning of a line as long as
they are not new. I tried to do this but got stuck trying to detect if
an accidental was new at that point in the bar or not. I was trying to
use the localAlterations property but I was only ever able to see the
last value of it. If there's a way a grob callback can check a context
property at the moment of the event that caused the grob I don't know
it. (I say this just in case anyone else does know how.)

Kevin 




Re: accidentals and broken bars

2020-08-08 Thread Werner LEMBERG


>> Is there a possibility to automatically get a sharp accidental for
>> the third quarter note?  I could neither find a hint in the manual
>> nor in the regression tests...
> 
> Accident rules are implemented before line-breaking.  If they were
> to take line-breaking into account, they'd need to be quite more
> complex.  There is some special-cased code trying to fudge around an
> accidental on a tied note broken across a barline (it should have a
> repeated accidental only when a linebreak occurs) but it cannot deal
> with followup changes: if another note with an accidental follows,
> _that_ accidental always is printed even if spurious.
> 
> One would have to think up a good data structure to cater in advance
> for all possible line breaks and how to write rules in anticipation
> of it.

Thanks for the explanation.  What about the other way round, this is,
adding some information to the invisible bar line that defines a
broken bar, and which accidentals could use to print themselves in
such cases?


Werner



Re: accidentals and broken bars

2020-08-08 Thread Martín Rincón Botero
FWIW, this issue was reported in 2018 as well
http://lilypond.1069038.n5.nabble.com/Accidental-style-in-presence-of-mid-bar-line-breaks-td214207.html.
A new accidental style would indeed solve this.


El El sáb, 8 ago 2020 a las 22:37, Werner LEMBERG  escribió:

>
> > That's a pity, I guess, but seeing that you're manually putting a
> > mid-bar break, it makes sense to manually mark the needed accidental
> > as well.
>
> For my use case I really would like to have automatic behaviour.  The
> example sent to the list was just for demonstration purposes; in
> reality I'm using only
>
>   \bar ""
>
> and let LilyPond decide whether there is a break.  And if there is no
> break, '!' doesn't do the right thing.
>
>
> Werner
>
-- 
www.martinrinconbotero.com


Re: accidentals and broken bars

2020-08-08 Thread Werner LEMBERG


> That's a pity, I guess, but seeing that you're manually putting a
> mid-bar break, it makes sense to manually mark the needed accidental
> as well.

For my use case I really would like to have automatic behaviour.  The
example sent to the list was just for demonstration purposes; in
reality I'm using only

  \bar ""

and let LilyPond decide whether there is a break.  And if there is no
break, '!' doesn't do the right thing.


Werner



Re: accidentals and broken bars

2020-08-08 Thread David Kastrup
Werner LEMBERG  writes:

> Folks,
>
>
> look at this example:
>
>   \paper {
> line-width = 50\mm
>   }
>
>   { c'4 cis' \bar "" \break
> cis' c' }
>
> Is there a possibility to automatically get a sharp accidental for the
> third quarter note?  I could neither find a hint in the manual nor in
> the regression tests...

Accident rules are implemented before line-breaking.  If they were to
take line-breaking into account, they'd need to be quite more complex.
There is some special-cased code trying to fudge around an accidental on
a tied note broken across a barline (it should have a repeated
accidental only when a linebreak occurs) but it cannot deal with
followup changes: if another note with an accidental follows, _that_
accidental always is printed even if spurious.

One would have to think up a good data structure to cater in advance for
all possible line breaks and how to write rules in anticipation of it.

-- 
David Kastrup



Re: accidentals and broken bars

2020-08-08 Thread Martín Rincón Botero
That's a pity, I guess, but seeing that you're manually putting a mid-bar
break, it makes sense to manually mark the needed accidental as well. I
guess I never wondered how to further customize the available accidental
styles other than adding the occasional exceptional accidental.

El El sáb, 8 ago 2020 a las 21:53, Werner LEMBERG  escribió:

>
> > If you need it automatically, I'm not sure if \accidentalStyle
> > "neo-modern" repeats the accidental after a break.
>
> Thanks for the idea, but no, it doesn't.  As far as I can see, broken
> bars aren't covered at all by the available accidental rules.
>
>
> Werner
>
-- 
www.martinrinconbotero.com


Re: accidentals and broken bars

2020-08-08 Thread Werner LEMBERG


> If you need it automatically, I'm not sure if \accidentalStyle
> "neo-modern" repeats the accidental after a break.

Thanks for the idea, but no, it doesn't.  As far as I can see, broken
bars aren't covered at all by the available accidental rules.


Werner



Re: accidentals and broken bars

2020-08-08 Thread Martín Rincón Botero
If you need it automatically, I'm not sure if \accidentalStyle "neo-modern"
repeats the accidental after a break.

El El sáb, 8 ago 2020 a las 20:09, Martín Rincón Botero <
martinrinconbot...@gmail.com> escribió:

> I believe cis'! should do the trick.
>
> El El sáb, 8 ago 2020 a las 20:01, Werner LEMBERG  escribió:
>
>>
>> Folks,
>>
>>
>> look at this example:
>>
>>   \paper {
>> line-width = 50\mm
>>   }
>>
>>   { c'4 cis' \bar "" \break
>> cis' c' }
>>
>> Is there a possibility to automatically get a sharp accidental for the
>> third quarter note?  I could neither find a hint in the manual nor in
>> the regression tests...
>>
>>
>> Werner
>>
> --
> www.martinrinconbotero.com
>
-- 
www.martinrinconbotero.com


Re: accidentals and broken bars

2020-08-08 Thread Martín Rincón Botero
I believe cis'! should do the trick.

El El sáb, 8 ago 2020 a las 20:01, Werner LEMBERG  escribió:

>
> Folks,
>
>
> look at this example:
>
>   \paper {
> line-width = 50\mm
>   }
>
>   { c'4 cis' \bar "" \break
> cis' c' }
>
> Is there a possibility to automatically get a sharp accidental for the
> third quarter note?  I could neither find a hint in the manual nor in
> the regression tests...
>
>
> Werner
>
-- 
www.martinrinconbotero.com


accidentals and broken bars

2020-08-08 Thread Werner LEMBERG

Folks,


look at this example:

  \paper {
line-width = 50\mm
  }

  { c'4 cis' \bar "" \break
cis' c' }

Is there a possibility to automatically get a sharp accidental for the
third quarter note?  I could neither find a hint in the manual nor in
the regression tests...


Werner


Re: accidentals and broken bars

2013-05-03 Thread Janek Warchoł
2013/4/29 Werner LEMBERG :
>
>>> \relative c'' {
>>>  cis4 cis \bar"" \break
>>>  cis cis
>>>}
>>
>> How about
>>
>> \relative c'' {
>> cis4 cis \bar"" \break
>> cis! cis
>>   }
>
> Thanks, but this makes an additional accidental in case the bar
> doesn't get broken.  I want a solution which is independent on the
> layout.
>
> Note that I'm intentionally asking this apparently naive question here
> on the user mailing list and not on `devel', but my gut feeling says
> that this functionality is missing in lilypond...

Apparently.
http://code.google.com/p/lilypond/issues/detail?id=3347

best,
Janek

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


Re: accidentals and broken bars

2013-04-28 Thread Werner LEMBERG

>> \relative c'' {
>>  cis4 cis \bar"" \break
>>  cis cis
>>}
> 
> How about
> 
> \relative c'' {
> cis4 cis \bar"" \break
> cis! cis
>   }

Thanks, but this makes an additional accidental in case the bar
doesn't get broken.  I want a solution which is independent on the
layout.

Note that I'm intentionally asking this apparently naive question here
on the user mailing list and not on `devel', but my gut feeling says
that this functionality is missing in lilypond...


Werner

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


Re: accidentals and broken bars

2013-04-28 Thread Nick Payne

On 29/04/13 13:08, Werner LEMBERG wrote:

\relative c'' {
 cis4 cis \bar"" \break
 cis cis
   }


How about

\relative c'' {
cis4 cis \bar"" \break
cis! cis
  }

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


accidentals and broken bars

2013-04-28 Thread Werner LEMBERG

Folks,


if a bar gets broken, how can I make lilypond display additional
accidents automatically after the break?

  \relative c'' {
cis4 cis \bar"" \break
cis cis
  }


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