5

I was about to ask this question a few days ago, but at the time the site suggested this question to me and I thought that it is the same problem with mine. But now as PL2 releases, the problem in the addressed question is fixed yet mine remain, hence the question below.

Suppose that there is a package like the following:

\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\RequirePackage{l3keys2e}
\ProvidesExplPackage
  {testpackage}
  {2022/06/20} {}
  {A test package}

\keys_define:nn { testpackage } { , unknown .code:n = {} } \ProcessKeysOptions { testpackage }

\endinput

And the main document is like this:

\documentclass[11pt]{article}
\usepackage{testpackage}

\begin{document}

Text in case of empty.

\end{document}

Two days ago with 2022-06-01 PL1 one shall get

Unused global option(s):
    [11pt,11pt].

Now with PL2 it is:

Unused global option(s):
    [11pt].

However, in the previous releases, with unknown.code:n = {}, it is expected that there shouldn't be any warning here.

What is the problem here and how should one fix this?

Jinwen
  • 8,518
  • Try without l3keys2e and with \ProcessKeyOptions (without the s in the middle) – Ulrike Fischer Jun 22 '22 at 09:22
  • @UlrikeFischer That leads to Missing \begin{document}. – Jinwen Jun 22 '22 at 09:24
  • Oh and remove the argument (or make it an optional argument) – Ulrike Fischer Jun 22 '22 at 09:25
  • @UlrikeFischer Thank you, now there's no problem. So should I do this to all my packages/classes? (I don't quite understand what is going on here, so not sure if it applies to all cases) – Jinwen Jun 22 '22 at 09:29
  • 1
    @Jinwen sorry about the bug, PL2 fixes it for the new version, looks like l3keys2e would need a similar fix, but that package should be considered legacy now, the new built in option code is based on the same core expl3 code but extended and improved so hopefully all packages using l3keys2e will switch – David Carlisle Jun 22 '22 at 09:35
  • I'm now getting unused options in triplicate with the same warning message. I'm not using l3keys2e at all that I know of. Very strange. – LaTeXereXeTaL Jun 22 '22 at 16:39
  • @LaTeXereXeTaL It may not be you, but the packages that you've loaded. For example, after having fixed all my classes and packages (to stop using l3keys2e), I discovered that the remaining warning in my document was caused by scontents, for which I'm not able to do much. Each package that uses l3keys2e can lead to a replication of your class options in the warning message. – Jinwen Jun 22 '22 at 17:30
  • Yes I just discovered that! Mea culpa! Something else is going on. I'm compiling a large .dtx project. – LaTeXereXeTaL Jun 22 '22 at 17:38
  • @Jinwen I think I have the packages isolated now. Thanks for your help. – LaTeXereXeTaL Jun 22 '22 at 22:41
  • @Jinwen does the answer to this question answer your question? If so, can you accept it so we can get it out of the unanswered queue? If not, maybe clarify what is missing. Thanks! – scottkosty Nov 19 '22 at 14:18

1 Answers1

3

This is due to a bug in l3keys2e in which I copied some (incorrect) code from an improvement to the new keyval handler in the kernel. On reflection, I've backed out the change in l3keys2e as the better plan is to migrate to the new kernel code. I will sort out a CTAN update later today to address this issue.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • Thank you for fixing this. For now there are quite a lot packages that use l3keys2e, such as unicode-math, embrac, and big bundle like ctex uses it twice. Currently each instance of l3keys2e can lead to a replication of the global options in the warning message. Not sure how long it will take before they can all switch to the new option-setting method, especially if this new method requires a fairly new kernel, which might lead to compatibility issue. – Jinwen Jun 22 '22 at 17:52
  • @Jinwen I'll have the fix at CTAN today, so by Friday at the latest that will propogate – Joseph Wright Jun 22 '22 at 17:54
  • 1
    @Jinwen To be clear, once the fix is out, there's no need for packages to update - things will continue to work with l3keys2e, it's just that over time migration would be useful (I've set this up as a conditional in siunitx for example) – Joseph Wright Jun 22 '22 at 17:56