[Tex/LaTex] Texmaker cannot find class file. “LaTeX Error: File `revtex4-1.cls’ not found.”

document-classespdftextexmaker

I am using Ubuntu 16.04 with Texlive, and more specifically with the Texmaker graphical editor.

I am attempting to use a class file from a third party, .cls, which is located in a subdirectory of ~/texmf which I verified to be my $TEXMFHOME using tlmgr. The "ls-R" file located in ~/texmf lists .cls, so apparently Texlive is able to find it in the subdirectory. However, when I try use \documentclass[options]{<filename>} in a sample LaTeX file and try to build (using texmaker), I get the error "LaTeX Error: File `revtex4-1.cls' not found." There are .sty files in ~/texmf and subdirectories that I can use without a problem, but I cannot figure out why my class file can't be found by texmaker, even though it seems to have been found by texlive (since it shows up the in ls-R file in ~/texmf).

I looked at a couple other similar sounding questions like this:
! LaTeX Error: File `filename.cls' not found
But my file actually is a .cls file not a .tex file so this is no help.

I also looked at this question: .cls file not found
but that appears to be a simple spelling error.

There are a few other similarly titled questions on tex.SE but none of which seem applicable to my situation.

Can anyone tell me what might be causing this? I am working on a relatively fresh install and have only been using LaTeX on here for a couple days, but I was able to get other packages placed into ~/texmf to be used without a problem, the only significant difference apparent to me being that none of these were class files. Is there something else that I need to configure to be able to make texmaker find a class file?

Best Answer

So after a bit of frustration I have figured out how to properly use my .cls file and other .cls files.

Originally, all the packages I placed into my ~/texmf directory were placed in top-level subdirectories, which didn't cause any problems as far as I could tell as all were accessible and findable without any errors. However, my class file, name.cls, was located in the following structure: ~/texmf/name/tex/latex/name.cls and although my ls-R file ocated in ~/texmf did list name.cls, texmaker was not able to find the file. My fix was to mv ~/texmf/name/tex/ ~/texmf/tex and then sudo mktexlsr ~/texmf. After reloading texmaker, I was able to use name.cls without a problem.

A curious thing which I noticed when updating ls-R was that sudo mktexlsr listed three texmf directories which were updated, but did not list ~/texmf, even though I did verify that $TEXMFHOME = ~/texmf. I overcame this by simply adding the directory argument ~/texmf as described above, but I am still not sure why this directory wasn't located automatically. I'm not sure if this had anything to do with the original problem or not, but I thought it was worth noting in case anyone ran into similar issues.