[Tex/LaTex] How to rename command to avoid double defined command names

algorithmicx

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{postscript}[scale=0.6]\special{header=gastex.pro}   
  \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?

Best Answer

After loading algorithm, and before loading vaucanson-g, put a

\let\MyState\State
\let\State\relax

Then you can use \MyState as the \State from algorithm, and vaucanson-g can define \State afresh, avoiding the error. (Thanks, @egreg !)