Skip to content
No description, website, or topics provided.
Emacs Lisp Shell Makefile
Branch: master
Clone or download
johnbcoughlin Merge pull request #21 from johnbcoughlin/show-selections
Ensure calc-highlight-selections-with-faces is enabled
Latest commit 00d5d5e Aug 12, 2019

Table of Contents

  1. CalcTeX
    1. Why a WYSIWYG equation editor?
      1. A Tool of Thought
      2. No clicking
  2. Installation
    1. MacOS
    2. LaTeX Packages
  3. Usage
    1. Integrating with documents


CalcTeX is a GNU Emacs minor mode that turns the Emacs Calculator into a WYSIWYG editor for LaTeX formulas.


Why a WYSIWYG equation editor?

Much has been written about the virtues of LaTeX not being a What-You-See-Is-What-You-Get markup system. These arguments, however convincing you find them, deal with LaTeX as a language for writing text in. I have never seen any kind of argument that the LaTeX development cycle is beneficial for writing mathematics.

On the contrary, editing mathematics in LaTeX is, frankly, horrible. The experience bears zero resemblance to writing on the page. Whereas editing text on the computer is faster than handwriting, editing mathematics lags far behind in terms of user experience. Consider the difference between writing out an integral by hand,


and typing the LaTeX source for that same formula:

The handwritten formula flows out of one's pen, and is a pleasure to write. On the other hand, nothing about the LaTeX source code is ergonomic. The backslash key is hard to reach, and long macro names and curly braces obscure the form of the equation. When typing the formula, there is no visual feedback to remind you where you are in the formula, alert you to any mistakes, or provide opportunity for reflecting on the content of what you're typing.

A Tool of Thought

A good editor should be a tool of thought. Mathematical notation is the most refined and sophisticated tool of thought in human history. When writing math on the computer, we deserve an editor that augments the tool of mathematical notation, not one that suffocates it.

No clicking

WYSIWYG equation editors typically provide large menus of clickable buttons. A more powerful, Emacs-y alternative is key commands. CalcTeX is a display mode for Emacs Calc, which provides a huge number of key commands for manipulating equations.



Ensure that you have the latex and tlmgr binaries installed and on your $PATH. The easiest way to install them is via the BasicTeX version of the TeXLive distribution, which installs all the binaries but omits 2.5GB of CTAN packages:

brew cask install basictex

You'll need to reload your shell to get the TeXLive binaries on your PATH. Check that you have them installed:

latex -version
tlmgr -version

LaTeX Packages

CalcTeX makes use of a few LaTeX packages. To run CalcTeX with the default settings, make sure that you have the following LaTeX packages installed:

  • dvipng
  • xparse
  • xcolor
  • soul
  • adjustbox
  • collectbox

If you are using TeXLive, you can install these with tlmgr:

sudo tlmgr update --self
sudo tlmgr install dvipng l3packages xcolor soul adjustbox collectbox

You should now be able to run

dvipng -version

Alternatively, you can modify the value of the calctex-format-latex-header variable:

(setq calctex-format-latex-header "...")

However, be aware that doing so may compromise some facilities of CalcTeX, particularly its selection handling.


To fire up calc, invoke M-x calc, or C-x * c. calctex-mode will toggle the minor mode in the calc buffer. You can type ' for Algebraic entry mode, or type a numeral to begin a numeric entry. Refer to the Calc manual for the many mathematical commands that are available.

Integrating with documents

CalcTeX is designed to be used in conjunction with calc's Embedded Mode. In a LaTeX or Org buffer, move point to a LaTeX formula environment, and type C-x * e to invoke embedded mode. This will couple the top of the calc stack to the contents of the equation in the buffer you are editing.

You can’t perform that action at this time.