答案1
可以使用以下方法完成此操作array
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\renewcommand\arraystretch{1.2}
\begin{array}{c@{}c@{\,}c@{\,}c@{\,}c@{\,}ccl}
& \makebox[0pt]{\raisebox{-.5\normalbaselineskip}[0pt][0pt]{$\times$}} & & 1 & 2 & 3 \\
& & & 4 & 5 & 6 \\
\cline{3-6}
& & & 7 & 3 & 8 & & \text{(this is $123 \times 6$.)} \\
+& & 6 & 1 & 5 & & & \text{(this is $123 \times 5$, shifted one position to the left.)} \\
& 4 & 9 & 2 & & & & \text{(this is $123 \times 4$, shifted one position to the left.)} \\
\cline{1-6}
& 5 & 6 & 0 & 8 & 8
\end{array}
\]
\end{document}
随着arydshln
包一可以得到结果上方的双虚线:
\documentclass{article}
\usepackage{amsmath}
\usepackage{arydshln}
\setlength\dashlinedash{5pt}
\setlength\dashlinegap{2.5pt}
\begin{document}
\[
\renewcommand\arraystretch{1.2}
\begin{array}{c@{}c@{\,}c@{\,}c@{\,}c@{\,}ccl}
& \makebox[0pt]{\raisebox{-.5\normalbaselineskip}[0pt][0pt]{$\times$}} & & 1 & 2 & 3 \\
& & & 4 & 5 & 6 \\
\cline{3-6}
& & & 7 & 3 & 8 & & \text{(this is $123 \times 6$.)} \\
+& & 6 & 1 & 5 & & & \text{(this is $123 \times 5$, shifted one position to the left.)} \\
& 4 & 9 & 2 & & & & \text{(this is $123 \times 4$, shifted one position to the left.)} \\
\cdashline{1-6}\\[-1.09\normalbaselineskip]\cdashline{1-6}
& 5 & 6 & 0 & 8 & 8
\end{array}
\]
\end{document}
答案2
A. Allet 被删除的答案的方向是正确的,但该xlop
程序包不仅可以自动进行乘法运算,还可以显示移位的位置,以及包含 和\oplput
的注释\oprput
:
\documentclass{article}
\usepackage{xlop}
\begin{document}
\opmul[displayshiftintermediary=all]{123}{456}
\oplput(1,3){(this is $123 \times 6$.)}
\oprput(-5,2){$+$}
\oplput(1,2){(this is $123 \times 5$, shifted one position to the left.)}
\oplput(1,1){(this is $123 \times 4$, shifted two positions to the left.)}
\end{document}
顺便说一句,插入的评论也可以自动乘法,因此任何错误输入都会更加明显:
\documentclass{article}
\usepackage{xlop,xcolor}
\begin{document}
\opmul[displayshiftintermediary=all]{123}{456}
\oplput(1,3){(\opmul[style=text]{123}{6})}
\oplput(1,2){(\opmul[style=text]{123}{5})}
\oplput(1,1){(\opmul[style=text]{123}{4})}
\end{document}
答案3
你可以使用 xlop 包
http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/generic/xlop/doc/xlop-doc.pdf
第 15-16 页