When working on a LaTeX project I like to create an .sty file (say mymacros.sty) where all my custom macros are defined. I then simply call \usepackage{mymacros} in the main .tex file preamble. I also update mymacros.sty while working when I need to define a new macro.

The drawback is that most LaTeX editors I have tried can auto-complete commands directly in the preamble of the main .tex file but cannot auto-complete commands from mymacros.sty.

TeXStudio autogenerates a .cwl file corresponding to mymacros.sty but marks all commands with #S (i.e. do not show in completer at all). Okay, I could simply replace these with #n for example and everything would be fine. However, when updating mymacros.sty for a new command, the .cwl file is not updated correspondingly. I would have to manually insert the new command to the .cwl file.

Kile does auto-complete commands for mymacros.sty but, for some reason, only some of them. I haven't been able to find out why.

My question:

Is there an editor which would provide the described functionality out-of-the-box? That would be able automatically parse the used packages and offer auto-completion of its commands even when the package is regularly updated?


  • I do not want to be editing any .cwl files.
  • I'm fine with all the commands being classified as #n as long as they appear in the auto-complete pop-up window.
  • 1
    While this would be a great feature, it's pretty hard to do this for arbitrary packages (and I'm not aware of any editor doing this). Think of \csname constructions and the different options to define macros (\def/\gdef, …, \newcommand, …, \NewDocumentCommand, …, \cs_set:Npn, …). Therefore you might focus on an editor you really want to use and open a feature request there. – TeXnician Aug 15 '18 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.