# Replicate a typesetting of polynomial long division

I found a typesetting of series long division I want to replicate in a book I've been reading: So I tried with the following code (using different polynomial than the example):

\begin{align*}
\renewcommand\arraystretch{2}
\begin{array}{r@{\hskip\arraycolsep}c@{\hskip\arraycolsep}l*2r}
&&\dfrac{1}{z}+\dfrac{1}{3!}z&+\left[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\right]z^3+\cdots\\
\cline{2-4}
z-\dfrac{1}{3!}z^3+\dfrac{1}{5!}z^4-\cdots&\Bigg)&1\\
&&1-\dfrac{1}{3!}z^2&+\dfrac{1}{5!}z^4-\cdots\\
\cline{2-4}
&&\hfill\dfrac{1}{3!}z^2&-\dfrac{1}{5!}z^4+\cdots\\
&&\hfill\dfrac{1}{3!}z^2&-\dfrac{1}{(3!)^2}z^4+\cdots\\
\cline{2-4}
&&&\left[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\right]z^4-\cdots\\
&&&\left[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\right]z^4-\cdots\\
\cline{2-4}
&&&\multicolumn{1}{c}{\vdots}\\
\end{array}
\end{align*}


and here is the result: As you may see, the are some differences between the example and my attempt (besides fonts, of course). The biggest problem seems to be associate with the vertical spacing, is there anything I can do to improve the result? Thank you very much!

• First of all you have some minor mistakes regarding some signs in your code compared to the "original" version. Is this normal or just typing mistakes? – Ludovic C. Jul 12 '13 at 10:33
• I used a different polynomial. Sorry if I didn't state it clear. – Francis Jul 12 '13 at 10:35
• You have that you used a different polynomial in your post. It is right below the first image. – dustin Jul 12 '13 at 10:38
• Welcome to TeX.SX! You can have a look on our our starter page to familiarize yourself further with our format. – Claudio Fiandrino Jul 12 '13 at 10:48
• isn't that Brown/Churchill:Complex Variable – RE60K Dec 25 '14 at 19:20

The only difference I could see was the spacing between the rows that caused some of the equations to lie on the cline.

Adding [.1cm] or whatever distance separation you want will achieve a bigger spacing.

\documentclass{article}
\usepackage{amsmath, array}
\begin{document}
\begin{align*}
\renewcommand\arraystretch{2}
\begin{array}{r@{\hskip\arraycolsep}c@{\hskip\arraycolsep}l*2r}
&&\dfrac{1}{z}+\dfrac{1}{3!}z&+\left[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\right]z^3+    \cdots\.1cm] \cline{2-4} z-\dfrac{1}{3!}z^3+\dfrac{1}{5!}z^4-\cdots&\Bigg)&1\\[.1cm] &&1-\dfrac{1}{3!}z^2&+\dfrac{1}{5!}z^4-\cdots\\[.1cm] \cline{2-4} &&\hfill\dfrac{1}{3!}z^2&-\dfrac{1}{5!}z^4+\cdots\\[.1cm] &&\hfill\dfrac{1}{3!}z^2&-\dfrac{1}{(3!)^2}z^4+\cdots\\[.1cm] \cline{2-4} &&&\left[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\right]z^4-\cdots\\[.1cm] &&&\left[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\right]z^4-\cdots\\[.1cm] \cline{2-4} &&&\multicolumn{1}{c}{\vdots}\\ \end{array} \end{align*} \end{document} Also, if you want to use a square root in stead of ) and \cline, you could do \sqrt{1 + \phantom{\left(\frac{10^{2}}{10^{2}}\right)+50000000000000000000000000}}  Then you will have to adjust your spacing of division. You could then adjust +50000000... to cover as much width as you need. There may be even a smooth way to extend the radical without using phantom. I will look into and see if I can find something or maybe someone else will know. Instead of using \phantom alone, I have adapted Werner's solution from Large Square Root Symbols \newcommand{\blank}{\hfil\penalty1000\hfilneg\rule[-3pt]{#1}{1cm}} \[ 3 = \sqrt{\phantom{\blank{5cm}}}


I modified his example to take care of height too. You can adjust this to whatever you want by changing 1cm and the width is argument of \blank. So this produces: Furthermore, we can adapt How can I create a multiline split inside of a radical inside of an array environment? in order to use the radical in better manner.

By using aligned environment, we can achieve the image below (I only edited the first few lines as an example) The code is:

\documentclass{article}
\usepackage{amsmath, array}
\begin{document}
\begin{align*}
\renewcommand\arraystretch{2}
\newcommand{\blank}{\hfil\penalty1000\hfilneg\rule[-3pt]{#1}{.75cm}}
\begin{array}{r@{\hskip\arraycolsep}c@{\hskip\arraycolsep}l*2r}
&&\begin{aligned}
+\bigg[\dfrac{1}{(3!)^2}-\dfrac{1}{5!}\bigg]z^3 +\cdots
\end{aligned}\\[.1cm]
z-\dfrac{1}{3!}z^3+\dfrac{1}{5!}z^4-\cdots&&\sqrt{\begin{aligned}
1 & \phantom{\blank{4.5cm}}
\end{aligned}}\\[.1cm]
&&\begin{aligned}
+\dfrac{1}{5!}z^4-\cdots
\end{aligned}\\[.1cm]
\cline{2-3}
&&\begin{aligned}