类包装器:为什么会出现“未使用的全局选项”警告

类包装器:为什么会出现“未使用的全局选项”警告

我正在尝试编写一个包装器来包装一些文档类,作为一个小测试。到目前为止一切正常,但为什么我得到了一个

LaTeX Warning: Unused global option(s): [math=true,tikz=true,base=normal,type=article].

显然,这些选项被解析,否则我的文档中的环境将不起作用。


班级text.cls

% Declare that this style file requires at least LaTeX version 2e.
\NeedsTeXFormat{LaTeX2e}

% Provide the name of your page, the date it was last updated, and a comment about what it's used for
\ProvidesClass{text}[2019/11/25 A documentation class]

% ---------------------------
% Package
% ---------------------------

\RequirePackage{kvoptions}
\RequirePackage{ifthen}

% ---------------------------
% Options base
% ---------------------------

\SetupKeyvalOptions{%
  family=textbase,%
  prefix=textbase@,%
  setkeys=\kvsetkeys,%
}

% String options
\DeclareStringOption[report]{type}
\DeclareStringOption[koma]{base}

% Process options
\ProcessKeyvalOptions{textbase}

% ---------------------------
% Options
% ---------------------------

\SetupKeyvalOptions{%
  family=text,%
  prefix=text@,%
  setkeys=\kvsetkeys,%
}

% Bool option
\DeclareBoolOption[false] {listings}
\DeclareBoolOption[false] {math}
\DeclareBoolOption[false] {tikz}

% any other options are passed to the base class
\DeclareDefaultOption{%
  \ifthenelse{\equal{\textbase@type}{article}}{%
    \ifthenelse{\equal{\textbase@base}{normal}}{%
      \PassOptionsToClass{\CurrentOption}{article}%
    }{}%
    \ifthenelse{\equal{\textbase@base}{koma}}{%
      \PassOptionsToClass{\CurrentOption}{scrartcl}%
    }{}%
  }{}%
  \ifthenelse{\equal{\textbase@type}{report}}{%
    \ifthenelse{\equal{\textbase@base}{normal}}{%
      \PassOptionsToClass{\CurrentOption}{report}%
    }{}%
    \ifthenelse{\equal{\textbase@base}{koma}}{%
      \PassOptionsToClass{\CurrentOption}{scrreprt}%
    }{}%
  }{}%
}

% Process options
\ProcessKeyvalOptions{text}

% ---------------------------
% Base class
% ---------------------------

% Load base class

\ifthenelse{\equal{\textbase@type}{article}}{%
  \ifthenelse{\equal{\textbase@base}{normal}}{%
    \LoadClass{article}
  }{}%
  \ifthenelse{\equal{\textbase@base}{koma}}{%
    \LoadClass{scrartcl}
  }{}%
}{}%
\ifthenelse{\equal{\textbase@type}{report}}{%
  \ifthenelse{\equal{\textbase@base}{normal}}{%
    \LoadClass{report}
  }{}%
  \ifthenelse{\equal{\textbase@base}{koma}}{%
    \LoadClass{scrreprt}
  }{}%
}{}%


% ---------------------------
% Package
% ---------------------------

\iftext@math
  \RequirePackage{amsmath}
\fi

\iftext@tikz
  \RequirePackage{tikz}
\fi

% ---------------------------
% Fin
% ---------------------------

\endinput

平均能量损失

\documentclass[%
  base=normal,
  type=article,
  a4paper,
  12pt,
  math=true,
  tikz=true,
]{text}

\author{An author}
\title{text class description}
\date{\today}

\begin{document}

\maketitle

Hello World!

\begin{align}
  a &= b & c &=d
\end{align}

\begin{tikzpicture}
\node (node) at (0,0){A node};
\end{tikzpicture}

\end{document}

相关内容