Place a markup string at the right of a notehead

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Place a markup string at the right of a notehead

Paolo Prete-3
Hello.

I can't find an easy way to place a markup string exactly at the right of a notehead so they appear horizontally aligned. The only apparent way to obtain that is the trial-and-error procedure. 
This can be very frustrating because I have to compile the input several times.
A work-around would be to replace the notehead's stencil with the notehead+text, but it doesn't convince me and it causes spacing issues with groups of notes.

Is there a simpler way to solve this?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Thomas Morley-2
Am Fr., 6. Dez. 2019 um 01:55 Uhr schrieb Paolo Pr <[hidden email]>:

>
> Hello.
>
> I can't find an easy way to place a markup string exactly at the right of a notehead so they appear horizontally aligned. The only apparent way to obtain that is the trial-and-error procedure.
> This can be very frustrating because I have to compile the input several times.
> A work-around would be to replace the notehead's stencil with the notehead+text, but it doesn't convince me and it causes spacing issues with groups of notes.
>
> Is there a simpler way to solve this?
>
> Thanks

Hijack StrokeFinger?

{
  <
   bes-\tweak text "foo" -\rightHandFinger #0
   d'-\tweak text "bar" -\rightHandFinger #0
   f'-\tweak text "buzz" -\rightHandFinger #0
   bes'-\tweak text "boink" -\rightHandFinger #0
  >
}

Cheers,
  Harm

Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Carl Sorensen-3
In reply to this post by Paolo Prete-3

 

 

From: Paolo Pr <[hidden email]>
Date: Thursday, December 5, 2019 at 5:54 PM
To: lilypond-user <[hidden email]>
Subject: Place a markup string at the right of a notehead

 

Hello.

 

I can't find an easy way to place a markup string exactly at the right of a notehead so they appear horizontally aligned. The only apparent way to obtain that is the trial-and-error procedure. 

This can be very frustrating because I have to compile the input several times.

A work-around would be to replace the notehead's stencil with the notehead+text, but it doesn't convince me and it causes spacing issues with groups of notes.

 

Is there a simpler way to solve this?

 

In my opinion you will need to create a new type of Grob, and create an engraver for it.  It could be a scheme engraver.  LilyPond has the concept of text in a notehead, and text above or below a note+stem combination, but there is no traditional musical element that is aligned directly beside a notehead.  Hence the need for a new engraver.

 

This seems strange, since it would be so easy to do in a graphical interface program, but that’s one of the strengths of LilyPond.  If you get the music semantically right, the graphics happen almost by magic.  So to do what you want, you need to add the semantics to LilyPond.

 

Carl

Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Paolo Prete-3
In reply to this post by Thomas Morley-2
Thanks Thomas.

A really smart solution.

On Fri, Dec 6, 2019 at 12:08 PM Thomas Morley <[hidden email]> wrote:
Am Fr., 6. Dez. 2019 um 01:55 Uhr schrieb Paolo Pr <[hidden email]>:
>
> Hello.
>
> I can't find an easy way to place a markup string exactly at the right of a notehead so they appear horizontally aligned. The only apparent way to obtain that is the trial-and-error procedure.
> This can be very frustrating because I have to compile the input several times.
> A work-around would be to replace the notehead's stencil with the notehead+text, but it doesn't convince me and it causes spacing issues with groups of notes.
>
> Is there a simpler way to solve this?
>
> Thanks

Hijack StrokeFinger?

{
  <
   bes-\tweak text "foo" -\rightHandFinger #0
   d'-\tweak text "bar" -\rightHandFinger #0
   f'-\tweak text "buzz" -\rightHandFinger #0
   bes'-\tweak text "boink" -\rightHandFinger #0
  >
}

Cheers,
  Harm
Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Paolo Prete-3
In reply to this post by Thomas Morley-2
Hi Thomas,

I think that your solution should be posted in the snippet repository as well. It's very useful for very complex scores, when you have to manage lot of markups, because the trial-and-error method is time consuming.
In addition:

1) How can I set the font's attributes of this tweak to the markup's default ones? As you can see, there are some additional attributes that differ (size and italic)

{
   bes-\tweak text \markup {"foo" } -\rightHandFinger #0
   d'^\markup { "foo" }
}

2) Is there a way to place the markup exactly on the top or on the bottom of the notehead as well? 

3) What can be used to add an extra offset (vertical or horizontal, depending on the position of the markup)?

1 + 2 + 3 could give a really complete solution for having TOTAL control of the markup's position. I understand that this is not the proper way to manage these objects with Lilypond (you can add a warning in the snippet, like "use this method only if you really need it") but in many cases it's really useful.

Thanks
P





