# LaTeX finds .cls file but not .sty file in ~/texmf directory

I'm writing a paper that depends on a file elsarticle.cls and also a file clrscode3e.sty (they're for two different things - not related). I have placed both files in my ~/texmf directory. When I remove anything in my .tex file dependent on clrscode3e.sty and compile with LaTeX, everything is fine and from the output formatting i can see that elsarticle.cls has clearly been recognised. When I add something which depends on clrscode3e.sty, I get "File clrscode3e.sty not found". To verify that I hadn't mistyped anything, I tried moving clrscode3e.sty into the same directory as the .tex file being compiled and everything worked fine. Why would LaTeX recognise a .cls file in my ~/texmf directory but not a .sty file?

-
Put it in ~/texmf/tex/latex/SOMENAME and run texhash. See tex.stackexchange.com/questions/2063/… and other previous related questions. –  Leo Liu Feb 11 '11 at 8:15
Could it be the case that the cls is already installed in your distribution and it is read from the main tex-tree rather than you local one? –  Martin H Feb 11 '11 at 8:36
@Martin H: AFAIK the user directory should come first, but this is of course a matter of configuration. –  Martin Scharrer Feb 11 '11 at 9:39
@Martin Scharrer: True, but maybe not in if the cls is not in the correct folder within the local tree. That is what I implied –  Martin H Feb 11 '11 at 12:26
@Martin Scharrer: What Martin H. means is that the local cls and sty are both in a wrong folder which is not searched, and that a second version of the cls exists in a correct location. –  Ulrike Fischer Feb 11 '11 at 14:32

The most likely answer here is that neither file is being loaded from ~/texmf, but that the .cls file is also installed correctly in the main TeX tree. The way to work this out is to look at the .log file which TeX produces. Each file loaded will include the location it was loaded from, so a quick search for the relevant files should reveal where they are loaded from.
In general, TeX will find any .cls or .sty file inside ~/texmf/tex/latex, although you may need to run texhash before this happens. (Recent versions of TeX Live do not require you to run texhash on your local tree, whereas older ones do.)
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9692080020904541, "perplexity": 3140.5120906957354}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-06/segments/1422121981339.16/warc/CC-MAIN-20150124175301-00239-ip-10-180-212-252.ec2.internal.warc.gz"}