I created a new package as a .sty file. I want to be able to use it in all of my documents.

I followed the instructions on the MacTeX website. I located my Library folder in Macintosh HD using Command + Up. It had a TeX folder, but no texmf folder, so I created one. In fact, I created the following subdirectory (at least that's what I think it's called) :


I added my file, mystyle.sty, to this folder. Then I attempted to compile a minimal document using the command \usepackage{mystyle}. I got the error message File 'mystyle.sty' not found. What should I do?

  • On the folder latex, create a subfolder Mystyle, and in it add the file mystyle.sty. I'm not sure if you can directly add mystyle.sty in the root of the latexfolder. Does this advice help? – quark67 May 3 at 21:17
  • @quark67 That did not fix the problem I get the same error message. – simple jack May 3 at 21:19
  • @quark67 Now mystyle.sty is in the folder ~/Library/texmf/tex/latex/Mystyle – simple jack May 3 at 21:20
  • 1
    Just to be clear, you're sure you created the texmf folder in ~/Library, i.e., in the library folder of your home directory, and not /Library? In the Terminal, what does the command ls ~/Library/texmf/tex/latex return? – Alan Munn May 3 at 22:17
  • 2
    No, that's incorrect. That's the system library. You need to make the folder in the library that is in your home user folder. – Alan Munn May 3 at 22:19

The local texmf folder has to be created in your home Library folder, not the system library folder. You can navigate to that folder from the Finder by using the Go Menu: (Command-Shift-G) Goto Folder.

enter image description here

In the dialogue box type ~/Library (the ~/ is important).

Now you can create the texmf folder. For a LaTeX package, it minimally needs to have a folder tex, containing a folder latex, and optionally a folder for your style file itself (although this is strictly speaking not necessary).

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.