# LaTeX not finding .sty files

I know a similar question has been asked many times, but I cannot seem to port those answers to my situation.

I have recently installed TeXLive on my Ubuntu 14.04 system. I did this using the install-tl.zip file from texlive.org.

When I try to compile just the basic TeXLive default article, it crashes on every package, giving me (just to pick the first one):

``````! LaTeX Error: File 'booktabs.sty' not found.
``````

But I know booktabs.sty is on my system:

``````/usr/local/texlive/2016/texmf-dist/tex/latex/booktabs/booktabs.sty
``````

I have the following lines at the end of my .bashrc:

``````PATH=/usr/local/texlive/2016/bin/x86_64-linux:\$PATH
export PATH
MANPATH=\$MANPATH:/usr/local/texlive/2016/texmf-dist/doc/man
export MANPATH
INFOPATH=\$INFOPATH:/usr/local/texlive/2016/texmf-dist/doc/info
export INFOPATH
``````

None of those lines point to the location of any of my .sty files, and I'm not sure what variable should.

• Welcome! You should almost certainly remove `MANPATH`. However, that's not the problem here, obviously. Can you compile a document on the command line? If not, what does `which pdflatex` give? (Substitute whichever command you use to compile e.g. `which xelatex` or `which context`.) If you can compile at the command line but not in your editor, which editor do you use? – cfr Sep 16 '16 at 1:24
• Have a look through the answers to tex.stackexchange.com/questions/1092/… to see if you've missed anything. For example, it may be that you have a partial Ubuntu installation of TeX as well as the one in `/usr/local`, in which case you need to remove it but keep your package manager happy. The answers to the linked question explain the details. – cfr Sep 16 '16 at 1:26
• @cfr Thanks! I only have one pdflatex: which pdflatex /usr/local/texlive/2016/bin/x86_64-linux/pdflatex – bigred_bluejay Sep 16 '16 at 1:29
• So what does `which pdflatex` give? Can you compile on the command line? – cfr Sep 16 '16 at 1:30
• @cfr compiling via command line works using `pdflatex test.tex` The problem seems to be with TeXWorks. – bigred_bluejay Sep 16 '16 at 1:33

I solved my issue by following the answer by @Dox here.

Specifically, simply running

`sudo apt-get -y install texlive-latex-recommended texlive-pictures texlive-latex-extra`

fixed my installation.

I confess that I don't entirely understand why that worked, and I would love it if someone would explain why. Using `install-tl.tar.gz` from TeXlive seems to have installed LaTeX into `/usr/local`. But that does not come with an editor, like TeXworks. Downloading TeXworks from the ubuntu software center seems to make the editor think that all LaTeX .sty files will be located in in `/usr/share`. Finally, running the above line of code makes the editor work, yet my `/usr/share/` installation doesn't balloon to ~2 GB. I still seem to only have one "full" LaTeX installation in `/usr/local` (1.8 GB), while `/usr/share` is very small (100 MB).

I would appreciate any explanation of why this works, or ideas about what is going on behind the scenes of my installation(s?).

Thanks

• I cannot answer why `/usr/share` is so small, but you definitely seem to have two different installations. (A simple test: as we know `which latex` is returning the version installed by `Apt`, then do you have commands like `latex` in [something like] `/usr/local/texlive/2016/texmf-dist/tex/latex`?) Your basic issue is that you tried to install the editor from Apt, but TeX Live for the official sources; and I imagine Apt-installed versions of TeXworks assume you will install TeX Live from Apt as well. But, originally, you did not. – jon Sep 17 '16 at 22:14
• You can also check and see which version of a package (e.g., `booktabs`) is being used by adding `\listfiles` to the top of your `.tex` file, compiling the file, and then examining the end of the resulting `.log` file. – jon Sep 17 '16 at 22:17
• @jon How do you know that the `/usr/bin/latex` is the one from apt? Putting `\listfiles` at the beginning of my document confirms that it is finding the .sty files in `/usr/share` which is the small installation from apt. I'm considering removing both and trying to install from `tug.org` again. Can I just `rm -r /usr/local/texlive` to eliminate that entire install? I'll use my package manager to remove the `/usr/share/` version. Thank you for your help. I've been a user of TeX for a while, but have rarely dipped into the behind the scenes things. I appreciate your help and patience. – bigred_bluejay Sep 18 '16 at 20:55
• I know because I've done it both ways over the years. TUG's version installs into the corresponding year directory under `/usr/local/texlive` (see your comment below question; and this is why you had to set your PATH variable). I'd do `rm -rf /usr/local/texlive/2016` if you want to uninstall it. Then reinstall and make sure the PATH is OK; then I'd install the 'fake version' of TeX Live from Apt (see here); then install TeXworks or your editor of choice. – jon Sep 18 '16 at 21:10