Skip to content

Extra space with starred version of a DeclarePairedDelimiter command #3183

Closed
@evfinkn

Description

@evfinkn

Issue Summary

When using an operator before the starred version of a command made with \DeclarePairedDelimiter (or its variants), an extra space is added between them. This is true in both MathJax v3 and MathJax v4. I would expect this when using scaled delimiters manually, such as in \sin\left(x\right), but the mathtools documentation mentions fixing this:

Within the starred version of \DeclarePairedDelimiter and \DeclarePairedDelimiterX we make a few changes such that the auto scaled \left and \right fences behave as opening and closing fences, i.e. $\sin(x)$ vs. $\sin\left(x\right)$ (the later made via $\sin\left(x\right)$), notice the gap between ‘sin’ and ‘(’.

Technical details:

  • MathJax Versions: 3.2.2, 4.0.0-beta.4
  • Client OS: macOS 14.3
  • Browsers: Obsidian 1.5.3 (which uses Chromium), Firefox 122.0.1

I'm not sure how Obsidian configures and loads MathJax, but for MathJax v4.0.0-beta.4 in Firefox, I'm using the following configuration:

MathJax = {
  loader: { load: ["[tex]/mathtools"] },
  tex: { packages: { "[+]": ["mathtools"] } },
};

and loading MathJax via

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/tex-mml-chtml.js"></script>

Supporting information:

The following screenshots show what I'm referring to. I'd expect the brackets on both lines to align, like in LaTeX.

LaTeX:
dpdxpp-latex

MathJax v3:
dpdxpp-mathjax3

MathJax v4:
dpdxpp-mathjax4

And here's the TeX used in those screenshots:

\DeclarePairedDelimiterXPP\Prob[1]{\Pr}[]{}{#1}
\begin{align}
    \text{unstarred:}\qquad & \Prob{A} \Prob{B} \\
    \text{starred:}\qquad & \Prob*{A} \Prob*{B} \\
\end{align}

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedIssue has been reproduced by MathJax teamCode ExampleContains an illustrative code example, solution, or work-aroundMergedMerged into develop branchv3v4

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions