Open Sciemon opened 10 months ago
Some context about the issue.
This is similar to this one
but happens with mediabag supporting files and with output file name conflict.
Overall issue is order of cleanup for supporting files
I am putting back what I shared there at https://github.com/quarto-dev/quarto-cli/issues/6705#issuecomment-1706569288 by adapting to this use case.
Cleanup code is in renderCleanup()
https://github.com/quarto-dev/quarto-cli/blob/248a3a4b1cd8985eb062cd53e53b23326c13eb2d/src/command/render/cleanup.ts#L48-L55
we are cleanup supporting file in some situations and this happens with docx format.
We cleanup the whole directory and not just the file associated to the format https://github.com/quarto-dev/quarto-cli/blob/248a3a4b1cd8985eb062cd53e53b23326c13eb2d/src/command/render/cleanup.ts#L83-L88
When rendering to --to all
we pass through this 3 times, and not in the order I though.
docx
cleanup will happen before PDF rendering. If docx
is called first, the cleaning step happens last. So PDF rendering can work ok.
Try just putting docx
first as a workaround
diff --git a/model_requirements.qmd b/model_requirements.qmd
index 522edb4..3f12bf1 100644
--- a/model_requirements.qmd
+++ b/model_requirements.qmd
@@ -8,6 +8,7 @@ toc: true
number-sections: true
highlight-style: pygments
format:
+ docx: default
pdf:
geometry:
- top=30mm
@@ -17,7 +18,6 @@ format:
html-math-method: katex
default-image-extension: svg
css: style.css
- docx: default
---
Setting keep-md: true
in the YAML as global, or just under docx
format will also prevent the cleaning before PDF Rendering and should avoid the issue
This is a topic we can deal with
It will happen with any combination of formats mixing
embed-resources
) or PDF that needs supporting file for tex rendering. This would probably be the better options. @cscheid do you agree ?
New use case I found:
---
title: About
format:
typst: default
typst+toc:
toc: true
---
# Header
Content
❯ quarto render index.qmd
pandoc
to: typst
output-file: index.typ
standalone: true
default-image-extension: svg
wrap: none
citeproc: false
metadata
title: About
pandoc
to: typst
output-file: index.typ
standalone: true
default-image-extension: svg
wrap: none
citeproc: false
toc: true
metadata
title: About
[typst]: Compiling index.typ to index.pdf...DONE
[typst]: Compiling index.typ to index.pdf...error: input file not found (searched at C:\Users\chris\Documents\DEV_OTHER\00-TESTS\test-quarto\index.typ)
ERROR: Error
at Object.complete (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/output-typst.ts:80:13)
at eventLoopTick (ext:core/01_core.js:153:7)
at async file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render.ts:282:23
at async withTimingAsync (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/core/timing.ts:50:20)
at async Object.complete (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render.ts:277:7)
at async Object.onPostProcess (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render-files.ts:720:28)
at async renderFileInternal (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render-files.ts:689:3)
at async renderFiles (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/render-files.ts:325:9)
at async renderProject (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/project.ts:441:23)
at async Command.actionHandler (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/cmd.ts:248:26)
Adding keep-typ
solves it
format:
typst: default
typst+toc:
toc: true
keep-typ: true
So it is not possibly to use the variant format with Typst right now because of our rendering and cleaning process.
https://github.com/quarto-dev/quarto-cli/issues/10883 is another report involving docx cleaning before LaTeX rendering happens.
---
title: "Quazz"
format:
pdf: default
docx: default
---
# Quazz
This is a sumbol of a pie chart in SVG:
![Symbolic pie chart](./piechart.svg)
That is it.
With this svg to reproduce: piechart.svg
Doing reverse order solves it
format:
docx: default
pdf: default
Bug description
An mwe can be found in the github repo https://github.com/Sciemon/issue_figures_folder
Somehow latex assumes the figures are in a 'mediabag' folder that does not exist.
Steps to reproduce
It is only possible to render (with quarto render ...) the file 'model_requirements.qmd' if 'docx: default' is deleted from the yaml.
Expected behavior
if 'docx: default' is deleted, the pdf is rendered
Actual behavior
Otherwise latex throws the following error:
ERROR: compilation failed- error Unable to load picture or PDF file 'model_requirements_files/mediabag/figs/SVS_droop.pdf'.