I want to know which one is suited when I try to create a package file or a class file?
[Tex/LaTex] Is ProvidesFile better than ProvidesPackage or ProvidesClass
documentclass-writingpackage-writing
Related Solutions
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.
Maybe one could say a package is for extending possibilities, a class is for restricting possibilities.
If you want to add new features which can help users create specific effects in a lot of different document types, a package is for you.
If you want to set sensible defaults and create an optimal environment for efficiently creating documents of a specific type without having to do a lot of customisation, make a class.
There are a lot of fringe cases, of course ;-)
Best Answer
Use the appropriate macro for the appropriate case. That is, use
\ProvidesPackage
for a package (typically a.sty
),\ProvidesClass
for a class (a.cls
) and\ProvidesFile
for anything else.One example:
\ProvidesPackage
does additional checking in terms of the name used by the package and that used with\usepackage
. However, it also stores a package "version" if is it supplied:This can be used to make sure loading of packages meet a version criteria, if needed.