After considering Quarto for a long time (using instructions for the tarball version) and failing to make it work with Emacs properly, I decided to go all in on the computational notebook features of Org Mode. It is not that Quarto (with its .qmd files) does not work with my current setup. It does, and I was able to render something basic involving R, Python, and Julia using a complex setup (with Quarto using knitr along with reticulate and JuliaCall). But working with QMD files in Emacs was ugly. Quarto is designed for VSCode, Neovim, and others; the relevant Emacs package has not been updated in several years.

Clearly, I was not meant to use Quarto with Emacs. Quarto has some nice publishing functionalities; in Emacs, there will be more steps to make the output resemble Quarto books or websites. But for now, getting all the computational notebooks functioning properly is the priority. The bridge of publishing will be dealt with when we get to it.

Why is the Quarto package outdated? Not enough people use it. Why? The answer seems obvious upon some thought: Org Mode already had been doing what Quarto only recently began.

Anyway, even before getting to the programming languages, immediate task was to get LaTeX working with Emacs.

Installing LaTeX and Compiling PDF Files

Install LaTeX using the following command. This might be more than I really need. It required a bunch of trial-and-error, and I don’t want to go on an uninstall-reinstall loop to find out what I really need.

sudo pacman -S texlive-basic texlive-latex texlive-binextra texlive-latexextra

In Emacs, using package-install, install auctex.

Now any .tex file can be used to render a PDF. Activate PDF mode with this.

C-c C-t C-p 

And then run the file to compile a PDF.

C-c C-a

Live Previews

This still does not work the way I would like, but it is a good start for now.

Install dvipng and dvisvgm.

sudo pacman -S texlive-dvisvgm dvipng

# (Or `` sudo pacman -S texlive-bin`` for both.)

But this might still throw an error like this: ! LaTeX Error: File `ulem.sty' not found.

It was resolved with this installation.

sudo pacman -S texlive-ulem

Refresh the TeX filename database (usually not needed).

sudo mktexlsr
# or
sudo texhash

Now, by going to an equation block \[ ... \](multiline) or $$ ... $$, you can get the live preview using this. (These block brackets are not needed if proper LaTeX syntax is used.)

C-c C-x C-l

# or M-x org-latex-preview

This can be used on blocks to toggle between viewing the mathematical form and the code form.

However, this is nothing like what I see on this Emacs LaTeX video, where the preview appears (apparently automatically) alongside the code. Something to look further into.

Addenda

Edit 1

Not quite the live preview I want, but with the keybindings it can be usable.

Use M-x describe-variable with org-format-latex-options to edit the scale and other variables of the latex previews. The changes are automatically reflected in the custom.el file inside .emacs.d.

Edit 2 : Org-Fragtog

Just figured out that the org-fragtog package does most of what I need. I needed to put this in the relevant emacs config file (here, my-org.el).

(use-package org-fragtog
  :hook (org-mode . org-fragtog-mode))

This toggles the LaTeX blocks by just rolling the cursor over the blocks. The preview shortcut is not needed.

Also, I have been directly editing the scale variable inside custom.el (which is not supposed to be edited). It does change the font size (really the picture size) for the equations.

Org + LaTeX in Emacs basically works now.

See Setting Up Computational Notebook Functionality in Emacs Org Mode to make Python, R, and Julia code run in the Org files.

Also, SDS Project Configuration.