[Tex/LaTex] Adding .sty files into tex


I am new to TeX and I want to add a .sty file. But when I tried all the ways described on this site. I could not do it, as it requires the permission of the folder to add the .sty file.I am a Linux user.

Update 1:
I have tried:
copying the .sty file in
/usr/local/share/texmf but I did not find any file here. Again I have tried copying here: /usr/share/texmf/tex/latex but did not get any permission.

Again I have tried with the /home/username and I was shocked that I did not saw any folder texmf .

After these I have also tried the ways as advised in the comment section as well as the answer. But did not work.

Any further help will be appreciated.

Best Answer

If I understand correctly, you don't have the permissions to add the .sty file to your home TeX directory. If you can't do that, you can always put it in any other folder you have access to.

For example, if your .sty file is named file.sty, you can copy it to the same folder as the .tex file and write in the preamble:


In general, if you don't want to or can't copy the .sty file to the .tex folder, you can write the relative path to where it is saved, like this:


The problem with this approach is that you will have to either copy the .sty file every time you use it or write the relative path to it.