Help me place this Lilypond snippet into Lyx

Do you typeset your scores on Linux? Share your thoughts, tips, and tricks here.

Moderators: MattKingUSA, khz

Post Reply
Aleks
Established Member
Posts: 285
Joined: Wed Nov 09, 2011 5:36 pm

Help me place this Lilypond snippet into Lyx

Post by Aleks »

Merry Christmas and Happy New Year, folks! I am trying to create a lilypond template that I can use for some tutorials, but I've ran into a problem. I combined this code

Code: Select all

\version "2.18.2"

<<
\new ChordNames {
\chordmode {
c1:m 
}
}
\new Staff {
\clef "treble_8"
<c g c' es' g'>1^\markup {
% standard size
\override #'(size . 2) {
\override #'(fret-diagram-details . (
(dot-color . white)
(finger-code . in-dot))) {
\fret-diagram-verbose #'((mute 6)
(place-fret 5 3 "1")
(place-fret 4 5 "5")
(place-fret 3 5 "1")
(place-fret 2 4 "b3")
(place-fret 1 3 "5")
(barre 5 1 3))
}}}
}
>>
When I engrave it in Frescobaldi, it shows just fine. But, when I try to insert it in Lyx (by inserting it as a custom inset), it gives me this error:

Code: Select all

An error occurred while running:
lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf
"newfile1.lytex"
Any suggestions?

Aleks
Established Member
Posts: 285
Joined: Wed Nov 09, 2011 5:36 pm

Re: Help me place this Lilypond snippet into Lyx

Post by Aleks »

Solved it!

This is the right code

Code: Select all

<< \new ChordNames { \chordmode { c1:m  } } 
 \new Staff { \clef "treble_8" <c g c' es' g'>1^
 \markup {   \override #'(size . 3)   
\override #'(fret-diagram-details . ( (dot-color . white) (finger-code . in-dot)))  
 \fret-diagram-verbose #'((mute 6) (place-fret 5 3 "1") 
(place-fret 4 5 "5") (place-fret 3 5 "1") 
(place-fret 2 5 "b3") (place-fret 1 3 "5") (barre 5 1 3))} }>>
Now if I could just find a way to decrease the size of the charachters in the circle, or to put a proper flat sign instead of b, it would be perfect!

Hafting
Established Member
Posts: 5
Joined: Fri Sep 28, 2012 11:17 pm

Re: Help me place this Lilypond snippet into Lyx

Post by Hafting »

To get a proper flat sign, use a proper flat sign. That is, the unicode character "flat sign". If it is not available on your computer keyboard, cut&paste from any of many unicode listing pages. (Google "unicode flat sign", and you'll find it.) Or paste it from here:

(place-fret 2 5 "♭")

Lilypond has no problem with this. LyX may protest about an "unknown character", but that is fixable.
In Document->Settings->Output, select PDF(LuaTeX) or PDF(Xetex) as output format
In Document->Settings->fonts, check "Use non-TeX fonts (via XeTeX/LuaTex)"

For this to work, you need the XeTeX or *LuaTex software. But those are available as part of any good LaTeX distribution anyway, such as TeXLive or whatever you use.

Post Reply