Article View: net.text
Article #798a question for TeXperts: selective loading of macros
From: Sunil Podar
Date: Mon, 03 Mar 1986 03:40
Date: Mon, 03 Mar 1986 03:40
56 lines
2702 bytes
2702 bytes
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 little 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/texlib/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; actually that
might be unnecessary), 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 and the texhax list has been dormant for a long time.
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
Technical Details
Message-ID:
<83@sbcs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!sbcs!podarShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sbcs.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!sbcs!podar From: podar@sbcs.UUCP (Sunil Podar) Newsgroups: net.text Subject: a question for TeXperts: selective loading of macros Message-ID: <83@sbcs.UUCP> Date: Sun, 2-Mar-86 22:40:02 EST Article-I.D.: sbcs.83 Posted: Sun Mar 2 22:40:02 1986 Date-Received: Tue, 4-Mar-86 04:19:05 EST Distribution: net Organization: Computer Science Dept, SUNY@Stony Brook Lines: 56