I personally do not like the \polyhornerscheme[x=x_0]{<a_0 + a_1 x + ... a_n x^n>} macro of the polynom package because of personal aesthetic preferences and how it doesn't have a general enough use case for synthetic division since it is primarily focused on the polynomial evaluation aspect.

How do I programmatically typeset Horner's method / scheme of regular synthetic division and expanded synthetic division for monic divisors and non-monic divisors by defining a macro \polysynthdiv{<dividend>}{<divisor>} with three different possible cases for each? (possibly using TikZ

Preferably, I want the spacing to be proper and not too tight and I also want a bar separating the remainder from the quotient and I want an optional argument [show] to toggle the variables (e.g., x) to be seen on top of the dividend's coefficients.

• Case 1 (Regular Synthetic Division)

I want to simply type \polysynthdiv{x^3 - 2x^2 - 4}{x - 3} for

\polysynthdiv{x^3 - 2x^2 - 4}{x - 3}

and \polysynthdiv[show]{x^3 - 2x^2 - 4}{x - 3} for

\polysynthdiv[show]{x^3 - 2x^2 - 4}{x - 3}

• Case 2 (Expanded Synthetic Division for Monic Divisor)

I want to simply type \polysynthdiv{x^3 - 12x^2 - 42}{x^2 + x - 3} for

\polysynthdiv{x^3 - 12x^2 - 42}{x^2 + x - 3}

and \polysynthdiv[show]{x^3 - 12x^2 - 42}{x^2 + x - 3} for

\polysynthdiv[show]{x^3 - 12x^2 - 42}{x^2 + x - 3}

• Case 3 (Expanded Synthetic Division for Non-Monic Divisor)

I want to simply type \polysynthdiv{6x^3 + 5x^2 - 7}{3x^2 - 2x - 1} for

\polysynthdiv{6x^3 + 5x^2 - 7}{3x^2 + 2x - 1}

and \polysynthdiv[show]{6x^3 + 5x^2 - 7}{3x^2 - 2x - 1} for

\polysynthdiv[show]{6x^3 + 5x^2 - 7}{3x^2 + 2x - 1}

Thank you.

  • @MS-SPO I would personally accept a reasonable answer that uses 6 different commands each as long as they fit the syntax using only 2 mandatory arguments {<dividend>}{<divisor>} Jun 24 at 4:16

1 Answer 1


From a programming perspective I’d typeset each of your 6 use cases and many more manually, i.e. without any option. Variability is king here.

Next I’d have a look at commonalities and differences and see how to treat the whole in elegant ways.

Finally these findings need to be put into macros, like the ones the mentioned package uses. It will be a long route.

As an alternative try to extract a handful of useful templates from your use cases, which might be easier and quicker to obtain and maintain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.