# How to display simply an addition in latex

Given A, B, C any string or maths code, given + any operation of my choice, I would like to display a really simple calculation - here addition. On below the result I would like to obtain :

 A
+B
__
C


I can't do it here, but please see the underline as right under B (not my above ugly displaying). A, B and C should be aligned. The operator is displayed on the left of B.

Actually, I am wondering if there is a package for that, to perform this simply ?

What you can do is use the tabular environment:

\documentclass[12pt,a4paper]{article}

\usepackage{array}
\usepackage{siunitx}

\begin{document}

\begin{tabular}{lS}
& 354.42\\
$+$& 42.1\\
& 396.52\\
\end{tabular}

\end{document}


By using the S column of the siunitx package, you are able to set everything accordingly to their value (unidades, decenas, centenas, etc.)

Now, regarding the line... I'm sorry, but I don't know what is the best approach. The result of the code mentioned above is:

I just realized that you could use \hline or \bottomrule if using the booktabs package and get something decent:

\documentclass[12pt,a4paper]{article}

\usepackage{array}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{tabular}{lS}
& 354.42\\
$+$& 42.1\\
\hline %or \bottomrule if using the booktabs package
& 396.52\\
\end{tabular}

\end{document}


This would be the result:

• First of all, thank you for your answer. I see what you mean, and I also thought about using tabular, but I also missed the line. I was also wondering if there was other methods which would fit with that. – Header12 Sep 28 '13 at 18:39
• @Header12 check the updated answer :). You can use either the \hline or \bottomrule if using the booktabs package – Mario S. E. Sep 28 '13 at 18:44
• Thank you for your help. That's what I was looking for. Regards. – Header12 Sep 28 '13 at 18:55