Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I created a new class file to use.

I have put the .cls file in the same directory as the original cls files (report, book etc) and im 100% sure the names match.

The directory for me is:

C:\Program Files\MiKTeX 2.8\tex\latex\base

But still, when compiling it says:

! LaTeX Error: File `myclass.cls' not found.

What am i doing wrong here? (sorry for being such a noob)

In my texteditor i use:

\documentclass[12pt,%
               %draft,%
               a4paper]{myclass}
share|improve this question

4 Answers 4

up vote 8 down vote accepted

This is a duplicate of the following questions:

The basic answer is you should never put your own packages/classes in the main diretories of your TeX distribution; you should always put them into a local directory. Consult the accepted answers to these questions for more details of how to do this.

share|improve this answer

Every own created packages and classes should go into a local tree, which is supported by all TeX distributions. For MiKTeX read the MiKTeX documentation, section "Walkthrough: Registering a User-Managed TEXMF Directory". It shows how a local tree can be created, if not already present.

and here

share|improve this answer
    
In Miktex, we can easily register our own packages/classes that are saved in any sub directory of tex\latex (no matter where we put the tex\latex directory) to the LaTeX system as explained in your link above. How to do the same thing in TeX Live? –  xport Jun 7 '11 at 8:13
  • I recommend to put your class file into a dedicated directory.

  • After copying the class into your texmf directory structure, refresh TeX's file name database. In MiKTeX, open MiKTeX Options/ Settings and click the button "Refresh FNDB", or run mktexlsr (or texhash in some distributions) at the command prompt.

share|improve this answer
    
I put it in the directory with the other classes. What u mean with a dedicated directory? I did refresh the database but didnt help. –  Toroo Feb 7 '11 at 18:57
    
@Toroo: I mean: don't mix your own files with distribution files. What if you update to MiKTeX 2.9 but your class remains in C:\Program Files\MiKTeX 2.8\tex\latex\base? –  Stefan Kottwitz Feb 7 '11 at 19:03

A quick fix is to just put the .cls file next to the .tex file you're compiling (ie. in the same directory).

Perhaps this is not a permanent enough solution for you (eg. if you're going to use this class file in many documents), but this is how I use IEEE's & OSA's journal class files (where once every few years at most I need to use a particular class file). This has the added benefit of your LaTeX document's directory being self-contained - it should compile on any other LaTeX system without needing any additional installation - important for submitting a journal paper - not sure about your case.

share|improve this answer
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Paul Gessler Aug 19 at 18:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.