I am trying to extend my class by supporting multiple paper sizes, and therefore adding some options by

\DeclareOption{a5paper}{% Paper size: 148mm x 210mm
%   \SBpaperAfivetrue
%   \SBpaperAsixfalse

My whole document as a MWE looks like

\ProvidesClass{Liederbuch}[2016/02/04 version 1.00 Decoration and placement of songs]
\typeout{Book subclass: Liederbuch 2016/02/04 v 1.00}
% --- Class structure: declaration of options part
% --- 
% This class extends the book class
% Read all the documentclass options; pass them to book

% --- Class structure: execution of options part
% --- 
\ProcessOptions \relax

% --- Class structure: declaration of options part
% ---
%Page layout
\RequirePackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}

% --- Page size
% --- Option declaration for page size
\DeclareOption{a5paper}{% Paper size: 148mm x 210mm
%   \SBpaperAfivetrue
%   \SBpaperAsixfalse

imported in a document as

Hallo 2
Test 3

If I leave the \DeclareOption, then I get the error

The package `' is defective.
It attempts to load `pdftexcmds' in the options section, i.e.,
between \DeclareOption and \ProcessOptions.

If I remove it, everything is fine. If I move the \ProcessOption option after the declaration, I get even more errors. What am I doing wrong?

  • You have \DeclareOption{a5paper}{...} long after \ProcessOptions.
    – egreg
    Feb 14, 2016 at 11:57
  • If I move it afterwards, then I get ! LaTeX Error: \RequirePackage or \LoadClass in Options Section.
    – arc_lupus
    Feb 14, 2016 at 12:00
  • You have to place it before \ProcessOptions
    – egreg
    Feb 14, 2016 at 12:01
  • However, \SBpaperAsixfalse will throw an error, if a5paper is used.
    – egreg
    Feb 14, 2016 at 12:04
  • 2
    Declare options, process options, then load packages.
    – Johannes_B
    Feb 14, 2016 at 12:13

1 Answer 1


The correct order should be

\DeclareOption{<option>}{<code>} % any number of them
\ExecuteOptions{<option list>} % optional


After this line, other setup can be added, particularly addition of packages.


You must log in to answer this question.

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