Math & ScienceDivide polynoms

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

Divide polynoms

Post by NELLLY »

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.?

Code: Select all

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}


\usepackage[T1]{fontenc}
\usepackage{polynom}
 
\polyset{%
   style=B,
   delims={\big(}{\big)},
   div={\big|}
}
 
\begin{document}
   \[
     \polylongdiv{x^3-1}{x-1}
   \]
   
\end{document}
To this

Code: Select all

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}


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

 \begin{document}
$\begin{array}{r|l}
    \dropsign{-} x^3\phantom{{}x^2+x}-1                     & x-1 \\ \cline{2-2}
                 x^3-x^2\phantom{{}x-1}& x^2+x+1 \\ \cline{1-1} \\[\dimexpr-\normalbaselineskip+\jot]
  \dropsign{-} x^2\phantom{{}-x}-1\\
               x^2-x\phantom{{}-1} \\    \cline{1-1} \\[\dimexpr-\normalbaselineskip+\jot]                             
   \dropsign{-}            x-1\\ 
                           x-1\\ \cline{1-1} \\[\dimexpr-\normalbaselineskip+\jot]
               0
  \end{array}$
   
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply