I have a document that's highly fragmented. A MWE might look something like:






\DeclareAcronym{gnu}{short=GNU,long=Gnu is Not Unix}



Here the ac command in chapter is highlighted as red, if the \usepackage{acro} command is moved to main.tex, TeXstudio works, but not when the file is fragmented.

Is there a way to make TeXstudio see that it should autocomplete acro commands without the \usepackage being in the main file?

This is not a problem with all packages. The siunitx package works fine, but the acro package, for some reason, does not.

Something weird was happening:

Our non MWE preamble looked more like: Preamble.tex

%Start of using many packages
%end of using many packages
%A few more things

If we moved \usepackage{acro}\input{acronymlist.tex} below \usepackage{listings} it suddenly worked. It's probably due to an unlucky combination of things before and after the acro package. The weirdest thing is that other packages were not affected by this. We tried moving \usepackage{cleveref} around, but the \cref never stopped being marked as correct.

  • 1
    Are you really using \usepackage{acro.tex}? Apr 26, 2019 at 12:42
  • @Ulrike Fischer yes offcourse, that's the best version of acro ;-) (I'll fix that now) Apr 26, 2019 at 13:26

1 Answer 1


Moving the goal posts changes my behaviour it still worked with a fresh set of files on my machine.

OK now I see it IF I only open chapter so there is no other means of reference AND I have NOT told TeXstudio I am using acronyms then it will obviously turn red go to Options > configure > advanced > completion and enable both acro and acronym click OK and you should be good to go

As a result of comments and further testing
It looks like the division of preamble and main are the cause I can get acro and acronym accepted WITHOUT manually setting cwl irrespective of packages given as examples IF

I have told TeXstudio where the main file is even if its not currently open It then seems to follow the chain to include the cwls necessary for both main and preamble.

If I add a "wrong" entry it is red, but using the mwe files above then \ac offers me {ID} whilst autocompleting without any problems. Running 2.12.14 on Windows 10 (Portable 32bit MiKTeX)

enter image description here

  • 1
    Thanks, the problem seemed to be with another package I hadn't included in the preamble (and not in the MWE) May 1, 2019 at 12:13
  • @ThorbjørnE.K.Christensen Seem to remember somewhere that TeXstudio will autoload the cwl as it sees fit (based on active main preamble) but if they are not loaded then you need to manually confirm which ones to add into memory since adding ALL would grind some users to a halt.
    – user170109
    May 1, 2019 at 14:00
  • It's just wierd that the order of \usepackage commands should have an influence on the cwl file. the preamble IS loaded, yet it didn't work before moving acro to after listings. May 1, 2019 at 14:29

You must log in to answer this question.

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