Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!iesd!iesd.auc.dk!fj From: fj@iesd.auc.dk (Frank Jensen) Newsgroups: comp.text.tex Subject: Re: Redefining a macro in terms of itself Message-ID: Date: 16 Jan 91 19:13:06 GMT References: <1991Jan15.061451@bcat1.prime.com> <6547.2794b1a0@csv.viccol.edu.au> Sender: news@iesd.auc.dk (UseNet News) Organization: Mathematics and Computer Science, University of Aalborg Lines: 38 In-reply-to: Douglas.Miller@viccol.edu.au's message of 17 Jan 91 01:03:43 GMT In article <6547.2794b1a0@csv.viccol.edu.au> Douglas.Miller@viccol.edu.au (Douglas Miller) writes: In article <1991Jan15.061451@bcat1.prime.com>, kjg@bcat1.prime.com (Ken Gartner) writes: > While trying to create a private LaTeX style file, I stumbled while attempting > to redefine \tableofcontents and \marginpar in terms of themselves. > I think the \let is what I want since there is > an indication that it copies the current definition Yes --- here is what I do to atomatically insert a table of contents in a document style: \let\old@document=\document \def\document{\old@document\tableofcontents} > -- unfortunately > (again for me) the following generate some noise about > > % Try to get table of contents tighter for article: > \let\k1\tableofcontents > \renewcommand{\tableofcontents}{\parskip 0in \k1} > > > ! Missing \begin{document}. > \@latexerr ...for immediate help.}\errmessage {#1} > > ... > l.53 \let\k1\tableofcontents > ? ^D Nearly right, but you used an invalid macro name "\k1" --- digits are not allowed! The 1 got interpreted as text to be typeset, hence the error message. Almost right! \k is let equal to 1, and the \tableofcontents command generates text to be typeset.