Consider the following document:
\documentclass{article}
\usepackage{polynomial}
\begin{document}
\def\a{-3}
\def\b{-2}
\def\c{-4}
\[
\polynomial{\a,\b,\c}\quad\polynomial{-3,-2,-4}
\]
\end{document}
As can be seen in the result
the first \polynomial
produces extra +
signs in front of negative coefficients, most probably due to late expansion of \a
, \b
, and \c
. How can this be prevented?
Edit:
The solution provided
\begingroup\edef\x{\endgroup\noexpand\polynomial{\a,\b,\c}}\x
fails in a moving argument:
\documentclass{article}
\usepackage{polynomial}
\begin{document}
\def\a{-3}
\def\b{-2}
\def\c{-4}
\begin{figure}
\caption{$\begingroup\edef\x{\endgroup\noexpand\polynomial{\a,\b,\c}}\x$}
\end{figure}
\end{document}
What modifications are required in this case?
This question appeared while providing an answer to Parameters in a caption.