Can I fix the ugly spacing with `union/inter.big`?

This code:

$ union.big_n U_n = union.big_n {x ∈ X | f(x) ∈ V_n} $

renders like this in the latest release (0.15.1):

image

The spacing after ⋃ looks too tight to me, especially before the opening brace. What would be the cleanest way to increase it globally? Also, should I open an issue about this?

Actually, this is consistent with LaTeX.

xelatex + Computer Modern:

xelatex + unicode-math + New Computer Modern:

main.tex
\documentclass{article}

% \usepackage{unicode-math}
% \setmathfont{NewCMMath-Regular.otf}

\begin{document}
\begin{equation}
    \bigcup_n U_n = \bigcup_n \{x \in X \mid f(x) \in V_n\}
\end{equation}
\end{document}

You can check math classes (Typst docs, Unicode docs) by visiting General Symbols - Typst Documentation and search and click the symbols.


In §18 of the TeXbook, the spacing between large (Op) and opening (Open) is indeed zero.

I don’t know why, however…

4 Likes

That’s interesting. Do you know where in the Typst source code the spacing between Large and Opening is defined?

Yes, see here:

/// Computes the spacing between two adjacent math items.
fn spacing<'a>(
    l: &mut MathItem,
    space: Option<MathItem<'a>>,
    r: &mut MathItem,
) -> Option<MathItem<'a>> {
    use MathClass::*;

    let script = |f: &MathItem| f.size().is_some_and(|s| s <= MathSize::Script);

    match (l.rclass(), r.lclass()) {
        // Thin spacing around large operators, unless to the left of
        // an opening delimiter. TeXBook, p170
        (Large, Opening | Fence) => {}

        _ => {…}
    };

    None
}
1 Like