パッケージ「」に欠陥があります

パッケージ「」に欠陥があります

私はクラスを拡張して複数の用紙サイズをサポートしようとしており、そのためにいくつかのオプションを追加しています。

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

私のMWE文書全体は次のようになります

\NeedsTeXFormat{LaTeX2e}
\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
\DeclareOption*{\InputIfFileExists{\CurrentOption.min}{}{%
    \PassOptionsToClass{\CurrentOption}{book}}}

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

% --- Class structure: declaration of options part
% ---
\LoadClass{book}
%Page layout
%\RequirePackage{xcolor}
\RequirePackage{gtrcrd}
\RequirePackage{stackengine}
\RequirePackage{graphicx}
\RequirePackage[utf8]{inputenc} 
\RequirePackage[T1]{fontenc} 
\RequirePackage[dvipsnames]{xcolor} 
\RequirePackage[object=vectorian]{pgfornament}
\usetikzlibrary{calc}
\RequirePackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}
\RequirePackage{fancyhdr}

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

文書にインポートされた

\documentclass[8pt,a6paper]{Liederbuch}
%\usepackage[utf8]{inputenc}
\begin{document}
Hallo 2
\newpage
Test
\newpage
Test 3
\end{document}

を放置すると\DeclareOptionエラーが発生します

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

削除すればすべて正常になります。\ProcessOptionオプションを宣言の後に移動すると、さらに多くのエラーが発生します。何が間違っているのでしょうか?

答え1

正しい順序は

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

\LoadClass{<class>}

この行の後に、他のセットアップ、特にパッケージの追加を追加できます。

関連情報