Custom dynamic mark on several lines

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

Custom dynamic mark on several lines

Claire Meyer-2
Hello,

I was wondering if I could write a custom dynamic mark on several lines. Something along the lines of :

dals = \tweak DynamicText.self-alignment-X #CENTER
#(make-dynamic-script
(markup #:normal-text "l1"
#:normal-text "l2"
#:normal-text "l3"
))

Where l1 is on line 1, l2 is on line 2, and l3 is on line 3. Can someone help me ?

Thanks,
Claire
Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Aaron Hill
On 2020-08-30 12:59 pm, Claire Meyer wrote:

> Hello,
>
> I was wondering if I could write a custom dynamic mark on several
> lines.
> Something along the lines of :
>
> dals = \tweak DynamicText.self-alignment-X #CENTER
> #(make-dynamic-script
> (markup #:normal-text "l1"
> #:normal-text "l2"
> #:normal-text "l3"
> ))
>
> Where l1 is on line 1, l2 is on line 2, and l3 is on line 3. Can
> someone
> help me ?

You should be able to use \column:

%%%%
dals = \tweak DynamicText.self-alignment-X #CENTER
#(make-dynamic-script #{ \markup \normal-text \column { 11 12 13 } #})
%%%%


-- Aaron Hill

Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Claire Meyer-2
Thank you very much ! Would you know as well how to center it vertically on the second line ?

On Sun, Aug 30, 2020 at 10:12 PM Aaron Hill <[hidden email]> wrote:
On 2020-08-30 12:59 pm, Claire Meyer wrote:
> Hello,
>
> I was wondering if I could write a custom dynamic mark on several
> lines.
> Something along the lines of :
>
> dals = \tweak DynamicText.self-alignment-X #CENTER
> #(make-dynamic-script
> (markup #:normal-text "l1"
> #:normal-text "l2"
> #:normal-text "l3"
> ))
>
> Where l1 is on line 1, l2 is on line 2, and l3 is on line 3. Can
> someone
> help me ?

You should be able to use \column:

%%%%
dals = \tweak DynamicText.self-alignment-X #CENTER
#(make-dynamic-script #{ \markup \normal-text \column { 11 12 13 } #})
%%%%


-- Aaron Hill

Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Hwaen Ch'uqi
Greetings Claire,

This SHOULD work.

dals = \tweak DynamicText.self-alignment-X #CENTER
#(make-dynamic-script #{ \markup \normal-text \column { "11"
\fill-line { "12" } 13 } #})

Hwaen Ch'uqi


On 8/30/20, Claire Meyer <[hidden email]> wrote:

> Thank you very much ! Would you know as well how to center it vertically on
> the second line ?
>
> On Sun, Aug 30, 2020 at 10:12 PM Aaron Hill <[hidden email]>
> wrote:
>
>> On 2020-08-30 12:59 pm, Claire Meyer wrote:
>> > Hello,
>> >
>> > I was wondering if I could write a custom dynamic mark on several
>> > lines.
>> > Something along the lines of :
>> >
>> > dals = \tweak DynamicText.self-alignment-X #CENTER
>> > #(make-dynamic-script
>> > (markup #:normal-text "l1"
>> > #:normal-text "l2"
>> > #:normal-text "l3"
>> > ))
>> >
>> > Where l1 is on line 1, l2 is on line 2, and l3 is on line 3. Can
>> > someone
>> > help me ?
>>
>> You should be able to use \column:
>>
>> %%%%
>> dals = \tweak DynamicText.self-alignment-X #CENTER
>> #(make-dynamic-script #{ \markup \normal-text \column { 11 12 13 } #})
>> %%%%
>>
>>
>> -- Aaron Hill
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Aaron Hill
In reply to this post by Claire Meyer-2
On 2020-08-30 1:29 pm, Claire Meyer wrote:
> Thank you very much ! Would you know as well how to center it
> vertically on
> the second line ?

Depending on what you are doing, \vcenter \column { ... } might work.

Alternately, you could use a combination of \column and \dir-column.  
Consider:

%%%%
\version "2.20.0"

\markup {
   baseline >

   \column { 1 2 3 }

   \column {
     \override #`(direction . ,UP)
     \dir-column { 2 1 }
     3
   }

   \override #`(direction . ,UP)
   \dir-column { 3 2 1 }

   < >

   \vcenter \column { 1 2 3 }

   < baseline
}
%%%%

The last example shows how \vcenter does not quite align the same as the
other option.  But again, it might not matter in context so it is worth
trying as it is simpler.


-- Aaron Hill

