[Tex/LaTex] Function arguments in algorithmicx

algorithmicx

I have a question about function arguments in the algorithmicx package. The following code works:

\documentclass{article}
\usepackage{algpseudocode}
\usepackage{algorithm}

\begin{document}

\begin{algorithm}
\begin{algorithmic}[5]
  \Function{f}{$\tau$ , $\delta$}
  %\Function{f}{$\overrightarrow{\tau}$, $\overrightarrow{\delta}$}
  \State etc
  \EndFunction
\end{algorithmic}
\end{algorithm}

\end{document}

But if I change the arguments to:

   \Function{f}{$\overrightarrow{\tau}$ , $\overrightarrow{\delta}$}

I get an apparently unrelated error:

! Illegal parameter number in definition of \@gtempa.

Do you know any solutions or workarounds for this situation?

Best Answer

If in doubt, try \protect...

  \Function{f}{$\protect\overrightarrow{\tau}$, $\protect\overrightarrow{\delta}$}

enter image description here