21 Embrace Quarto
“LaTeX is a document preparation system. Microsoft Word is a document destruction system.”
— Leslie Lamport, creator of LaTeX, just maybe, while having lunch with Genghis Khan.
21.1 The writer’s soliloquy rant
Enough talking about the editor. We want to write papers. How? Quarto. Yes, I could write some boring introduction about Quarto here. Just go and take a look at their site’s home page. When you’re satisfied come back. If you’re not satisfied, please also come back. Let’s at least run one example before you decide to go back to Microsoft Word.
If you’ve tried to submit some papers in journals, you might have heard about this thing called LaTeX even if you never used it yourself. It’s one format they typically accept. It’s a more coding-like way of writing documents. You write some weird things along with actual text, and you get a PDF in the end. But a beautiful one indeed.
Beautiful PDFs come from ugly LaTeX files. Yes, I mean, there’s a lot of unnecessary jargon in a LaTeX file that you probably don’t care about. I won’t try to defend LaTeX. You just want to write your document, don’t you? Well, it’s time for Quarto. Luckily for you, the Positron devs already included Quarto in your Positron editor so if we intend to use that, you don’t need to install anything else!
21.2 Give me that paper already
Come on, search for the command New Folder from Git, just as I told you in the previous section. You can copy URLs of GitHub repositories directly. I created an example for you. It’s at https://github.com/lbm364dl/test-paper. You can pay a visit if you’re interested or just copy and paste the URL:

And we get our example Quarto project! Open the index.qmd file:

21.3 Let’s preview that…
See that Preview button up there? I wonder what it does… let’s just hit that Subscribe Preview button and find out!

A bunch of things show up there. The important ones:
- Useful messages saying we didn’t install packages such as knitr and rmarkdown. You might know how to solve that, but wait.
- Something saying “Use
renv::restore()to restore the project library”.
What is this renv::restore() thing? Just a simple command that will install all R packages required to run some code in the project. So you don’t need to install each package by hand, just run this command in the console:

If you want to know more about renv, go visit the Virtual environments with renv chapter or read any better guide, even the official renv docs. If for some reason you’re an renv hater, just remove source("renv/activate.R") from the .Rprofile file and then you can also get rid of the renv folder and the renv.lock file. But if you’re really an renv hater, you probably already knew that.
21.4 …tiny tiny paper
OK, OK, we installed some packages, we should get no errors now. Just hit again that Preview button. Hopefully you see this:

You know I believe in you. You got some new things on the right. By this point you and your Positron should be like a kid with their new toy. Just experiment. I’m sure you’ll be able to make that output window bigger.
And that’s it. You produced your PDF paper! Under the hood, your Quarto file index.qmd is being converted to a LaTeX file, and the PDF output is created from that LaTeX file. The magic is you don’t need to write ugly LaTeX. Quarto does that for you. It also knows how to convert your file to dozens of other formats.
Embrace Quarto.