quarto-dev / quarto-dev/quarto-cli
Incorrect size and spacing for left/right functions with typst and docx formats
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
- Using the formats
typstanddocxcause\Vertto be rendered with too much space. This does not happen with the formatshtmlorpdfwhich produce the correct output. This issue does not happen with other delimiters likefloorandceil. - For some reason,
\vertis rendered correctly withdocx(and the other formats), but not withtypst. \vertand\Vertare not expanded to their full size when using\leftand\rightintypst, but is correct withhtml,pdf, anddocx.typstalso seams to automatically enlarge other delimiters likeflooreven when\leftand\rightis 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
docx
html
pdf
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/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Quarto example with typst, docx, html, and pdf to reproduce the delimiter spacing and sizing differences. Trace the format-specific math rendering path and compare its handling of vert, Vert, left, right, floor, and ceil. Done means the documented expressions render consistently across the affected formats without format-specific raw markup.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100