quarto-dev / quarto-dev/quarto-cli

[FR] Rethink the way to output PDF from any format.

Open
#7,039 5 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

epic
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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.