I've had to ask a new question since I can't figure out how to post the code into the thread I'd opened.
I've tried manipulating the code Steven B. Segletes posted in Sharelatex to get what I want. However I cannot get it all lined up properly I'm not sure what's wrong.
Here's the code:
\documentclass{article}
\usepackage{tabstackengine,mathtools}
\stackMath
\setstacktabbedgap{1.5ex}
\setstackgap{S}{3pt}
\newcommand\showdiv[1]{\smash{\raisebox{1.5pt}{\scalebox{1.15}{)}}}#1}
\newcommand\laprule[1]{\rlap{\rshift\smash{\rule[-1pt]{#1}{.5pt}}}}
\makeatletter
\newcommand\rshift[1][0pt]{\hspace{\dimexpr#1+\tabbed@gap\relax}}
\makeatother
\begin{document}
\[
\tabbedShortstack[r] {x^2 & +5x & -2 \\
\laprule{90pt}&&\\
x-3 \showdiv {x^3} +2x^2 & -17x & +6 \\
& +x^3 & -3x^2\\
&\laprule{55pt}&&\\
&& 5x^2 & -17x\\
&& 5x^2 & -15x\\
&\laprule{55pt}&&&&&&\\
&& -2x & +6&&\\
&& -2x & +6&&\\
&\laprule{55pt}&&\\
&&& 0
}
\]
\end{document}


polynompackage isn't good enough? Try\documentclass{article} \usepackage{polynom} \begin{document} \polylongdiv{x^3+2x^2-17x-6}{x-3} \end{document}. – Torbjørn T. Jun 20 '17 at 21:29Brett
– Brett Jun 20 '17 at 21:56&column delimiters (they don't). Each column (delimited by&) will be aligned with the similar values from other rows. The only quirk here is that, because you are right aligning the columns, the\lapruleshould be applied in the column before where you actually want it to begin. So start by getting an equal number of&in each row, and then begin figuring out which column content gets aligned with other rows. – Steven B. Segletes Jun 21 '17 at 00:53