2

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.]

8
  • kpsewhich -var-value TEXMFHOME is the right command line.
    – egreg
    Commented Sep 6, 2018 at 21:45
  • @egreg So when I do that, it returns /home/myname/texmf. However, no such directory exists.
    – Addem
    Commented Sep 6, 2018 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
    Commented Sep 6, 2018 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 Commented Sep 6, 2018 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
    Commented Sep 6, 2018 at 22:15

2 Answers 2

3

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.

1

texconfig conf can give all kpathsea variables too:

=========================== kpathsea variables ===========================
TEXMFMAIN=/usr/texmf-dist
TEXMFDIST=/usr/texmf-dist
TEXMFLOCAL=//texmf-local
TEXMFSYSVAR=/usr/texmf-var
TEXMFSYSCONFIG=/usr/texmf-config
TEXMFVAR=/home/firestar/.texlive2022/texmf-var
TEXMFCONFIG=/home/firestar/.texlive2022/texmf-config
TEXMFHOME=/home/firestar/texmf
VARTEXFONTS=/home/firestar/.texlive2022/texmf-var/fonts
TEXMF={{}/home/firestar/.texlive2022/texmf-config,/home/firestar/.texlive2022/texmf-var,/home/firestar/texmf,!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}
SYSTEXMF=/usr/texmf-var://texmf-local:/usr/texmf-dist
TEXMFDBS={!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}
WEB2C={{}/home/firestar/.texlive2022/texmf-config,/home/firestar/.texlive2022/texmf-var,/home/firestar/texmf,!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}/web2c
TEXPSHEADERS=.:{{}/home/firestar/.texlive2022/texmf-config,/home/firestar/.texlive2022/texmf-var,/home/firestar/texmf,!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}/{dvips,fonts/{enc,type1,type42,type3}}//
TEXCONFIG={{}/home/firestar/.texlive2022/texmf-config,/home/firestar/.texlive2022/texmf-var,/home/firestar/texmf,!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}/dvips//
ENCFONTS=.:{{}/home/firestar/.texlive2022/texmf-config,/home/firestar/.texlive2022/texmf-var,/home/firestar/texmf,!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}/fonts/enc//
TEXFONTMAPS=.:{{}/home/firestar/.texlive2022/texmf-config,/home/firestar/.texlive2022/texmf-var,/home/firestar/texmf,!!//texmf-local,!!/usr/texmf-config,!!/usr/texmf-var,!!/usr/texmf-dist}/fonts/map/{kpsewhich,pdftex,dvips,}//

That is better than one kpathsea command at a time.

You must log in to answer this question.

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