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 have created my custom class myclass.cls and I've put it into the BASE folder on MiKTeX dis. (C:\Program Files\MiKTeX 2.9\tex\latex\base). Then I have created my xxx.sty file with some additional code, I've put it into the new folder OWNCLS (C:\Program Files\MiKTeX 2.9\tex\latex\owncls) and refreshed the file name database (FNDB) in MiKTeX settings. I hope I did everything how I should.

And my question is: How do I define \newcommand in myclass.cls that will load the xxx.sty file from its folder?

For example, when I want to create a new document, I will use command \loadmytheme{xxx} in the preamble. beamer class has got something similar \usetheme{Themename}.

I will appreciate any help.

share|improve this question
up vote 8 down vote accepted

If by base directory you mean the directory with article.cls in, then that is not a good place, the base directory indicates the core LaTeX distribution and will get overwritten on any update.

Using .sty is not what you want here, if you do use .sty then you could load your additional package with


as normal.

If you name the files for your class themes in a unique way, say theme xxx gets stored in the file xxx.mycls-def then you can define a custom loading command in your class file something like


Or perhaps adding \makeatletter if your theme files need to allow @.

share|improve this answer
Ou thank you very much for this advices. So if i understand you right, i shouldn't create xxx.sty file with theme commands but i need to create some unique e.g. xxx.thm and after that i can use loading command in my class file. Just confirm me :) And one last thing.Should those xxx.thm files be in some special folder or can i keep'em in the folder where is myclass.cls located? – Longobard May 11 '12 at 14:56
Any folder in your tex input path will do, the same folder as your class seems simplest (and would help packaging if you were ever to distribute this to others) But as I say, this should not be the base latex folder. – David Carlisle May 11 '12 at 15:31
Thank you. I made it work but it gives me 1 warning. "You have requested package '', but the package provides 'tropicana'." Class (\ProvidesClass{myreport}) and theme (\ProvidesPackage{tropicana}) are in the same folder (C:\Program Files\MiKTeX 2.9\tex\latex\myreport). Can you help me how to get rid of this warning? – Longobard May 11 '12 at 17:10
remove \ProvidesPackage{tropicana} because that is not a package but one of your theme files. – David Carlisle May 11 '12 at 19:07
David Carlisle, BIG thanks to you! Everything works :) have a good day. – Longobard May 12 '12 at 9:42

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.