6

enter image description here

What is the LaTeX code for this image? Please help!

19

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

  • 1
    (+1) for using the delimeters ;) – Raaja Dec 3 '18 at 9:45
  • 1
    In the original question, the $A\ B$ in the first line were right of the other two lines. I suspect (supported by the acceptance) that was not required. +1. – Ross Millikan Dec 4 '18 at 4:30
  • @Raaja: presumably the delimiters you mention are the square brackets. I haven't seen them. What do they do? – Ross Millikan Dec 4 '18 at 4:31
  • @RossMillikan Well, here what I mean by delimeter is that using a \\ instead of a not-so-nice tab space using &. – Raaja Dec 4 '18 at 6:49
6

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}
5

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}

  • 1
    I think 58+37=95 is the solution of the addition, not 59+37 :) – user156344 Dec 3 '18 at 13:23
  • 2
    @DũngVũ With or without taking the last carry? Because then A=5+1 and 59+37 is correct ... Ok, it was just messing, really it was only a typo... ;) – Fran Dec 3 '18 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.