I am quite new to TeX, so i don't know how to represent polynom division in latex. I can't use package polynom, since I don't have a polynom with numbers so this is a generic solution for this fraction (x_1^n-x_0^n)/(x_1-x_0)
I would appreciate some help to represent this somehow like this:
A similar question was answered there: How to draw polynom division? but i want to picture polynom division in more convinient style
like the package polynom does it and don't know how to tune that solution for my purposes
Best Answer
This is using the under-development
tabstackengine
package, first introduced here at Writing a table with equally spaced columns, based on the widest column (source code available at Measuring align).The package extends the
stackengine
package by adding tabbing capability. This answer, Can I tab inside of align environment?, gives some of the syntax of the package. I apologize that I have been lax in completing the package and getting it out the door, so the only way to see it in action is by searching this site fortabstackengine
.In this particular answer, I set up the polynomial division with a tabular stack, where I set the alignments of each column. The only twist is the introduction of the macro
\rl{}
which give a rule corresponding to the typeset contents of the mathematical argument (extended with allap
and\rlap
to make smooth transitions).The answer below has been EDITED in response to Barbara'a comment, through a redefinition of
\rl{}
. My earlier solution artificially extended the horizontal gap between stacked columns, which was a proper criticism. An additional criticism levied had to do with the unequal spacings around the math operators. To a large extent, this edit corrects much of that. However, residual asymmetries about the-
and+
characters are notably due to the alignment requirements of the columns. For example, in the middle rows, there is more space prior to the7x
than after the preceding-x^2
. This occurs because the7x
must achieve right-alignment with the somewhat wider(4x
three rows later. In essence,mathrel
spacings are sacrificed in order to maintain column alignments, which is considered essential to this problem.Here is an example of another problem cited by the OP. The only differences here were the need to use
\rlap
if an entry was to be allowed to cross column boundaries, and I also changed the column alignment tol
for the polynomial entries, as opposed tor
in the last example, which had constant coefficients.