You can configure AuCTeX to automatically replace " with \enquote{ or }, if the package csquotes is loaded, which is great.

But when I am using my own custom class, where csquotes is loaded in the class file, Emacs does not recognize it and therefore instead replaces " with ``.

How can I make AuCTeX also in this case replace " with \enquote{ or }?

Because I always use the package csquotes, it does not have to recognize, whether the package is loaded in some class or package file, but instead it can always assume that it is loaded. (Actually, I would even prefer the latter, since I suspect the former to be complex and more prone to errors.)

1 Answer 1


AUCTeX provides an interface for this: Write your own AUCTeX style file which corresponds to your own custom LaTeX class file. Suppose the name of your custom class is classname.cls. A simple skeleton for your classname.el can look like this:

 "classname" ;; Replace with the real name of your class
 (lambda ()
   (TeX-run-style-hooks "article" ;; or which .cls you load

Now save this classname.el in a directory which is listed in the variable TeX-style-private (or adjust is accordingly), and make sure you have this in your init file:

(setq TeX-parse-self t)

With this setup, AUCTeX should recognize that you're using classname inside the argument of \documentclass once you open your .tex file and load its support files for article and csquotes which should give you the results you're looking for.

  • I did not know about style files. This fixes the problem and tells me to read the AuCTeX manual again. Thank you!
    – Sinthoras
    May 30, 2023 at 19:24

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.