Skip to content

Incorrect size and spacing for left/right functions with typst and docx formats #10424

@njericha

Description

@njericha

Bug description

  1. Using the formats typst and docx cause \Vert to be rendered with too much space. This does not happen with the formats html or pdf which produce the correct output. This issue does not happen with other delimiters like floor and ceil.
  2. For some reason, \vert is rendered correctly with docx (and the other formats), but not with typst.
  3. \vert and \Vert are not expanded to their full size when using \left and \right in typst, but is correct with html, pdf, and docx.
  4. typst also seams to automatically enlarge other delimiters like floor even when \left and \right is not given. This may be the intended behavior for typst and I don't think anyone would complain about this, but I am pointing out that it is at least inconsistent with the other 3 formats.

Steps to reproduce

---
format: typst
---

`format: typst`

This is the absolute value of a number using `\lvert` and `\rvert`: $\lvert x \rvert$.

You could just use `\vert`: $\vert x\vert$.

This is the norm of a vector using the pair `\lVert` and `\rVert`: $\lVert v \rVert$.

You could just use `\Vert` and get this result: $\Vert v \Vert$.

Here is a big equation without `\left` and `\right`,

$$
\lVert \sum_{i=1}^n a_i \rVert,
$$

and now with `\left` and `\right`,
$$
\left\lVert \sum_{i=1}^n a_i \right\rVert.
$$

This is the floor and ceiling of a number $\lfloor x \rfloor \leq x \leq \lceil x \rceil$.

Here is the floor of a big equation without `\left` and `\right`,

$$
\lfloor \sum_{i=1}^n a_i \rfloor,
$$

and now with `\left` and `\right`,
$$
\left\lfloor \sum_{i=1}^n a_i \right\rfloor.
$$

Expected behavior

I expect all four formats to produce the same visual output.

With the format typst, correct spacing and height can be achieved with the raw code within Quarto:

```{=typst}
$norm(v)$
``` 

but of course this only works with the format typst and must be retyped when switching to other formats.

Actual behavior

Here are the outputs for the 4 formats.
typst
image
docx
image
html
image
pdf
image

Your environment

  • VSCode 1.91.1
  • Windows 11

Quarto check output

Quarto 1.5.55
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.5.55
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Tex:  (not detected)

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.11.9
      Path: C:/Users/Nicholas/AppData/Local/Programs/Python/Python311/python.exe
      Jupyter: 5.7.2
      Kernels: julia-1.10, python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmathany issue related to math support in specific formatspandoctypstupstreamBug is in upstream library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions