2

I'm trying to typeset a polynomial long division problem and I'm getting double operators.

\documentclass{standalone}
\usepackage{polynom}
%% macro to remove 1 coefficients
\makeatletter
\let\pldx@saved@PrintRational\pld@PrintRational
\renewcommand*{\pld@PrintRational}[2]{%
  \def\pldx@do{\pldx@PrintRational{#1}{#2}}%
  \futurelet\pldx@token\pldx@do
}
\newcommand*{\pldx@PrintRational}[2]{%
  \let\pldx@do\@firstofone
  \ifx\pldx@token\pld@S
    \def\pldx@a{#1}%
    \def\pldx@b{#2}%
    \ifx\pldx@a\pldx@b
      \let\pldx@do\@gobble
    \fi
  \fi
  \pldx@do{%
    \pldx@saved@PrintRational{#1}{#2}%
  }%
}
\makeatother
\begin{document}
    $$\polylongdiv{3x^2 + ax + a + 9}{x + 2}$$
\end{document}

Gives me this:

enter image description here

I would like it to not have that +-2 on the final line.

Marijn
  • 37,699
Nedd
  • 21
  • 2

0 Answers0