JohnPaul
I have this code about adding two polynomials.
```
\documentclass[a4paper,12pt]{article}
\usepackage[left=2cm,right=2 cm,top=2cm,bottom=2cm]{geometry}
\usepackage{listofitems,xstring,calcfrac}
\makeatletter
\def\xadd@tomacro#1#2{\expandafter\add@tomacro\expandafter#1\expandafter{\expanded{#2}}}
\def\eadd@tomacro#1#2{\expandafter\add@tomacro\expandafter#1\expandafter{#2}}
\def\eeadd@tomacro#1#2{\expandafter\eadd@tomacro\expandafter#1\expandafter{#2}}
\def\add@tomacro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}}
\def\add@toline#1#2{%
\ifcsname pol[#1]term@\temp@exp\endcsname
\eeadd@tomacro#2{\csname pol[#1]term@\temp@exp\expandafter\endcsname\expanded{\ifnum\temp@exp>0 x\ifnum\temp@exp>1 ^{\temp@exp}\fi\fi}}%
\fi
\ifnum\temp@exp>0 \add@tomacro#2&\fi
}
\newif\iffirst@term
\def\addpolynom{%
\begingroup
\begingroup
\catcode32 9
\addpolynom@a
}
\def\addpolynom@a#1#2{%
\endgroup
\def\arraystretch{1.5}%
\setsepchar[:]{+||-:x^}%
\def\pol@cnt{1}\parse@polynom{#1}%
\def\pol@cnt{2}\parse@polynom{#2}%
\let\tab@line@one\empty
\let\tab@line@two\empty
\let\temp@exp\max@exp
\loop
\ifnum\temp@exp>-1
\add@toline1\tab@line@one
\add@toline2\tab@line@two
\edef\temp@exp{\the\numexpr\temp@exp-1}%
\repeat
\edef\pol@tab{\noexpand\begin{array}{*{\the\numexpr\max@exp+1}c}\noexpand\\\unexpanded\expandafter{\tab@line@one\\}\unexpanded\expandafter{\tab@line@two\\\hline}}%
\let\temp@exp\max@exp
\def\cfdisp##1##2##3{%
\xadd@tomacro\pol@tab{%
\ifnum##2>0
\ifnum##11=-1 -\else\iffirst@term \else##1\fi\fi
\ifnum##3=1
\ifnum##2=1
\ifnum\temp@exp=0 1\fi
\else
##2%
\fi
\else
\noexpand\frac{##2}{##3}%
\fi
\ifnum\temp@exp>0 x\ifnum\temp@exp>1 ^{\temp@exp}\fi\fi
\else
\ifnum\temp@exp=0 \iffirst@term0\fi\fi
\fi
\ifnum\temp@exp>0 &\fi
}%
\ifnum##2>0 \first@termfalse\fi
}%
\first@termtrue
\loop
\ifnum\temp@exp>-1
\expandafter\expandafter\expandafter\calcfrac\expandafter\expandafter\expandafter{\csname polresult@\temp@exp\endcsname}%
\edef\temp@exp{\the\numexpr\temp@exp-1}%
\repeat
\add@tomacro\pol@tab{\end{array}}%
\ensuremath\pol@tab
\endgroup
}
\def\parse@polynom#1{%
\readlist\curr@polyn{#1}%
\def\curr@sign{+}%
\def\max@exp{0}%
\foreachitem\curr@term\in\curr@polyn{%
\ifnum\listlen\curr@polyn[\curr@termcnt]=1
\ifcat\relax\detokenize\expandafter{\expanded{\curr@polyn[\curr@termcnt,1]}}\relax\else
\IfSubStr{\curr@polyn[\curr@termcnt]}{x}
{%
\IfEndWith{\curr@polyn[\curr@termcnt]}{x}
{%
\StrBefore{\curr@polyn[\curr@termcnt,1]}{x}[\curr@coeff]%
\ifx\curr@coeff\@empty\def\curr@coeff{1}\fi
\def\curr@exp{1}%
}
{\errmessage{Illegal term \curr@polyn[\curr@termcnt]}}%
}
{\edef\curr@coeff{\curr@polyn[\curr@termcnt]}\def\curr@exp{0}}%
\assign@term\curr@exp{\curr@sign\curr@coeff}%
\fi
\else
\edef\curr@coeff{\curr@polyn[\curr@termcnt,1]}%
\ifx\curr@coeff\@empty\def\curr@coeff{1}\fi
\edef\curr@exp{\curr@polyn[\curr@termcnt,2]}%
\assign@term\curr@exp{\curr@sign\curr@coeff}%
\fi
\edef\curr@sign{\curr@polynsep[\curr@termcnt]}%
}%
\cf@for\temp@exp=0to\max@exp{%
\ifcsname polresult@\temp@exp\endcsname\else\expandafter\def\csname polresult@\temp@exp\endcsname{0}\fi
}%
}
\def\assign@term#1#2{
\def\cfdisp##1##2##3{%
\expandafter\edef\csname pol[\pol@cnt]term@#1\endcsname{%
\ifnum#1<\max@exp ##1\else\ifnum##11=-1 -\fi\fi
\ifnum##3=1 \ifnum##2=1 \ifnum#1=0 1\fi\else##2\fi\else\noexpand\frac{##2}{##3}\fi
}%
}%
\ifnum#1>\max@exp\edef\max@exp{#1}\fi
\expandafter\calcfrac\expandafter{\expanded{#2}}%
\csname\ifcsname polresult@#1\endcsname xadd@tomacro\else edef\fi\expandafter\endcsname\csname polresult@#1\endcsname{#2}%
}
\makeatother
\begin{document}
\parindent0pt
\addpolynom{-3/17x^4+7x^2+x-3}{5x^4-3x^3-x^2-4x+7}\medbreak
\addpolynom{2x^3-4x}{-2x^3+3x^2+3x-1}\medbreak
\addpolynom{2/3x^2-1/2x+7/12}{1/3x^2-3/2x-1/4}\medbreak
\addpolynom{3/5x^3-1/4x^2-2x+1/3}{-7/10x^3+1/3x-1/3}\medbreak
\addpolynom{1/2x^7-3/4x^3+1/5}{-1/2x^7+3/4x^3+1238}\medbreak
\addpolynom{2x^2-3x+1}{-2x^3+2x^2+3x+12344}
\addpolynom{6x^3 -2x^2+ x + 3}{6x^3-6x^2+126x}
\end{document}
```

How can I align + and - signs. E.g
