# tabular environment: Showing overflow in binary addition?

I have the following code to show binary addition of two numbers:

\documentclass{article}
\begin{document}
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{lllll}
& 1 & 0 & 0 & 1 \\
+ & 1 & 1 & 0 & 0 \\
\hline
1 & 0 & 1 & 0 & 1 \\
\hline
\end{tabular}
\end{document}


I want to be able to indicate the overflow to the reader somehow. 2 ideas that I have in mind are presented below:

## 2. Boxing the overflown bit

EDIT: User Ivan pointed out that using fbox{1} would do it and it works perfectly. But I would still like to know how to put underbraces. Thanks!

• Maybe \fbox{1} ?
– Ivan
Apr 22, 2021 at 14:50
• Actually, I had always used fbox on figures so it never occured to me. Thanks! I would still like to know the underbrace solution, so I am editing the question. Apr 22, 2021 at 14:53
• Check out this answer Underbrace under table, stretching over multiple columns Apr 22, 2021 at 15:04

After checking out the post linked in the comments I have decided on the following solution:

\documentclass{article}

\begin{document}
\begin{table}[h]\centering
\begin{tabular}{cllll}
& 1 & 0 & 0 & 1 \\
$+$ & 1 & 1 & 0 & 0 \\
\hline
\fbox{1} & 0 & 1 & 0 & 1 \\
\hline \\[-3ex]
& \multicolumn{4}{c}{\upbracefill} \\
& \multicolumn{4}{c}{\small significant bits}
\end{tabular}
\end{table}
\end{document}


which produces basically what I want:

If the box is a little too close to the hrule s then you can increase the row separation using \renewcommand{\arraystretch}{...} and adjust the \\[] lengths accordingly!