4

Is there a way to suppress the coefficient 1 in front of a in the following calculation?

\documentclass{article}

\usepackage{polynom}

\begin{document} [ \polylongdiv{x^3 + ax^2 - x + 4}{x - 1} ] \end{document}

Output from polynom

Bernard
  • 271,350
user44413
  • 601

1 Answers1

3

There is an old question and I think that your question it is a duplicate of this question: Expand LaTeX macros to modify. I have used the excellent macro of the answer of Sep 18 '13 at 20:45 of the user @Heiko Oberdiek, for example, that delete the coefficient 1. Or if you prefer work correctly also the macro of @David Carlisle. Here there is an example.

\documentclass[a4paper,12pt]{article}
\usepackage{polynom}

\makeatletter \let\pldx@saved@PrintRational\pld@PrintRational \renewcommand{\pld@PrintRational}[2]{% \def\pldx@do{\pldx@PrintRational{#1}{#2}}% \futurelet\pldx@token\pldx@do } \newcommand{\pldx@PrintRational}[2]{% \let\pldx@do@firstofone \ifx\pldx@token\pld@S \def\pldx@a{#1}% \def\pldx@b{#2}% \ifx\pldx@a\pldx@b \let\pldx@do@gobble \fi \fi \pldx@do{% \pldx@saved@PrintRational{#1}{#2}% }% } \makeatother

\begin{document} [\polylongdiv{x^3 + ax^2 - x + 4}{x - 1}] \end{document}

enter image description here

Sebastiano
  • 54,118