Using a new LaTeX package

compilation errorcompilingpackages

I downloaded a new package (quiver) for making commutative diagrams on latex from this link. I use LaTeX on VS Code (Visual Studio Code).

To prevent from having to copy and paste my packages every time, I made a folder with all my tex resources and made a file with all my packages and commands. Whenever I make a new file, I just write

\input{C:/Users/[myname]/Documents/LaTeX-Resources/LaTeX-Template.tex}

In this template, I added

\usepackage{quiver}

However, even though I put the quiver.sty folder in the LaTeX-Resources folder (where the template is in), any new document I make won't compile unless the quiver.sty file is also in that folder.

For example, if I have a file HW1.tex in a Math 112 folder, it won't compile without the quiver.sty file also being in the folder. I don't know why this issue comes up, because \usepackage{quiver} is only in my template, which is in the same folder as the quiver.sty file.

How can I avoid having to copy the quiver.sty file into every folder where I have TeX documents?

Best Answer

You can make your package available by installing it locally. The easiest way to do this (if it's not part of MikTeX or TeXLive) is to put it into your local texmf-home. You can find the folder by using

kpsewhich -var-value TEXMFHOME

in the command line. This should yield a folder. Therein create another folder with the name of the package/class/bundle you want to locally install and put all files necessary for the TeX-run into that folder.

Usually this folder should have a similar folder structure to your TeXLive/MikTex installation, so a LaTeX package you want to install should go into <texmf-home>/tex/latex/<package-name>. Put all files necessary for a LaTeX run (so for a package the .sty) into that folder. No need to update any index, your LaTeX installation should search this path on every run (as long as you don't create a local index file for that folder).

After this you can access your file from your entire system without specifying any path by using the standard methods to include the file, e.g., \usepackage.

Related Question