Hello Stefan (also Federico), is there a particular reason you are using font Arial instead of simply using markup command \sans?
This is a slightly more robust approach (not requiring manual positioning), using a markup command #(define-markup-command (tuning-column layout props tunings) (list?) (let* ((tuning-markups (map (lambda (x) (interpret-markup layout props x)) tunings)) (tuning-markups (map (lambda (x) (ly:stencil-aligned-to x Y CENTER)) tuning-markups)) (tuning-markups (map (lambda (x) (ly:stencil-aligned-to x X CENTER)) tuning-markups)) (tuning-markups (map (lambda (x y) (ly:stencil-translate-axis x (* y 1.5) Y)) tuning-markups (iota (length tuning-markups)))) (column (apply ly:stencil-add tuning-markups)) (up-column (ly:stencil-aligned-to column Y UP)) (first (car tuning-markups)) (first-height (interval-length (ly:stencil-extent first Y))) (half-space-corrected-column (ly:stencil-translate-axis up-column (/ first-height 2) Y))) half-space-corrected-column)) which allows us to do \new TabStaff \with { \override InstrumentName.self-alignment-X = #RIGHT instrumentName = \markup { \center-column { " " \raise #-0.4 "Ac. Guitar" \override #'(font-size . -1.5) "(Double Drop-D)" " " } \fontsize #-3.2 \raise #-0.7 \sans \tuning-column #'("D" "A" "D" "g" "b" "d") } shortInstrumentName = "git" } { \set TabStaff.stringTunings = \stringTuning <d, a, d g b d'> d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 } But even more stable would be to separate tuning and instrument name, doing something like this: %%% Add a tuning column left of the first staff symbol stencil #(define (staff-symbol-with-tuning tuning) (grob-transformer 'stencil (lambda (grob orig) (let* ((unbroken (ly:grob-original grob)) (siblings (ly:spanner-broken-into unbroken)) (m-stc (grob-interpret-markup grob #{ \markup\sans\fontsize #-3.2 \tuning-column #tuning #})) (oext (ly:stencil-extent orig Y)) (m-stc (ly:stencil-translate-axis m-stc (cdr oext) Y)) (m-stc (ly:stencil-translate-axis m-stc -1.1 X))) (if (eq? grob (car siblings)) (ly:stencil-add orig m-stc) orig))))) %%% Automatically adjust InstrumentName padding by changed StaffSymbol extent \layout { \override TabStaff.InstrumentName.padding = #(grob-transformer 'padding (lambda (grob orig) (let* ((ss (ly:grob-object grob 'staff-symbol)) (ss-stencil (ly:grob-property ss 'stencil)) (sext (ly:stencil-extent ss-stencil X))) (- orig (min 0 (car sext)))))) } \new TabStaff \with { % On first StaffSymbol add tuning to the left \override StaffSymbol.stencil = #(staff-symbol-with-tuning '("D" "A" "D" "g" "b" "d")) instrumentName = \markup\center-column { "Ac. Guitar" \fontsize #-1.5 "(Double Drop-D)" } shortInstrumentName = "git" } { \set TabStaff.stringTunings = \stringTuning <d, a, d g b d'> d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 \break d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 } or even extract the tuning from the context (although this requires us to specify the tuning before): %%% Add a tuning column from string tuning property #(define ((context-staff-symbol-with-tuning case) context) (let* ((tuning (ly:context-property context 'stringTunings)) (tuning (reverse tuning)) (tuning-markups-lc (map (lambda (x) (note-name->markup x #t)) tuning)) (tuning-markups-uc (map (lambda (x) (note-name->markup x #f)) tuning)) (n (length tuning)) (nh (/ n 2)) (tuning-markups-mixed (map (lambda (lc uc i) (if (< i nh) uc lc)) tuning-markups-lc tuning-markups-uc (iota n))) (tuning-markups (cond ((eq? case 'upper) tuning-markups-uc) ((eq? case 'mixed) tuning-markups-mixed) (else tuning-markups-lc)))) (ly:context-pushpop-property context 'StaffSymbol 'stencil (staff-symbol-with-tuning tuning-markups)))) \new TabStaff \with { stringTunings = \stringTuning <d, a, d g b d'> \applyContext #(context-staff-symbol-with-tuning 'mixed) instrumentName = \markup\center-column { "Ac. Guitar" \fontsize #-1.5 "(Double Drop-D)" } shortInstrumentName = "git" } { d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 \break d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 } I’ve appended the file with all cases. An even cleaner approach would be to add a new grob type and engraver for this. Cheers, Valentin Am Montag, 30. Jänner 2023, 22:45:58 CET schrieb Stefan E. Mueller: > Thanks Valentin and Federico for your suggestions and examples - > > I needed to tweak things a little bit in order to line up the letters to > the tablature lines. > > This is what I came up with: > > \new TabStaff \with { > \override InstrumentName.self-alignment-X = #RIGHT > instrumentName = \markup {\center-column { > " " > \raise #-0.4 > "Ac. Guitar" > \override #'(font-size . -1.5) > "(Double Drop-D)" > " " > } \override #'(font-size . -3.2) \override #`(baseline-skip . 1.5) > \override #'(font-name . "Arial") > \raise #-1.2 \right-column { > "d" \raise #-0.1 "b" "g" \raise #-0.2 "D" "A" "D" > }} > shortInstrumentName = "git" > } { > \set TabStaff.stringTunings = \stringTuning <d, a, d g b d'> > {d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 } } > > } > > This works for me, but I wonder if the vertical position of the individual > tablature lines could be accessed and used for the positioning of the > letters instead of doing things by hand. > > Stefan > > -- > Stefan E. Mueller > > stefan.e.muel...@gmx.de > > On Sun, 29 Jan 2023, Federico Bruni wrote: > > Il giorno dom 29 gen 2023 alle 22:20:14 +0100, Stefan E. Mueller > > > > <stefan.e.muel...@gmx.de> ha scritto: > >> What I would like to know is whether it is possible to give the tuning > >> notes right before the first Tabstaff, vertically aligned to the > >> tablature > >> lines. I tried accomplish this using "instrumentName", but it does not > > > >> align nicely: > > Here's my saved list of alternative tunings: > > > > % Dropped D > > tuningDropD = \markup { > > \fontsize #-4 > > \override #'(baseline-skip . 1.5) > > \column \override #'(font-name . "Arial Bold") { > > > > E B G D A D > > > > } > > } > > > > % Open G > > tuningOpenG = \markup { > > \fontsize #-4 > > \override #'(baseline-skip . 1.5) > > \column \override #'(font-name . "Arial Bold") { > > > > D B G D G D > > > > } > > } > > > > % Open D > > tuningOpenD = \markup { > > \fontsize #-4 > > \override #'(baseline-skip . 1.5) > > \column \override #'(font-name . "Arial Bold") { > > > > D A \concat { F \override #'(font-name . "Emmentaler-16") \small ♯ } D A > > > > D > > } > > } > > > > % Open E > > guitar-open-e-tuning = \stringTuning <e, b, e e b e'> > > tuningOpenE = \markup { > > \fontsize #-4 > > \override #'(baseline-skip . 1.5) > > \column \override #'(font-name . "Arial Bold") { > > > > E B E E B E > > > > } > > } > > > > % Open A add4 > > guitar-open-a-add-four = \stringTuning <e, a, d e a cis'> > > tuningOpenAaddFour = \markup { > > \fontsize #-4 > > \override #'(baseline-skip . 1.5) > > \column \override #'(font-name . "Arial Bold") { > > > > \concat { C \override #'(font-name . "Emmentaler-16") \small ♯ } A E D A > > > > E > > } > > > > > > > > And a simple example: > > > > \new TabStaff \with { > > stringTunings = \guitar-open-g-tuning > > instrumentName = \markup { " " \tuningOpenG } > > } > > { > > d, g, d g b d' > > }
%%% Create a column of tuning markups aligned to 1.5 staff spaces #(define-markup-command (tuning-column layout props tunings) (list?) (let* ((tuning-markups (map (lambda (x) (interpret-markup layout props x)) tunings)) (tuning-markups (map (lambda (x) (ly:stencil-aligned-to x Y CENTER)) tuning-markups)) (tuning-markups (map (lambda (x) (ly:stencil-aligned-to x X CENTER)) tuning-markups)) (tuning-markups (map (lambda (x y) (ly:stencil-translate-axis x (* y 1.5) Y)) tuning-markups (iota (length tuning-markups)))) (column (apply ly:stencil-add tuning-markups)) (up-column (ly:stencil-aligned-to column Y UP)) (first (car tuning-markups)) (first-height (interval-length (ly:stencil-extent first Y))) (half-space-corrected-column (ly:stencil-translate-axis up-column (/ first-height 2) Y))) half-space-corrected-column)) %%% Using this command in instrument name \new TabStaff \with { \override InstrumentName.self-alignment-X = #RIGHT instrumentName = \markup { \center-column { " " \raise #-0.4 "Ac. Guitar" \override #'(font-size . -1.5) "(Double Drop-D)" " " } \fontsize #-3.2 \raise #-0.7 \sans \tuning-column #'("D" "A" "D" "g" "b" "d") } shortInstrumentName = "git" } { \set TabStaff.stringTunings = \stringTuning <d, a, d g b d'> d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 } %%% Add a tuning column left of the first staff symbol stencil #(define (staff-symbol-with-tuning tuning) (grob-transformer 'stencil (lambda (grob orig) (let* ((unbroken (ly:grob-original grob)) (siblings (ly:spanner-broken-into unbroken)) (m-stc (grob-interpret-markup grob #{ \markup\sans\fontsize #-3.2 \tuning-column #tuning #})) (oext (ly:stencil-extent orig Y)) (m-stc (ly:stencil-translate-axis m-stc (cdr oext) Y)) (m-stc (ly:stencil-translate-axis m-stc -1.1 X))) (if (eq? grob (car siblings)) (ly:stencil-add orig m-stc) orig))))) %%% Automatically adjust InstrumentName padding by changed StaffSymbol extent \layout { \override TabStaff.InstrumentName.padding = #(grob-transformer 'padding (lambda (grob orig) (let* ((ss (ly:grob-object grob 'staff-symbol)) (ss-stencil (ly:grob-property ss 'stencil)) (sext (ly:stencil-extent ss-stencil X))) (- orig (min 0 (car sext)))))) } \new TabStaff \with { % On first StaffSymbol add tuning to the left \override StaffSymbol.stencil = #(staff-symbol-with-tuning '("D" "A" "D" "g" "b" "d")) instrumentName = \markup\center-column { "Ac. Guitar" \fontsize #-1.5 "(Double Drop-D)" } shortInstrumentName = "git" } { \set TabStaff.stringTunings = \stringTuning <d, a, d g b d'> d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 \break d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 } %%% Add a tuning column from string tuning property #(define ((context-staff-symbol-with-tuning case) context) (let* ((tuning (ly:context-property context 'stringTunings)) (tuning (reverse tuning)) (tuning-markups-lc (map (lambda (x) (note-name->markup x #t)) tuning)) (tuning-markups-uc (map (lambda (x) (note-name->markup x #f)) tuning)) (n (length tuning)) (nh (/ n 2)) (tuning-markups-mixed (map (lambda (lc uc i) (if (< i nh) uc lc)) tuning-markups-lc tuning-markups-uc (iota n))) (tuning-markups (cond ((eq? case 'upper) tuning-markups-uc) ((eq? case 'mixed) tuning-markups-mixed) (else tuning-markups-lc)))) (ly:context-pushpop-property context 'StaffSymbol 'stencil (staff-symbol-with-tuning tuning-markups)))) \new TabStaff \with { stringTunings = \stringTuning <d, a, d g b d'> \applyContext #(context-staff-symbol-with-tuning 'mixed) instrumentName = \markup\center-column { "Ac. Guitar" \fontsize #-1.5 "(Double Drop-D)" } shortInstrumentName = "git" } { d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 \break d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4 }
signature.asc
Description: This is a digitally signed message part.