#Simple addition "graphic"

1 messages · Page 1 of 1 (latest)

dull schooner
#
\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{align*}
        &&&&&|10111001\\
        10111001&&\longrightarrow&&&+|1\\
        \hline\\
        &&&&&1|10111001
    \end{align*}
\end{document}

Is the code I used to create the current output. Normally I'd use it for aligning equations at the = sign vertically, but I'm trying to create the above situation with it. Any other ways more elegant would obviously be much appreciated. I hope the provided image explains enough what I am trying to achieve, thanks.

inner roverBOT
#

hopcefizl
Compile Error! Click the errors reaction for more information.
(You may edit your message to recompile.)

dull schooner
#

also I know the addition with the binary numbers is incorrect, I just copy pasted the same number

#

and it would be even better if the output could be with the typewriter font :)

dull schooner
#

if anyone manages to find a solution, tag me so I don't accidentally miss your reply

fluid kiln
#
\documentclass{article}
\usepackage{array}
\begin{document}
{\ttfamily%
\begin{tabular}{rr|r}
    && 10111001 \\
    10111001 \(\longrightarrow\) & + & 1 \\ \cline{2-3}
    &1 & 10111001
\end{tabular}
}
\end{document}

With package array, @dull schooner (edit: font)

dull schooner
fluid kiln
#

Exactly. The package also provides more options to adjust the columns' widths, alignments, and more

#

,texdoc array

inner roverBOT
dull schooner
#

Sweet, thanks!

#

I also didn't know curly brackets could be freely used like that to limit where the font type ends.