I have trouble understanding how LaTex deals with packages, so this is a rather general question that arose from my specific problem with the commath package.

I want to use the commath package, and so I downloaded it from CTAN. In order to install it I tried two different things:

First Try
I have used the amsmath package before, so I checked where on my system it's located and found this:


So I created a folder /usr/share/texmf-dist/tex/latex/commath and placed the file commath.sty in it. I restarted my computer. It didn't work (with both kile and texmaker).

Second Try
As recommended in some forums, I checked my TEXMFLOCAL path:

$kpsewhich -var-value TEXMFLOCAL

Neither of these folders existed on my computer, so I created a folder /usr/share/texmf, created the folder commath in it, placed file commath.sty in the commath folder. I restarted my computer. Also didn't work.

So can someone please tell me what I am doing wrong? Why does kile/ texmaker use one package (amsmath) but not another, if they are in the same parent directory? How can I find out specifically which directories the editors search?

I use TexLive on Manjaro Linux.

  • 1
    there should be no need to install the package manually, it is in texlive. So install it with the texlive manager. – Ulrike Fischer Jan 10 at 14:37
  • 1
    your first try didn't work because you didn't call mktexlsr, but you shouldn't install manually in texmf-dist. The second is unclear, perhaps mktexlsr is missing too, or the tree is not known (it looks odd that there are two pathes in your TEXMFLOCAL variable), you could try TEXMFHOME instead. – Ulrike Fischer Jan 10 at 14:54
  • 2
    well apacite consist of 19 files, which must be first unpacked from the dtx and then go in various locations in the texmf tree. – Ulrike Fischer Jan 10 at 15:16
  • 1
    About commath see tex.stackexchange.com/search?q=commath+user%3A4427 for reasons about not using it. – egreg Jan 10 at 15:34
  • 1
    you really don't want to use commath. – David Carlisle Jan 10 at 17:36

If you installed TeX through a package manager, you want to install new packages for it through the same package manager. You mention that this is Manjaro, so you would want to search the package list with pacman -Ss for keywords or pacman -Qo for files. Or you might look for a package online.

Or, do a full installation of TeX Live, and you will probably never need to read past this sentence or worry about it ever again.

Generally, you’d look for a .sty file for packages you’d invoke with \usepackage. a .cls file for document classes, a .tfm file for legacy fonts, .otf or sometimes .ttf or .ttc for modern fonts, or .mf for really old fonts.

If you are using your own TeX Live installation, you will need to set the PATH to use its executables. On Manjaro or Arch, its command-line utilities will not work by default. You then want to search CTAN for the package you want, and see if it has a line like “Contained in TeX Live as commath”. You then install it with tlmgr. You might need to run tlmgr through sudo or as an Administrator. Since I normally create an account just to install TeX, I have an alias in my shell for sudo -u tex -E $(which tlmgr).

If you are running MikTeX, you would want to update via the MikTeX console.

Rarely, you might need to manually install a package that isn’t available through any package manager. In this case, the best place to put it is usually the directory you found for TEXMFLOCAL, with the command

kpsewhich --var-value=TEXMFLOCAL

On Linux, you normally want to put your own files under /usr/local/share/, not /usr/share/. Otherwise, you were on the right track: create your subdirectory and copy the files over. If you’re installing your own packages like this, you almost certainly want to remove the outdated TeX that comes with your OS and install an up-to-date TeX Live or MikTeX. Newer packages might not even work otherwise.

If you are running MikTeX rather than TeX Live, you will need to add this new directory as a local TeX tree in its console.

After copying over the files, run


As whatever account owns your TeX installation.

If you are on a multi-user system and cannot save to TEXMFLOCAL, use TEXMFHOME. You find its location similarly, with

kpsewhich --var-value=TEXMFHOME

As a last resort, you can create a directory such as ~/texmf and try TEXINPUTS=$HOME/texmf; export TEXINPUTS to use it.


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.