1

When I use \usepackage{<package_name>}, what directories does LaTeX check for the .sty file for <package_name>? I'm asking this because I have a set of "configurations" that I always place in the preamble of my files and it would just be a lot easier to load all of that from a .sty file.

In my experience, it checks the directory of the .tex file and the regular install directory (in my case ~/.local/texlive/2020/texmf-dist/tex/latex), but I was wondering if there are any other options.

Not sure if it matters but I'm using Ubuntu 18.04 with a user (rather than root) install of TeXLive.

2
  • You can use kpsewhich --progname=pdflatex --show-path=tex which should give a lot of pathes. But normally texmf-local/tex/latex or texmfhome/tex/latex should be fine (texmfhome is normally somewhere in your home directory, kpsewhich --expand-path=$texmfhome) – Ulrike Fischer May 6 '20 at 13:40
  • 1
    It depends on the installation. The real question is "Where does TeXlive check for packages?" – John Kormylo May 6 '20 at 14:52
0

You can write the relative path for the package.

\usepackage{Folder/Bruh.sty}
5
  • Hi, please do you can explain better your solution? – Sebastiano May 6 '20 at 19:21
  • The Folder is a folder, athough it could also be a file path. Bruh.sty is the package (it doesn't have to be bruh) – Someone May 6 '20 at 20:10
  • Could the relative path also be an absolute path? (e.g.: ~/Documents/package-name.sty) – MithicSpirit May 6 '20 at 20:51
  • I run LaTeX with Overleaf, so I don't know. – Someone May 6 '20 at 22:34
  • 1
    The \usepackage command expects a name not a path. See How can I properly resolve relative paths in `\usepackage`? – Alan Munn Oct 3 '20 at 15:46

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.