quarto-dev / quarto-cli

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

Options to customize Typst output are not working properly #7216

Closed avouacr closed 11 months ago

avouacr commented 11 months ago

Bug description

Hi, I know this is still an experimental feature, but the options provided to customize Typst output are not working properly. It seems that their schema is ill-defined. As a result, the rendering fails due to failed validation of the YAML front matter.

Steps to reproduce

Rendering the example code provided in the documentation reproduces the problem :

---
title: "My Document"
format:
  typst:
    toc: true
    section-numbering: true
    columns: 2
bibliography: refs.bib
bibliographystyle: chicago-author-date
---

Expected behavior

The output pdf should be properly rendered.

Actual behavior

The rendering fails with the following error message :

ERROR: In file test.qmd
(line 6, columns 24--28) Field "section-numbering" has value true, which must instead be a string
5:     toc: true
6:     section-numbering: true
                         ~~~~~
7:     columns: 2
✖ The value true is of type boolean.
ℹ The error happened in location format:typst:section-numbering.

Your environment

Quarto check output

Quarto 1.4.415
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.8: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.4: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.415
      Path: /opt/quarto/bin

[✓] 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.4 (Conda)
      Path: /opt/mamba/bin/python
      Jupyter: 5.3.2
      Kernels: python3

(\) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
(|) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] 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/
cderv commented 11 months ago

I believe this is because Typst does not expect true or false here, but a string on which numbering to use

So the schema is ok on this https://github.com/quarto-dev/quarto-cli/blob/8b9adcd845bc0aee127d42693bce74a8b54a3d12/src/resources/schema/document-numbering.yml#L51-L55

We haven't build the reference pages yet so you can't find on the website (we do it only for the stable release)

You can find it in typst doc guide in our website though: https://quarto.org/docs/prerelease/1.4/typst.html#typst-format

Maybe you are looking for number-sections: true which will apply a default numbering.

Example of section-numbering

---
title: "My Document"
format:
  typst:
    toc: true
    section-numbering: 1.A.a
    columns: 2
---

# Title

## Sub header

### Sub Sub header

## Sub header

### Sub Sub header

### Sub Sub header

# Title

## Sub header

### Sub Sub header

## Sub header

### Sub Sub header

### Sub Sub header
cscheid commented 11 months ago

The documentation you linked shows that section-numbering is not a boolean:

image

The validation feature is working as intended here.

cderv commented 11 months ago

yes but the example if not correct in fact... 🤦‍♂️

image

Thanks @avouacr ! We'll update the documentation

cscheid commented 11 months ago

... big yikes on our part. Thanks for catching that, @cderv!!

avouacr commented 11 months ago

No worries, thank's for your amazing work on quarto