TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

share|improve this question
up vote 11 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

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 '14 at 18:29
Thank you for the help. For complete newbies like me, here is a short tutorial on what is a class file and how to actually use one. – Vorac Nov 19 '15 at 17:15
  • 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

Your Answer


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.