Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmm-mode sage-shell:sage-mode integration in specific latex environments #37

Open
Poetastrophe opened this issue Nov 27, 2017 · 1 comment

Comments

@Poetastrophe
Copy link

I was looking into how I could get sage-shell:sage-mode to work in sageblock and sagesilent environments. I found this post about getting python-mode to work in specific environments. https://emacs.stackexchange.com/questions/20136/pythontex-and-auctex#20150
But I honestly do not know how to implement this correctly for sage-shell:sage-mode. But I thought it would be neat for working with math-documents.

@stakemori
Copy link
Collaborator

I am not familiar with mmm-mode but the following code seems to work to some extent:

(require 'mmm-auto)
(setq mmm-global-mode 'maybe)

(let ((envs '("sageblock" "sagesilent")))
  (mmm-add-classes
   `((latex-sage
      :submode sage-shell:sage-mode
      :face mmm-default-submode-face
      :front ,(rx-to-string
               `(and "\\begin{" (or ,@envs) "}" eol))
      :back ,(rx-to-string
              `(and "\\end{" (or ,@envs) "}" eol))))))

(mmm-add-mode-ext-class 'latex-mode nil 'latex-sage)

Unfortunately syntax highlighting in example.tex is broken with this configuration. I guess the method used by org-mode better than mmm-mode. Perhaps I should examine how org-mode highlights source blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants