5

Page 9 of the LaTeX 3 interfaces file (interface3.pdf) discusses the commands \ProvidesExplPackage, \ProvidesExplClass, and \ProvidesExplFile.

These functions act broadly in the same way as the corresponding LATEX2ε kernel functions \ProvidesPackage, \ProvidesClass and \ProvidesFile. However, they also implicitly switch \ExplSyntaxOn for the remainder of the code with the file. At the end of the file, \ExplSyntaxOff will be called to reverse this. (This is the same concept as LATEX2ε provides in turning on \makeatletter within package and class code.)

So I've just tested the latter command \ProvidesFile and it does not appear to do this. I tested a MWE:

\documentclass{article}
\input{ExplFile}
\newcommand{\pangram}{The Five Boxing Wizards Jump Quickly!}
\begin{document}
\pangram
\end{document}

The input ExplFile, located in the same folder, has code

%
\ProvidesExplFile{ExplFile}{2023/05/27}{1.0.0}{Test file}
%
%FILE CONTENTS
%

The compiled pdf displays only the \pangram but all the space characters are removed. The only reason the space characters wouldn't display as usual is due to ExplSyntax not turning off automatically at the end of the file with \ProvidesExplFile.

EDIT: 2023-07-03 I just learned that this issue was already posted on GitHub. https://github.com/latex3/latex3/issues/817

1 Answer 1

4

\ProvidesExplFile is based on \ProvidesFile, which then 'goes with \ProvidesPackage and \ProvidesClass. These all use the LaTeX catcode stack to save/restore @ (classically) and ExplSyntaxOn/Off status. However, to do that, you have to load the files in the right way: \RequirePackage, \LoadClass, etc. At present, for arbitrary files there is only \@onefilewithoptions, which is really internal: that is something we need to address. If, however, you use this mechanism, you will find that the code status is correctly handled.

1
  • 1
    I think I need someone to demonstrate how to "load the files in the right way". I tried using \ProvidesExplFile within a .cls file after \ProvidesClass and \LoadClass and encountered the same issue. Commented May 28, 2023 at 8:23

You must log in to answer this question.

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