我想写这个除法,但我的代码不起作用
这是我的代码
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\title{division}
\author{othnielnzue23 }
\date{October 2023}
\begin{document}
\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\renewcommand{\arraycolsep}{2pt}
\begin{array}{rrrr|rrrr}
x&-\dfrac{1}{6}x^3&+\dfrac{1}{120}x^5& &1 &-\dfrac{1}{2}x^2 &+\dfrac{1}{24}x^4& \\
\cline{5-7}
-(x&-\dfrac{x^3}{2}&+\dfrac{x^5}{24}) & & &x&+\dfrac{1}{3}x^3&+\dfrac{2}{15}x^5\\
\cline{1-2}
&2x^2 & & & & & \\
&-2x^2&+2x& & & & \\
\cline{2-3}
& &2x & & & & \\
& &-2x&+2& & & \\
\cline{3-4}
& & &+1& & & \\
\end{array}
\end{equation*}
\end{document}
答案1
这是最好的代码朋友
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx} % Required for inserting images
\title{division}
\author{othnielnzue23 }
\date{October 2023}
\begin{document}
\begin{equation*}
\renewcommand{\arraystretch}{1.2}
\renewcommand{\arraycolsep}{2pt}
\begin{array}{rrrr|rrrr}
x&-\dfrac{1}{6}x^3&+\dfrac{1}{120}x^5& &1 &-\dfrac{1}{2}x^2 &+\dfrac{1}{24}x^4& \\[0.5em]
\cline{5-7}
- \Bigl(x \Bigl. &-\dfrac{x^3}{2}& \Bigl. +\dfrac{x^5}{24}\Bigr) & & x&+\dfrac{1}{3}x^3&+\dfrac{2}{15}x^5 &\\
\cline{1-4}
&2x^2 & & & & & \\
&-2x^2&+2x& & & & \\
\cline{2-4}
& &2x & & & & \\
& &-2x&+2& & & \\
\cline{3-4}
& & &+1& & & \\
\end{array}
\end{equation*}
\end{document}
现在可以了