I define this new command:

\usepackage{ dsfont }
\( a \longto +\infty \)

but the command \renewcommand{\longto}{\longrightarrow} doesn't work!!

  • 3
    What do you mean by «Doesn't work»? I do get the arrow. EDIT: Ah, you edited. renewcommand is used to change the definition of a command, as the log says Error: \longto undefined., you only need to substitute \renewcommand with \newcommand. – Manuel Jan 23 '14 at 14:41
  • 3
    \longto is not defined, so you have to \newcommand{\longto}{\longrightarrow} – karlkoeller Jan 23 '14 at 14:43
  • 1
    @karlkoeller You should post your comment as an answer – azetina Jan 23 '14 at 14:44
  • 2
  • 2
    \let\longto\longrightarrow – user2478 Jan 23 '14 at 14:50

The command \longto is not defined, so you can not "renew" its meaning through \renewcommand, which can only be used to redefine existing commands.

To define a new command, as in your case, you have to use \newcommand, specifically:


See this post for more info: What do newcommand, renewcommand, and providecommand do, and how do they differ?


If you want to be on the save side then use:

\providecommand\longto{}% does nothing, if already defined
\renewcommand\longto{\longrightarrow}% works now

or if you want the short way:

  • 1
    I can't recommend this. A package might define \longto and use it in some of its constructions; the macro would be redefined without any warning. – egreg Jan 23 '14 at 15:36
  • sure, but a \@ifdefinable is overkill in this special case! – user2478 Jan 23 '14 at 15:49
  • 1
    That's what \newcommand is for; why looking for complications? – egreg Jan 23 '14 at 15:50
  • It looks like that you never wrote a package ... – user2478 Jan 23 '14 at 15:51
  • 3
    This is for a document level definition, not for a package. The user level command for this is \newcommand that will inform the user in case the macro already has a definition; in this case suitable action can be taken. Try imagining what would happen if somebody follows your advice with \box instead of \longto. Your answer should start with “If you want to be on the unsafe side…”. – egreg Jan 23 '14 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.