첫 번째 옵션을 제외하고 패키지에 전달된 옵션에 대해 "사용되지 않은 전역 옵션 경고"가 나타나는 이유는 무엇입니까?

첫 번째 옵션을 제외하고 패키지에 전달된 옵션에 대해 "사용되지 않은 전역 옵션 경고"가 나타나는 이유는 무엇입니까?

나는 매크로와 바로 가기를 위한 사용자 정의 패키지와 내가 선호하는 문서 스타일을 위한 사용자 정의 클래스를 작업 중입니다. 내 패키지에서 키-값 옵션을 정의하는 데 사용하고 있으며 DeclareKeys, 이 패키지를 로드하는 내 클래스는 옵션을 기본 클래스(기사)에 전달하여 전체적으로 옵션을 전달합니다. 잘 작동하지만 사용하지 않는 전역 옵션에 대한 이상한 경고가 표시됩니다. 코드는 다음과 같습니다.

% demo-pkg.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{demo-pkg}[Demo]

\RequirePackage{xstring}

\DeclareKeys[my]
{
    lang.choices:nn =
        { english, hebrew }
        {\ExpandArgs{Nc}\let\@my@lang{l_keys_choice_tl}},
    lang.usage = load,
    lang.initial:n = english,
    notation.choices:nn =
        { physics, math }
        {\ExpandArgs{Nc}\let\@my@notation{l_keys_choice_tl}},
    notation.usage = load,
    notation.initial:n = physics,
    foo.choices:nn =
        { bar, baz }
        {\ExpandArgs{Nc}\let\@my@foo{l_keys_choice_tl}},
    foo.usage = load,
    foo.initial:n = bar
}

\ProcessKeyOptions[my]

\RequirePackage{xparse}

\IfStrEqCase{\@my@notation}{%
{physics}{%
\NewDocumentCommand{\Conjugate}{ m }{{##1}^{\ast}}%
}%
{math}{%
\NewDocumentCommand{\Conjugate}{ m }{\overline{##1}}%
}%
}%

 

% demo-cls.cls
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{demo-cls}[Demo class]

\DeclareKeys[demo-cls]
{
    unknown.code = \PassOptionsToClass{\CurrentOption}{article}
}

\ProcessKeyOptions[demo-cls]

\LoadClass[a4paper, 12pt]{article}
\RequirePackage{demo-pkg}

 

% main.tex
\documentclass[lang=hebrew, notation=math, foo=baz]{demo-cls}

\usepackage{amsmath}

\begin{document}
\[ z = x + iy \Longleftrightarrow \Conjugate{z} = x - iy \]
\end{document}

이 코드를 실행하면 올바른 문서가 생성되지만 경고가 표시됩니다.

LaTeX Warning: Unused global option(s):
    [notation,foo].

내 패키지는 이러한 옵션을 명확하게 선택하고 사용했는데( notation단순화를 위해 옵션의 사용법만 표시함), 왜 이 경고가 표시되고, 첫 번째 옵션에 대해서는 경고가 없는 이유는 무엇입니까 lang=hebrew?

옵션 순서를 변경하면 \documentclass[notation=math, lang=hebrew, foo=baz]{demo-cls}경고가 다음과 같이 변경됩니다.

LaTeX Warning: Unused global option(s):
    [lang,foo].

그래도 문서는 여전히 컴파일되고 괜찮아 보입니다.

첫 번째 옵션을 제외한 모든 옵션에 대해 경고가 표시되는 이유는 무엇이며 이러한 경고를 해결하려면 어떻게 해야 합니까?

답변1

이것은 새로운 l3keys 기반 옵션 핸들러의 옵션 목록을 처리하는 버그입니다. 옵션 사이에 과도한 공백이 없도록 하면 잘못된 경고를 피할 수 있습니다.

\documentclass[lang=hebrew,notation=math,foo=baz]{demo-cls}

이 예에서는.

코드는 라텍스 소스에서 이미 수정되었으므로(@Skillmon의 풀 요청에서) 향후 릴리스에서 수정될 예정입니다.

버그 신고

https://github.com/latex3/latex2e/issues/1238

수정 사항이 포함된 풀 요청

https://github.com/latex3/latex2e/pull/1239

보고서와 깨끗한 테스트 파일을 보내주셔서 감사합니다.

관련 정보