9

I created a class of my own that uses book as base class.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{manuscript}[2013/03/23 Creative writing manuscripts class]
\LoadClass[a4paper,12pt,oneside]{book}

The problem is that I want to be able to choose paper size and other options the book class has. The only way to do that is to redefine all the options the book class already has with the same values and pass it when I load the base class?

Also, let's say I want to add a language option to my class so that if I choose Portuguese, for example, I want to load babel with portuguese.

How can I create use the options already defined in book class to change the values of that class and use my new Portuguese option to load babel with that language.

0

2 Answers 2

6

You can use

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}

to pass all not used option to your basic class book when it is called with \LoadClass{book}.

To give you a better advice you should add a MWE what you doing in your class.

2
  • Ah, understood. And what about the babel package? My idea was to use \documentclass[portuguese,a4paper,12pt,oneside]{newClass} And get just the portuguese option to make something like \usepackage[portuges]{babel} with that option instead hardcoding it inside the class. May 3, 2013 at 8:26
  • Btw, here's the source code of my class github.com/efernandespt/Manuscript/blob/master/manuscript.cls I'm trying to use \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} \LoadClass{book} and get this error \RequirePackage or \LoadClass in Options selection May 3, 2013 at 9:20
2

To pass the options, use

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions \relax
\LoadClass[12pt,a4paper,oneside]{book}

To pass a new option to another package (in this case babel)

\DeclareOption{english}{\AtEndOfClass{\main@language{english}}}
\DeclareOption{portuguese}{\AtEndOfClass{\main@language{portuges}}}
\RequirePackage[portuges, english]{babel}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .