quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.69k stars 297 forks source link

Inconsistent table formatting between vanilla Typst output and Typst extension output #10065

Closed mvuorre closed 2 months ago

mvuorre commented 2 months ago

Bug description

I created a new Quarto Typst extension called "example" with quarto create extension format:typst. I then compared tables within this extension to tables from vanilla Typst output, and the former have gridlines whereas the latter don't.

(The complete source for this example is in this repo: https://github.com/mvuorre/quarto-typst-table-reprex and in example.zip.) example.zip

Steps to reproduce

No response

Expected behavior

---
title: Untitled
format:
  typst: default # Tables don't have gridlines
---

```{r}
knitr::kable(data.frame(a = 1:2, b = 3:4))
#| echo: false
knitr::kable(data.frame(a = 1:2, b = 3:4))

Renders to
<img width="678" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/7349270/06e9435d-0e8d-4c6b-9fc9-64172aca61fb">

### Actual behavior

title: Untitled format: example-typst: default # Tables have gridlines

knitr::kable(data.frame(a = 1:2, b = 3:4))
#| echo: false
knitr::kable(data.frame(a = 1:2, b = 3:4))


Renders to 
<img width="714" alt="image" src="https://github.com/quarto-dev/quarto-cli/assets/7349270/8c0d998c-c9ad-4ebb-b55a-be7b856b060d">

### Your environment

OS: MacOS Sonoma 14.5
Using Quarto from terminal

### Quarto check output

Quarto 1.5.45
[✓] 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.45
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /Library/TeX/texbin
      Version: 2024

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

[✓] Checking Python 3 installation....OK
      Version: 3.12.3
      Path: /opt/homebrew/opt/python@3.12/bin/python3.12
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources
      LibPaths:
        - /Users/matti/Library/R/arm64/4.4/library
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.46
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK
mcanouil commented 2 months ago

May I inquire as to how Quarto is accountable for the retention of the default Typst table style within your extension? Should the default style not meet your preferences, I would kindly suggest implementing the necessary Typst command to adjust it accordingly. There are no bugs present in this context.

https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/formats/typst/pandoc/quarto/typst-template.typ#L90-L93

See https://quarto.org/docs/output-formats/typst-custom.html#advanced-customization.

cscheid commented 2 months ago

@mcanouil This is actually a bug, just FYI.

cscheid commented 2 months ago

The fix here is to sync up the templates with the create files at src/resources/create/format

mcanouil commented 2 months ago

To be sure, the bug is not the style of the table, but the fact that quarto create extension format:typst does not use the correct template, correct?

cscheid commented 2 months ago

To be sure, the bug is not the style of the table, but the fact that quarto create extension format:typst does not use the correct template, correct?

Yes.

gordonwoodhull commented 2 months ago

Thanks for reporting this @mvuorre!

mvuorre commented 2 months ago

Works great, thank you:

image