On Fri, Dec 6, 2019 at 12:08 PM Thomas Morley <[hidden email]> wrote:
Am Fr., 6. Dez. 2019 um 01:55 Uhr schrieb Paolo Pr <[hidden email]>:
>
> Hello.
>
> I can't find an easy way to place a markup string exactly at the right of a notehead so they appear horizontally aligned. The only apparent way to obtain that is the trial-and-error procedure.
> This can be very frustrating because I have to compile the input several times.
> A work-around would be to replace the notehead's stencil with the notehead+text, but it doesn't convince me and it causes spacing issues with groups of notes.
>
> Is there a simpler way to solve this?
>
> Thanks

Hijack StrokeFinger?

{
  <
   bes-\tweak text "foo" -\rightHandFinger #0
   d'-\tweak text "bar" -\rightHandFinger #0
   f'-\tweak text "buzz" -\rightHandFinger #0
   bes'-\tweak text "boink" -\rightHandFinger #0
  >
}

Cheers,
  Harm
Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Thomas Morley-2
Am So., 8. Dez. 2019 um 11:51 Uhr schrieb Paolo Pr <[hidden email]>:

>
> Hi Thomas,
>
> I think that your solution should be posted in the snippet repository as well. It's very useful for very complex scores, when you have to manage lot of markups, because the trial-and-error method is time consuming.
> In addition:
>
> 1) How can I set the font's attributes of this tweak to the markup's default ones? As you can see, there are some additional attributes that differ (size and italic)
>
> {
>    bes-\tweak text \markup {"foo" } -\rightHandFinger #0
>    d'^\markup { "foo" }
> }

That's because only the text-property of the StrokeFinger is tweaked,
thus the other defaults for StrokeFinger persist.
You may tackle them by additional \tweaks like:

{
   bes
     -\tweak font-size #0
     -\tweak font-shape #'()
     -\tweak text \markup { "foo" }
     -\rightHandFinger #0

   <
    bes
      -\tweak font-size #0
      -\tweak font-shape #'()
      -\tweak text \markup { "foo" }
      -\rightHandFinger #0
    d'
      -\tweak font-size #0
      -\tweak font-shape #'()
      -\tweak text \markup { "bar" }
      -\rightHandFinger #0
   >

   d'^\markup { "foo" }
}

Alas, collisions will occurr now.

> 2) Is there a way to place the markup exactly on the top or on the bottom of the notehead as well?

Not sure what you mean, could you provide an image?

> 3) What can be used to add an extra offset (vertical or horizontal, depending on the position of the markup)?

use \tweak extra-offset <number-pair>

> 1 + 2 + 3 could give a really complete solution for having TOTAL control of the markup's position. I understand that this is not the proper way to manage these objects with Lilypond (you can add a warning in the snippet, like "use this method only if you really need it") but in many cases it's really useful.

Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Paolo Prete-3


On Sun, Dec 8, 2019 at 1:37 PM Thomas Morley <[hidden email]> wrote:
Am So., 8. Dez. 2019 um 11:51 Uhr schrieb Paolo Pr <[hidden email]>:

> 2) Is there a way to place the markup exactly on the top or on the bottom of the notehead as well?

Not sure what you mean, could you provide an image?


I would like the same behaviour of expressive marks like dots or staccato above (or below) noteheads:


They are placed near the notehead regardless of the collision with the staff's lines
If we have this too, we have therefore a complete test case:

1) Markup at the right of a notehead  (the tweak you wrote before)
2) markup exactly above or below the notehead (?)
3) markup above or below notehead + staff + stem  ( c'^\markup {"foo"}  ,  c'_\markup {"foo"} ) 

thanks



 
Reply | Threaded
Open this post in threaded view
|

Re: Place a markup string at the right of a notehead

Thomas Morley-2
Am So., 8. Dez. 2019 um 18:38 Uhr schrieb Paolo Pr <[hidden email]>:

>
>
>
> On Sun, Dec 8, 2019 at 1:37 PM Thomas Morley <[hidden email]> wrote:
>>
>> Am So., 8. Dez. 2019 um 11:51 Uhr schrieb Paolo Pr <[hidden email]>:
>>
>> > 2) Is there a way to place the markup exactly on the top or on the bottom of the notehead as well?
>>
>> Not sure what you mean, could you provide an image?
>>
>
> I would like the same behaviour of expressive marks like dots or staccato above (or below) noteheads:
>
> http://lilybin.com/ndhwj3/1
>
> They are placed near the notehead regardless of the collision with the staff's lines
> If we have this too, we have therefore a complete test case:
>
> 1) Markup at the right of a notehead  (the tweak you wrote before)
> 2) markup exactly above or below the notehead (?)
> 3) markup above or below notehead + staff + stem  ( c'^\markup {"foo"}  ,  c'_\markup {"foo"} )
>
> thanks

Well, you could hijack Script then:

    {
        a'
          -\tweak font-name #"TeXGyreSchola"
          -\tweak stencil #ly:text-interface::print
          -\tweak text "foo"
          -!
        c''
          -\tweak font-name "TeXGyreSchola"
          -\tweak stencil #ly:text-interface::print
          -\tweak text "bar"
          -!
    }

Cheers,
  Harm