Yesterday, I came across a need to have at least rudimentary \let
support; the real issues had more to do with attorneys and getting
things out the door, but the (very rapid) solution was to rename some
markup in a document prologue; we happened to use \let, mostly to
reduce the chance of the magic being as obvious as it was (less to
type, less chance and attorney will care about the technique...). So,
all of a sudden, I had a document with this:
\let\developers=\author
\let\developersaddress=\authoraddress
LaTeX was happy, we supplied a print-out to the attorney, and all
was well.
I then generated the HTML version of the document, and didn't like
the messages I say. So I came up with a little hack to my l2h support
files, and life goes on. Anyway, here's what I came up with. If
anyone wants it, help yourself. If you improve it, please let me
know!
(Now, if anyone comes up with support for \makeatletter and
\makeatother, I'll be happy to hear about that as well!)
Enjoy!
------------------------------------------------------------------------
# This is a fairly simple hack; it supports \let when it is used to create
# (or redefine) a macro to exactly be some other macro: \let\newname=\oldname.
# Many possible uses of \let aren't supported, or are not supported correctly.
#
sub do_cmd_let{
local($_) = @_;
my $matched = 0;
s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
if ($matched) {
my($new, $old) = ($1, $3);
eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }';
print "\ndefining handler for \\$new using \\$old\n";
}
else {
s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es;
if ($matched) {
my($new, $char) = ($1, $3);
eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }";
print "\ndefining handler for \\$new to insert '$char'\n";
}
else {
write_warnings("Could not interpret \\let construct...");
}
}
$_;
}
------------------------------------------------------------------------
-Fred
--
Fred L. Drake, Jr.
[EMAIL PROTECTED]
Corporation for National Research Initiatives
1895 Preston White Drive Reston, VA 20191