Open mroberts1 opened 1 month ago
Sorry to hear you're having issues with it.
There isn't quite enough information here to help diagnose the problem:
quarto-ext
folder come from? This extension doesn't create that folder.The _extensions
folder should be in the root directory where your .qmd file is. Inside the _extensions
folder, there should be a folder called nrennie
. Inside there, there will be the PrettyPDF
folder containing the relevant files. I'd suggest starting with installing the template and making sure you can get that running - it downloads the files and puts them in the correct place so you shouldn't need to think about where the files go.
What do you mean by even when copied into PrettyPDF
- the Quarto files that you're rendering shouldn't be in the same folder as the extension itself. The Quarto files should be in the same directory as the _extensions folder i.e. where the template.qmd file is as an example.
- which format are you using, (LaTeX) pdf or typst? I assume typst only from the error message.
typst
- are you using the template, or trying to edit an existing document?
An existing .qmd document in the root directory
- where did the
quarto-ext
folder come from? This extension doesn't create that folder.
It is a directory that contains two other extensions. Normally it lives in the root directory but it somehow got relocated to the _extensions directory when I installled PrettyPDF. I moved it back.
- how are you installing the extension? If you install using the instructions in the README, the installation process puts the files in the right place.
'quarto install extension nrennie/PrettyPDF' in the terminal
The
_extensions
folder should be in the root directory where your .qmd file is. Inside the_extensions
folder, there should be a folder callednrennie
. Inside there, there will be thePrettyPDF
folder containing the relevant files. I'd suggest starting with installing the template and making sure you can get that running - it downloads the files and puts them in the correct place so you shouldn't need to think about where the files go.
All this is correct, but I don't see a PrettyPDF template file (pdf?). Do I have to download it separately? If so, which directory should it go in?
What do you mean by
even when copied into PrettyPDF
- the Quarto files that you're rendering shouldn't be in the same folder as the extension itself. The Quarto files should be in the same directory as the _extensions folder i.e. where the template.qmd file is as an example.
That's correct, but I'm still getting the same error message (see attached) - the extension can't find logo.png, even though it's in the right directory and the path is correct.
FYI my _quarto.yml file contains this:
format:
PrettyPDF-typst:
papersize: us-letter
mainfont: "Source Sans"
fontsize: 14pt
margin:
x: 1.25in
y: 1.25in
I still can't reproduce your error unfortunately. Can you please confirm that your directory structure looks like the example here: https://github.com/nrennie/quarto-examples/tree/main/PrettyPDF%20Example
Can you render the document.qmd
file in the example linked above?
I still can't figure out what the problem is. I have the extensions folder correctly installed in the root directory, and am trying to generate a PrettyPDF-typst file from the front matter of an index.qmd file.
You can take a look at the repo here: mroberts1/entangled-lives.
The error I'm getting now is about a duplicate title entry - the problem is that the subtitle is being read as a duplicate title. I checked typst-show.typ but the subtitle field appears to be correct, so I don't know why my subtitle field isn't being parsed correctly.
I've had a look at the GitHub repo you shared, I can't render it at all since the img
folder isn't on GitHub. (Generally you might want to think about conditional content (https://quarto.org/docs/authoring/conditional.html) since there's code to add videos which doesn't work in PDF)
The subtitle doesn't render for me in normal Typst output:
---
title: "My title"
subtitle: "My subtitle"
format: typst
---
Test
as a minimum reproducible example, you'll see that the subtitle doesn't appear but there is no error.
Reprex of your problem:
---
title: "My title"
subtitle: "My subtitle"
format: PrettyPDF-typst
---
Test
fails with duplicate title warning. I've removed any references to subtitle in the extension to get rid of the error (the subtitle still won't show as it doesn't in Typst, but it shouldn't error any more). Can you try re-installing the extension, and re-rendering? The updated version of PrettyPDF should now give the same behaviour for typst
and PrettyPDF-typst
. Please note that subtitles are not yet a native feature in Typst: https://github.com/quarto-dev/quarto-cli/discussions/9638, and have only just been added in Pandoc.
I'll put subtitle support on the to-do list once it's a bit more stable in Typst - see nrennie/PrettyTypst#3
Sorry, that repo I shared is probably not the best one to use, as it contains a bunch of images and videos stored in LFS. Instead, I've been testing the extension with this repo: https://github.com/mroberts1/fsu-smt-su24
I wasn't familiar with conditional content in Quarto so thank you! I know that Latex pdfs don't support embedded gifs (which my index.qmd file contains), so will use the conditional-content code block to fence it off.
I tried reinstalling the extension in a smaller repo, but with same error as before when PrettyPDF-typst is called from _quarto.yml.
I created a new file PrettyPDF-template.qmd in the home/root directory, with the extension in _extensions, but got the same error - It seems to be something to do with the path to typst-logo.
PrettyPDF-pdf generates just fine though - it's only PrettyPDF-typst that throws the error.
See below for the PrettyPDF-typst error.
processing file: PrettyPDF-template.qmd
output file: PrettyPDF-template.knit.md
pandoc
to: typst
output-file: PrettyPDF-template.typ
standalone: true
shift-heading-level-by: -1
default-image-extension: svg
wrap: none
citeproc: false
reference-location: margin
metadata
papersize: letter
margin:
x: 2cm
'y': 2cm
font-paths: _extensions/nrennie/PrettyPDF/Ubuntu
typst-logo:
path: _extensions/nrennie/PrettyPDF/logo.png
image-alt: ' '
citation-location: margin
editor: visual
title: Pretty PDFs with Quarto
[typst]: Compiling PrettyPDF-template.typ to PrettyPDF-template.pdf...error: file not found (searched at /Users/dokoissho/GitHub/fsu-smt-su24/\_extensions/nrennie/PrettyPDF/logo.png)
┌─ PrettyPDF-template.typ:239:24
│
239 │ let img = image(typst-logo.path, width: 1.5cm)
│ ^^^^^^^^^^^^^^^
I am having the same problem. Seems to be somehow related to the typst issue . Version of typst i was having issue with is typst 0.11.1 (50115102)
found in arch repos.
EDIT: Forgot to add my quarto version: Version: 1.4.556
The problem in my case stemed from the fact the quarto resolves path
to logo.png
as \_extensions/nrennie/PrettyPDF/logo.png
and inserts that into the resulting .typ
file, but typst expects that path to be just _extensions/nrennie/PrettyPDF/logo.png
and if i correct the path to that(aka delete the prepending \
) then typst compiles that normally. I am not sure why this happens and whether the typst changed its behavior or the quarto changed the way it resolves paths
I still can't reproduce this issue which makes it really hard to debug. Does specifying the file path directly fix the problem? e.g.
format:
PrettyPDF-typst:
logo: "_extensions/nrennie/PrettyPDF/logo.png"
If not, does copying the logo into the root directory and using:
format:
PrettyPDF-typst:
logo: "logo.png"
work? It might just be an issue with escaping characters in file paths.
@mroberts1 - which version of Quarto/Typst are you using?
I'll try switching to using format-resources
(see nrennie/PrettyTypst#1 ) to see if that works better.
I am running the latest Quarto CLI - 1.5.52.
Rendering from the basic template.qmd file with PrettyPDF-typst as the format gives the error below. I tried specifying the path both to where the file actually is located, and after copying it to the root directory, with the same result.
PrettyPDF-pdf renders just fine, so it seems like this is a Typst issue.
==> quarto preview PrettyPDF.qmd --to PrettyPDF-typst --no-watch-inputs --no-browse
processing file: PrettyPDF.qmd
output file: PrettyPDF.knit.md
pandoc
to: typst
output-file: PrettyPDF.typ
standalone: true
shift-heading-level-by: -1
default-image-extension: svg
wrap: none
citeproc: false
metadata
papersize: a4
margin:
x: 2cm
'y': 2cm
font-paths: _extensions/nrennie/PrettyPDF/Ubuntu
typst-logo:
path: _extensions/nrennie/PrettyPDF/logo.png
editor: visual
title: Pretty PDFs with Quarto
[typst]: Compiling PrettyPDF.typ to PrettyPDF.pdf...error: file not found (searched at /Users/dokoissho/GitHub/PrettyPDF/\_extensions/nrennie/PrettyPDF/logo.png)
┌─ PrettyPDF.typ:239:24
│
239 │ let img = image(typst-logo.path, width: 1.5cm)
│ ^^^^^^^^^^^^^^^
After seeing the path error reported by MrDullDev, I fixed it by replacing the variable in typst-show.typ with the correct path, and the document now renders correctly.
#show: PrettyPDF.with(
$if(title)$
title: "$title$",
$endif$
$if(typst-logo)$
typst-logo: (
path: "_extensions/nrennie/PrettyPDF/logo.png",
caption: [$typst-logo.caption$]
),
$endif$
)
So with a bit of debugging and experemnting it seems that the issue happens somewhere inside the lua filters
that run the last, or somewhere inside pandoc
itself somewhere. I came to said conclusion due to the fact the quarto
even with all the debug features enabled says that the variable is just _extensions/nrennie/PrettyPDF/
without the escaping \
, so the two things i haven`t looked into probably do that escaping for some reason
As for the suggestions mentioned by @nrennie :
/
)
Just to be sure, can @nrennie confirm whether the quarto inserts the path with or without the dreaded /
in their setup? To make it fail and leave the intermediate files(there is probably a flag for that, but light googling didn`t suceed) you can just delete the logo file, it should leave you with .typ file with the path(probably).EDIT: Since i also forgot to add pandoc version in my previous comment, here it is just for reference:
pandoc 3.1.8
Features: +server +lua
Scripting engine: Lua 5.4
@MrDullDev No, Quarto doesn't insert the extra \
in the path for me. As I mentioned, the planned changes are to move to keeping the logo file in the root directory (which you've confirmed workz without issue) and this will remove any file path issues. This will be addressed in nrennie/PrettyTypst#1 (when I get time to work on it in the next few weeks).
This is likely the most robust solution for now (since Typst/Quarto is still evolving quite rapidly), and now seems to be the suggested way of including logos with Quarto templates anyway.
I've split the PrettyPDF into two separate extensions, with the Typst extension now called PrettyTypst
(note the change of GitHub repository). This allows specifying minimum version requirements for Typst without it affecting the LaTeX version. I'm hoping that the use of format-resources
has now fixed the issue with the logo path. Can you try re-installing the template using:
quarto use template nrennie/PrettyTypst
and rendering the updated template, to see if that works?
@nrennie Yep, works like a charm! Will probably investigate a bit and post an issue on quarto project
It just keeps erroring this:
The install process is confusing - is the PrettyPDF directory (or the nrennie directory?) supposed to be in the main directory of the Quarto project? In the _extensions directory in the project directory? In the quarto-ext directory inside _extensions?
And where is the PrettyPDF.qmd template supposed to be?
UPDATE: I can render the PrettyPDF.qmd template, from a subdirectory I created called PrettyPDF in the main project directory. It contains the template and an _extensions folder containing the nrennie folder. However, I am unable to render any .qmd files in the main project directory, even when copied into PrettyPDF.