Last active
June 13, 2019 08:47
-
-
Save dandrake/6d7e46f36cecab6d89bc to your computer and use it in GitHub Desktop.
Use MMM for SageTeX in emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; add this to your .emacs / init.el to use mmm (multiple major modes) with SageTeX. This works with AUCTeX and | |
;; emacs 23.4. The fontification gets a little wonky, though; quotes inside a SageTeX environment throw | |
;; off the highlighting for the LaTeX bits that follow. But the modes correctly get switched. | |
;; if you don't have sage-mode installed, you can either (1) do "sage -i sage-mode" and follow the instructions to | |
;; enable it, or (2) replace sage-mode below with python-mode, which is good enough for regular editing of Sage code | |
(require 'mmm-auto) | |
(setq mmm-global-mode 'maybe) | |
(mmm-add-classes | |
'((sagetex | |
:submode sage-mode | |
:delimiter-mode nil | |
:front "\\\\begin{sage\\(block\\|silent\\|verbatim\\|example\\|commandline\\)}" | |
:back "\\\\end{sage~1}" | |
:save-matches 1))) | |
(mmm-add-mode-ext-class nil "\\.tex\\'" 'sagetex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment