9

In the very recent 2023-10-10 l3kernel update, (See: https://www.ctan.org/pkg/l3kernel), it looks like many new argument-specifier variants of existing control sequences were added to the kernel, mostly switching from x to e expansion variants.

I have written a package which begins with \NeedsTeXFormat{LaTeX2e}[YYYY-MM-DD]. My package uses some of the new cs variants which were recently added without using \cs_generate_variant:Nn. e.g. using e instead of x expansions for messages, \str_set:NV, \msg_error:nnV, \keys_define:ne, etc.

My question is: Is it necessary for me to now write \NeedsTeXFormat{LaTeX2e}[2023-10-10] instead of the previous date? I worry that someone using an old version of LaTeX will be unable to use my package.

EDIT: Update 2023-11-11. The 2023-11-01 kernel update added the \IfExplAtLeastTF command which tests the version of the LaTeX3 programming layer.
https://www.latex-project.org/news/latex2e-news/ltnews38.pdf

1
  • 3
    You mean you just wrote the package in the last two days? There is no harm in adding \cs_generate_variant:Nn for the e versions that you use, by design this will silently do nothing if they already are defined in the latest format. Commented Oct 12, 2023 at 8:42

1 Answer 1

11

There are two aspects here: what the change means for programmers and how to check the expl3 versions.

The team have switched from x- to e-type for a number of reasons: I've covered this in my blog. This includes deprecating the x-type variants but not removing them. It will take a long time for even 'active' expl3 developers to make the switch (if they choose to). So you can go on using the x-type variants 'for ever'.

That said, internally changing to e-type for your own functions now will be quite safe: I plan to do that for siunitx for example. At which point you decide to switch the core variants you use is a policy question for you: I will likely wait for TL'23 to freeze and update for TL'24.

If you want to use variants and are not sure they exist, you can always apply \cs_generate_variant:Nn - this is designed such that it can be called multiple times and will only generate a variant if it does not already exist.

On detecting the expl3 version, \NeedsTeXFormat won't help: this checks the version of latex.ltx. Currently, we don't have a good interface for checking the expl3 version, so you need something like

\@ifundefined{ExplLoaderFileDate}
  {\RequirePackage{expl3}}
  {}
\@ifl@t@r\ExplLoaderFileDate{2022-11-09}
  {}
  {%
    \PackageError{siunitx}{Support package expl3 too old}
      {%
        You need to update your installation of 'l3kernel'.\MessageBreak
        Loading~siunitx~will~abort!%
      }%
    \endinput
  }%

(again taken from siunitx): there is an open issue about coming up with a kernel-level interface for this.

4
  • Question: Can the new \IfExplAtLeastTF check expl3 versions older than the release date of \IfExplAtLeastTF? Commented Nov 16, 2023 at 6:28
  • 1
    @User23456234 Yes, anything back to when we introduced the version data macro it uses (2016-ish I think)
    – Joseph Wright
    Commented Nov 16, 2023 at 6:29
  • Follow-up question: Can \IfExplAtLeastTF be used in LaTeX2e formats older than the release date of \IfExplAtLeastTF (2023-11-01)? Commented Jun 14 at 14:21
  • 1
    @User23456234 You'll need to \providecommand\IfExplAtLeastTF for that yo work
    – Joseph Wright
    Commented Jun 14 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .