Ich hatte eigentlich Harms Lösung im Sinn; allerdings ist dort der Text dann vertikal mittig ausgerichtet.
Ich hab' noch etwas weiter gearbeitet und `combine-align´ geschrieben mit der Möglichkeit zahlreiche markups zu kombinieren sowie deren Ausrichtung zu kontrollieren.
\combine-align #'()
Zentriert alle gegebenen markups in x- und y-Richtung
\combine-align #'((-1 . -1))
Kombiniert alle markups auf die selbe Art und Weise (hier: links-unten)
\combine-align #'((-3 . -2) (-1 . -1) (1 . 0) (3 . 1))
Kombiniert vier markups auf die individuell angegebene Art.
Im Beispiel unten sind alle Möglichkeiten aufgeführt.
Außerdem habe ich die Gelegenheit ergriffen ein paar neue markup-commands zu demonstrieren:
\rest \draw-dashed-line \draw-dotted-line
Hierfür ist aber 2.17.10 erforderlich.
Das entsprechende Beispiel ist auskommentiert. Im angehängten Bild jedoch einsehbar (für alle, die keine neuere devel-Version haben)
\version "2.16.1"
% Note: All markup-work below is possible without defining a new markup-command
%
% Just for fun. :)
#(define-markup-command (combine-align layout props align-values args)
(list? markup-list?)
#:category align
"
Combines and aligns a list of markups.
Per default all elements of @var{args} are centered in X- and Y-direction.
Example:
\\markup
\\combine-align #'()
{ "\"X"\" \\draw-line #'(2 . 0) }
Other values can be used to align all elements of @var{args}.
Example:
\\markup
\\combine-align #'((-1 . 0))
{ "\"X"\" \\draw-line #'(2 . 0) }
Also possible is to adress each element of @var{args} separately.
Example:
\\markup
\\combine-align #'((0 . 0) (1 . 1))
{ "\"X"\" \\draw-line #'(2 . 0) }
"
(if (<= (length args) 1)
(begin
(ly:warning "Nothing to combine - ignoring")
empty-stencil)
(let* ((args-length (length args))
(new-align-values
(cond ((null? align-values)
(make-list
args-length
'(0 . 0)))
((and (= (length align-values) 1)
(pair? (car align-values)))
(make-list
args-length
(cons (caar align-values) (cdar align-values))))
(else align-values)))
(x-align (map
(lambda (x) (car x))
new-align-values))
(y-align (map
(lambda (y) (cdr y))
new-align-values))
(stil-list (map
(lambda (arg) (interpret-markup layout props arg))
args)))
(apply ly:stencil-add
(map
(lambda (stil x y)
(ly:stencil-aligned-to
(ly:stencil-aligned-to stil X x)
Y
y))
stil-list
x-align
y-align)))))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% TEST
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Some test-markups
stilI =
\markup {
\box
\stencil
#(ly:make-stencil "" '(0 . 6.5) '(0 . 6.5))
}
stilII =
\markup {
\with-color #red
\rotate #45
\box
\stencil
#(ly:make-stencil "" '(0 . 10) '(0 . 10))
}
% The final
\markup
\override #'(box-padding . 1)
\box
\fill-line { \fontsize #6 "The markup-command \\combine-align" }
\markup \vspace #2
\markup
\fill-line {
\column {
\rounded-box
\center-column {
"Per default, all markups to combine are centered in X- and Y-direction."
\fontsize #-2 \typewriter "\\combine-align #'()"
}
\vspace #1
}
}
\markup \fill-line { \combine-align #'() { \stilI \stilII } }
\markup
\fill-line {
\column {
\vspace #1
\rounded-box
\center-column {
"Other values are possible. To align all left-down use:"
\fontsize #-2 \typewriter "\\combine-align #'((-1 . -1))"
}
\vspace #1
}
}
\markup
\fill-line {
\combine-align #'((-1 . -1))
{ \stilI \stilII }
}
\markup
\fill-line {
\column {
\vspace #1
\rounded-box
\center-column {
"Each markup to combine may be adressed separately."
\fontsize #-2
\typewriter
"\\combine-align #'((-3 . -2) (-1 . -1) (1 . 0) (3 . 1))"
}
\vspace #1
}
}
\markup
\fill-line {
\combine-align #'((-3 . -2) (-1 . -1) (1 . 0) (3 . 1))
{ \stilI \stilI \stilI \stilI }
}
%% "2.17.10" requested:
%{
\markup
\fill-line {
\column {
\vspace #1
\rounded-box
\center-column {
"Using some other, new markup-commands."
"\\rest available with \"2.17.9\""
"\\draw-dashed-line and \\draw-dotted-line with \"2.17.10\""
}
\vspace #1
}
}
\markup
\fill-line {
\override #'(box-padding . 2)
\box {
\combine-align #'((-1 . -2)
(-1 . -4)
(-1 . 0)
(-1 . 4)
(-1 . 2)
(-1 . 120)
(-1 . 124)
(-1 . 128)
(-1 . 4.5))
{
\line {
"Notes: "
\hspace #14.8 \note #"1" #1
\hspace #0.6 \note #"2" #1
\hspace #0.6 \note #"4" #1
\hspace #0.6 \note #"8" #1
\hspace #0.6 \note #"16" #1
}
\override #'(off . 0.2) \draw-dotted-line #'(38 . 0)
\draw-dashed-line #'(38 . 0)
\override #'(off . 0.2) \draw-dotted-line #'(38 . 0)
\line {
"Rests:"
\hspace #16 \rest #"1"
\hspace #1 \rest #"2"
\hspace #1 \rest #"4"
\hspace #1 \rest #"8"
\hspace #1 \rest #"16"
}
\override #'(off . 0.2) \draw-dotted-line #'(38 . 0)
\draw-dashed-line #'(38 . 0)
\override #'(off . 0.2) \draw-dotted-line #'(38 . 0)
\line {
"MultiMeasureRests: "
\override #'(multi-measure-rest . #t){
\hspace #1 \rest #"1"
\hspace #1 \rest #"2"
\hspace #1 \rest #"3"
\hspace #1 \rest #"4"
\hspace #1 \rest #"5"
}
}
}
}
}
%}Gruß,
Harm
P.S. Alle demonstrierten Effekte sind tatsächlich auch ohne `combine-align´ möglich, aber da ich gerade dabei war ...
