Print

Print


> there are possibilities of various sophistication. A simple approach
> for just expl3 would be something like \ActivateExplCode
> \DeactivateExplCode where the latter would simply hook into some
> core functions like the arg expansion mechanism, e.g., replacing
> \exp_args:No and a few others with a suitable error message when
> called. And \ActivateExplCode would \cs_set_eq:NN the orig
> definitions back. All you would need to do would be to select the
> right kind of code pieces to make this work.

But that `\ActivateExplCode` cannot be added to the LaTeX2e kernel,
isn't it? If I'm right on that, then in order to be usable with
LaTeX2e, new documents would still need to explicitly
`\usepackage{expl3}`. In order to enforce that, we can do the
following.

- The LaTeX2x format contains all the definitions of expl3, but at the
end, it saves and undefines every experimental command that does not
contain either : or _ in its name.

- The package starts by checking what format called it. If it is
LaTeX2e, then all definitions are made as currently. Otherwise, the
saved definitions are restored.

The idea is that once `\ExplSyntaxOn` is undefined, the user cannot
access most of the experimental features (except by manually changing
catcodes, but that's harder than writing `\usepackage{expl3}`, so
hopefully, people won't do that). Of course, as Frank mentions,
meaningful errors are better, so the LaTeX2x format can define each
user command to be

\PackageError{expl3}{Package not loaded.}{You need to write
\string\usepackage{expl3} in your preamble to use the experimental
features.}


On the other hand, if the LaTeX2e kernel _can_ be modified, then e.g.
`\ExplSyntaxOn` could be defined to do
`\usepackage{expl3}\ExplSyntaxOn` by LaTeX2e.


A list of macros with no _ nor : in their name (only those documented
by `\begin{function}{...}` in the implementation part of a l3....dtx
file, and I'm not sure of my script).

% from l3names
\ExplSyntaxOn
\ExplSyntaxOff
\ExplSyntaxNamesOff
\ExplSyntaxNamesOn
\ProvidesExplFile
\ProvidesExplClass
\ProvidesExplPackage
\filedescription
\fileauthor
\filetimestamp
\fileversion
\filedate
\filenameext
\filename
\GetIdInfo

% from l3chk
\traceoff
\traceon
\tracingoff
\donotcheck
\absolutelytracingall
\tracingall

% from l3precom
\dumpLaTeXstate

% from l3calc
\stepcounter
\addtocounter
\setcounter
\gaddtolength
\addtolength
\gsetlength
\setlength
\real
\ratio
\totalheightof
\depthof
\heightof
\widthof
\minof
\maxof

-- Bruno