Skip to content

Multiple pdf format fail with generated figures #8367

Open

Description

@Nenuial

Bug description

When you have multiple pdf formats in a Quarto document that contains figures (generated by R for example), the process cleans up those figures after rendering the first PDF and the second PDF fails to render.

Steps to reproduce

---
title: "Test"
format: 
  pdf: default
  pdf+option: default
---

```{r}
cars |> 
  ggplot2::ggplot(ggplot2::aes(x = speed, y = dist)) +
  ggplot2::geom_line()
```

Expected behavior

The figures should be kept until all formats are rendered.

Actual behavior

The figures are deleted after the first PDF is rendered.

Your environment

  • IDE: RStudio Version 2023.12.0+369 (2023.12.0+369)
  • MacOS Sonoma 14.2.1

Quarto check output

Quarto 1.4.545
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.4.545
Path: /Applications/quarto/bin

[✓] Checking tools....................OK
TinyTeX: v2023.12
Chromium: 869685

[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/admin/Library/TinyTeX/bin/universal-darwin
Version: 2023

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

[✓] Checking Python 3 installation....OK
Version: 3.11.4 (Conda)
Path: /opt/homebrew/Caskroom/miniconda/base/bin/python
Jupyter: 5.3.1
Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
Version: 4.3.2
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
knitr: 1.45
rmarkdown: 2.25

[✓] Checking Knitr engine render......OK

Activity

  1. added
    bug
    on Jan 21, 2024
  2. added this to the v1.5 milestone on Jan 21, 2024
  3. added
    latex
    on Jan 24, 2024
  4. cderv commented on Feb 28, 2024

    @cderv
    Member

    This is related to other issues linked to

    We need to track input / output and intermediates totally to name them correctly and avoid overwrite

  5. modified the milestones: v1.5, Future on Feb 28, 2024
  6. andrewheiss commented on Apr 18, 2024

    @andrewheiss

    There's a temporary workaround to this if you keep the intermediate markdown files around (see #8373 (comment)). This will work with Quarto 1.5.29 (and maybe earlier?):

    ---
    title: "Test"
    format: 
      pdf: default
      pdf+option: default
    keep-md: true
    ---
    
    ```{r}
    cars |> 
      ggplot2::ggplot(ggplot2::aes(x = speed, y = dist)) +
      ggplot2::geom_line()
    ```
    
  7. andrewheiss commented on Apr 18, 2024

    @andrewheiss

    Though according to @cscheid it's likely an accident that it's working: #6705 (comment)

    (but a happy accident that I'm (unwisely!) relying on!)

  8. Nenuial commented on Apr 22, 2024

    @Nenuial
    Author

    Thanks for this!
    It will, as long as this accident works, offer a workaround that allows me to avoid manual renders.

  9. cderv commented on Apr 23, 2024

    @cderv
    Member

    I don't think this is an accident: when keep-md: true is set, the supporting files are kept. It is on purpose because in .md file, there will be linked to resources

    // if we aren't keeping the markdown or text and we are instructed to
    // clean supporting files then do it
    if (
    !format.execute[kKeepMd] &&
    !format.render[kKeepTex] &&
    !format.render[kKeepTyp] &&
    supporting
    ) {

    So this works in this case, but you'll get leftovers at the end.

    The "accident" is this example

    ---
    title: "Test"
    format: 
      pdf: default
      pdf+option:
        keep-md: true
    ---
    
    ```{r}
    cars |> 
      ggplot2::ggplot(ggplot2::aes(x = speed, y = dist)) +
      ggplot2::geom_line()
    ```
    
    

    Where compilation would work now, with no leftovers, but because we have an issue where keep-md: true is not really respected.

    This will all be handled better with #6518

  10. Nenuial commented on Apr 23, 2024

    @Nenuial
    Author

    Ok, that good to know. Thanks for the explanation.

    Looking forward to #6518 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglatex

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions