1

I'm trying to install a new style file that doesn't come by default with LaTeX. I'm on a Linux Mint computer, and installed LaTeX with a simple

sudo apt install texlive

or something like that, if I recall correctly. Now as I search for my texmf directory, I've found two (which I found by following some instructions at various pages on the internet). One is at /var/lib/texmf and the other is at /usr/local/share/texmf/. The former has the folders:

dvipdfmx/
dvips/
fonts/
luatex-cache/
tex/
web2c/
xdvi/
...

as well as seven files, one of them for instance is fmtutil.cnf-DEBIAN.

With some blind exploration, I don't find any .sty files in any of the sub-folders. In the other directory, /usr/local/share/texmf/ the directory is entirely empty.

So unless I just haven't explored the sub-folders of the first directory enough, I don't think either of these are where LaTeX is looking for its .sty files. So how do I find the correct directory? When I type which tex it gives me usr/bin/tex but in that directory, I don't see any other file that seems related to LaTeX.

When I run texhash it returns

texhash: /usr/local/share/texmf: directory not writable. Skipping...
texhash: /var/lib/texmf: directory not writable. Skipping...
texhash: /var/lib/texmf: directory not writable. Skipping...
texhash: /var/lib/texmf: directory not writable. Skipping...
texhash: Done.

Since I don't really know what I'm doing I didn't want to run texhash as root, but this sort of makes me think that the texmf tree has to be in one of these directories ... so I'm just confused at this point.

[Edit: I've seen some people suggest that there might be a texmf tree at the home directory, but there isn't one for me. That is to say there is no texmf directory located in my ~/ directory.]

[Further edit: Also when I type echo $TEXMFHOME it returns a blank line.]

[Further edit: Per egreg's comment I entered kpsewhich -var-value TEXMFHOME which returns /home/myname/texmf but this directory doesn't exist.]

  • kpsewhich -var-value TEXMFHOME is the right command line. – egreg Sep 6 '18 at 21:45
  • @egreg So when I do that, it returns /home/myname/texmf. However, no such directory exists. – Addem Sep 6 '18 at 21:46
  • 1
    Yes. You don't need to make all of the structure, just the stuff you need. So minimally you will probably need texmf/tex/latex for latex packages and if you want documentation for a package to be found by texdoc it should be in texmf/doc. – Alan Munn Sep 6 '18 at 22:05
  • 1
    you have installed the "system" tex via sudo so that and the default tex tree are not writable under a normal account but the default search path includes TEXMFHOME set to a texmf tree in your home directory (which does not need to exist) so if you make it and put just your updated files in there, then all standard files will be found in the existing system location, but it will look in ~/texmf first and find any updated files there – David Carlisle Sep 6 '18 at 22:05
  • 1
    You can find the location of any particular file by using kpsewhich. E.g. kpsewhich article.cls will tell you the exact path TeX uses to find the article.cls that is loaded when you say \documentclass{article}. But basically most of your stuff is in the /usr/local/share/texmf. – Alan Munn Sep 6 '18 at 22:15
1

Local additions should not be put into the system texmf directory, i.e., /usr/local/share/texmf, but instead should be put into your home texmf folder. This folder is not created automatically, so you need to create it yourself.

The location of your local texmf can be found by using the command:

kpsewhich -var-value TEXMFHOME

On a Linux system, this will typically be ~/texmf (/home/<username>/texmf). You can create the folder yourself but it must conform to the TeX Directory Structure. See:

Once you've done this you don't need to do anything else for packages to be found; TeX looks in this directory first.

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.