Double ossia with tabulature issue

2022-07-07 Thread Neo Anderson
Hi!
I've been trying to add an ossia to an existing guitar part with the 
tabulature. However, I run into this issue that the ossia gets doubled as long 
as the tab part is uncommented. As soon as I don't use the tab staff, 
everything is fine.
I guess it's all because of my /score block, but I can't figure it out. 
The ossia itself doesn't have to have its own tab, but if, as an extra, someone 
could make it happen, I would be happy, too.
MWEs:a) Minimal reproducible example included as an attachementb) 
https://www.hacklily.org/?edit=Aelfstone/sheet-music/ossia_issue_mwe.lyc) The 
code itself

%%
\version "2.23.10"

gtrOne = {  d'1~ d'1  \break <<    { f'1 }    \new Staff     \with { 
alignAboveContext = "gtrOne" }    { c''1 }  >>    g'1}

\score {  <<    \new Staff = "gtrOne" \with { }    { \gtrOne }        \new 
TabStaff    { \gtrOne }        >>  \layout {    \context { }  }}
%%


\version "2.23.10"

gtrOne = {
  d'1~ d'1
  \break  
 
  <<
{ f'1 }
\new Staff 
\with { alignAboveContext = "gtrOne" }
{ c''1 }
  >>
  
  g'1
}


\score {
  <<
\new Staff = "gtrOne" \with { }
{ \gtrOne }

\new TabStaff
{ \gtrOne }  
  >>
  \layout {
\context { }
  }
}


Re: Double ossia with tabulature issue

2022-07-07 Thread Jean Abou Samra




On 7/8/22 02:23, Neo Anderson wrote:

Hi!

I've been trying to add an ossia to an existing guitar part with the 
tabulature. However, I run into this issue that the ossia gets doubled 
as long as the tab part is uncommented. As soon as I don't use the tab 
staff, everything is fine.


I guess it's all because of my /score block, but I can't figure it out.

The ossia itself doesn't have to have its own tab, but if, as an 
extra, someone could make it happen, I would be happy, too.


MWEs:
a) Minimal reproducible example included as an attachement
b) https://www.hacklily.org/?edit=Aelfstone/sheet-music/ossia_issue_mwe.ly
c) The code itself

%%
\version "2.23.10"

gtrOne = {
  d'1~ d'1
  \break
  <<
    { f'1 }
    \new Staff
    \with { alignAboveContext = "gtrOne" }
    { c''1 }
  >>
  g'1
}


\score {
  <<
    \new Staff = "gtrOne" \with { }
    { \gtrOne }
    \new TabStaff
    { \gtrOne }
  >>
  \layout {
    \context { }
  }
}

%%




Well, LilyPond is doing exactly what you've asked it. Since
there is \new Staff both in the normal staff and in the tablature,
you get two new staves. You need to do \new Staff in the staff,
and \new TabStaff in the tablature. Furthermore, you need to adjust
alignAboveContext. To do that without repeating the music, you
can use tags.


\version "2.23.10"

ossia = { c''1 }

gtrOne = {
  d'1~ d'1
  \break

  <<
    { f'1 }
    \tag staff \new Staff = ossia \with { alignAboveContext = gtrOne } 
\ossia

    \tag ossia \new TabStaff \with { alignAboveContext = ossia } \ossia
  >>
  g'1
}


\score {
  <<
    \new Staff = "gtrOne" \keepWithTag staff \gtrOne
    \new TabStaff \keepWithTag ossia \gtrOne
  >>
}


See 
https://lilypond.org/doc/v2.23/Documentation/notation/different-editions-from-one-source#using-tags


Note that I've also removed your useless (empty) \layout block.

Best,
Jean