Re: centralising markups above notes

2021-04-09 Thread Gilberto Agostinho

Hi Jean,

On 09/04/2021 15:36, Jean Abou Samra wrote:

What you are doing is more or less the proper
way. Objects have two parameters for alignment
because it should depend on both the extents of
the aligned object and its parent. This was
briefly discussed in this recent thread:

https://lists.gnu.org/archive/html/bug-lilypond/2021-02/msg00016.html

For what it's worth, you can do

center = \tweak parent-alignment-X 0 \tweak self-alignment-X 0 \etc

and then it's a matter of

{
    d''1\center ^"III."
}


Thank you so much for the reply. It's good to know this is basically the 
right way of doing things, I will use your suggested approach of 
combining multiple tweaks on a single variable and use it in the score 
as in your example.


Many thanks,
Gilberto




Re: centralising markups above notes

2021-04-09 Thread Jean Abou Samra

Le 09/04/2021 à 13:59, Gilberto Agostinho a écrit :


Hi David,

On 09/04/2021 12:32, David Kastrup wrote:

Where does the documentation suggest that \center-align (and similar)
does anything to a single item?  It aligns the things passed to it, not
their outside.


See the Text alignment section in 
http://lilypond.org/doc/v2.23/Documentation/notation/formatting-text 
it clearly makes use of a single item with \center-align.


Regardless of the documentation, would you be able to tell me what's 
the best approach to centre a markup on a note, please? The solution I 
found (last bar in my previous minimal example) seems very hacky to me 
as it's mixing two things (\center-align and parent-alignment-x) for 
the alignment.


Many thanks,
Gilberto


Hi,

What you are doing is more or less the proper
way. Objects have two parameters for alignment
because it should depend on both the extents of
the aligned object and its parent. This was
briefly discussed in this recent thread:

https://lists.gnu.org/archive/html/bug-lilypond/2021-02/msg00016.html

For what it's worth, you can do

center = \tweak parent-alignment-X 0 \tweak self-alignment-X 0 \etc

and then it's a matter of

{
    d''1\center ^"III."
}

Best,
Jean


Re: centralising markups above notes

2021-04-09 Thread Robin Bannister

Gilberto Agostinho wrote:


The solution I found [...] seems very hacky to me as it's
mixing two things (\center-align and parent-alignment-x) for the alignment.


My take on this: it is not 'mixing' but rather 'combining' two things.
You get more useful combinations with less headaches.

See the last 2 paragraphs of
https://sourceforge.net/p/testlilyissues/issues/4036/#2bde


Cheers,
Robin



Re: centralising markups above notes

2021-04-09 Thread David Kastrup


Please keep the list copied.

Gilberto Agostinho  writes:

> Hi David,
>
> On 09/04/2021 12:32, David Kastrup wrote:
>> Where does the documentation suggest that \center-align (and similar)
>> does anything to a single item?  It aligns the things passed to it, not
>> their outside.
>
> See the Text alignment section in
> http://lilypond.org/doc/v2.23/Documentation/notation/formatting-text
> it clearly makes use of a single item with \center-align.

Well, seems like my recollection hasn't caught up to

commit 6f3f8f0fceed3b318c2572337e7dca83e4a11f6c
Author: Janek Warchoł 
Date:   Mon Jun 23 23:30:49 2014 +0200

TextScript, CombineTextScript: use aligned_on_parent

I think this makes more sense than just using "self-alignment".
It makes these grobs consistent with Lyrics and Dynamics, and
allows users to override their alignment more predictably.

Expected changes in output: TextScripts and CombineTextScripts
will be aligned slightly different when the user sets self-alignment-X
explicitly (parent notehead will be included in alignment, as in Lyrics).
Default placement should remain the same.

I'm also changing one regtest, just to make sure that despite slightly
changed alignment the markups will stick out far enough to the left.

-- 
David Kastrup



Re: centralising markups above notes

2021-04-09 Thread Gilberto Agostinho

Hi David,

On 09/04/2021 12:32, David Kastrup wrote:

Where does the documentation suggest that \center-align (and similar)
does anything to a single item?  It aligns the things passed to it, not
their outside.


See the Text alignment section in 
http://lilypond.org/doc/v2.23/Documentation/notation/formatting-text it 
clearly makes use of a single item with \center-align.


Regardless of the documentation, would you be able to tell me what's the 
best approach to centre a markup on a note, please? The solution I found 
(last bar in my previous minimal example) seems very hacky to me as it's 
mixing two things (\center-align and parent-alignment-x) for the alignment.


Many thanks,
Gilberto


Re: centralising markups above notes

2021-04-09 Thread David Kastrup
Gilberto Agostinho  writes:

> Hi everyone,
>
> I'm trying to add centred string numbers to some notes in my
> composition using markup. Using only \center-align as the
> documentation suggests does not seem to do the trick, as the text is
> still not centralised.

Where does the documentation suggest that \center-align (and similar)
does anything to a single item?  It aligns the things passed to it, not
their outside.

-- 
David Kastrup



centralising markups above notes

2021-04-09 Thread Gilberto Agostinho

Hi everyone,

I'm trying to add centred string numbers to some notes in my composition 
using markup. Using only \center-align as the documentation suggests 
does not seem to do the trick, as the text is still not centralised. I 
am only able to get them properly centred when I set parent-alignment-X 
to zero AND use \center-align. Am I doing something incorrect or do I 
really need these two commands in order to get the text centred?


Minimal example: 4 bars, only last one seems to be properly centered

\version "2.23.0"
{
    % regular markup: left aligned
    d''1
    ^ \markup { III. }

    % \center-aligned: still not centered
    d''1
    ^ \markup { \center-align III. }

    % setting parent-alignment-X to 0: still not centered
    \once \override TextScript.parent-alignment-X = #0
    d''1
    ^ \markup { III. }

    % setting parent-alignment-X to 0 with \center-aligned: now it's 
properly centered

    \once \override TextScript.parent-alignment-X = #0
    d''1
    ^ \markup { \center-align III. }
}

Producing: 
https://i.postimg.cc/ZKVTyn6L/Screenshot-from-2021-04-09-11-30-58.png


Many thanks,
Gilberto