Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!elroy.jpl.nasa.gov!lll-winken!ames!uhccux!waikato.ac.nz!comp.vuw.ac.nz!munnari.oz.au!murtoa.cs.mu.oz.au!viccol!dougcc From: Douglas.Miller@viccol.edu.au (Douglas Miller) Newsgroups: comp.text.tex Subject: Re: Redefining a macro in terms of itself Message-ID: <6547.2794b1a0@csv.viccol.edu.au> Date: 17 Jan 91 01:03:43 GMT References: <1991Jan15.061451@bcat1.prime.com> Organization: Computer Services, Victoria College, Melbourne Lines: 33 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.