I have been toiling around polynom package to typeset polynomial long division. The polynom package produces wonderful long division with step by step process. But I just have two problems. Let me tell you what I need exactly

Here is the output that I produced with polynom for \polylongdiv{X^3+X^2-1}{X-1}

enter image description here

But instead of spaces for the missing x, I want to have 0x. Is it possible to do that? I checked the documentation and I couldn't find a way to do this.

You can read the documentation here: http://www.cs.brown.edu/system/software/latex/doc/polynom.pdf

I also realized that the polynomials aren't formatted inside the math environment. So is there anyway to format these equations inside math environment also? I tried putting $ signs around \polylongdiv{X^3+X^2-1}{X-1}, but that didn't change anything. Equations inside math environment produces something like this

enter image description here

I am very new to latex. So please help me.

Update: @polgab helped me solve the second question of producing math environment like output. I just need the solution for question 1 now which is I want to have 0x in the place of missing x instead of a space which is being produced by polynom.

  • Welcome to TeX.SE. Commented Jul 15, 2012 at 4:18
  • I was just looking at Multivariate polynomial long division using LaTeX, and was about to compose a question when I saw this. Is this a duplicate that answers your question? Commented Jul 15, 2012 at 4:19
  • I edited your question and put the first image in there- the second image seemed to be the same?
    – cmhughes
    Commented Jul 15, 2012 at 4:40
  • @PeterGrill No mine is not a duplicate of tex.stackexchange.com/questions/50404/…. I don't want to typeset multivariate polynomial long division. I just want to get help in modifying some basic settings of the polynom package. Thanks for taking your time to comment!
    – Adhithya
    Commented Jul 15, 2012 at 14:27
  • @cmhughes I just put the second image to show how the output from polynom is different from the output produced in the math environment. If you feel it is causing ambiguity, please feel free to remove it.
    – Adhithya
    Commented Jul 15, 2012 at 14:30

1 Answer 1


Changing the internal macros that are responsible for omitting zero terms you get what you want (but you have to specify the zero term in the input):

           \pld@if \pld@Extend\pld@temp{\expandafter\pld@F\pld@frac}\fi
    \ifx\pld@symbols\@empty \else
    \ifx\pld@temp\@empty \else

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .