Q:

Is typesetting of elementary arithmetic exercises without tables or TikZ possible?

Is there a way to avoid using TikZ or tables typesetting elementary arithmetic exercises like these:

I would like to have a some kind of a placeholder character and the distance between numbers have to be the same.

A:

Using tables cannot be avoided, but you can hide them to the user.
\documentclass{article}
\usepackage{xparse,array,booktabs}

\ExplSyntaxOn

\NewDocumentCommand{\multiplication}{mmmm}
 {% #1 = first factor, #2 = second factor, #3 = steps, #4 = result
  \gemir_mult:nnnn { #1 } { #2 } { #3 } { #4 }
 }

\seq_new:N \l__gemir_mult_steps_in_seq
\seq_new:N \l__gemir_mult_steps_out_seq

\cs_new_protected:Nn \gemir_mult:nnnn
 {
  \seq_set_split:Nnn \l__gemir_mult_steps_in_seq { \\ } { #3 }
  \seq_clear:N \l__gemir_mult_steps_out_seq
  % add padding to the steps
  \seq_indexed_map_function:NN \l__gemir_mult_steps_in_seq \__gemir_mult_pad:nn
  % typeset the table
  \begin{tabular}[t]{@{}r@{}}
  \tl_map_function:nN { #1 } \__gemir_mult_box:n
  \__gemir_mult_box:n { \cdot }
  \tl_map_function:nN { #2 } \__gemir_mult_box:n
  \\
  \midrule
  \seq_map_function:NN \l__gemir_mult_steps_out_seq \__gemir_mult_step:n
  \midrule
  \tl_map_function:nN { #4 } \__gemir_mult_box:n
  \end{tabular}
 }

\cs_new_protected:Nn \__gemir_mult_pad:nn
 {
  \seq_put_right:Nx \l__gemir_mult_steps_out_seq
   {
    #2
    \prg_replicate:nn { \seq_count:N \l__gemir_mult_steps_in_seq - #1 } { \scan_stop: }
   }
 }

\cs_new_protected:Nn \__gemir_mult_box:n
 {
  \makebox[1em]{$\str_if_eq:nnTF { #1 } { ? } { \_ } { #1 }$}
 }
\cs_new_protected:Nn \__gemir_mult_step:n { \tl_map_function:nN { #1 } \__gemir_mult_box:n \\ }

\ExplSyntaxOff

\begin{document}

\multiplication{928}{58}{4640\\7424}{53824}\qquad
\multiplication{928}{58}{4?40\\7424}{53?24}

\end{document}

A ? means a blank in the table.

