I'm building a class for monographs, dissertations, and thesis from my department. I chose as a base the scrbook class that is part of koma-script. I need the natbib package numbers option to be called by a class option of the same name. I do not understand why the following example minimal does not work

The class Estilo. File Estilo.cls.

\ProvidesClass{Estilo}[21/06/2018 UFRRJ monografias, dissertações e teses]

File Teste.tex

    Uma gravação em pedra encontrada em Karnak-Egito

When compiling this example we find the following error:

LaTeX Error: \RequirePackage or \LoadClass in Options Section

If the last line of the Estilo.cls class is commented the compile is successful, without any error message, warning or bad box.

I do not understand why this mistake happens. Could someone help me understand and, if possible, point out a solution.

Thank you very much

  • 1
    Welcome to TeX.SX! Try moving your declare option command before processoptions. – TeXnician Jun 23 '18 at 8:46
  • 1
    The instructions \DeclareOption{numbers}{\PassOptionsToPackage{numbers}{natbib} have to come before the \RequirePackage[sort&compress]{natbib} instruction. In fact, all three instructions can be combined into a single instruction: \RequirePackage[numbers,sort&compress]{natbib}. – Mico Jun 23 '18 at 9:06
  • Thanks for the response Mico, but the problem persists in any order that puts the commands. Would you have another suggestion? I need to implement it as shown in the example to meet the rules of university composition. I thought of an alternative like that. – Benaia Sobreira de Jesus Lima Jun 23 '18 at 16:29
  • \newif\if@loadrefnum \DeclareOption{refnum}{\@loadrefnumtrue} \if@loadrefnum \RequirePackage[numbers]{natbib} \fi Without the commands \RequirePackage[sort&compress]{natbib} \DeclareOption{numbers}{\PassOptionsToPackage{numbers}{natbib}} But it did not work, it gives the same error – Benaia Sobreira de Jesus Lima Jun 23 '18 at 16:30
  • 1
    @cfr - The sort&compress option really makes sense only if used in combination with the numbers option -- the latter option sets up numeric-style citation call-outs, and "sorting and compressing" refers to a way the citation call-out numbers could be displayed. – Mico Jun 24 '18 at 4:51

Your Answer

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

Browse other questions tagged or ask your own question.