Alignment of instrument names

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Alignment of instrument names

Francesco Napoleoni
Hello everyone

A foreword: I’m an italian enthusiastic LilyPond user and I want to thank you
all for your efforts in making such a beautiful piece of software.

Now my question: (how) can I get instrument names at the start of staves
automatically aligned to the internal page margin?

The code (minimal, I hope) is attached as mozart.ly and the result as
mozart.pdf. The problem is that the string “Violoncello e contrabbasso” goes
out of the page edge, as can be seen on the pdf.

At the moment the only workaround I have found is to fiddle with “indent”.

I have to add that in some handcrafted editions I have seen, the indentation
of the first system is based on the width of the longest instrument name,
the latter starting at the printing margin.

In principle such alignment could be obtained enclosing the column of all the
instrument names in a box, which in turn could be aligned to the printing
margin, but I don’t have a clue on how to achieve this in LilyPond.

Any ideas?

Thank you
Francesco Napoleoni

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

mozart.pdf (157K) Download Attachment
mozart.ly (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Alignment of instrument names

Simon Albrecht-2
On 10.11.2016 15:28, Francesco Napoleoni wrote:
> (how) can I get instrument names at the start of staves
> automatically aligned to the internal page margin?

Unfortunately you can’t. There already is a request for that feature in
our issue tracker, but it hasn’t been implemented yet.

> The code (minimal, I hope)

Not quite minimal. Minimal would be

%%%%%%%%%%%%
\version "2.19.49"
\new Staff \with {
   instrumentName = "Violoncello e Contrabbasso"
} { 1 }
%%%%%%%%%%%%

You do have to find an appropriate indent value by trial and error.
However, you /can/ override instrument names’ self-alignment, if you like:

%%%%%%%%%%%%
\version "2.19.49"
<<
   \new Staff \with {
     instrumentName = "Flauti"
   } { 1 }
   \new Staff \with {
     instrumentName = "Violoncello e Contrabbasso"
   } { 1 }
 >>
\layout {
   \context {
     \Staff
     \override InstrumentName.self-alignment-X = #LEFT
   }
   indent = 50
}
%%%%%%%%%%

Ultimately, I’d certainly advise you to use
instrumentName = \markup {
   \center-column {
     "Violoncello e"
     "Contrabbasso"
   }
}
or something similar, to avoid the need for such a huge indent.

Best, Simon

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Alignment of instrument names

Alexander Kobel-2
On 2016-11-10 16:34, Simon Albrecht wrote:
> On 10.11.2016 15:28, Francesco Napoleoni wrote:
>> (how) can I get instrument names at the start of staves
>> automatically aligned to the internal page margin?
>
> Unfortunately you can’t. There already is a request for that feature in
> our issue tracker, but it hasn’t been implemented yet.

Hm. Shouldn't it be possible to work around this restriction with
something in the line of:

\version "2.19.49"

\paper {
   indent =
   #(let* ((layout '()) ;; <=== How to get the default layout here?!
           (text-props (ly:output-def-lookup layout 'text-font-defaults))
           (stil (ly:text-interface::interpret-markup layout text-props
(markup "Supercalifragilisticexpialidocious")))
           (xext (ly:stencil-extent stil X))
           (width (- (cdr xext) (car xext))))
     width)
}

\new Staff \with {
   instrumentName = "Supercalifragilisticexpialidocious"
} { c'1 \break c'1 }

The goal being to adjust the indent to fit the largest instrumentName
(manually selected and entered before any content is inserted). The
above code will not work, though, because I don't know how to get some
layout object at this point...
Any hints?


Cheers,
Alexander

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Alignment of instrument names

Kieren MacMillan-2
In reply to this post by Francesco Napoleoni
Hello Francesco,

> how can I get instrument names at the start of staves
> automatically aligned to the internal page margin?
[…]
> In principle such alignment could be obtained enclosing the column of all the
> instrument names in a box, which in turn could be aligned to the printing
> margin, but I don’t have a clue on how to achieve this in LilyPond.

Here’s some code that David N. whipped up for me which, I believe, does what you want. Note that it does NOT automatically set the indent — you need to do this manually (by trial and error, essentially).

(David: I’ve cc’ed you here in case you have any improvements to add or things to fix, based on recent improvements in the Lilypond codebase.)

Hope this helps!
Kieren.



________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

mozart.ly (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Alignment of instrument names

Francesco Napoleoni
In data sabato 12 novembre 2016 09:29:54, Kieren MacMillan ha scritto:
> Here’s some code that David N. whipped up for me which, I believe, does what
> you want. Note that it does NOT automatically set the indent — you need to
> do this manually (by trial and error, essentially).

Ok, I have to study carefully your code to understand how it works: it’s not
much time since I have started learning both Scheme and LilyPond programming
interface.

Anyway, thanks to all for your answers!

Francesco


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user