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 Aug 1 '17 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 Aug 1 '17 at 20:35

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 Aug 1 '17 at 21:46
  • Are you explicitly loading expl3 in the dtx? Or is it loaded through other packages? – giordano Aug 1 '17 at 22:12
  • @TeXtnik - See update in my answer. – Arash Esbati Aug 2 '17 at 20:06

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.