After installing tinytex R package, I started getting LaTeX error regarding missing .sty files. One such error is

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

I used the following code

Checked Texlive version

$ tex -v
TeX 3.14159265 (TeX Live 2018)
kpathsea version 6.3.0
Copyright 2018 D.E. Knuth.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.

Where is Texlive installed

$ which latex

Where is Texlive installed

$ whereis latex
latex: /usr/bin/latex /home/myaseen/bin/latex /usr/share/man/man1/latex.1.gz

Locating ulem.sty

$ locate ulem.sty

Making ulem directory

$ sudo mkdir /usr/share/texmf/tex/latex/ulem
mkdir: cannot create directory ‘/usr/share/texmf/tex/latex/ulem’: File exists

Copying ulem.sty file

$ sudo cp /usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty /usr/share/texmf/tex/latex/ulem/

Running texhash

$ sudo texhash

Locating ulem.sty

$ locate ulem.sty

Wonder how to fix the problem?

  • Why is there a different copy of latex installed in your home directory from the one on your system? It might not be reading the same directories. If you really need to do this, you might install the package in usermode. – Davislor May 7 at 5:55
  • Thanks @Davislor for your comment. I was also worry about that but do not know how to fix it. Any thoughts, please. – MYaseen208 May 7 at 6:14
  • Presumably your /home/myaseen/bin directory is in your PATH before the system directories. You could remove it from your PATH and try again, or you might even temporarily rename it to something like /home/myaseen/bin/latex.disable. – Davislor May 7 at 6:38
  • If you don’t know why you have a copy there, it seems like you definitely should be running the one that gets updates. – Davislor May 7 at 6:38
  • Also, in general, you shouldn’t be copying TeX packages manually. Use your package manager to find out which package contains the file, e.g. apt-file ulem.sty. Then install that package. If you have a different TeX distribution than the texlive supplied by Ubuntu, use its installer. – Davislor May 7 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.