# Polylongdiv: Show x^n if the coefficient = 0

I'm trying to figure out how to display x^n with 0 as coefficient in the polynom divison. I'm using the polynom package for this but the following example doesn't show x^3 and x.

Minimal example

\documentclass{article}
\usepackage{polynom}
\begin{document}
\begin{center}
\polyset{style=C,div=:,vars=x}
\polylongdiv{x^4 + 0 x^3 - 45 x^2 + 0x + 324}{x - 6}
\end{center}
\end{document}


I didn't find anything in the package's manual. So is there a solution for my problem?

• Welcome to TeX.SX! This will not be that easy as we would have to redefine the package polynom. Clearly, it decides for you not to display the zero terms and I guess, it should be possible to avoid this decision. But if you just need to type such an expression (with zeros) for one time, you should have a look here: tex.stackexchange.com/a/155609 – LaRiFaRi Jun 30 '14 at 7:41
• Thx. This solved my problem :) – Philipp Jun 30 '14 at 9:39
• Good to hear. Maybe, you just post your new formula as an answer here. And if no other solutions come up the next time, you can accept it as answer. – LaRiFaRi Jun 30 '14 at 10:38

$\tabularShortstack{crcrcrcrcrl}{ &(x^4 &+ &0x^3 &- &45x^2 &+ &0x &+ &324 &): (x-6) = x^3 + 6x^2 - 9x - 54\\ - &(x^4 &- &6x^3 &) & & & &\\ \rl{-} &\rl{(x^4} &\rl{-} &\rl{6x^3.} &\rl{)} & & & &\\ & & &6x^3 &- &45x^2 & & &\\ & &- &(6x^3 &- &36x^2 &) & &\\ & &\rl{-} &\rl{(6x^3} &\rl{-} &\rl{36x^2-}&\rl{.)} & &\\ & & & & &-9x^2 &+ &0x &\\ & & & &- &(-9x^2 &+ &54x &)\\ & & & &\rl{-} &\rl{(-9x^2}&\rl{+} &\rl{54x))} &\rl{)}\\ & & & & & & & &\\ & & & & & & &-54x &+ &324\\ & & & & & &-( &-54x &+ &324 &)\\ & & & & & &\rl{-(} &\rl{-54x} &\rl{+} &\rl{324} &\rl{)}\\ & & & & & & & & &0 }$