2

I'm trying to load the yasnippets for the LaTeX mode every time I open an org file.

Is it possible? How can this be achieved?

  • Only one major mode is active at a time. Check to see if either of those major modes has a corresponding minor mode that you can use at the same time as the other major mode. – Drew Jan 29 '18 at 14:57
3

You can load an additional modes via yas-activate-extra-mode in the hook of the major mode (it also works with yas-global-mode turned on).

Just copy-paste following elisp snippet into your init file:

(defun my-org-latex-yas ()
  "Activate org and LaTeX yas expansion in org-mode buffers."
  (yas-minor-mode)
  (yas-activate-extra-mode 'latex-mode))

(add-hook 'org-mode-hook #'my-org-latex-yas)

Tested with:

  • GNU Emacs 25.3.1 (x86_64-unknown-cygwin, GTK+ Version 3.22.20) of 2017-09-11
  • yasnippet-20180124.1445
  • yasnippet-snippets-20180122.521

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.