Thank you Aaron and Valentin for your help and your codes.
It worked perfectly in my previous example.
Is it possible to make it working also with tags?
Here is a bit of information.
In my code, I use tags to generate two different outputs, one for midi and one for layout.
So my variables are like this...
ja = {\tag #'midiOut <c e>8 \tag #'screenOut <c' e'>8}
...and my "score" part is like this:
\score { \keepWithTag #'screenOut \music \layout {} }
\score { \keepWithTag #'midiOut \music \midi{} }
In this way I can specify a visual representation that is very different from the midi output.
Now let's go back to my problem.
Here it is my code with tags:
\version "2.23.2"
ja = {\tag #'midiOut <c e>8 \tag #'screenOut <c' e'>8}
jb = {\tag #'midiOut <g b>8 \tag #'screenOut <g' b'>8 }
music = \new Voice \fixed c << \ja \jb >>
\score { \keepWithTag #'screenOut \music \layout {} }
\score { \keepWithTag #'midiOut \music \layout{} } %here \layout{} should be \midi{}
This works perfectly and generates two scores:
<< { \tag #'screenOut < c' e' >8 } { \tag #'screenOut < g' b' >8 } >>
<< { \tag #'midiOut < c e >8 } { \tag #'midiOut < g b >8 } >>
Now I would like to make it work also with a manual beam. These are the solution I tried that don't work:
music = \new Voice \fixed c << \ja [\jb] >> % trivial wrong solution
music = \new Voice \fixed c \mergeChords \ja \jb % Aaron solution
music = \new Voice \fixed c \ja s[ \jb s] % Valentin solution
If you have any suggestion to fix it you're welcome.
Thanks, g.