AucTeX is not highlighting properly the expl3 code; not in the .dtx file, not in the derived .sty file. The macros are not highlighted after the first occurrence of _.

Should I some how manually load the expl3.el file when programming in expl3?

  • Does this answer (tex.stackexchange.com/a/129521/136923) help you?
    – stone-zeng
    Commented Aug 1, 2017 at 11:32
  • @Stone-Zeng My search was narrowed to expl3 and I don't realise that I should also search for latex3. Thanks for the link, it may help.
    – TeXtnik
    Commented Aug 1, 2017 at 20:35

1 Answer 1


I think the issue you describe is fixed upstream in current version (11.91) of AUCTeX. For me, xparse.dtx is fontified like this:

enter image description here

Please update your AUCTeX and try it again. I admit that the solution just works in .dtx files and not in .sty. This should be fixed; maybe you can submit a bug report.

AUCTeX is capable to parse your .dtx or .sty in order to find out which package(s) you're using and load the respective style file(s). Just add the following line to your .dtx:


After that, you can hit C-c C-n to parse the file. With this line in your .emacs:

(setq TeX-parse-self t)

AUCTeX parses your file directly when you open it.

  • I acutaly load xparse.dtx with version 11.90 and it looks fine! I installed the 11.91 and the problem persists. It seems that AucTeX doesn't know that my .dtx is using expl3. Should I have something in the code that AUCTeX should parse?
    – TeXtnik
    Commented Aug 1, 2017 at 21:46
  • Are you explicitly loading expl3 in the dtx? Or is it loaded through other packages?
    – giordano
    Commented Aug 1, 2017 at 22:12
  • @TeXtnik - See update in my answer. Commented Aug 2, 2017 at 20:06
  • @ArashEsbati, Loading the expl3 package doesn't make my Emacs and AUCTeX that colorful, it would do it for an LaTeX2e file. Also, I'd expect Emacs to detect \ProvidesEpxlPackage and act accordingly, which it ignores. The "auto" file does not add the expl3 style hook in that case.
    – Jan
    Commented Mar 25, 2023 at 10:50
  • Above @stone-zeng linked to tex.stackexchange.com/a/129521/136923, where you could see some examples of other editors. Any other mentioned editor is more fancy, than emacs. :-(
    – Jan
    Commented Mar 25, 2023 at 10:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .