quarto-dev / quarto-cli

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

format-resources are not cleaned up after rendering #1460

Open Benjamin-Lee opened 2 years ago

Benjamin-Lee commented 2 years ago

Bug description

I'm building an extension for formatting my thesis at Oxford. Let's say I have the following bare-bones extension:

title: Oxford Thesis Format
author: Benjamin Lee
version: 0.1.0
contributes:
  format:
    pdf:
      format-resources:
        - ociamthesis.cls

When I render the PDF on my Mac, it works but the .cls file isn't cleaned up as would be expected.

quarto check Output

[✓] Checking Quarto installation......OK
      Version: 1.0.28
      Path: /Applications/quarto/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.9.13
      Path: /usr/local/opt/python@3.9/bin/python3.9
      Jupyter: 4.8.1
      Kernels: corona, python3, squiggle, deep-rules, condo, julia-1.0, viroids, python37564bit620d0d3e6fc64febbcdac4f79a1dc46f, hla, mechwolf, krtd, javascript, krtd-binning

(\) Checking Jupyter engine render....dyld[45896]: Library not loaded: @executable_path/../.Python
  Referenced from: /Users/BenjaminLee/.virtualenvs/corona/bin/python3.7
  Reason: tried: '/Users/BenjaminLee/.virtualenvs/corona/bin/../.Python' (no such file), '/usr/local/lib/.Python' (no such file), '/usr/lib/.Python' (no such file)

Kernel died before replying to kernel_info
[✓] Checking Jupyter engine render....OK

quarto tools check Output

[✓] Inspecting tools

Tool         Status            Installed     Latest  
chromium     Not installed     ---           869685  
tinytex      Not installed     ---           v2022.07

Checklist

jjallaire commented 2 years ago

format-resources are specifically NOT cleaned up (so that if you do keep-tex you can compile it entirely without quarto).

If this isn't a requirement then you can leave it out of format-resources and just reference it relative to the extension directory.

Benjamin-Lee commented 2 years ago

I'm a little confused why it wouldn't be controlled by keep-tex then. I would need the cls file to compile without Quarto but in the normal case, I was surprised to see it (and not the intermediate tex and aux files etc) stick around. The format-resources also doesn't obey latex-output-dir, which is clearly documented but counterintuitive.

The alternative approach of referencing relative to the extension worked for non-cls files I tested it with (csl and logo for the title page) but broke with the cls. Not sure what's going on, will debug a little more later to see what's going on.

jjallaire commented 2 years ago

@dragonstyle could you weigh in here?

dragonstyle commented 2 years ago
dragonstyle commented 2 years ago

One other thought/note - format resources aren’t necessarily limited to pdf output. Something we’ll have to deal with as we consider the right solution.

cscheid commented 1 month ago

@icarusz and I discussed a general strategy for this class of file problems. It's fixable but a requires a significant structural change in our TypeScript codebase. We'll investigate this seriously in 1.7.