I'm using (La)TeX as installed by my Linux/Unix distribution. I've come across a package that I don't have installed. How do I find out which Linux/Unix package contains that (La)TeX package?


  1. This is a public service question, please take that into account when answering. More than ever, good answers should be detailed.
  2. If the distribution has an "install everything" package, that's worth mentioning. But some people want to only install what they need so please still answer the question as asked.
  3. Please specify the flavour of Linux/Unix in your answer.

I don't think we have a question that covers this, but obviously if someone finds it then we'll delete this one.

  • 1
    This is more or less a Linux question: "How to find out which Linux package contains which file?". This is off-topic here, isn't it? – Schweinebacke Dec 22 '17 at 10:59
  • 2
    @Schweinebacke: Well it's borderline. It also depends quite a bit on the Linux distribution. I agree that it is actually better suited for unix.stackexchange.com – Martin Scharrer Dec 22 '17 at 11:06
  • 1
    @MartinScharrer there is a LaTeX specific part of how to find what files are provided by a package and where in the texmf-dist tree they are located. – StrongBad Dec 22 '17 at 14:30
  • 2
    Technically, all questions should be public service questions - that's the entire purpose of Stack Exchange ;) – Lightness Races with Monica Dec 22 '17 at 21:32
  • 2
    @LightnessRacesinOrbit My meaning was that this isn't a question that I'm asking because I want to know the answer myself but rather that I felt it a question that ought to be asked-and-answered here. – Loop Space Dec 22 '17 at 22:38

Most Linux distributions provide a tool to find out which distribution package contains which file. Some distributions provide a website as well.

Which file do I want?

  • For \usepackage{foo} (LaTeX package), you need foo.sty.
  • For \documentclass{foo} (LaTeX class), you need foo.cls.
  • For \input foo (TeX macro file), you need foo.tex.
  • For \bibligraphystyle{foo} (BibTeX style), you need foo.bst.
  • For a font, it depends on the font's encoding. The easiest thing would be to look for the LaTeX package that makes the requisite declarations (foo.sty).

If you know which CTAN package you want, on CTAN, follow the “Sources” link and look at the file names there. Note that .dtx files are used to generate other files; often one of the generated file has the same name and the extension .sty (for LaTeX) or .tex (for other formats), but this is a habit, not a rule.

If you use a graphical package manager, check if it has an option to search a package by file name. If not, see below for command line methods.

Debian, Ubuntu, Linux Mint, elementary OS...

On Debian-based distributions, the tool apt-file lets you search the package database by file name. First, install it if it is not installed already. You only need to do this once, and to run apt-file update after upgrading to a new release of the distribution.

sudo apt-get install apt-file
sudo apt-file update

Here's an example of looking for a given file and installing the package containing it. $ represents a shell prompt.

$ apt-file search /foils.sty
foiltex: /usr/share/texmf/tex/latex/foiltex/foils.sty
$ sudo apt-get install foiltex

Some Debian derivatives may include the apt-file program but not the databases that it needs to function. If so you'll need to find another way. Chances are that the derivative hasn't changed the way the TeX packages are organized, so you can use the web to find out where it is in Debian or Ubuntu:

Red Hat, CentOS, Fedora

Modern releases use dnf, which offers the following command:

dnf provides '*/foils.sty'

Older releases use yum, which has a similar command with a slightly different name:

yum whatprovides '*/foils.sty'

Note that both commands need a full path, not just the base name of the file. But you can use * to replace a part of the path that you don't know, thus */foils.sty looks for a file called foils.sty located anywhere.

Once you've identified the package name, install it with sudo dnf install … or sudo yum install ….


See Schweinebacke's answer. In a nutshell:

zypper search --provides --match-exact 'tex(foo.sty)'
sudo zypper install …

Arch Linux

You can search for packages by contents with pacman. First update the local database:

sudo pacman -Fy

(or su -c 'pacman -Fy' or using whatever method you prefer to run commands as root). Then, to search for a specific file name:

pacman -Fs /foo.sty

Once you've identified the package name, install it with pacman -S.


You can search for the package providing a given file name with equery.

equery belongs /foo.sty


Try searching for a port on Porgle. Tick the “packing list” checkbox to search by file name.

Where else can I look for help?

  • Arch Linux does not have sudo by default. – cfr Dec 23 '17 at 4:27
  • I think Gentoo's equery belongs only works for files that actually exist on the system. Or perhaps only for installed packages. The point is, if you want to find which package you should install to obtain a file that you don't already have, equery isn't going to be much help. – David Z Dec 24 '17 at 22:20
  • On Gentoo Linux you look up the filename of the package like siunitx.stywith portagefilelist.de There was a tool dev-tex/texmfind, but we removed it in favour portagefilelist and its tools. equery will only work on installed files. – Jonas Stein Dec 25 '17 at 5:04
  • This is an amazing answer! Very useful. – Abhinav Apr 10 '18 at 14:00

Gotta love the hightech pig Ubuntu

Debian and Debian-related Linux distributions have apt-file to find the Linux package that contains a file, e.g.:

apt-file update
apt-file search extarticle.cls

should result in

texlive-latex-recommended: /usr/share/texlive/texmf-dist/tex/latex/extsizes/extarticle.cls

Note, this method only shows files of already installed repositories.

To be able to use this file search, you still need to know a file related to a (La)TeX package. For LaTeX-classes this should always be the class name with appended file extension .cls. For LaTeX-packages you should add the extension .sty. But most simple way is to try to use the package and have a look into the .log file. (La)TeX tells you which file is does not find. This should also work for most other kind of files.

  • 2
    ooh a pig with candles! :) – Paulo Cereda Dec 22 '17 at 11:15
  • 1
    @LoopSpace ??? How could you not? Why should you search for something you do not know? Or is your question: How can I find out, what packages are available for which purpose? This would be something completely different than I've understood from your question above. I'm very confused know. But, If this would be your question, I'd delete this answer. – Schweinebacke Dec 22 '17 at 11:28
  • @Schweinebacke ooh a hightech pig! :) – Paulo Cereda Dec 22 '17 at 11:38
  • 2
    For a non-expert user, it's probably much simpler to just use the search tool at packages.ubuntu.com or debian.org/distrib/packages ("search the content of packages", example). – Federico Poloni Dec 23 '17 at 10:36
  • @FedericoPoloni: Running apt-file isn't complicated, it is very, very easy. So IMHO "much simpler" is a little bit exaggerated. LaTeX users should also be able to run a console application. And users do not need to be online to use apt-file. And most online kiddies will also find the answer using Google, Bing … – Schweinebacke Dec 24 '17 at 14:07

A duck was here

For SuSE Linux it is a little bit more tricky, because searching in the file list of a package is only provided for already installed package.

zypper search provides searching for installed and not yet installed packages, that provides capabilities. But you have to know which capability you are searching. For TeX capabilities the packages contain provides information like tex(article.cls) or tex(pgf.sty) so you can do, e.g.:

zypper search --provides --match-exact 'tex(article.cls)'

to get:

S | Name          | Summary                                | Type   
  | texlive-latex | A TeX macro package that defines LaTeX | package


zypper search --provides --match-exact 'tex(pgf.sty)'

to get

 S | Name        | Summary                                   | Type   
   | texlive-pgf | Create PostScript and PDF graphics in TeX | package

You can also use wildcards, e.g.:

zypper search --provides 'tex(*article.cls)'

to get several packages with classes names …article.cls, e.g. article.cls, extarticle.cls etc.:

 S | Name               | Summary                                      | Type   
   | texlive-afparticle | Typesetting articles for Archives of Foren-> | package
   | texlive-bangtex    | Writing Bangla and Assamese with LaTeX       | package
   | texlive-bxjscls    | Japanese document class collection for all-> | package
   | texlive-elsarticle | Class for articles for submission to Elsev-> | package
   | texlive-extsizes   | Extend the standard classes' size options    | package
   | texlive-gzt        | Bundle of classes for "La Gazette des Math-> | package
   | texlive-jsclasses  | Classes tailored for use with Japanese       | package
   | texlive-latex      | A TeX macro package that defines LaTeX       | package
   | texlive-luatexja   | Typeset Japanese with Lua(La)TeX             | package
   | texlive-platex     | PLaTeX2e and miscellaneous macros for pTeX   | package
   | texlive-skb        | Tools for a repository of long-living docu-> | package
   | texlive-uplatex    | PLaTeX2e and miscellaneous macros for upTeX  | package

If you search for the package to install it, you can also install using the capability, e.g.,

sudo zypper install --dry-run 'tex(datatool.sty)'

