nrennie / nrennie.github.io-comments

Repository to host Utterances for blog.
2 stars 0 forks source link

blog/making-pdf-with-quarto-typst-latex/ #14

Open utterances-bot opened 7 months ago

utterances-bot commented 7 months ago

Making Pretty PDFs with Typst (and Quarto) | Nicola Rennie

With the latest 1.4 release of Quarto, it's now possible to create PDF documents with Quarto using Typst. How does it compare to LaTeX, and is it actually easier to learn and use?

https://nrennie.rbind.io/blog/making-pdf-with-quarto-typst-latex/

rainer-rq-koelle commented 7 months ago

Hi Nicola, thanks that was a useful resource. I am currently looking into using Typst/Quarto for reporting at work. One of the style "requirements" is to have a line separating the header and footer. Would you have an idea how this is done/can be done? I somehow fail to find the answer in the typst documentation.

nrennie commented 7 months ago

I don't think there's a built-in option to do it, but as long as you know the height of the header/footer, you can use the line function to draw a line: https://typst.app/docs/reference/visualize/line/

butames commented 6 months ago

Thank you for introducing me to this resource. I used LaTeX sometime ago when I was in graduate school After doing my data analysis, writing out my work using LaTeX felt like an additional chore. I will look into Typst, it certainly looks more accessible. Thank you again.

castedo commented 5 months ago

A third approach is to not use LaTeX nor Typst at all and instead output HTML that can be rendered into a PDF using WeasyPrint. I can email you more details if you are interested. Quarto 1.4 by default outputs HTML with CSS that does not work (https://github.com/quarto-dev/quarto-cli/issues/9510), but custom CSS that is print-reponsive could work similar to what is described here: https://github.com/quarto-dev/quarto-cli/discussions/9505

An interesting blog post might be contrasting the pros and cons of generating PDFs from print-responsive HTML vs using LaTeX/Typst.

nrennie commented 5 months ago

Thanks for the suggestion - I'm aware that you can convert from HTML to PDF (this post was focusing on PDF as a primary output rather than secondary). Personall, I normally use pagedjs rather than WeasyPrint (paged.js works out of the box with R Markdown via pagedown so I can use the code I already have from that).

See also this GitHub issue: https://github.com/quarto-dev/quarto-cli/discussions/6401