I get an error when running the following code:
\begin{frame}
\frametitle{MWE}
\begin{tikzpicture}
\begin{axis}[declare function={f(\x)=\x^3-3*\x^2+\x;}]
\addplot[red] {f(x)};
\pgfmathsetmacro{\a}{-0.15}
\coordinate (A) at (axis cs: \a, {f(\a)});
\foreach \dx in {1.0, 0.5, 0.2, 0.1, 0.05}{
\coordinate (b) at (axis cs: {\a+\dx}, {f(\a+\dx)});
}
\end{axis}
\end{tikzpicture}
\end{frame}
The error: `! Undefined control sequence. axis cs: {\a +\dx
}, {f(\a +\dx )}`
The \coordinate command outside the loop works (i.e. \coordinate (A) at (axis cs: \a, {f(\a)});).
I would appreciate any help finding out the issue.
<argument> axis cs: {\a +\dx }, {f(\a +\dx )} l.18 \end{axis}– pelegs Jun 03 '21 at 14:35