Fourth argument in \RequirePackage internals?

The macro \@fileswithoptions is also used to load class files. Indeed, you find

\def\LoadClass{%
  \ifx\@currext\@pkgextension
     \@latex@error
      {\noexpand\LoadClass in package file}%
      {You may only use \noexpand\LoadClass in a class file.}%
  \fi
  \@fileswithoptions\@clsextension}

As usual for macros with optional arguments, the arguments are picked up by using different macros. In this case the macro \@fileswithoptions stores its single argument and checks whether a [ follows. If there is [, \@fileswith@ptions#1 is called, otherwise \@fileswith@ptions#1[] (so an empty optional argument is supplied).

Note that #1 will be either \@pkgextension or \@clsextension which has to be carried forward.

Next a regular argument is scanned, still carrying forward the first two arguments; then another optional one. The final macro, the one performing the real job, will therefore need four arguments.

In latex.ltx we see

\def\@fileswith@pti@ns#1[#2]#3[#4]{%
  \ifx#1\@clsextension
    \ifx\@classoptionslist\relax
      \xdef\@classoptionslist{\zap@space#2 \@empty}%
      \def\reserved@a{%
        \@onefilewithoptions#3[{#2}][{#4}]#1%
        \@documentclasshook}%
    \else
      \def\reserved@a{%
        \@onefilewithoptions#3[{#2}][{#4}]#1}%
    \fi
  [...]

and you see that the argument is used. In the abridged form used in miniltx.tex, argument #1 is not actually used, because it makes no sense to load a class. So the code author decided not to use #1 but also to stick with the standard definition when the arguments are picked up: only a few parts are streamlined.


The first argument is going to be \@pkgextension Interestingly, unless you've deleted some lines in the definition of \@fileswith@pti@ns, that first argument isn't actually used anywhere.