答案1
以下解决方案采用了array
环境。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{array,xcolor}
\newcommand\cy{\scriptstyle\textcolor{blue}{1}} % short for "\carry"
\begin{document}
\[
\setlength\arraycolsep{0pt}
\begin{array}{*{6}{c}}
& \cy & \cy & & \cy & \\[-0.8ex]
& & 1 & 1 & 0 & 1 \\
+ & & 0 & 1 & 0 & 1 \\
\hline
& 1 & 0 & 0 & 1 & 0
\end{array}
\]
\end{document}