Table of Contents
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.
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.
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
tlmgr binaries installed and on
$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
brew cask install basictex
You'll need to reload your shell to get the TeXLive binaries on your
Check that you have them installed:
latex -version tlmgr -version
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:
If you are using TeXLive, you can install these with
sudo tlmgr update --self sudo tlmgr install dvipng l3packages xcolor soul adjustbox collectbox
You should now be able to run
Alternatively, you can modify the value of the
(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.