1

This question is the following of this one. The solution worked very well (Thanks so much JPI !) but it remains another request : with the previous code (without the 1st solution by JPI) I could use polynomial command with \dfrac{2}{3} as one of the arguments. And it worked ! Now (with the JPI's solution) it doesn't. Question : is there a solution to both requirements ? The following (without JPI's code) is the code leading to the following result :

\FPeval\VRcoeffa{(0-1)}     \FPclip\VRcoeffa{\VRcoeffa}
\FPeval\VRcoeffb{(8/3)}     \FPclip\VRcoeffb{\VRcoeffb}
\FPeval\VRcoeffc{(0)}       \FPclip\VRcoeffc{\VRcoeffc}
\FPeval\VRcoeffd{(0-12)}    \FPclip\VRcoeffd{\VRcoeffd}
\FPeval\VRcoeffe{(1)}       \FPclip\VRcoeffe{\VRcoeffe}
\FPeval\VRcoefff{(0-1)}     \FPclip\VRcoefff{\VRcoefff}
\FPset\toto{\dfrac{2}{3}}

$f(x)=\polynomial[reciprocal]{%
\VRcoeffa,%
\dfrac{2}{3},%
\VRcoeffc,%
\VRcoeffd,%
\VRcoeffe,%
\VRcoefff%
}$

The result is :

enter image description here

1 Answers1

1

Perhaps with \noexpand?

\documentclass{article}

\usepackage{polynomial,amsmath}
\makeatletter
\def\shpol@getcoeff#1{% Parse the coeffs and store in #1-vars
  \shpol@numcoeff=0%
  \@for\shpol@coeff:=#1\do{%
    \advance\shpol@numcoeff by 1\relax%
    \expandafter\edef\csname shpol@coeff\romannumeral\shpol@numcoeff\endcsname{\shpol@coeff}%
  }%
}
\makeatother

\begin{document}

\newcommand{\vl}{-3}

$\polynomial{1,\vl,-4}$

$\polynomial{1,\vl,-\noexpand\dfrac{4}{3}}$

\end{document}

enter image description here

  • This is exactly what I was expecting ! Thanks ! Is it requesting a modification of the polynomial command ? – B.Gravouil Feb 15 '17 at 20:42
  • @B.Gravouil I used the code that JPI had provided, and worked in that context. Whether the author of polynomial would like to offer such an option, I cannot say, but it is clear he intended the arguments to be direct numbers and not macros. Perhaps you could email the author of polynomial if you are seeking something more official. – Steven B. Segletes Feb 15 '17 at 20:47