I'm fairly new to LaTeX so I don't really know much yet.

Is there a way I can make a custom document class that embeds an external document containing custom macros?

For example, I have right now a MyBook.cls file with a few small changes from the default Book document class. I would also like to define a bunch of \newcommand{} macros, but I don't want to have to do it in every custom document class.

  • 1
    You can put your \newcommand in a mycommands.sty or mycommands.tex file and then load it using, respectively \usepackage{mycommands} or \input{mycommands.tex} – Guido Dec 11 '12 at 20:30
  • Do you mean you want to create a file (or 'package' --- say mycustomcmds.sty) that contains several macros you want to use in many different documents that all use MyBook.cls? I think this can be done with \usepackage{mycustomcmds}. But perhaps you have something trickier in mind..? – jon Dec 11 '12 at 20:31
  • A package did the job, thanks. Had no idea I could easily make my own package like that. Now I can just \usepackage on my custom list of commands. – Mirrana Dec 11 '12 at 20:47

A package is what I was looking for. I just made a custom .sty file and now I can load it whenever I wish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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