General ⇒ Changing the brace »)« to a pipe »|« in polynom package
Changing the brace »)« to a pipe »|« in polynom package
I am useing polynom package to write my mathematics book.
However, I am not so happy with the rendered output of long division as shown below.
Polynom.sty : http://www.ctan.org/tex-archive/macros/ ... ib/polynom
Not so beautiful I want to change it as follows.
Beautiful If we can change the package, how to do it?
Thank you in advance.
regards,
Yuko
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Changing the brace »)« to a pipe »|« in polynom package
I wonder where people always get those links from. Just link to CTAN.yoyoimut wrote:[...] Polynom.sty : http://www.cs.brown.edu/system/software ... olynom.pdf [...]
Code: Select all
http://ctan.org/pkg/polynom
It is not recommendable to modify a package directly. Necessary modifications are done better by taking the critical part of the package code and modify it in the preamble of the document. This has been done in the code below.yoyoimut wrote:[...] If we can change the package, how to do it? [...]
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{polynom}
\makeatletter
\def\pld@ArrangeResult#1{%
\ifx\pld@remainder\@empty
\@tempcnta\pld@maxcol\relax
\pld@InsertItems@do\pld@lastline
{\pld@firsttrue\pld@PLD{\pld@R{0}{1}}}%
\fi
\ifnum\pld@currstage>\z@
\pld@Extend\pld@allines{\pld@lastline\cr}%
\else
\pld@InsertFake\pld@lastline
\fi
\pld@iftopresult
\def\pld@lastline{\pld@PrintPoly\pld@divisor\,\smash{\Big|}\kern-2pt&}%
\else
\let\pld@lastline\@empty
\ifx B\pld@style\else
\def\pld@lastline{\pld@leftdelim\strut\pld@rightxdelim&}%
\fi
\fi
\expandafter\pld@AR@col\expandafter\pld@PLD
\expandafter\pld@lastline#1+\relax+%
\pld@SplitQuotient
\pld@iftopresult
\let\pld@currentline\@empty
\expandafter\pld@AR@col\expandafter\pld@PLD
\expandafter\pld@currentline
\pld@quotient+\relax+%
\expandafter\pld@AR@col\expandafter\pld@XPLD
\expandafter\pld@currentline
\pld@shadow+\relax+%
\edef\pld@subline{%
\noexpand\cline{\tw@-\pld@maxcol}%
\noalign{\vskip\jot}}%
\pld@Extend\pld@currentline{\expandafter\cr\pld@subline}%
\else
\@tempcnta-\@tempcnta
\advance\@tempcnta\pld@maxcol\relax \advance\@tempcnta\@ne
\edef\pld@span{\the\@tempcnta}%
\ifx B\pld@style
\pld@AddTo\pld@lastline{%
&\multispan\pld@span${}=%
\pld@PrintPolyWithDelims\pld@divisor
\expandafter\pld@IfSum\expandafter{\pld@divisor}{}{\cdot}%
\expandafter\pld@IfSum\expandafter{\pld@quotient}\pld@true
\pld@false
\pld@if \pld@leftdelim
\pld@PrintPolyShadow
\pld@rightdelim
\else \pld@PrintPolyShadow \fi
\pld@firstfalse
\expandafter\pld@PrintRemain\expandafter{\pld@remainder}$}%
\else
\pld@AddTo\pld@lastline{%
&\multispan\pld@span$\pld@leftxdelim\strut\pld@rightdelim
\pld@div
\pld@PrintPolyWithDelims\pld@divisor=
\pld@PrintPolyShadow
\ifx\pld@remainder\@empty\else
+{}%
\setbox\z@=\hbox{$\displaystyle
\frac{\let\strut\@empty\pld@firsttrue \expandafter
\pld@PrintRemain\expandafter{\pld@remainder}}%
{\let\strut\@empty\pld@PrintPoly\pld@divisor}$}%
\dp\z@=\z@\box\z@
\fi
$}%
\fi
\fi
\expandafter\pld@AR@\pld@allines\relax}
\makeatother
\begin{document}
\polylongdiv{x^3+x^2-1}{x-1}
\end{document}
Best regards
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Changing the brace »)« to a pipe »|« in polynom package
I just noticed your additional post.
That is really helpfull and works the way I want.

Thank you very much.
regards,
Yuko.