dynmark.cropped.png (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Claire Meyer-2
Wow, thank you very much for the comprehensive exemple !

Claire

On Sun, Aug 30, 2020 at 10:46 PM Aaron Hill <[hidden email]> wrote:
On 2020-08-30 1:29 pm, Claire Meyer wrote:
> Thank you very much ! Would you know as well how to center it
> vertically on
> the second line ?

Depending on what you are doing, \vcenter \column { ... } might work.

Alternately, you could use a combination of \column and \dir-column. 
Consider:

%%%%
\version "2.20.0"

\markup {
   baseline >

   \column { 1 2 3 }

   \column {
     \override #`(direction . ,UP)
     \dir-column { 2 1 }
     3
   }

   \override #`(direction . ,UP)
   \dir-column { 3 2 1 }

   < >

   \vcenter \column { 1 2 3 }

   < baseline
}
%%%%

The last example shows how \vcenter does not quite align the same as the
other option.  But again, it might not matter in context so it is worth
trying as it is simpler.


-- Aaron Hill
Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Claire Meyer-2
Arf, I'm still struggling :

dals = \tweak DynamicText.self-alignment-X #LEFT
#(make-dynamic-script
#{ \markup \normal-text
\center-column {
\override
#`(direction . ,UP)
\dir-column { "smol" "Very very very tol" }
medium }
#})

I also want to center horizontally (here, the first and second line are left-aligned, and the third is centered).

@Hwaen : your solution gives a weird "horizontal" alignment, the "11" and "13" are on the left, and the "12" is flushed right, but I appreciate the effort, thank you :)

On Sun, Aug 30, 2020 at 10:53 PM Claire Meyer <[hidden email]> wrote:
Wow, thank you very much for the comprehensive exemple !

Claire

On Sun, Aug 30, 2020 at 10:46 PM Aaron Hill <[hidden email]> wrote:
On 2020-08-30 1:29 pm, Claire Meyer wrote:
> Thank you very much ! Would you know as well how to center it
> vertically on
> the second line ?

Depending on what you are doing, \vcenter \column { ... } might work.

Alternately, you could use a combination of \column and \dir-column. 
Consider:

%%%%
\version "2.20.0"

\markup {
   baseline >

   \column { 1 2 3 }

   \column {
     \override #`(direction . ,UP)
     \dir-column { 2 1 }
     3
   }

   \override #`(direction . ,UP)
   \dir-column { 3 2 1 }

   < >

   \vcenter \column { 1 2 3 }

   < baseline
}
%%%%

The last example shows how \vcenter does not quite align the same as the
other option.  But again, it might not matter in context so it is worth
trying as it is simpler.


-- Aaron Hill
Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Aaron Hill
On 2020-08-30 2:39 pm, Claire Meyer wrote:

> Arf, I'm still struggling :
>
> dals = \tweak DynamicText.self-alignment-X #LEFT
> #(make-dynamic-script
> #{ \markup \normal-text
> \center-column {
> \override
> #`(direction . ,UP)
> \dir-column { "smol" "Very very very tol" }
> medium }
> #})
>
> I also want to center horizontally (here, the first and second line are
> left-aligned, and the third is centered).

Ah, you will need to use \center-align on each element:

%%%%
\markup {
   \column {
     \override #`(direction . ,UP)
     \dir-column {
       \center-align \line { d e }
       \center-align \line { a b c }
     }
     \center-align \line { f g h }
   }
}
%%%%

Note that by doing this, you don't need to use \center-column
specifically.

If you are using this pattern frequently enough, you could wrap it all
up in a new markup command:

%%%%
\version "2.20.0"

#(define-markup-command
   (centered-three-lines layout props arg1 arg2 arg3)
   (markup? markup? markup?)
   (interpret-markup layout props #{
     \markup \column {
       \override #`(direction . ,UP)
       \dir-column {
         \center-align #arg2
         \center-align #arg1
       }
       \center-align #arg3
     } #}))

\markup \centered-three-lines
   \line { a b c }
   \line { d e }
   \line { f g h }
%%%%


-- Aaron Hill

Reply | Threaded
Open this post in threaded view
|

Re: Custom dynamic mark on several lines

Claire Meyer-2
Thank you !

On Mon, Aug 31, 2020 at 12:13 AM Aaron Hill <[hidden email]> wrote:
On 2020-08-30 2:39 pm, Claire Meyer wrote:
> Arf, I'm still struggling :
>
> dals = \tweak DynamicText.self-alignment-X #LEFT
> #(make-dynamic-script
> #{ \markup \normal-text
> \center-column {
> \override
> #`(direction . ,UP)
> \dir-column { "smol" "Very very very tol" }
> medium }
> #})
>
> I also want to center horizontally (here, the first and second line are
> left-aligned, and the third is centered).

Ah, you will need to use \center-align on each element:

%%%%
\markup {
   \column {
     \override #`(direction . ,UP)
     \dir-column {
       \center-align \line { d e }
       \center-align \line { a b c }
     }
     \center-align \line { f g h }
   }
}
%%%%

Note that by doing this, you don't need to use \center-column
specifically.

If you are using this pattern frequently enough, you could wrap it all
up in a new markup command:

%%%%
\version "2.20.0"

#(define-markup-command
   (centered-three-lines layout props arg1 arg2 arg3)
   (markup? markup? markup?)
   (interpret-markup layout props #{
     \markup \column {
       \override #`(direction . ,UP)
       \dir-column {
         \center-align #arg2
         \center-align #arg1
       }
       \center-align #arg3
     } #}))

\markup \centered-three-lines
   \line { a b c }
   \line { d e }
   \line { f g h }
%%%%


-- Aaron Hill