'' 패키지에 결함이 있습니다.

'' 패키지에 결함이 있습니다.

다양한 용지 크기를 지원하여 수업을 확장하려고 하며 이에 따라 몇 가지 옵션을 추가합니다.

\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>}

이 줄 뒤에는 다른 설정, 특히 패키지 추가를 추가할 수 있습니다.

관련 정보