How to achieve equivalent multline in LaTeX?

Here’s @Andrew’s answer adapted to produce block equations instead of inline equations (this also takes directly an equation as parameter instead of content):

#let align-eq(alignment, eq) = {
  show math.equation.where(block: true): set align(alignment)
  eq
}

#let multiline(it) = {
  if it.body.func() != [].func() { return it }
  let parts = it.body.children.split(linebreak())
  if parts.len() not in (2, 3) { return it }
  if parts.len() == 2 {
    let (a, b) = parts.map(array.join)
    align-eq(left, $ #a $)
    show math.equation.where(block: true): set block(above: 0.65em)
    align-eq(right, $ #b $)
  } else {
    let (a, b, c) = parts.map(array.join)
    align-eq(left, $ #a $)
    show math.equation.where(block: true): set block(above: 0.65em)
    align-eq(center, $ #b $)
    align-eq(right, $ #c $)
  }
}

#multiline($
  a + b + c + d + e + f \
  + med i + j + k + l + m + n
$)
#multiline($
  a + b + c + d + e \
  + med f + i \
  + med j + k + l + m + n
$)

However this has various problems, e.g. with equation numbering and in cases where “multiline” should be used for only a part of the whole equation. Also the question has come up before here. It would probably make sense to file a feature request.

3 Likes