Is there a way to use the newer \(...\)
math syntax in arguments for any commands from algpseudocode
(algorithmicx
)? The documentation and virtually any other tutorial uses the TeX-primitive $...$
.
MWE:
\documentclass{article}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}
\begin{algorithmic}
\For{\(i \gets 0\) to \(n\)} % breaks
\State \Call{Foo}{\(i\)} % breaks
\EndFor
\end{algorithmic}
\end{algorithm}
\end{document}
Best Answer
I get no error from
\For{\(i \gets 0\) to \(n\)}
. But the error comes from\Call{Foo}{\(i\)}
because\Call
eventually becomesand
\equal{#2}
fails when it is passed something that contains LaTeX robust commands, because it attempts doing full expansion.You can fix this.
Or, more efficiently,
There are other two places that might need such fix, so a complete version should be