[Tex/LaTex] Write new package with LaTeX2e or LaTeX3

documentclass-writinglatex3package-writing

I’m planning to create a package and I wonder if it’s better do do this with LaTeX3 syntax or the „old“ LaTeX2e, which is the one I know.

Will LaTeX2e packages be supported by LaTeX3?

I can give more information if it is necessary …

Best Answer

At present, LaTeX3 is in development with some parts completed (a programming layer), other at least with some code written (for example the galley) and other more at the 'ideas' stage. This means that depending on what you are writing, you will need a varying amount of LaTeX2e code to write a 'LaTeX3 in LaTeX2e' package. For example, if most of what you want to do is essentially programmatic then you will need very little LaTeX2e code, but if you want to address some design area then you will need a lot more.

Almost certainly, it will not be possible to take a LaTeX2e package and simply load it directly with LaTeX3, even if the code is written entirely LaTeX3 syntax. At the very least it's to be expected that the lead-off

\RequirePackage{expl3}
\ProvidesExplPackage ...

line will need to be altered. Using the .dtx format, if your code is largely 'pure' LaTeX3 then this should not be too much of an issue, and the same source file should be usable for both LaTeX2e and LaTeX3.

There's also the question of whether what you are aiming to write will overlap with what is wanted for the LaTeX3 kernel. That should not stop you writing code now in LaTeX3 syntax, but might mean that for a LaTeX3 kernel the functionality is covered 'natively'. Here, I'd hope that if people write stuff which is useful then there is possibility of simply taking the code, adapting it, and adding it to the kernel. (While there is a 'LaTeX3 Team', the reality is that we will have to act as 'drivers' for a larger effort, and so contributions from other people are going to be very welcome.) Again, depending on the exact area you are aiming at then there may be more or less overlap.

Taking the example of my own siunitx package, the code is mainly written in LaTeX3 syntax but does have dependencies on LaTeX2e. For example, it relies on the LaTeX2e font mechanisms and tabular construction. I'd expect to take much of the code logic for a native LaTeX3 version, but also expect to need to adapt some parts. In the case of siunitx, I think splitting things up will also be necessary: perhaps some parts might get into the kernel, with others as optional modules.

So overall I'd see using LaTeX3 syntax in packages now as partly about taking advantage of the structures it provides, and partly about having code available for the future. I would not, however, see it as a way to have everything '100% ready to go' for a stand-alone kernel.

Related Question