Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

TeX/let

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Synopsis \let<new-command>[[<spaces>]=]<original-command> Description \let allows you to copy the content of a command into a new command. Unlike making a macro that calls the original command, \let allows you to subsequently modify the old command while still retaining its functionality under the new command. It is often used to change the behaviour of an existing command (but not replace it entirely). In such cases \renewcommand may fail, and \let may be required. The equal sign (and the spaces before it) are not required, but may be useful in some special cases where the second argument is a space or a equal sign. Examples If one wanted to change the behaviour of a command \foo wherever it was called, such that \bar were executed first, the following may seem appropriate. \renewcommand{\foo}{\bar\foo} This, however, will create a recursive loop where calling \foo will repeatedly call itself until the computer's memory is exhausted. In order to change the behaviour of \foo to include some other behaviour, the \let command is used: \let\originalfoo\foo \renewcommand{\foo}{\bar\originalfoo} The first line copies the contents of the \foo command into the new command \originalfoo. The second line modifies the \foo command to execute \bar followed by the original contents of the \foo command (which are now stored in \originalfoo).