Dieter Brehm

Writing Latex Documents in Emacs

# Overview

Through various projects, assignments, and more, I end up writing a lot of LaTeX files. For academic works, this is often for papers, writeups, and problem sets. LaTeX is really obtuse and hard to write clearly in though! It's like HTML but worse!

One solution which I've tried before is Overleaf, an online editor for these document types. The problem with it though is that compiling latex on the website is much slower than on my computer. The ironic "disconnect" of the internet slows down the writing process. Not only that, but when wifi is unavailable doing work becomes impossible! Clearly no good at all. Collaboration is also a mixed bag. When everyone in a project is familiar with software magic like git, I would much rather use that as opposed to Overleaf's collaboration options.

There is also a second issue in the LaTeX workflow. In 99% of cases, I don't want or need the magic powers of LaTeX beyond the formatting formality and consistency it provides. I'd much rather edit text in plain text, or in an editor like Pages, and have it become LaTeX-looking. For better or worse, this convoluted formatting is the expectation in many spheres of communication.

How could we make a system which gives the convenience of writing plain text with the formatting super-powers of LaTeX when we need it?

The open source community to the rescue! Below is a continually-in-progress guide to the open source LaTeX landscape, and how I've navigated it.

# Tooling Options

  • Emacs
  • Tex Live
  • MacTex
  • MiKTeX // Tex Live
  • Markdown
  • Org-Mode
  • Pandoc

# What I use

  • 1-2 sentence description, link to install instructions

# Emacs

# MacTeX


# PDFTools

# Pandoc

# Workflow

  • Gif of markdown
  • Gif of latex
  • Use-case examples

# Further Reading

  • Static website processors
    • Jekyll
    • Vuepress
    • Hugo
  • Github Pages
  • Netlify
  • Org-mode

# Alternatives

  • Overleaf
  • Notion
  • Pages
  • Plain Text

new post draft ^

old post ->

# Packages - Overview

First, we need to install some things. Namely a LaTeX distribution and Emacs itself.

# Install Homebrew

I use a macbook, so unlike most linux distributions I do not have a package manager to manage various software related to programming. You can install Homebrew by opening a terminal and entering:
"/usr/bin/ruby -e "$(curl -fsSL"" alternatively, you can read about it more at

# * Install Emacs

first, $ brew tap railwaycat/emacsmacport
and then $ brew install emacs-mac
when it finishes, emacs will be installed.

# * Install MacTex

the best supported distribution of LaTeX on mac is MacTex, you can download it here:

# * Install Emacs packages

Start by firing up emacs and performing the key stroke: Command+x, and then typing list-packages, then performing the keystroke: Ctrl+s, then typing use-package, then enter. Finally click "install".

then create the file init.el in the folder ~/.emacs.d/. Put the following into it

(require 'package)
(setq-default package-archives '(("gnu" . "")
                                 ("melpa" . "")
                                 ("org" . ""))
              package-enable-at-startup nil
			  load-prefer-newer t)

(unless (package-installed-p 'use-package)
	(package-install 'use-package))

(use-package auctex
	:defer t
	:ensure t
	(setq TeX-auto-save t)
	(setq TeX-parse-self t)
	(setq TeX-save-query nil))

(use-package flyspell
	(add-hook 'text-mode-hook 'flyspell-mode))

(use-package olivetti :ensure)

;; company = complete-any, a completion backend
(use-package company :ensure
  (add-hook 'prog-mode-hook 'company-mode)
	(add-hook 'tex-mode 'company-mode)
  (setq company-idle-delay 0.1)
  (bind-key "<C-tab>" 'company-manual-begin))

;; sort company completions by usage stats
(use-package company-statistics :ensure

then restart Emacs and the packages will auto-install.

©2021 Dieter Brehm. All rights reserved.