Closed lvjr closed 4 months ago
The issue is really with the latex format rather than fontspec. The new l3keys based option handler processes the global document class keys when handling a package, for consistency with traditional latex options.
It's possible that \ProcessKeyOptions could or should simply skip a key of the wrong type rather than throwing this error when processing the classoptions from within a package
Your class could remove the math=many from the global option list so it was not picked up by packages, which would get things working now, but I'm not sure if that's the best long term solution.
\ExplSyntaxOn
\prop_new:N\cEmptyProp
\ExplSyntaxOff
\documentclass[math=many]{randexam}
\makeatletter
\let\@raw@classoptionslist\@empty % or just remove math but simple case here
\makeatother
\usepackage{fontspec}
\begin{document}
Test
\end{document}```
You could also set the unknown handler (and fontspec could do that too):
\documentclass{book}
\ExplSyntaxOn
\DeclareKeys
{
math .choice:,
math / many .code:n = {\def\blub{abc}},
math / unknown .code:n={\typeout{class??????}}
}
\SetKeys{math=many,math=xxxx}
\show\blub
\DeclareKeys
{
math .bool_gset:N = \g__fontspec_math_bool,
math / unknown .code:n={\typeout{fontspec??????}}
}
\SetKeys{math=true,math=blub}
\bool_if:NT \g__fontspec_math_bool {\show\yes}
\ExplSyntaxOff
\begin{document}
abc
\end{document}
Perhaps a package should be able to opt out of inheriting the global class options? Without looking into the package exhaustively, off the top of my head I don’t think any of the standard class options are relevant.
@wspr We talked about that on the team list :)
Somewhere there was an issue about removing keyvals from the unused list: anyone remember where?
I am thinking of adding code to fontspec to address this. Does a warning make sense?
Package fontspec Warning: The global option 'math=yuck' is not recognised. It w
ill be ignored.
I'm thinking this would cause more harm than help.
(I thought we had word wrapping for expl3 messages...I guess I need to add it manually)
Description
My class defines
math
option aschoice
key with\DeclareKeys
command, but latestfontspec
package doesn't like it and throws an error.Check/indicate
Minimal example demonstrating the issue