# How to rename command to avoid double defined command names

Hy, I would like to use the packages vaucanson and algorithm.

\documentclass[11pt,a4paper,twoside,openright]{book}

\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\usepackage{vaucanson-g}

\begin{document}
\begin{algorithm}
\caption{code}
\begin{algorithmic}[1]
\Function{a}{$G,r,t$}
\State $a \gets g$
\EndFunction
\end{algorithmic}
\end{algorithm}

\begin{figure}[t]
\begin{VCPicture}{(0,-2)(6,2)}
\State[s_0]{(0,0)}{0}
\FinalState[s_2]{(3,1)}{1}
\EdgeL{0}{1}{t}
\end{VCPicture}
\end{postscript}
\end{figure}

\end{document}


The problem is that \State is already defined in vaucanson and I get

ERROR: LaTeX Error: Command \State already defined


Is it possible to simply rename one of the \State commands to avoid the conflict?

-

After loading algorithm, and before loading vaucanson-g, put a
\let\MyState\State

Then you can use \MyState as the \State from algorithm, and vaucanson-g can define \State afresh, avoiding the error. (Thanks, @egreg !)
Also \let\State\relax is necessary after that, to avoid the error. – egreg Dec 3 '12 at 15:32
Also don't be tempted to swap the definition back after loading vaucanson-g, as that package uses its \State command internally in other commands. – Andrew Swann Dec 3 '12 at 15:42