12.14.17 \RequirePackage & \RequirePackageWithOptions

Synopsis:

\RequirePackage[option-list]{pkgname}[release-date]
\RequirePackageWithOptions{pkgname}[release-date]

Load a package, like the command \usepackage (see Additional packages). An example:
\RequirePackage[landscape,margin=1in]{geometry}

The initial optional argument option-list, if present, must be a comma-separated list. The trailing optional argument release-date, if present, must have the form YYYY/MM/DD. If the release date of the package as installed on your system is earlier than release-date then you get a warning like ‘You have requested, on input line 9, version `2017/07/03' of package jhtest, but only version `2000/01/01' is available’.

The \RequirePackageWithOptions variant uses the list of options for the current class. This means it ignores any options passed to it via \PassOptionsToClass. This is a convenience command to allow easily building classes on existing ones without having to track which options were passed.

The difference between \usepackage and \RequirePackage is small. The \usepackage command is intended to be used in documents, while \RequirePackage is intended for package and class files. The most significant difference in practice is that \RequirePackage can be used in a document before the \documentclass command, while \usepackage gives an error there. The most common need for this nowadays is for the \DocumentMetadata command (see \DocumentMetadata: Producing tagged PDF output).

The LaTeX development team strongly recommends use of these and related commands over Plain TeX’s \input; see the Class Guide (https://ctan.org/pkg/clsguide).


Unofficial LaTeX2e reference manual