13

I use LaTeX and lilypond-book to create a hymn sheet. I increased the font size with KOMA script to increase the readability. Now the font sizes in the LaTeX document does not match the embedded lyrics from Lilypond. What can I do that Lilypond re-uses LaTeX' font size?

(Probably the problem is more difficult than I thought: Lilypond uses different fonts like truetype or type1 and not LaTeX' Computer Modern. Somewhat solved in comment)

Code with manually adjusted sizes that somehow match:

\documentclass[a4paper,fontsize=15pt]{scrartcl}
\usepackage{tgschola}
\addtokomafont{disposition}{\rmfamily}

\begin{document}
\begin{lilypond}
\version "2.12.3"
\paper { indent = 0 } 
Melodie = \relative c' {
  \clef treble
  \time 2/4
  \omit Staff.TimeSignature

  c2 d2 e2 g2
  \bar "|."
}

Text = \lyricmode {
  Lo -- rem ip -- sum
}

\score{
  <<
    \new Voice = "eins" {
      \autoBeamOff
      \Melodie
    }
    \new Lyrics \lyricsto "eins" \Text
  >>
  \layout {
    \context {
     \Lyrics
     \override LyricText #'font-size = #3
     %\override LyricText #'font-name = #"Computer Modern"
   }
  }
}
\end{lilypond}

2. Lorem ipsum dolor sit amet, / consetetur sadipscing elitr

\end{document}

The - in Lo -- rem is smaller than the letters. How do I adjust that?

  • 1
    Would you add a small example of the way you’ve set things up? It would help us answer your request if we saw the essential packages in your preamble, and, in the body of the document, a line or two from a folksong with some text around it. – Thérèse Jul 2 '14 at 6:50
  • In order to fit readable lyrics to readable music, lilypond automatically scales fonts according to the global staff size. Therefore, it seems that you’ll need to adjust the staff size until the lyrics look right to you. – Thérèse Jul 2 '14 at 7:49
  • 1
    The default serif font in lilypond is New Century Schoolbook, and you can use a font much like it for ordinary LaTeX text by adding usepackage{tgschola} to your preamble. (See the documentation of tex-gyre for the history of this font.) – Thérèse Jul 2 '14 at 21:10
  • @Thérèse Thanks for the hint with tgschola That's a huge improvement. – usr1234567 Jul 3 '14 at 3:58
  • @Thérèse Please make a answer from your last comment, then I'll give the bounty to it. – usr1234567 Jul 5 '14 at 21:45
7
+50

There are two parts to this problem: font size and typeface.

To begin with font size, in order to make the lyrics fit the music while remaining readable, lilypond automatically scales fonts according to staff size. I’ve found nothing in the many files produced by lilypond-book which would indicate the point size after scaling, so it seems that you’ll need to adjust the staff size until the lyrics look right to you. A grid produced with eso-pic or a program like Gnome’s screenruler or KDE’s kruler would help you here, but there will be enough trial and error that you should postpone this step until you’re sure you won’t change your mind about the font size of the document as a whole.

Once you’ve found the right staff size, if it’s other than the default staff size and if that’s all you want to change, you can give it as an option to the lilypond environment in square brackets:

\begin{lilypond}[staffsize=26]
d4 c b a
\end{lilypond}

As for typeface, the default serif font in lilypond is New Century Schoolbook, and TeX Gyre Schola is based on URW Century Schoolbook L. So adding \usepackage{tgschola} to your preamble will give the rest of your document a font much like that in the lyrics.

If you want some other font, add it to your preamble in usual manner and then to the \paper { } section in each instance of the lilypond environmment. For example,

\documentclass[fontsize=13pt]{scrartcl}
\usepackage{tgpagella}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat.

\bigskip

\begin{lilypond}
\paper {
  mystaffsize = #26
  #(define fonts
     (make-pango-font-tree "TeX Gyre Pagella"
       "TeX Gyre Heros"
       "TeX Gyre Cursor"
       (/ mystaffsize 26)
       )
     )
}
<<
  \relative c'' {
    \key g \major
    \time 6/8
    d4 b8 c4 a8 | d4 b8 g4 g8 |
    a4 b8 c[ b] a | d4 b8 g4. |
  }
  \addlyrics {
    Girls and boys come | out to play,
    The | moon doth shine _ as | bright as day; |
  }
>>
\end{lilypond}

\bigskip

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat.
\end{document}

output of the sample

You will need to repeat the \paper { } section in each instance of the lilypond environment, unless you redefine the environment. For some reason, I have not been able to make Pango play nicely with Latin Modern.

If you use fontspec, see https://tex.stackexchange.com/a/133241/7883.

1

Here's the relevant bit in my Lilypond preamble:

\paper {  
  #(set-paper-size "letter" )  
  mystaffsize = #20  
  #(define fonts  
     (make-pango-font-tree "Sabon LT Std"  
       "Agenda-Light"  
       "quadraat ps"  
       (/ mystaffsize 20)  
       )  
     )  
}

You can adjust the font names as needed. The first is for serif, the next sans, and the last mono. Adjust mystaffsize for the font sizes.

  • 1
    In lilypond-book, unfortunately, it seems that one needs to include this \paper { … } section in every single instance of \begin{lilypond} … \end{lilypond}, otherwise the defaults reappear. Not very convenient. Possibly one could redefine the environment. – Thérèse Jul 3 '14 at 23:42
  • Your suggestion does not work for me with the given example in my question. – usr1234567 Jul 5 '14 at 21:45
  • Did you indicate fonts that you have on your system? Also that's a really old version of Lilypond -- the latest stable is 2.18 and development version is 2.19 -- so that might be the problem. – bfootdav Jul 5 '14 at 21:58
  • It was my mistake, I screwed up with lilypond-book command. Works now. – usr1234567 Jul 6 '14 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.