(eplain.info)Environment for loading packages


Next: Packages known to work Prev: The \usepackage command Up: Loading LaTeX packages
Enter node , (file) or (file)node

4.23.2 Environment for loading 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 a concept 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.

   Both the 'miniltx.tex' file used by Eplain and some LaTeX packages
redefine TeX's primitive '\input' to be a macro. Under plain TeX, users
probably expect the primitive '\input'. 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'.

   Along the same lines, Eplain restores the catcode of '@' at
'\endpackages' to whatever it was before (using '\resetatcatcode', as
defined by 'miniltx.tex'). This is needed because 'miniltx.tex', read by
'\beginpackages', does not restore the catcode of '@', but leaves it as
11 (letter).

   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 cna be cured by restoring '\input' to
'\eplaininput' before loading each package. For example:

     \beginpackages
       \usepackage{pack1}
       \let\input\eplaininput
       \usepackage{pack2}
     \endpackages


automatically generated by info2www version 1.2.2.9