LaTeX forum ⇒ Math & ScienceDivide polynoms

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Divide polynoms

Postby NELLLY » Thu Dec 21, 2017 6:25 pm

Hello
I need to divide polynoms using package polynoms from latex.
Is it possible to move from the frist code to the second one by customizing the polynom package.?
  1. \documentclass[a4paper]{article}
  2.  
  3. %% Language and font encodings
  4. \usepackage[english]{babel}
  5. \usepackage[utf8x]{inputenc}
  6. \usepackage[T1]{fontenc}
  7.  
  8. %% Sets page size and margins
  9. \usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
  10.  
  11.  
  12. \usepackage[T1]{fontenc}
  13. \usepackage{polynom}
  14.  
  15. \polyset{%
  16. style=B,
  17. delims={\big(}{\big)},
  18. div={\big|}
  19. }
  20.  
  21. \begin{document}
  22. \[
  23. \polylongdiv{x^3-1}{x-1}
  24. \]
  25.  
  26. \end{document}

To this
  1. \documentclass[a4paper]{article}
  2.  
  3. %% Language and font encodings
  4. \usepackage[english]{babel}
  5. \usepackage[utf8x]{inputenc}
  6. \usepackage[T1]{fontenc}
  7.  
  8. %% Sets page size and margins
  9. \usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
  10.  
  11.  
  12. \usepackage[T1]{fontenc}
  13. \usepackage[fleqn]{mathtools}
  14. \newcommand{\dropsign}[1]{\smash{\llap{\raisebox{-.5\normalbaselineskip}{$#1$\hspace{2\arraycolsep}}}}}
  15.  
  16. \begin{document}
  17. $\begin{array}{r|l}
  18. \dropsign{-} x^3\phantom{{}x^2+x}-1 & x-1 \\ \cline{2-2}
  19. x^3-x^2\phantom{{}x-1}& x^2+x+1 \\ \cline{1-1} \\[\dimexpr-\normalbaselineskip+\jot]
  20. \dropsign{-} x^2\phantom{{}-x}-1\\
  21. x^2-x\phantom{{}-1} \\ \cline{1-1} \\[\dimexpr-\normalbaselineskip+\jot]
  22. \dropsign{-} x-1\\
  23. x-1\\ \cline{1-1} \\[\dimexpr-\normalbaselineskip+\jot]
  24. 0
  25. \end{array}$
  26.  
  27. \end{document}

Return to “Math & Science”

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests