Extend vertical line in polynom division
Expanding upon Ulrike's patch to automate the process. Here, with \mypolylongdiv
, the \polylongdiv
is done twice for each problem, the first time to measure the drop height of the line and the 2nd time to apply it.
\documentclass[12pt,a4paper]{article}
\usepackage{polynom,xpatch}
\newlength\mypolydepth
\makeatletter
\xpatchcmd\pld@ArrangeResult{\vrule height 2.25ex}{\rule{0pt}{2.2ex}\smash{\vrule height 2.25ex depth \mypolydepth}}{}{\fail}
\makeatother
\newcommand\mypolylongdiv[3][style=D]{%
\setlength\mypolydepth{0pt}%
\setbox0=\hbox{\polylongdiv[#1]{#2}{#3}}%
\setlength\mypolydepth{\dimexpr\dp0-1.3\baselineskip}%
\polylongdiv[#1]{#2}{#3}%
}
\begin{document}
\mypolylongdiv{x^2-4}{x+2}\medskip
\mypolylongdiv{x^3+x^2-4}{x+2}\medskip
\mypolylongdiv{x^4+x^2-4}{x+2}
\end{document}
I can make the line longer but I see no easy way to get the needed length automatically:
\documentclass[12pt,a4paper]{article}
\usepackage{polynom,xpatch}
\newlength\mypolydepth
\makeatletter
\xpatchcmd\pld@ArrangeResult{\vrule height 2.25ex}{\rule{0pt}{2.2ex}\smash{\vrule height 2.25ex depth \mypolydepth}}{}{\fail}
\makeatother
\setlength\mypolydepth{6\baselineskip} %manual value
\begin{document}
\polylongdiv[style=D]{x^3+x^2-4}{x+2}
\end{document}