1

please how to ameliorate this code (space and alignement ), I want to have a large fraction and all be aligned

\documentclass[12pt,a4paper,openany]{book}

\usepackage{mathrsfs}
\usepackage{amsmath,amssymb,amsthm}

\newcommand{\dropsign}[1]{\smash{\llap{\raisebox{-.5\normalbaselineskip}{$#1$\hspace{2\arraycolsep}}}}}

\begin{document}
\[
\Large
\begin{array}{r|r}
\dropsign{-} x+\frac{x^3}{6}+\frac{x^5}{120} &
1+\phantom{6}\frac{x^2}{2}+\frac{x^4}{24} \\ 
\cline{2-2} 
x+\frac{x^3}{2}+\phantom{}\frac{x^5}{24} & -\frac{x^3}{3}+\frac{2x^5}{15}\\ 
\cline{1-1}
\\ [\dimexpr-\normalbaselineskip+\jot]
\dropsign{-} -\frac{x^3}{3}-\frac{x^5}{30}\phantom{6}\\ -\frac{x^3}{3}-\frac{x^5}{6}-\frac{x^7}{72}\\
\cline{1-1}
\\ [\dimexpr-\normalbaselineskip+\jot]
\dropsign{-}\frac{2x^5}{15}+\frac{x^7}{15}\\
\frac{2x^5}{15}+\frac{x^7}{15}+\frac{x^9}{180}\\
\cline{1-1}
\\ [\dimexpr-\normalbaselineskip+\jot]
-\frac{19x^7}{36}-\frac{x^9}{180}
\end{array}
\]
\end{document}
2
  • Try with polynom package and remove \Large – Pablo González L Apr 24 '20 at 16:05
  • what is polynomial package ?@PabloGonzálezL – linda Oiladali Apr 24 '20 at 16:08
2

I propose this solution, based on an array with two columns, and an alignedat environment in each of these columns:

\documentclass[12pt,a4paper,openany]{book}
\usepackage{xcolor}
\usepackage{mathrsfs}
\usepackage{mathtools, amssymb, amsthm}
\usepackage{booktabs}

\begin{document}

\[
\begin{array}{r!{\vrule width 0.8pt}l}
\begin{alignedat}[t]{5}
& & x+\frac{x^3}{6} &&{}+\frac{x^5}{120} & & & & &\\
\noalign{\vskip-2ex}
\ArrowBetweenLines[\color{red}\boldsymbol{-}]%
\noalign{\vskip-2ex}
& & x+\frac{x^3}{2} & & {}+\frac{x^5}{24}& \\
\cmidrule{3-6}
& & -\frac{x^3}{3} &&{}-\frac{x^5}{30}& \\
\noalign{\vskip-2ex}
\ArrowBetweenLines[\color{red}\boldsymbol{-}]%
\noalign{\vskip-2ex}
& &-\frac{x^3}{3}&& {}-\frac{x^5}{6}& & {}-\frac{x^7}{72} & \\
\cmidrule(l{1em}r{-0.5em}){3-8}
& & & &\phantom{-}\frac{2x^5}{15} & & {}+\frac{x^7}{72} & \\
\noalign{\vskip-2ex}
\ArrowBetweenLines[\color{red}\boldsymbol{-}]%
\noalign{\vskip-2ex}
& & & & \phantom{-}\frac{2x^5}{15} & &{}+\frac{x^7}{15}& & & {}+\frac{x^9}{180} \\
\cmidrule(l{1em}r{-0.25em}){5-10}
& & & & & &{}-\frac{19x^7}{360} & & & {}-\frac{x^9}{180} \
\end{alignedat}
&
\begin{alignedat}[t]{6}
1 & {}+ \frac{x^2}{2} & & {}+ \frac{x^4}{24}\\
\cmidrule[0.8pt](l{-5pt}r{-1em}){1-4}
x & {}- \frac{x^3}{3} & & {} + \frac{2x^5}{15}{}
\end{alignedat}\\
\end{array}
\]

\end{document} 

enter image description here

2
  • that's what I want thank you very much – linda Oiladali Apr 24 '20 at 16:57
  • Please see the latest version – I've boldened the main rules. – Bernard Apr 24 '20 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.