[Tex/LaTex] define new command: \renewcommand{\longto}{\longrightarrow}

macros

I define this new command:

\documentclass[8pt,a4paper]{article}
\newcounter{conto}
\setcounter{conto}{\time}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{ dsfont }
\usepackage[mathscr]{euscript}
\renewcommand{\longto}{\longrightarrow}
\usepackage[a4paper,top=1cm,bottom=2cm,left=3cm,right=3cm]{geometry}
\begin{document}
\begin{flushleft}
\( a \longto +\infty \)
\end{flushleft}
\end{document}

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

Best Answer

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:

\newcommand{\longto}{\longrightarrow}

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