Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

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 !)

share|improve this answer
3  
Also \let\State\relax is necessary after that, to avoid the error. –  egreg Dec 3 '12 at 15:32
2  
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
    
@dziadgba I edited the answer to make it complete. –  mafp Dec 3 '12 at 15:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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