# How to create a command to load my own new .sty file

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.

-

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

 \usepackage{xxx}


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

\def\usetheme#1{\input{#1.mycls-def}}


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

-
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