如何根据 Ruffini - Horner Algoritms 表制作颜色?

如何根据 Ruffini - Horner Algoritms 表制作颜色?

我在制作表格 Ruffini-Horner 算法时遇到了问题,我从这个问题中获取了一个代码表格 Ruffini-Horners 算法命令

 \documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\ruffini}{mmmm}
 {% #1 = polynomial, #2 = divisor, #3 = middle row, #4 = result
  \franklin_ruffini:nnnn { #1 } { #2 } { #3 } { #4 }
 }
\seq_new:N \l_franklin_temp_seq
\tl_new:N \l_franklin_scheme_tl
\int_new:N \l_franklin_degree_int
\cs_new_protected:Npn \franklin_ruffini:nnnn #1 #2 #3 #4
 {
  % Start the first row
\tl_set:Nn \l_franklin_scheme_tl { #2 & }
  % Split the list of coefficients
\seq_set_split:Nnn \l_franklin_temp_seq { , } { #1 }
  % Remember the number of columns
\int_set:Nn \l_franklin_degree_int { \seq_count:N \l_franklin_temp_seq }
  % Fill the first row
\tl_put_right:Nx \l_franklin_scheme_tl
   { \seq_use:Nnnn \l_franklin_temp_seq{&} { & } { & } }
  % End the first row and leave two empty places in the next
\tl_put_right:Nn \l_franklin_scheme_tl{\\&&}
  % Split the list of coefficients and fill the second row
\seq_set_split:Nnn \l_franklin_temp_seq{,}{#3}
\tl_put_right:Nx \l_franklin_scheme_tl
   { \seq_use:Nnnn \l_franklin_temp_seq { & } { & } { & } }
  % End the second row
\tl_put_right:Nn \l_franklin_scheme_tl { \\ }
  % Compute the \cline command
\tl_put_right:Nx \l_franklin_scheme_tl
   {
    \exp_not:N \cline { 2-\int_to_arabic:n { \l_franklin_degree_int + 1 } }
   }
  % Leave an empty place in the third row (no rule either)
  \tl_put_right:Nn \l_franklin_scheme_tl { \multicolumn{1}{r}{} & }

% Split and fill the third row
\seq_set_split:Nnn \l_franklin_temp_seq { , } { #4 }
\tl_put_right:Nx \l_franklin_scheme_tl
{ \seq_use:Nnnn \l_franklin_temp_seq { & } { & } { & } }
% Start the array (with \use:x because the array package
% doesn't expand the argument)
\use:x
{
\exp_not:n { \begin{array} } { r | *{\int_use:N \l_franklin_degree_int} { r } }
}
% Body of the array and finish
\tl_use:N \l_franklin_scheme_tl
\end{array}
 }
\ExplSyntaxOff
\begin{document}
\[
\ruffini{1,-6,11,-6}{2}{2,-8,6}{1,-4,3,0}
\]
\end{document}

我收到这样的错误

[作者编辑时意外删除,但新代码的测试运行现在给出

! Undefined control sequence.
<argument> \seq_count:N 
                        \l_franklin_temp_seq 
l.55 \ruffini{1,-6,11,-6}{2}{2,-8,6}{1,-4,3,0}

]

这就是我要的:

在此处输入图片描述 你能帮助我吗 ?

请..

答案1

您以某种方式设法复制文本,但文本格式却不正确。

删除此项:

% Split and fill the third row
\seq_set_split:

您将能够编译它。

相关内容