My question is related to Where do I place my own .sty or .cls files, to make them available to all my .tex files? but the solutions don't work and the comments are very cluttered with not all comment information added to the answers (I did read the comments).

I have Ubuntu 12.04 and the most recent TeX Live. My directory is located at /usr/share/texmf/tex/latex. I added a folder called style to place Jubob's Matlab style file he created. On the linked thread, they say only older versions need to run texhash. I can tell you not running and running texhash doesn't work. When I didn't run texhash, TeX Live couldn't find the style file. When I run texhash, it says

directory not writeable skipping... done.

I ran sudo texhash as well but the output is the same.

How can we add a style file and make it available on the whole system in LaTeX with the current version of TeX Live.

From @DavidCarisle's comment, I have

dustin@dustin:~$ kpsexpand '$TEXINPUTS'.:{/home/dustin/.texlive2013/texmf-config,
  • 3
    It's generally a bad idea to use the tree rooted in /usr/share/texmf; it should rather be the one rooted in /usr/local/share/texmf (creating the necessary directories, in not existent).
    – egreg
    Commented May 4, 2014 at 15:44
  • 3
    kpsexpand '$TEXINPUTS' will show you the effective search path on your system. Directories prefixed with !! require texhash, directories followed by // subdirectories are searched recursively Commented May 4, 2014 at 15:44
  • @dustin I don't have a TeX Live/Debian at the moment, but the value shown should be /home/<username>/texmf.
    – egreg
    Commented May 4, 2014 at 15:47
  • 3
    @dustin Just create the texmf directory in your home and in it tex/latex/matlab, where you'll put the .sty file. No texhash will be needed.
    – egreg
    Commented May 4, 2014 at 15:51
  • 1
    so /home/dustin/texmf/tex/latex/mypackage/mypackage.sty should work and not need texhash Commented May 4, 2014 at 15:54

1 Answer 1


The best place for adding personal style files is in TEXMFHOME that, on GNU/Linux systems, should be found in


The directory is not automatically created upon installation, because the installer never acts on users' space. So

mkdir -p ~/dustin/texmf/tex/latex/jubobsmatlab
cp jubobsmatlab.sty ~/dustin/texmf/tex/latex/jubobsmatlab

will suffice in order that the TeX system will be able to find the file. Change jubobsmatlab into the real name.

You must log in to answer this question.

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