10

I have seen papers containing a command \ProvidesPackage. Is it different than \usepackage?

What is the difference between \ProvidesPackage and \usepackage?

egreg
  • 1,121,712
Vaibhav
  • 6,625
  • 15
  • 49
  • 76

1 Answers1

9

The most commonly known command to use extra functionality is called \usepackage{<name>}, which if we say out loud reveals what it does: It uses a package called <name>. it is important to know that \usepackage can only be used in the document preamble, that is the part between \documentclass and the beginning of typesetting at \begin{document}.

Sometimes we want to do stuff before loading any class, for example by setting different options. The command here is called \RequirePackage{<name>}. Actually it does just the same as \usepackage, or rather vice versa.


When loading a package, LaTeX checks some details, for example the date. The only way this is possible, is a short introduction that the package gives to LaTeX. "I, the file, provide package <name> dating of 2015/06/13"

\ProvidesPackage{<name>}[2015/06/13 package <name>]
cfr
  • 198,882
Johannes_B
  • 24,235
  • 10
  • 93
  • 248