[tex-eplain] Incorporating url.sty

geolsoft at mail.ru geolsoft at mail.ru
Sun Aug 28 23:27:56 CEST 2005


I realized that before loading packages recursively (inside
another package) we need to save \AtEndOfPackage commands of
the current package.  This requires a few additional lines
of code:

  \def\eplain at RequirePackage{%
    \global\ece\let{usepkg at save@pkg\usepkg at rcrs}\usepkg at pkg
    \global\ece\let{usepkg at save@options\usepkg at rcrs}\usepkg at options
    \global\ece\let{usepkg at save@date\usepkg at rcrs}\usepkg at date
+   \global\ece\let{usepkg at at@end at of@package\usepkg at rcrs}\usepkg at at@end at of@package
    \global\advance\usepkg at recursion@level by\@ne
    \real at usepackage
  }%
[...]
 \def\@finfinusepackage#1[#2]{%
[...]
   % Restore parameters in case we were called from \RequirePackage.
   \ifnum\usepkg at recursion@level>0
     \global\advance\usepkg at recursion@level by\m at ne
     \expandafter\let\expandafter\usepkg at pkg\csname usepkg at save@pkg\usepkg at rcrs\endcsname
     \expandafter\let\expandafter\usepkg at options\csname usepkg at save@options\usepkg at rcrs\endcsname
     \expandafter\let\expandafter\usepkg at date\csname usepkg at save@date\usepkg at rcrs\endcsname
+    \expandafter\let\expandafter\usepkg at at@end at of@package\csname usepkg at at@end at of@package\usepkg at rcrs\endcsname
     \global\ece\let{usepkg at save@pkg\usepkg at rcrs}\undefined
     \global\ece\let{usepkg at save@options\usepkg at rcrs}\undefined
     \global\ece\let{usepkg at save@date\usepkg at rcrs}\undefined
+    \global\ece\let{usepkg at at@end at of@package\usepkg at rcrs}\undefined
   \fi
[...]
 \def\usepkg at load@pkg#1{%
[...]
   % For the duration of the package, we want any calls to \usepackage
   % to be mapped to \RequirePackage, to allow nested package loads
   % without clobbering up anything.  (Maybe packages never use
   % \usepackage instead of \RequirePackage, but this won't hurt.)
   \let\usepackage\eplain at RequirePackage
+  % Clear \AtEndOfPackage commands (can be non-empty during recursive
+  % package loading).
+  \global\let\usepkg at at@end at of@package\empty

-- 
Best regards,
Oleg Katsitadze



More information about the tex-eplain mailing list