1

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?

lockstep
  • 250,273
Bryce Thomas
  • 971
  • 3
  • 9
  • 18
  • 7
    Put it in ~/texmf/tex/latex/SOMENAME and run texhash. See http://tex.stackexchange.com/questions/2063/how-can-i-manually-install-a-package-on-miktex-windows and other previous related questions. – Leo Liu Feb 11 '11 at 08:15
  • 4
    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 08: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 09: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 H: The folder shouldn't make a difference as along it was not used when the file was referenced, e.g. like \input{folder/file}. – Martin Scharrer Feb 11 '11 at 12:31
  • Look in the log file (not the output) to determine from where elsarticle.cls is being loaded. – Matthew Leingang Feb 11 '11 at 14:12
  • 1
    @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

1 Answers1

5

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.)

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036