This question is very similar to a previous post: Where do I place my own .sty or .cls files, to make them available to all my .tex files?

I am using MiKTeX 2.9 and TeXnicCenter to compose and execute my LaTeX file(s) on Windows 7. I am using a template from Elsevier to submit a journal article, but I am getting the LaTeX Error that File 'numcompress.sty' not found. This file is currently located in the same directory as the other elsarticle files: C:\Program Files (x86)\MikTex 2.9\tex\latex\elsarticle. I have actually followed the directions posted to the above question exactly: https://tex.stackexchange.com/a/20121/ but still have had no change in outcome.

  • 2
    If numcompress.sty is in this directory, and you clicked refresh FNDB, it should works. Did you try to compile your file without TeXnic center? – corentin Jul 20 '12 at 20:52
  • Here's a walk through on downloading, compiling and installing your own custom latex packages: inf.ed.ac.uk/systems/tex/new-packages.html – Eric Leschinski Feb 19 '17 at 1:39

Are you using MikTeX as User or as administrator? To be safe change to adminstrator, check wheather your file numcompress.sty is really in the directory C:\Program Files (x86)\MikTex 2.9\tex\latex\elsarticle. Now start MiKTeX 2.9 over Windows start -> all programms. Choose Maintenance (Admin), then Settings (admin) (Admin is important!). Now choose General and click Refresh FNDB. Afterwards you can change to user again and run MiKTeX. Refresh FNDB means refresh your database for the used filenames.


First, launch the Windows cmd line as administator and search for an .sty file that you know is present and works using the findtexmf utility, e.g.

findtexmf colortbl.sty

Ensure that your .sty file is in a similar location.

Now, update the filename database using the initexmf utility:

initexmf --admin -u
initexmf --admin --dump

The first one refreshes the filename database and the second performs other updates. You may not need both but it won't hurt.


As others answer already said: You should update the FNDB in admin mode if you put files in the main miktex tree. But it is not recommended to use this tree for local additions. Your additions can get lost when miktex updates packages. Use either one of the other trees (UserConfig or CommonConfig) or (better) use a new local tree: Create (e.g.) C:\mylocaltree\tex\latex\elsarticle, copy your file in this folder and then add C:\mylocaltree as a new root in miktex settings.


With MikTeX installed you have access to Texworks at the All Programs/MikTeX/ menu. Try loading and compiling from that IDE. If it will not compile from TeXworks then the *.sty has not been properly registered.

If this fails then use My Computer and actually verify that the files are exactly where you think they are. (The Windows defaults for file saving can easily trip you up.)


For Mac OS system: 1. Open your terminal 2. Find an .sty file that you know is present and works, for example "bm.sty" 3. In your terminal put: kpsewhich bm.sty it will show the path, for exampe: /users/yourname/Library/TinyTex/texmf-dist/tex/latex/tools/bm.sty 4. Go to that folder (Command+shift+G) on your desk. Put the path without tools/bm.sty 5. Search and download the package that you don't have, then put it in that folder. Or you have own .sty file, just put it in that folder. 6. Go to terminal, put: sudo teshash 7. The package will work.

  • Welcome! This is not good advice, I'm afraid. Local and custom files shouldn't be in texmf-dist. You should use, say, TEXMFHOME. On a Mac, this is usually in /Users/<username>/Library/texmf. – cfr Oct 31 '19 at 5:02

Your Answer

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