-
Notifications
You must be signed in to change notification settings - Fork 260
Previewing TeX in Macaulay2 Emacs buffers
Doug Torrance edited this page Dec 22, 2023
·
4 revisions
Using the texfrag Emacs package, it is possible to preview TeX code in Macaulay2 interaction buffers in a way similar to the preview-latex mode that comes with AUCTeX.
After installing texfrag (which is available through MELPA), add the following to your .emacs or .init.el:
(require 'texfrag)
(defun texfrag-M2-comint ()
"Texfrag setup for `M2-comint-mode'."
(when texfrag-mode
(setq texfrag-comments-only nil
texfrag-frag-alist '(("\\$" "\\$" "$" "$")))))
(push (list #'texfrag-M2-comint #'M2-comint-mode) texfrag-setup-alist)Then, when in an M2 interaction window buffer, start texfrag using M-x texfrag-mode. Alternatively, you can set texfrag to start automatically in Macaulay2 interaction buffers by adding the following to your configuration:
(add-hook 'M2-comint-mode-hook #'texfrag-mode)As an example, consider the following session:

Now suppose we run M-x preview-at-point (or its key binding, C-c C-p C-p). Then we get the following:

Homepage | Projects | Packages | Documentation | Events | Google Group