Usually, AUCTeX activates beamer-specific settings (e.g. syntax highlighting) depending on \documentclass. In my LaTeX templates, however, I have separated the preamble from the rest of the document using \input{beamer-preamble}.

Here's an MWE:

\input{beamer-preamble}  % `beamer-preamble.tex` only contains `\documentclass{beamer}`

\title{Some title}

\frametitle{Some frame title}


In this example, the argument of \frametitle should be highlighted similarly to the argument of \title.

How can I tell AUCTeX to still apply the beamer-specific settings?

  • Can you show your beamer-preamble and a .tex file where you use it and do the actual typesetting? Apr 26, 2017 at 8:09
  • @ArashEsbati I've updated the question. Interestingly, AUCTeX sometimes does it right, but not always.
    – Timm
    Apr 26, 2017 at 14:13
  • What is your setting of Tex-auto-local? Have you updated the local files? Apr 26, 2017 at 15:23
  • @AndrewSwann Tex-auto-local points to some directory under .emacs.d. In fact, when I remove the AUCTeX files there, the highlighting changes for the worse.
    – Timm
    Apr 26, 2017 at 16:11
  • It us usually just "auto" so that information can be stored in that subdirectory where your current tex file is. Have you changed the defaults? Apr 26, 2017 at 16:38

1 Answer 1


First of all, I suggest you create a proper class file beamer-preamble.cls like this:

  [2017/04/26 v0.1 My Beamer Preamble]

Next, you want to have an AUCTeX style file for beamer-preamble.cls. Doing M-x TeX-auto-generate RET in one way. But I recommend writing your own style file. Something like this should suffice:

 (lambda ()
   (TeX-run-style-hooks "beamer"))

Customize TeX-style-private to a directory of your choice and save the code above as beamer-preamble.el there. Add this to your init file,

(setq TeX-parse-self t)

restart Emacs and open your .tex file.

  • 2
    Thanks for your answer, which brought me to think about an even simpler (but more ad-hoc) solution: just add eval: (TeX-run-style-hooks "beamer") to the local variables of the file. Still, I really like the more generic approach of defining classes and including them globally.
    – Timm
    Apr 28, 2017 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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