[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Variables in instrumentName markup?
From:       Trevor Bača <trevorbaca () gmail ! com>
Date:       2015-03-29 12:24:52
Message-ID: CACTvJ4Wxc_fE3djM7etdbCExFnyLT1qE-Fti9MGJy9=RQKYJMQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Mark & hi Harm,

Brilliant. Just what I was looking for, and instructive in two different
ways.

Thank you both.

Trevor.

On Sat, Mar 28, 2015 at 4:20 PM, Thomas Morley <thomasmorley65@gmail.com>
wrote:

> 2015-03-28 20:27 GMT+01:00 Mark Knoop <mark@opus11.net>:
> > At 14:13 on 28 Mar 2015, Trevor Bača wrote:
> >>Hi,
> >>
> >>Is there a way to do ...
> >>
> >>   foo = #12
> >>   \new Staff \with {
> >>      instrumentName = \markup { \hcenter-in \foo Percussion }
> >>   } { ... }
> >>   \new Staff \with {
> >>      instrumentName = \markup { \hcenter-in \foo Violin }
> >>   } { ... }
> >>
> >>... or equivalent?
> >
> > Just write #foo. Or even #(+ foo 3), #(/ foo 2.735), ....
> >
> > --
> > Mark Knoop
>
>
>
> How about:
>
> \version "2.19.17"
>
> val = 12
>
> \layout {
>     \context {
>     \Staff
>     \override InstrumentName.after-line-breaking =
>     #(lambda (grob)
>       (ly:grob-set-property! grob 'long-text
>         (markup
>           #:box ;; only for debugging, delete me
>           #:hcenter-in val
>           (ly:grob-property grob 'long-text))))
>     }
> }
>
>    \new Staff
>    \with { instrumentName = "Percussion" }
>    { c''1 }
>    \new Staff
>    \with { instrumentName = "Violin" }
>    { d''1 }
>
>
> HTH,
>   Harm
>
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>



-- 
Trevor Bača
trevorbaca@gmail.com

[Attachment #5 (text/html)]

<div dir="ltr">Hi Mark &amp; hi Harm,<div><br></div><div>Brilliant. Just what I was \
looking for, and instructive in two different ways.</div><div><br></div><div>Thank \
you both.</div><div><br></div><div>Trevor.</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 28, 2015 at 4:20 PM, \
Thomas Morley <span dir="ltr">&lt;<a href="mailto:thomasmorley65@gmail.com" \
target="_blank">thomasmorley65@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><span class="">2015-03-28 20:27 GMT+01:00 Mark Knoop &lt;<a \
href="mailto:mark@opus11.net">mark@opus11.net</a>&gt;:<br> &gt; At 14:13 on 28 Mar \
2015, Trevor Bača wrote:<br> &gt;&gt;Hi,<br>
&gt;&gt;<br>
&gt;&gt;Is there a way to do ...<br>
&gt;&gt;<br>
&gt;&gt;     foo = #12<br>
&gt;&gt;     \new Staff \with {<br>
&gt;&gt;         instrumentName = \markup { \hcenter-in \foo Percussion }<br>
&gt;&gt;     } { ... }<br>
&gt;&gt;     \new Staff \with {<br>
&gt;&gt;         instrumentName = \markup { \hcenter-in \foo Violin }<br>
&gt;&gt;     } { ... }<br>
&gt;&gt;<br>
&gt;&gt;... or equivalent?<br>
&gt;<br>
&gt; Just write #foo. Or even #(+ foo 3), #(/ foo 2.735), ....<br>
&gt;<br>
&gt; --<br>
&gt; Mark Knoop<br>
<br>
<br>
<br>
</span>How about:<br>
<br>
\version &quot;2.19.17&quot;<br>
<br>
val = 12<br>
<br>
\layout {<br>
      \context {<br>
      \Staff<br>
      \override InstrumentName.after-line-breaking =<br>
      #(lambda (grob)<br>
         (ly:grob-set-property! grob &#39;long-text<br>
            (markup<br>
               #:box ;; only for debugging, delete me<br>
               #:hcenter-in val<br>
               (ly:grob-property grob &#39;long-text))))<br>
      }<br>
}<br>
<br>
     \new Staff<br>
     \with { instrumentName = &quot;Percussion&quot; }<br>
     { c&#39;&#39;1 }<br>
     \new Staff<br>
     \with { instrumentName = &quot;Violin&quot; }<br>
     { d&#39;&#39;1 }<br>
<br>
<br>
HTH,<br>
   Harm<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
lilypond-user mailing list<br>
<a href="mailto:lilypond-user@gnu.org">lilypond-user@gnu.org</a><br>
<a href="https://lists.gnu.org/mailman/listinfo/lilypond-user" \
target="_blank">https://lists.gnu.org/mailman/listinfo/lilypond-user</a><br> \
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature">Trevor Bača<br><a \
href="mailto:trevorbaca@gmail.com">trevorbaca@gmail.com</a></div> </div>



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic