I'm using pdflatex to compile my .tex files and I'm new on this.

I have this package that uses subfiles, but I can't compile because of this error:

LaTeX Error: File `subfiles.sty' not found.

I have already installed texlive-full and all other packages that I think could be the solution, also I run texhash and didn't work.

How can I overcome this error? Where are the package files? Can I download a subfiles.sty directly there?

  • 2
    It should be in texlive-latex-extra if you're on Ubuntu/Debian. But only for TeX Live 2012, not in the 2009 release that you may have.
    – egreg
    Jan 28, 2013 at 20:32
  • 1
    Welcome to TeX.sx! Jan 28, 2013 at 20:46

3 Answers 3


First of all, it is important to know how did you install TexLive:

  • As a package from your linux distribution.
    • What distribution?
    • What version of TexLive?
  • Directly from TexLive.

My installation of TexLive is the second one, TexLive 2012, and the file subfiles.sty is located at:


So, if you installed from your distribution, you have two options:

  • If using Debian (or Debian based distros), install texlive-latex-extra as pointed out by @egreg.
  • If using other distros, try to search a good match with the respectiv package manager.
  • If you prefer to have a more up-to-date LaTeX distribution, think about installing TexLive2012 from the link above.


As you are using Linux Mint, this problem is very strange, because if you execute in a terminal:

apt-cache show texlive-latex-extra

you can find subfile package in the list.


According to packages.debian.org, the location of subfiles.sty should be this:


Not your desired solution, but my humble advice:

I use Linux Mint debian edition at home (and Debian at work), but on both systems I have TexLive2012 installed by hand, in a custom directory, so I cannot tell you what happens with the distro packages.

Haven't you thought about installing TexLive directly with install-tl?:

I hope this can help.

  • I'm using Linux Mint which is Debian derived. I have installed texlive with the package manager (synaptics). The package texlive-latex-extra is already installed. I couldn't find my "$TEXLIVE_HOME"
    – RSFalcon7
    Jan 29, 2013 at 2:05
  • Please read my update above. About TEXLIVE_HOME, it's just a way to reference to the location where TexLive is installed. In your case, as you're using distro packages, it should be something similar to /usr/share/texlive in most cases. Jan 29, 2013 at 3:54
  • 1
    Thanks by the fast response. Using apt-cache show texlive-latex-extra didn't show subfile package (there is lots of packages, but not subfile). The packages are in slightly different location /usr/share/texmf-texlive/tex/latex/$PACKAGE_FOLDER but no subfiles there either. Never mind the original question, I will follow your advice and do a hard-hand install.
    – RSFalcon7
    Jan 29, 2013 at 4:33
  • What version of LinuxMint Debian edition are you using? Jan 29, 2013 at 4:50
  • Linux Mint 13 (Maya) Cinnamon 64-bit
    – RSFalcon7
    Jan 29, 2013 at 6:12

First, check whether your file is installed

locate subfiles.sty

(or find | grep subfiles.sty from your TeX directory).

If that is absent, install the package (via tlmgr or your system's installer). If that is present, then the problem is that LaTeX can't find that.

Path searches in LaTeX are done by kpathsea. One can add paths to the search path:

export TEXINPUTS=.:/opt/tex/cur//

, where two slashes mean subdirectory expansion.

Another option is to create a filename database

texhash /opt/tex/cur

(or mktexlsr depending on your system). Then add that path to your TEXMFDBS variable:

export TEXMFDBS=/opt/tex/cur

Note that database search works much faster than path expansion:

$ /bin/time kpsewhich standalone.cls
0.42user 0.05system 0:00.48elapsed 99%CPU 

$ export TEXMFDBS=/opt/tex/cur
$ /bin/time kpsewhich standalone.cls
0.05user 0.00system 0:00.06elapsed 98%CPU
  • It's a pity that this is not written in TeXLive installation manuals, but scattered on TUG site. Jun 13, 2017 at 13:05

I fixed it with

sudo tlmgr install subfiles

You must log in to answer this question.

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