这个问题是这个问题的后续一。解决方案非常有效(非常感谢 JPI!)但还有另一个要求:使用之前的代码(没有 JPI 的第一个解决方案),我可以使用多项式命令作为\dfrac{2}{3}
参数之一。而且它有效!现在(使用 JPI 的解决方案)它不起作用。问题:是否有同时满足这两个要求的解决方案?以下(没有 JPI 的代码)是导致以下结果的代码:
\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%
}$
结果是:
答案1
也许和\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}