Possible Duplicate:
How do I use pgfmathdeclarefunction to create define a new pgf function?
I'm running the simple code:
\documentclass{minimal}
\usepackage{pgfplots}
\pgfmathdeclarefunction{p}{1}{%
\pgfmathand{\pgfmathless{#1}{1}} {\pgfmathgreater{#1}{0}}%
}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot {p(x)};
\end{axis}
\end{tikzpicture}
\end{document}
I get:
! Undefined controlsequence.
1.4 \pgfmathdeclarefunction
Any ideas what might be wrong? Other examples with pgf seem to work just fine.
If it helps, I'm using TexShop for mac. I have the most recent version.

! Extra \else. \pgfmath@operation@@processFollowing defining-a-piecewise-function-for-pgfplots and using\pgfmathdeclarefunction{p}{1}{\pgfmathparse{(and(#1>0, #1<1)*1)}}everything works fine. Is your tex distribution up to date? ` – cmhughes Mar 19 '12 at 03:07TeXShopis just an editor, not the tex distribution that does the actual typesetting. And Welcome to TeX.SE. – Peter Grill Mar 19 '12 at 05:17