Skip to content

Discussion: Inline equations #2

@SolidTux

Description

@SolidTux

I'm also trying to build a grid system for a document. It's still changing constantly and entangled in a big document (and mangled without some LaTeX-like DIV calculation and leading calculation), but at some point I think it would make sense to consolidate efforts. In general, I have a very similar ansatz with setting top-edge to the wanted line height.

The main paint point for me currently are inline equations. I don't think there is an optimal solution as long as there's no way to get information about their baseline. I see that you are currently basically ignoring larger inline equations with this:

#show math.equation.where(block: false): it => box(height: line-height, it)

In LaTex, the grid package seems to also break with larger inline equations from my experiments.

I think, in general, it would be good to allow larger equations, but I didn't manage to get consistently good results so far. This is my best attempt so far (line-height is the quatization step):

#show math.equation.where(block: false): it => {
  let size = measure(it)
  let lines = 2 * calc.ceil(0.5 * size.height / line_height) - 1
  let frac = size.height / line_height - lines
  box(
    height: lines * line_height,
    baseline: ((lines - 1) / 2) * line_height,
    fill: if draft {
      red.transparentize(75%)
    },
    it,
  )
}

which results in this:

grafik

While some things are fine, the larger sum, for example, is broken.

Do you have any ideas how to handle this better?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions