podar@sbcs.UUCP (Sunil Podar) (11/23/85)
I have a question for TeXperts. The TeXbook talks about selective loading of macros and various ways to accomplish it. I thought up of one more way but since I am not a TeXpert (yet) I am unsure of the implications of such a technique. I would appreciate any comments. Having indulged in mlisp (ala EMACS) I wondered if it was possible to simulate its autoload function in TeX/LaTeX. Suppose we have a liitle file called mymac.tex which defines a macro \mymacro. Also I have another file called autoload.tex. autoload.tex contains the following line(s). % \def\mymacro{\input{/users/podar/texmacros/mymac}\mymacro} ... maybe other similar definitions for other macros, perhaps with different file names. % mymac.tex contains the definition of \mymacro, let's say: % \gdef\mymacro#1{\message{#1}} ... maybe some more macros, all \gdef'd. % Now, you see, In my actualtext.tex, all I have to say at the beginning is \input{.../autoload} and then the first time I use \mymacro, the file mymac.tex will be loaded, my macro executed (I can add parameters to the definition without any problem), and subsequently the macro will be redefined to its proper definition. The macros thus defined in the mymac.tex file have to be gdef'ed otherwise they will not be defined properly (in the outer mode) if they were not invoked from the outermost level. Also, if the file mymac.tex contains other macro definitions, all gdef'ed, then they all also get loaded, circumventing any load definitions in autoload.tex. Is this a sound idea? If so, then this is a neat way of doing selective loading of macros. The only problem I see is that they all have to be global definitions. This should perhaps be mailed to unix-tex list, but I do not have access to it. I'll appreciate any responses, and please mail them to me, unless you choose to decide otherwise. If necessary, I'll post a summary. -- Sunil Podar SUNY at Stony Brook CSNET: podar@sbcs.csnet ARPA: podar%suny-sb.csnet@csnet-relay.arpa UUCP: {allegra, hocsd, philabs, ogcvax} !sbcs!podar