How to automatically adjust size of mathematical expressions in inline math?

Hi,

I have this paragraph containing inline math:

where $rho$ is the vector (of length $N^(\*)$) of response propensities with population mean $rho^(‾)$. The population covariance of $y$ and $rho$ is given by $C o v (y , rho) = 1 \/ N^(\*) sum_(i = 1)^(N^(\*)) (y_i - y^(‾)_P) (rho_i - rho^(‾))$. The population standard deviations of $y$ and $rho$ are $sigma_y = sqrt(1 \/ N^(\*) sum_(i = 1)^N (y_i - y^(‾))^2)$ and $sigma_rho = sqrt(1 \/ N^(\*) sum_(i = 1)^N (rho_i - rho^(‾))^2)$, and $C o r (y , rho) = frac(C o v (y , rho), sigma_y sigma_rho)$ is the population correlation of $y$ and $rho$.

However the rendered inline equations overlap. Is there a easy way to automatically scale the inline math equations so that they won’t overrun a line?

Hello and welcome @MrWunderbar! This is a long-standing issue, see Large inline equations can overlap with other lines · Issue #1028 · typst/typst · GitHub.

If you don’t mind line spacing, I can recommend

#show math.equation.where(block: false): set text(bottom-edge: "bounds")

Alternatively, you can actually scale the equations, but that reduces readability imo.

#show math.equation.where(block: false): it => box(scale(75%, reflow: true, it))

Maybe someone else will have a more elegant solution!

4 Likes

Thanks! This will do for now

For the scaling solution maybe the following is better:

#show math.equation.where(block: false): set text(0.75em)

(This doesn’t prevent line breaks in inline math.)