will install package texlive-datatool-2017.132.2.27svn41772-33.1.noarch.

  • I really envy zypper over dnf (although I must say dnf is way better in Fedora 27). I always have fun with my OpenSUSE machine! – Paulo Cereda Dec 22 '17 at 12:15
  • I don't recommend using the texlive packages from SuSE. – user31729 Dec 22 '17 at 16:22
  • @ChristianHupfer As you can see in the output I don't use them myself (empty S column), but this wasn't the question. However they became much better over the years. BTW: I also do not use the texlive packages from debian/ubuntu. But I wouldn't say, that all these linux packages are useless or that I generally should warn about using them. I know users using them successfully. – Schweinebacke Dec 22 '17 at 16:33
  • @Schweinebacke: I didn't write that they are not usable successfully but are often outdated. – user31729 Dec 22 '17 at 17:02
  • @ChristianHupfer Not more than the texlive packages of other linux distributions. What is outdated? TeX Live installation from this week could be called outdated next week. But not all users need brand new packages. So TeX Live from this year often is enough. Currently texlive for Tumbleweed is TeX Live 2017. Not an up-to-date TeX Live 2017 but TeX Live 2017. Sometimes the SuSE packages provide the older TeX Live, sometimes Debian, sometimes … – Schweinebacke Dec 22 '17 at 18:43

Fedora logo

Here's the Fedora way. First, we can use dnf list and list all packages matching the string query:

$ dnf list texlive-*
Last metadata expiration check: 0:43:39 ago on Fri Dec 22 09:17:10 2017.
Installed Packages
texlive-algorithms.noarch                6:svn38085.0.1-36.fc27.5        @fedora
texlive-amsfonts.noarch                  6:svn29208.3.04-36.fc27.5       @fedora
texlive-amsmath.noarch                   6:svn41561-36.fc27.5            @fedora
texlive-attachfile.noarch                6:svn38830-36.fc27.5            @fedora
texlive-auto-pst-pdf.noarch              6:svn23723.0.6-36.fc27.5        @fedora
texlive-babel.noarch                     6:svn40706-36.fc27.5            @fedora
texlive-babelbib.noarch                  6:svn25245.1.31-36.fc27.5       @fedora
Available Packages
texlive-12many.noarch                    6:svn15878.0.3-36.fc27.5        fedora 
texlive-12many-doc.noarch                6:svn15878.0.3-36.fc27.5        fedora 
texlive-2up.noarch                       6:svn40417-36.fc27.5            fedora 
texlive-2up-doc.noarch                   6:svn40417-36.fc27.5            fedora 
texlive-ESIEEcv.noarch                   6:svn15878.0-36.fc27.5          fedora 
texlive-ESIEEcv-doc.noarch               6:svn15878.0-36.fc27.5          fedora 
texlive-FAQ-en-doc.noarch                6:svn34303.3.28-36.fc27.5       fedora 

The result has three columns: the package name, the version and the repository. Then dnf groups the list into two parts: installed and available. If we want to look only for available packages, we simply add the available modifier to the command:

$ dnf list available texlive-*

Similarly, by adding installed does the exact opposite: it shows the installed packages matching the string query.

Of course, this list might not be as useful as one might thinks. Let us try something different. Suppose that I want to use the datatool package. Packages, as we know, have the .sty extension, so we need to look for a file named datatool.sty. We can issue dnf again:

$ dnf provides */datatool.sty
Last metadata expiration check: 0:49:45 ago on Fri Dec 22 09:17:10 2017.
texlive-datatool-6:svn39421-36.fc27.5.noarch : Tools to load and manipulate data
Repo        : fedora
Matched from:
Filename    : /usr/share/texlive/texmf-dist/tex/latex/datatool/datatool.sty

Observe the */datatool.sty query. If you look only for datatool.sty, dnf will try to find a package that matches that name and path. Since this file surely won't be in the root of a filesystem, the match will yield no results. As the name implies, dnf provides will look for packages that provide the file entered in the query. And we found out the file is in texlive-datatool.

It is important to note that dnf will only look for files in your enabled repositories. I know this might sound obvious, but it's good for you to know that. :)

Now, let's try a different approach. There's a strange package named texlive-carlisle, I wonder what it is! Let us list the contents of such package:

$ dnf repoquery -l texlive-carlisle
Last metadata expiration check: 0:55:05 ago on Fri Dec 22 09:17:10 2017.

Bear in mind that the package does not need to be installed in your system, you can list the contents of any package, installed or available.

And that's it. :)

  • 1
    Nice. Does searching for filenames work for available (not installed) packages? This was the main problem, when searching with zypper. I'm asking because dnf is also available for SuSE but it seems to find only installed files. – Schweinebacke Dec 22 '17 at 12:26
  • @Schweinebacke Yes, it seems so. I tried with datatool.sty in my laptop and it gave me texlive-datatool, which was not installed. Which version of dnf does SuSE have? – Paulo Cereda Dec 22 '17 at 12:53
  • dnf-2.7.5 if the repo-info is correct (I've removed it, because it did not do what I want). – Schweinebacke Dec 22 '17 at 14:45
  • @Schweinebacke same version as mine. Interesting, perhaps there might be some hidden settings... – Paulo Cereda Dec 22 '17 at 14:47
  • @ChristianHupfer: you naughty German! :) – Paulo Cereda Dec 23 '17 at 8:39

arch linux logo

Arch has two ways for doing this (well, two ways of which I'm aware, anyway):

  • With the package manager (pacman),
  • and with an add-on tool called pkgfile.


First, update the database for files which are in packages which you do not have installed on your system (now there's a mouthful), which you can then query with the -F option:

sudo pacman -Fy

Then you can query the database like so (for texmaker, as an example):

$ pacman -Fo /usr/bin/texmaker
usr/bin/texmaker is owned by community/texmaker 5.0.2-1

The problem here is that you need to know the actual path of the file. Not much use if you're looking for a (La)TeX package (at least not to me -- I certainly don't know my texmf-dist tree by heart). But still, the option exists.

More geared towards our use case is the s option though, which allows searching for a filename (note that the query for datatool.sty will yield an empty result if you run it with pacman -Fo):

$ pacman -Fs datatool.sty
extra/texlive-latexextra 2017.45733-1

According to the manpages, this search mechanism should also support regexes, but I have not found a way to get them to work. So if I want to do wildcard searches, so far I need to use another way.

Thanks to Fox for the hint about the -x option; I'd overlooked that when browsing the manpages:

$ pacman -Fxs 'data.*\.sty'

This will give you a list of packages and the files within those packages which match the regex:

extra/texlive-latexextra 2017.45733-1
    [ etc. ]


First, install as usual:

sudo pacman -S pkgfile
sudo pgkfile --update

The default works pretty much like one would expect:

$ pkgfile datatool.sty

But let's say we want to find all packages which own a file with tikz in it, case-insensitive, via regular expression syntax:

$ pkgfile -ri '.*tikz.*'

You could then query those packages if you wanted to get the specific files. For auctex, as an example:

$ pkgfile -l auctex|grep -i tikz
community/auctex        /usr/share/emacs/site-lisp/auctex/style/tikz.el
community/auctex        /usr/share/emacs/site-lisp/auctex/style/tikz.elc

And the same query can also be run with pacman (though, funnily enough, it's actually slower than pkgfile, at least on my machine):

$ pacman -Fl auctex | grep -i tikz
auctex usr/share/emacs/site-lisp/auctex/style/tikz.el
auctex usr/share/emacs/site-lisp/auctex/style/tikz.elc

Arch Wiki

The Arch wiki also has a page on TeX Live, which is probably worth a look. Basically, you have the following package groups:

  • texlive-most : includes most TeX Live applications
  • texlive-lang : provides various character sets and non-English features

Note that texlive-core is based on the medium install scheme of TeX Live.

I usually just install texlive-most and texlive-lang on my machines. I have almost never had an issue with a missing package. Downside is that it's not exactly a lightweight affair.

(EDIT: cleaned up some confusing terminology stemming from the difference between packages and package groups.)

EDIT: See also this answer on the Unix/Linux SE

  • 1
    I want to try Arch some day! :) – Paulo Cereda Dec 22 '17 at 14:31
  • 2
    @PauloCereda it is a good way to avoid your thesis ;) – StrongBad Dec 22 '17 at 15:05
  • 1
    @StrongBad: oh no, I've been spotted. :) – Paulo Cereda Dec 22 '17 at 15:08
  • 1
    @PauloCereda I've been using it as my daily driver since 2011, and while I wouldn't say it's perfect by any means, it has served me very well since then on desktops, laptops and servers. And it's honestly not as hard as people tend to say (then again, maybe that's just my experience skewing my perspective). ;-) – alpenwasser Dec 22 '17 at 15:31
  • 1
    I don't like this at all. I can't help feeling that -y thing is really nasty. Surely all sane people use pkgfile? There's also at least texlive-latexextra and probably some more. Personally, I don't think it is KISS to use Arch's packages for TL. ;) – cfr Dec 23 '17 at 4:24

For recent Fedora, you can, e.g.

$ dnf install 'tex(datatool.sty)'

if you happen to know the filename. It seems quite slow on my admittedly aging hardware though.


With Debian, I use aptitude, as it allows me to see which packages I have installed, and a description of them, through the Ncurses interface, but:

If you access aptitude on the command-line, and request install (packagename)', even if it isn't available in that form, aptitude will come back with the message,there is no package of that description, but it is mentioned in the package description of `texlive-such&such'-for example, which you can then go ahead and install, gaining the function you need.

Other posters are correct. If you're going to ask a question, provide a greater degree of information. For all anybody here knows, you could be using Redhat, Suse, Debian, Gentoo, or any of the distributions built off them, all of which have different package managers, and different modes of dealing with the issue.

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.