Next: Packages known to work, Previous: The \usepackage command, Up: Loading LaTeX packages
Some packages request that certain commands are executed after all
packages have been loaded. In LaTeX, this means that the commands
are executed at the beginning of the document, after the so-called
preamble. Neither plain TeX nor Eplain have any kind of
preamble; therefore, Eplain requires that all packages be loaded inside
a \beginpackages...\endpackages block, for example:
\beginpackages
\usepackage[foo,bar]{pack1}
\usepackage{pack2}
\endpackages
This requirement enables Eplain to execute the “delayed”
commands at the end of the \beginpackages...\endpackages block.
For the same reason, it is advisable to specify only one such block per document, just like there is only one preamble in LaTeX.
Some packages (and the pseudo-LaTeX environment, miniltx.tex)
redefine TeX's primitive \input to be a macro. Non-primitive
\input is probably not what the user expects under
plain TeX. Therefore, at the beginning of the
\beginpackages...\endpackages block Eplain saves the meaning of
\input as
\eplaininput and restores the original \input at the end
of the block. This usually means that the primitive \input is
restored, unless you (or some other macro package you've loaded
directly) have redefined it before calling \beginpackages. In
case you need to access the package-provided \input, Eplain saves
it as \packageinput.
Sometimes you may encounter packages which make conflicting
redefinitions of \input. Common symptoms are TeX spewing
incomprehensible error messages or hanging in a loop at a call to
\input. This sometimes can be cured by restoring \input
to \eplaininput before loading each package. For example:
\beginpackages
\usepackage{pack1}
\let\input\eplaininput
\usepackage{pack2}
\endpackages