Skip to content

fig-cap-location margin support for Typst #10123

@cderv

Description

@cderv
---
format: 
  html: default
  typst: default
---

```{r}
#| label: fig-test
#| fig-cap: TEST
#| fig-cap-location: margin
plot(cars)
```

I think currently we don't support margin in typst format - article Layout for typst is still to support.

Though I believe we should have a failsafe and avoid bad error due to this missing support.

This is what we get currently,

typst]: Compiling test.typ to test.pdf...error: unknown variable: margin
    ┌─ \\?\C:\Users\chris\Documents\DEV_OTHER\00-TESTS\test-quarto\test.typ:282:10
    │
282 │ position: margin, 

because the fig-cap-location value is passed asis. We get this typ content for now

```r
plot(cars)
```

#figure([
#box(image("test_files/figure-typst/fig-test-1.svg"))
], caption: figure.caption(
position: margin, 
[
TEST
]), 
kind: "quarto-float-fig", 
supplement: "Figure", 
)
<fig-test>

Without cross-references, it just does not work without error

```{r}
#| fig-cap: TEST
#| fig-cap-location: margin
plot(cars)
```

(it is working for HTML - just ignored for Typst which seems ok for now. A warning could be added in typst format case to explain fig-cap-location is ignored)

So to sum up

  • We should probably not error like this and just ignore the configuration for typst so that it renders but with a default
  • We need to add support it - probably when we'll tackle article layout for typst format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions