How do I typeset multiple additions nicely?

Here's a simple syntax:

\documentclass{article}

\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\addition}{O{c}m}
 {
  \seq_set_split:Nnn \l_bert_addition_seq { + } { #2 }
  \begin{array}[#1]{@{}r@{\;}l}
  \seq_use:Nn \l_bert_addition_seq { \\ } \\[-.5ex]
  \additionrule \\[-.5ex]
  \int_eval:n { #2 }
  \end{array}
 }
\seq_new:N \l_bert_addition_seq
\ExplSyntaxOff

\newcommand{\additionrule}{%
  \leaders\hrule height \dimexpr \fontdimen22\textfont2+0.2pt\relax
                 depth \dimexpr -\fontdimen22\textfont2+0.2pt\relax
  \hfill\hspace*{0pt} & +
}

\begin{document}

\[
\addition{1234+321+12345+6}
\]

\end{document}

The optional argument to \addition can be t, b or c and is passed to array.

enter image description here


This answer does not provide additional spacing between digits, as is done with xlop, but otherwise provides multi-addend addition.

\documentclass{article}
\usepackage{xlop}
\usepackage{stringstrings,stackengine}
%%% \showsum based on http://tex.stackexchange.com/questions/219090/
%%%            writing-manual-summation-of-two-numbers/219113#219113
\newcounter{mysum}
\newcommand\showsum[1]{%
  \convertchar[q]{#1}{ }{+}%
  \setcounter{mysum}{\numexpr\thestring\relax}%
  \def\stackalignment{r}%
  \edef\tmp{\themysum}%
  {\stackunder{\underline{\ \Longstack{#1}}}{%
   \tmp}\raisebox{-\dp\strutbox}{\,+}}%
}
\begin{document}
\opadd{12}{12}

\showsum{1 2 3 4}  $\qquad$
\showsum{23 567 34 32}  $\qquad$
\showsum{1 3567 2334 3352 567}
\end{document}

enter image description here


Since I can't comment on this (not enough reputation) I'll post this as an answer. Do you have to do it inside a math-environment? You could accomplish that in a tabular-environment easily I think.

EDIT: Because it was requested:

\documentclass{article}

\begin{document}
    \begin{tabular}{rr}
         &1234\\
        +&321\\
        +&12345\\
        +&6\\
        \hline
        &13906
    \end{tabular}
\end{document}

Please note that this doesn't calculate the results. Also please note that this puts a '+' in front of every row and not next to the \hline. For that use:

\documentclass{article}

\usepackage{multirow}

\begin{document}
    \begin{tabular}{rr}
         1234 & \\
          321 & \\
        12345 & \\
            6 & \multirow{2}{*}{+}\\
        \cline{1-1}
        13906 & \\
    \end{tabular}
\end{document}