Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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.

share|improve this answer
    
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. –  Psicofrenia May 3 '13 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 –  Psicofrenia May 3 '13 at 9:20
    
@Psicofrenia There is a problem with babel, languages as options of babel and languages as options of your documentclass. I suppose you will always use language portuges: so write a explicite call of babel in your class with \usepackage[portuges]{babel}. If you need to use options test your class carefully: there may be some astonishing behaviour ... It could be, that a language given in the options of your class or of babel is not working. For example I had often problems with the correct active language ... –  Kurt May 3 '13 at 11:57
    
@Psicofrenia just a hint because I saw \usepackage{ae,aecompl} in your class: package ae is outdated. Please have a look into l2tabu.pdf eith command texdoc l2tabu or search package l2tabuon CTAN. –  Kurt May 3 '13 at 12:08

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}
share|improve this answer
    
And how does your document look like? Does it calls your class with language options or not? More than one? Then you can be in problems ... –  Kurt May 3 '13 at 12:01

Your Answer

 
discard

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.