Open cderv opened 1 year ago
For example on Firefox you will still get garbage resp. wrong page breaks in the printed results after activating this mode.
You aren't kidding. Came here after exporting to PDF on Firefox (hadn't seen the doc warning), which produced terrible results. This is a highly needed improvement.
FWIW I found the revealjs output with decktape with the screenshot size to be excellent. e.g.
decktape myfile.html myfile.pdf --screenshots-size=1280x720
The only issue real issue are errors about having trouble finding embedded fonts when using adobe acrobat (that don't seem to pop up on other pdf viewers).
For reference, good recipe on using docker decktape: https://github.com/quarto-dev/quarto-cli/discussions/7018#discussioncomment-7897967
I use decktape from inside R to convert the HTML version of quarto presentations to PDF. I'm presently using quarto prerelease v1.4.534. With the most recent version of decktape (3.11), conversion fails because decktape will not stop printing slides. This might possibly be a version of this old decktape issue: astefanutti/decktape#137, or something like it. What happens is that decktape correctly identifies the number of slides in the deck, prints them all in order, but then just repeatedly prints the last slide forever. If you specify the number of slides to print via decktape's --slides
switch, it will correctly terminate after that number of slides. If you specify any n > the number of slides, it will repeatedly print the last slide till it reaches n slides.
To reproduce the problem, create a quarto slide document—the default one created from New File > Quarto Presentation ... in RStudio will do fine. Save it as test.qmd
. Render the file to HTML, then from the terminal (and with decktape 3.10 or 3.11 installed) do
decktape --chrome-arg=--allow-file-access-from-files reveal ./test.html test.pdf
Decktape should launch, begin rendering as expected, but not stop after the 4th slide. Instead it just keeps going. No file is produced. To make it render properly, do
decktape --chrome-arg=--allow-file-access-from-files --slides 1-4 reveal ./test.html test.pdf
I believe this is a quarto issue rather than a decktape issue as I can render other non-quarto revealjs decks OK, e.g. this one I found at random that seems to have been written in markdown or directly in html and produced by hugo:
decktape reveal https://ksucs-hugo.russfeld.me/0-basic-content/02-reveal-example-slides/ test.pdf
I apologize for not being able to pin down which quarto prerelease version this issue appeared in ... I'm returning to slides that were happily rendering to PDF last semester in preparation for this semester's classes. Happy to open a new bug report if it seems like it deserves one rather than a comment here.
@kjhealy Thanks for the report, I can reproduce that. I'll bisect and come back to this.
HEAD
is badThe offending commit is 362dbc4bc8556f5be9de806a95e74164c082498c
Reopening #6800 since that fix breaks the decktape
workflow which we want to support. I'll track there.
@kjhealy Fix is here https://github.com/quarto-dev/quarto-cli/commit/ea55f5740393cf693d079661d77ca72cd05f466f. We're setting up the release candidates for 1.4 tonight, so a new build should be out soon. Thanks again for the report.
Fantastic, thanks so much.
After having this in my workflow last year (and for the upcoming term) my conclusion is that: (1) quarto+revealjs is great for slides - and thanks to the quarto team for pushing me to try it over beamer/pdf; (2) decktape is pretty slick once properly configured and is certainly a good replacement for PDF output of slides, which was the main reason to use latex/pdf; but (3) it is a pain to setup and maintain outside of the rest of the publication toolchain. I think if you supported proper revealjs slide output "out of the box" as an alternative to beamer, it would help the transition for a lot of people.
For example, most people I know have never directly installed node before, etc. (I hadn't) This is especially a problem when I want to think about moving to github action based publications, etc. This latest bug shows how fragile things can be with quarto versions.
So I hope that you guys consider building decktape support direclty into the quarto publication options, which lets you pin version numbers, add in proper unit tests, and becomes much easier for outsiders to get pdf access when trying to replace latex with revealjs.
So I hope that you guys consider building decktape support direclty into the quarto publication options
This is the whole point of having this issue (still) open.
Following @jlperla suggestion to use decktape, I observe significant font problems with math. Here's the qmd
source, followed by a screenshot of the reveal result in Firefox (perfect) and of the PDF output from decktape.
---
format: revealjs
---
## Slide
$$ \mathcal{X} $$
$$\sqrt{\sum_i^n \sigma_i}$$
This was produced using
decktape math.html math.pdf --screen-shot=1280x720
I'll be glad for suggestions on how to get proper output out of decktape.
@mpf
It isn't perfect, but I had to fudge some mathjax settings to get things to work consistently. Maybe try:
html-math-method: # until Quarto 1.4 is released?
method: mathjax
url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
In the header?
That works. Thank you!
I note the comment in your solution: until Quarto 1.4 is released
. I'm using v1.4.542, so still an issue.
Previously someone had pointed me to #4493 but it looks like the target milestone was changed in December. @cderv is the workaround here I posted still the best option for the upcoming 1.4 release?
is the workaround here I posted still the best option for the upcoming 1.4 release?
Yes - we'll tackle all the revealjs work and updates for next version. Thanks for your patience
It isn't perfect, but I had to fudge some mathjax settings to get things to work consistently. Maybe try:
html-math-method: # until Quarto 1.4 is released? method: mathjax url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
In the header?
This workaround solves the font issue. Thanks!
However, it does cause javascript errors that show up in the console, such as MathJax.Hub is undefined
. These errors can be seen on these slides produced by this MWE.
I sometimes have issues with defining macros in mathjax, and I wonder if these errors may be related. Any ideas on how to fix these?
On the latest Quarto 1.5.57, I find several issues with Decktape rendering:
html-math-method
doesn't change anything. screenshot
option is not passed in. Thanks for the report. @shriv can you share a repo with the slide with problem ?
Last time I used decktape to produce PDF from my slides, it works well.
BTW the command I ran is the following (using docker container)
docker run --rm -t -v .:/slides astefanutti/decktape -s 1280x720 generic /slides/index.html slides-full.pdf
Using generic
mode instead of revealjs mode allowed to simulate arrow navigation and gets all the slides as if it was recorded on screen.
If slides are showing correctly in HTML in browser, issues you are encountering could be with decktape and revealjs only. Not sure we can do something in Quarto. You should look into this. If we do generate bad HTML that prevent decktape rendering, then we'll be happy to fix.
Current PDF export mode rom revealjs doesn't work reliable on most browsers. For example on Firefox you will still get garbage resp. wrong page breaks in the printed results after activating this mode. Well, you'll find a warning note about this flaw in the documentation, but it's IMHO still a very disappointing behavior.
I would therefore prefer a more reliable solution, which provides reproducible correct results in arbitrary browsers.
This can be realized in practice by integrating decktape resp. puppeteer, playwright or another similar mechanism into the CLI-tool for the document processing to generate a PDF-document beside the HTML-output and just add a download button in the HTML-menu or -toolbar instead of the present print style-switch entry. That's the way, how for example slidev handles this task in a much more reliable manner (see: https://sli.dev/guide/exporting#pdf).
Originally posted by @mash-graz in https://github.com/quarto-dev/quarto-cli/issues/2988#issuecomment-1455245996
Related