Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local options cannot be checked using the \ProcessKeyOptions command #1589

Closed
texno3 opened this issue Dec 21, 2024 · 3 comments
Closed

Local options cannot be checked using the \ProcessKeyOptions command #1589

texno3 opened this issue Dec 21, 2024 · 3 comments

Comments

@texno3
Copy link

texno3 commented Dec 21, 2024

Brief outline of the bug

Local options cannot be checked using the \ProcessKeyOptions command, In the previous LaTeX \aaa should have been bbb, but now it is aaa, indicating that option opt is not recognized by the macro package mypkg.

Minimal example showing the bug

\begin{filecontents}{mybook.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesExplClass{mybook}{2024/12/21}{}{}
\DeclareKeys{opt.code = \def\aaa{aaa}}
\ProcessKeyOptions
\LoadClass{book}
\end{filecontents}

\begin{filecontents}{mypkg.sty}
\NeedsTeXFormat{LaTeX2e}
\ProvidesExplPackage{mypkg}{2024/12/21}{}{}
\DeclareKeys{opt.code = \def\aaa{bbb}}
\ProcessKeyOptions
\end{filecontents}

\documentclass[opt]{mybook}
\usepackage{mypkg}
 
\begin{document}
\aaa
\end{document}
@muzimuzhi
Copy link
Contributor

muzimuzhi commented Dec 21, 2024

This is the new expected behavior since LaTeX2e 2024-11-01.

To pass class options to packages, you need to use

\DeclareKeys{
  opt .code = \def\aaa{aaa},
  opt .pass-to-packages = true
}

The .pass-to-packages key property is added in the LaTeX2e 2024-11-01 release, and yes the default behavior has been changed since then.

texdoc clsguide (2024-09-15), sec. 4.4 "Creating and using keyval options" and texdoc ltnews40, sec. "Avoiding key–value option clashes between classes and packages" contain doc and motivation for this change.

@texno3
Copy link
Author

texno3 commented Dec 21, 2024

Okay, thank you. I've noticed

This is the new expected behavior since LaTeX2e 2024-11-01.

To pass class options to packages, you need to use

\DeclareKeys{
  opt .code = \def\aaa{aaa},
  opt .pass-to-packages = true
}

The .pass-to-packages key property is added in the LaTeX2e 2024-11-01 release, and yes the default behavior has been changed since then.

texdoc clsguide (2024-09-15), sec. 4.4 Creating and using keyval options and texdoc ltnews40, sec. "Avoiding key–value option clashes between classes and packages" contain doc and motivation for this change.

Okay, thank you. I've noticed.

@FrankMittelbach
Copy link
Member

As @muzimuzhi said, this was a deliberate change to avoid interaction problems that could otherwise occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants