4

After learning how to create my own commands and how to make them available in TeXstudio through a autocomplete list with a .cwl file, I could not do the same with packages files I created with those commands.

The following example is the autocomplete list for my own command named myclock.

enter image description here

A very well summarized explanation is here.

I read the latex-document.cwl, that show us the basics of TeXstudio default autocompletion, as the following figure presents,

enter image description here

and also section 4.14 Description of the cwl format of TeXstudio manual, which gives the whole set of instructions to create own .cwl files, and this FAQ of TeXstudio.

Unfortunately I still could not create a completion list for my own packages.

When I start typing a package name inside \usepackage{ }, or use the combination Ctrl+Space, the list appears with all packages TeXstudio recognizes.

enter image description here

But what should I do to insert myownpackage list in the autocompletion list of packages?

The basic idea I had didn't work.

enter image description here

The following figures show an attempt that clearly is not the desired result. The first line replaces the original setup, which is not desirable.

enter image description here enter image description here enter image description here

3
+50

You don't need a cwl file to achieve this.

All you need to is place the sty of your package in the folder for local packages in your installation directory:

enter image description here



After that you have to update the file name database:
TeXLive: run a texhash on your system, or update via the tlmgr.
MiKTeX: open the MiKTeX console and follow these instructions (taken from here):

enter image description here


After the database is updated TeXstudio knows your package exists:

enter image description here

4
  • Hi @schoekling, I think I need some help. I'm a windows user, and texhash is a Linux command. I checked this link and learned about mktexlsr, but I couldn't understand nor find its syntax. I tried some combinations using DOS (typing commands) and MikTeX console (update/refresh options) but without success. I know MikTeX finds my texmf, but it doesn't seem to be enough. – FHZ Mar 23 at 22:35
  • 1
    I am a Windows user too, but I am using TeXlive and sometimes forget not everyone does, sorry. I'm not familiar with any MiKTeX commands, but it looks like you can update the file database via the MiKTeX Console. I've added a link and screenshot to my answer. – schoekling Mar 23 at 23:00
  • Hmmm, It will not be that simple. I've being using RFND (Refresh File Name Database) for long. This operation is necessary after any update on my own packages. I just used it and the autocomplete for pacakge's names still doesn't work. The option "Update package database" still doesn't seem to work. With your answer, it seems it is not a TeXstudio related issue, but a MikTeX related issue. – FHZ Mar 24 at 23:50
  • 1
    In that case, I am sorry I cannot help with that. I am aware that MiKTeX is usually the recommended option for Windows users, but from my personal experience TeXLive works just as well, if not better (except for this issue, which can be resolved and probably affects like 0.01% of users). – schoekling Mar 25 at 0:41

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.