vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
211 stars 18 forks source link

Typst: `table` does not contain field `cell` #326

Closed petermacp closed 2 months ago

petermacp commented 2 months ago

I also posted this on the quarto issues page, but wondered if this was actually a tinytable issue.

I have written a .qmd file containing typst code that I run in RStudio to compile my CV.

Recently I got a new computer, and now my .qmd file renders fine on the old machine, but not on the new machine.

I am now very wary about updating the old machine, in case I am not able to render the document at all.

Grateful for any suggestions about how to resolve.

New machine error:


[typst]: Compiling PM_CV_typst.typ to PM_CV_typst.pdf...error: function table does not contain field cell
┌─ PM_CV_typst.typ:352:14
│
352 │ #show table.cell: it => {
│ ^^^^```
vincentarelbundock commented 2 months ago

It will likely be impossible to help you without a fully reproducible minimal example. There are some tips on how to ask good software questions here:

https://marginaleffects.com/vignettes/help.html

Note that tables in tinytable require pre-release version of Quarto, which ships with a recent version of Typst.

petermacp commented 2 months ago

Apologies for this. I have tried to add more information here to give a minimal example.

On my machine where rendering is not working, I have the following minimal file.

---
title: ""
format: 
  typst:
    keep-typ: true
    mainfont: "Source Sans Pro"
---

```{r}
library(tinytable)
dat <- mtcars[1:9, 1:8]
tt(dat) |> 
  group_tt(
    i = list("I like (fake) hamburgers" = 3,
             "She prefers halloumi" = 4,
             "They love tofu" = 7),
    j = list("Hamburgers" = 1:3,
             "Halloumi" = 4:5,
             "Tofu" = 7)) |>
  style_tt(
    i = c(3, 5, 9),
    align = "c",
    background = "black",
    color = "orange") |>
  style_tt(i = -1, color = "orange")

I can run the code chunk, and produce the table output in RStudio's viewer no problem.

However, when I press the render button, I get the following error:

[typst]: Compiling Untitled.typ to Untitled.pdf...error: function `table` does not contain field `cell`
    ┌─ Untitled.typ:445:14
    │
445 │   #show table.cell: it => {
    │               ^^^^

In case it is helpful.

> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.6.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tinytable_0.4.0

loaded via a namespace (and not attached):
 [1] compiler_4.4.0    fastmap_1.2.0     cli_3.6.3         htmltools_0.5.8.1 tools_4.4.0       rstudioapi_0.16.0 yaml_2.3.10       fansi_1.0.6      
 [9] rmarkdown_2.28    knitr_1.48        xfun_0.47         digest_0.6.37     rlang_1.1.4       evaluate_0.24.0  

Many thanks.

vincentarelbundock commented 2 months ago

My guess is that you do not have the pre-release version of Quarto installed. You can get it here:

https://quarto.org/docs/download/prerelease.html