First of all, why do you use a markup? If you read the section on trills,
it will point you to the section on articulations which tells you that you
can use d2.^\trill.
However, to answer your direct question, use
\override Script #'avoid-slur = #'inside
(assuming that you replaced your markup wit
I have some notes that are on the upper portion of a piano system, like this:
<< {
8 g,_\<( bes ees g bes \times 3/2 { ees8[ f] } \times 3/2
{ g[ bes]\! }
\times 3/2 { bes8 aes } \times 3/2 { g f } ees2.
d2.^\markup{ \italic \bold "tr." } \grace { c16[ d] } ees2.)
} \\ {