This question already has an answer here:
What would be the best way to use TeX to typeset basic arithmetic as it's done in school - for example, to typeset equations like
356 + 42 --- 398
written in this way?
You could define a command to handle this:
In the above code, I assume the default operation will be addition, but I allow an optional argument be provided to change the operation. I also allow multiplication be indicated by passing
One approach would be to have the addition sign on the right (which I have seen on occasions), and would look something like this:
The code is a bit clunkier to have the addition symbol on the left side: