quarto-dev / quarto-dev/quarto-cli
[FR] Rethink the way to output PDF from any format.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Pandoc does have a simple way to print PDF (https://pandoc.org/MANUAL.html#creating-a-pdf)
To produce a PDF, specify an output file with a .pdf extension:
--pdf-engine controls the behavior. Default is to look at the output format, a specific method will be used.
- -t latex or none: pdflatex (other options: xelatex, lualatex, tectonic, latexmk)
- -t context: context
- -t html: wkhtmltopdf (other options: prince, weasyprint, pagedjs-cli; see print-css.rocks for a good introduction to PDF generation from HTML/CSS)
- -t ms: pdfroff
- -t typst: typst
Quarto does not really work that way - this currently limit the way to create a PDF, and this is not really consistent across format.
In Quarto we support format: pdf which assumes LaTeX or ConTeXt enine. And format: typst which will produce PDF file by default.
There is special output-ext that can modify PDF render. output-ext: tex when format: pdf renders a .tex file. And output-ext: typ when format: typst render a .typ file. But this variable output-ext is fragile (try setting output-ext to anything it will not error)
When typst was introduced, format: typst has been created but default to render a PDF file. output-ext can be use to get the .typ.
HTML printing to PDF is not really supported in Quarto (https://github.com/quarto-dev/quarto-cli/issues/222).
Using format: latex does not exactly work the same as format: typst as it won't produce PDF.
We should probably rethink all this, and offer more mechanism to create PDF according to method available like Pandoc allows
- Easy and robust way to opt-out PDF for a format that default to it
- Allow printing to PDF from HTML using an external pdf-engine that supports that.
- Consistent way to produce PDF from Quarto render; or another quarto command (e.g
quarto print)
Related Issues / Discussions
- https://github.com/quarto-dev/quarto-cli/issues/222
- https://github.com/quarto-dev/quarto-cli/issues/6084
- https://github.com/quarto-dev/quarto-cli/discussions/7018
- https://github.com/quarto-dev/quarto-cli/issues/4677
- Removing Pandoc's extension to
--to latexwhen usingformat: pdf(https://github.com/quarto-dev/quarto-cli/issues/6613#issuecomment-1693397040, https://github.com/quarto-dev/quarto-cli/issues/7966) - https://github.com/quarto-dev/quarto-cli/discussions/9483
- https://github.com/quarto-dev/quarto-cli/issues/13314
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing Quarto's current format: pdf, format: typst, output-ext, and render behavior with Pandoc's PDF options. Read the related issues and discussions linked in the report before proposing a direction. Done would require an agreed, consistent mechanism for PDF generation, including HTML printing and opting out of default PDF output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html, latex
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100