# Write new package with LaTeX2e or LaTeX3

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?

-

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.

-
Notes: 1) When I say the code layer is 'completed', I mean it's usable. There are still things to add. 2) We don't yet have a mechanism for loading optional modules in LaTeX3 kernel mode. 3) Design and code are intended to be much more separated in LaTeX3 than in LaTeX2e, so anything 'design-based' is likely to be heavily modified for LaTeX3. –  Joseph Wright Nov 20 '11 at 11:54
I would not use LaTeX3 for my LaTeX packages until LaTeX3 becomes stable enough. Sorry but I am not good at all in chasing what is going to be changed, what feature will be implemented,etc. –  IRAN Nov 20 '11 at 12:14
Joseph, @Vafa: Thank you both! I think I stay with LaTeX2e syntax until LaTeX3 is released some time. At the moment I have no time to learn LaTeX3 anyhow … –  Tobi Nov 20 '11 at 15:11

Only an opinion not an answer:

Stability:

The LaTeX3 extensions to LaTeX2e are still experimental. This means that details of the command interface may still change. LaTeX2e itself will not change a lot in future. The interface has been frozen almost. Only internal macros may be changed.

So providing a package using LaTeX3 extensions may need more and faster support, e.g., testing against each new release of LaTeX and modify the package to work with the newest changes. Every new release of the LaTeX3 extensions may break your package. So if you are short in time or simply want to release a package but don't want to spend time in support, don't use LaTeX3 extensions.

Features:

The LaTeX3 extensions to LaTeX2e provides a lot of features and very nice implementation interfaces. After reading all the documentation you will like it. And if you would like to use any of the advantages of the LaTeX3 extensions to LaTeX2e you should design your package using them!

-
Even LaTeX2e internals will only change for clear bugs (for example, there was one in \in@ that was fixed recently). The parts of LaTeX3 in l3kernel are 'broadly stable', which means that we are looking to have as few changes as possible while not being stuck with less-good ideas. Over the past six months, we've added a lot of information to the docs on when things have changed, and are very much aiming to keep the wider community well informed (via the LaTeX-L list). Of course, there is still work to do to keep packages up to date with LaTeX3 changes :-) –  Joseph Wright Nov 20 '11 at 12:02
@Joseph Wright: That's what I've tried to say. –  Schweinebacke Nov 20 '11 at 12:10
Thank you for your opinion! I’ll accept Joseph’s answer since it’s a little more extensive … –  Tobi Nov 20 '11 at 15:12