What is the LaTeX code for this mathematical expression?

Welcome to TeX.SX! This is a simple answer, however, you should check the commands and packages specifically for the addition / multiplication / etc. on TeX.SX.

\documentclass{article}
\begin{document}
\[
\begin{array}{rr}
       A & B \\
    +\ 3 & 7 \\
    \hline
       9 & A
\end{array}
\]
\end{document}

enter image description here


I would do:

\documentclass{article}
\begin{document}
\begin{center}\renewcommand{\tabcolsep}{.3ex}\renewcommand{\arraystretch}{.9}
\begin{tabular}{ccc}&$A$&$B$\\ +&$3$&$7$\\ \hline&$9$&$A$
\end{tabular}\end{center}
\end{document}

Another approach with xlop:

mwe

\documentclass[12pt]{article}
\usepackage{xlop}
\begin{document}
\oplput(1,2){A}\oplput(2,2){B}
\oplput(0,1.5){$+$}
\oplput(1,1){3}\oplput(2,1){7}
\ophline(0,0.8){4}
\oplput(1,0){9}\oplput(2,0){A}
\end{document}

To show also the solution you only need add some like \vspace{1em}\opadd{59}{37}

Tags:

Math Mode