lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic offset to align texts on their baseline.


From: Stéphane SOPPERA
Subject: Automatic offset to align texts on their baseline.
Date: Wed, 2 Jun 2021 15:01:03 +0200

Hi,

This is my first post here and I hope this question has not already been answered.

I want to add harmonic analysis under my scores, something like that:
Screenshot from 2021-06-02 14-55-24.png
To achieve that I have used the script at the bottom of this mail. Something I had to do to align those texts properly though is:
  \new Dynamics \with {
    \override TextScript.Y-offset = #-3
  }


Without this override, I get this result:
Screenshot from 2021-06-02 14-55-06.png

Is there any way to have automatic alignment without having to use Y-offset override?

Thanks in advance,
Stéphane SOPPERA


The full script:
\version "2.20.0"

#(define-markup-command
  (degree-text layout props degree indices)
  (markup? markup-list?)
  "Harmonic analysis DEGREE with exponents INDICES.

Input DEGREE is usually a simple string: e.g. VII.
Input INDICES a list of simple strings: e.g. (6 4)."
  (displayScheme indices)
  (let ((indices (if (= 1 (length indices))
                  (list (car indices) (markup #:null))
                  indices)))
   (interpret-markup layout props
     #{\markup {
         \vcenter #degree

         \vcenter
         \fontsize #-3.5
         \override #'(baseline-skip . 1.4)
         \right-column #indices
       }#})))
 

<<
  \new Staff \relative {
    c'1 | d | e |
  }
  \new Dynamics \with {
    \override TextScript.Y-offset = #-3
  } {
    s1_\markup { \degree-text I {6 4 -3} } |
    s_\markup { \degree-text VII {2} } |
    s_\markup { \degree-text III {} } |
  }
>>

 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]