Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What is the best way to have AUCTeX fold some math macros specifically for one file? For example in this very trivial example:


I would like to tell AUCTeX that in this document and this document only, the fold commands (C-c C-o C-b and the such) should fold the macro \foo in math mode to the string "λ". I tried adding the following to the file:

% Local Variables:
% eval: (add-to-list 'LaTeX-fold-math-spec-list '("λ" ("foo")))
% End:

But it didn't work. First the change was permanent, ie. not local to this file, and second the code was evaluated after the fold-mode was activated, and therefore I needed to reload the file to see the effect.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Instead of

% eval: (add-to-list 'LaTeX-fold-math-spec-list '("λ" ("foo")))


% eval: (add-to-list (make-variable-buffer-local 'LaTeX-fold-math-spec-list) '("λ" ("foo")))
% eval: (TeX-fold-mode 1)

The first line makes LaTeX-fold-math-spec-list buffer local and adds the custom element to the alist, the second one re-activates the folding mode.

share|improve this answer
@nik it's due to the eval, but you already use an eval in your code so I supposed that you alreade made it safe. Customize enable-local-eval. –  giordano Nov 6 '13 at 18:38
Oh yes you're completely right, I removed it in between from my .emacs. Thanks! –  Najib Idrissi Nov 6 '13 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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