格式化长除法的下一步

格式化长除法的下一步

我已经发过后面这个关于长除法。

想法下面显示的内容运行完美。但直到今天,我才用一个在商的小数点前有几位数字的示例尝试了一下,结果很糟糕。

我有两个问题:

  • 我们如何才能让它在商的小数点前有几位数字的情况下正常工作?我可能需要付出更多的努力才能解决这个问题,但如果下一个问题没有好的答案,我不愿意这样做,因为这超出了我目前的能力。

  • 我们如何将其制作成一个用户友好的样式文件,以便用户只需输入数字,并提示每个数字在长除法过程中的作用?

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
% \usepackage{xcolor}
\usepackage{array, booktabs}
\parindent=0pt
\pagestyle{empty}

\begin{document}

\[
\begin{array}{ rr@{} %>{\color{red}}
c@{}*{6}{c@{\mkern2mu}} }
& 0 & . & 7 & 1 & 6 & 2 \\ \cmidrule[0.6pt](l{-0.385em}){2-8}\\[-16.9pt]
74\;\rlap{\Large)} &53 & . & 0 & 0 & 0 & 0 & 0 \\
& 51 & & 8 \\ \cmidrule(l{1ex}){2-5}
& 1 & & 2 & 0 \\
& & & 7 & 4 \\ \cmidrule{3-6}
& & & 4 & 6 & 0 \\
& & & 4 & 4 & 4 \\ \cmidrule{4-7}
& & & & 1 & 6 & 0 \\
& & & & 1 & 4 & 8 \\ \cmidrule{5-8}
& & & & & 1 & 2 & 0
\end{array}
\]

\[
\begin{array}{ rr@{} %>{\color{red}}
c@{}*{8}{c@{\mkern2mu}} }
& 101 & . & 8 & 0 & 2 & 0 & 8 & 3 \\ \cmidrule[0.6pt](l{-0.385em}){2-8}\\    [-16.9pt]
96\;\rlap{\Large)} &9773 & . & 0 & 0 & 0 & 0 & 0 \\
& 96\phantom{00} & &  \\ \cmidrule(l{1ex}){2-2}
& 17\phantom{0} & & \\
&  0\phantom{0} \\ \cmidrule(l{1ex}){2-2}
& 173 \\
&  96 \\ \cmidrule(l{1ex}){2-3}
& 77 & & 0 \\
& 76& & 8 \\ \cmidrule(l{1ex}){2-4}
& & & 2 & 0 \\
& & & & 0 \\ \cmidrule{3-5}
& & & 2 & 0 & 0 \\
& & & 1 & 9 & 2 \\ \cmidrule{3-6}
& & & & & 8 & 0 \\
& & & & & & 0 \\ \cmidrule{6-7}
& & & & & 8 & 0 & 0 \\
& & & & & 7 & 6 & 8 \\ \cmidrule{6-8}
& & & & & & 3 & 2 & 0 \\
& & & & & & 2 & 8 & 8 \\ \cmidrule{7-9}
& & & & & & & 3 & 2 & 0
\end{array}
\]

\end{document}

答案1

我必须为荷兰数字设计教科书做长除法。我也用这种方法对二进制数做长除法。诀窍是使用隐藏字符将数字缩进到正确的位置。宏\ph{}会处理这个问题。请注意,注释是荷兰语:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{xcolor}

%% Print hidden characters by using the white color, used for aligning numbers.
%% Please note that the dash must cast to mathbin. See:
%% http://tex.stackexchange.com/questions/21598/how-to-color-math-symbols
\newcommand\ph[1]{\if-#1\mathbin{\textcolor{white}{-}}\else\textcolor{white}{#1}\fi}

\begin{document}

\begin{equation*}
\setlength{\jot}{0pt}
\begin{split}
                                  &12345.67 \div 25 = 493.8268 \leftrightarrow \text{quoti\"ent}\\
\text{viermaal aftrekken}\qquad  &\underline{100}\ - \\
                                  &\ph{0}234 \\
\text{negenmaal aftrekken}\qquad &\ph{0}\underline{225}\ - \\
                                  &\ph{000}95 \\
\text{driemaal aftrekken}\qquad  &\ph{000}\underline{75}\ - \\
                                  &\ph{000} 20\ph{.}6 \\
\text{achtmaal aftrekken}\qquad  &\ph{000}\underline{20\ph{.}0}\ - \\
                                  &\ph{00000.}67 \\
\text{tweemaal aftrekken}\qquad  &\ph{00000.}\underline{50}\ - \\
                                  &\ph{00000.}170 \\
\text{zesmaal aftrekken}\qquad   &\ph{00000.}\underline{150}\ - \\
                                  &\ph{00000.0}200 \\
\text{achtmaal aftrekken}\qquad  &\ph{00000.0}\underline{200}\ - \\
                                  &\ph{00000.000}0 \leftrightarrow \text{rest} \\
\end{split}
\end{equation*}

\end{document}

相关内容