Add a special case to the note-collision algorithm: if the lowermost upstem
note is the same as the uppermost downstem note but the interval between the
top two notes of the downstem is a second, don't shift the upstem chord to
the left of the downstem chord.
--- /dev/null
+\version "2.11.44"
+
+\header {
+ texidoc = "Seconds do not confuse the collision algorithm too much. The best
+way to format this would be to merge the two Ds, but we will be happy for now
+if the upstem D does not collide with the downstem C."
+}
+
+
+<< d' \\ <c' d'> >>
Real shift_amount = 1;
bool touch = (ups[0] >= dps.back ());
+ /* As a special case, if the topmost part of the downstem chord is a second,
+ the top note of which is the same pitch as the lowest upstem note, they
+ shouldn't count as touching.
+ */
+ if (dps.back () == ups[0] && dps.size () > 1 && dps[dps.size() - 2] == ups[0] - 1)
+ touch = false;
+
if (touch)
shift_amount *= -1;