原来的线。我想用浮点数表示长除法,但结果很奇怪。数字没有对齐(黄色)。而且有些数字相距很远(红色)。
\documentclass{article}
\usepackage[TABcline]{tabstackengine}
\TABstackMath
\renewcommand\stackalignment{l}
\newcommand\lminus{\llap{$-$}}
{\catcode`-=\active
\gdef -{\lminus}}
\newcommand\minusactive{\phantom{-}\catcode`-=\active}
\setstacktabbedgap{3pt}
\begin{document}
\begin{tabular}{ll@{\hspace{10ex}}c}
$
\minusactive
\tabbedShortunderstack[r]{
&7,&6&2&4&:4=1,815\\
-&4&& &&&\\
\TABcline{2,3}
& &3&2&&&&\\
&-&3&2&&&&\\
\TABcline{3,4}
& & & &6& &&\\
& & &-&4& &&\\
\TABcline{5}
& & & & 2&0&\\
& & & -& 2&0&\\
\TABcline{5}
& & & &0&
}
$
\end{tabular}
\end{document}
答案1
像这样?
\documentclass{article}
\usepackage[TABcline]{tabstackengine}
\TABstackMath
\renewcommand\stackalignment{l}
\newcommand\lminus{\llap{$-$}}
{\catcode`-=\active
\gdef -{\lminus}}
\newcommand\minusactive{\phantom{-}\catcode`-=\active}
\setstacktabbedgap{3pt}
\begin{document}
\begin{tabular}{ll@{\hspace{10ex}}c}
$
\minusactive
\tabbedShortunderstack[r]{
&7\rlap{,}&6&2&4&:4=1,815\\
-&4&& &&&\\
\TABcline{2,3}
& &3&2&&&&\\
&-&3&2&&&&\\
\TABcline{3,4}
& & & &6& &&\\
& & &-&4& &&\\
\TABcline{5}
& & & & 2\rlap{$\; 0 $}&&\\
& & & -& 2\rlap{$\; 0 $}&&\\
\TABcline{5}
& & & &0&
}
$
\end{tabular}
\end{document}
答案2
如果不需要显示千位分隔符号(此处,
:),布局就会变得容易得多,而且只需使用array
环境就可以解决印刷问题。
\documentclass{article}
\usepackage{array} % for '\newcolumntype' macro
\newcolumntype{C}{>{{}}c<{{}}}
\usepackage{mathtools} % for '\mathllap' macro
\begin{document}
\[
\setlength\arraycolsep{0.5pt} % default: 5pt
\begin{array}[t]{@{} C @{} *{4}{c} CcC *{4}{c} @{}}
&7&6&2&4 &:&4&=& 1&9&0&6\\
-&4 \\ \cline{2-2}
&3&6 \\
-&3&6 \\ \cline{2-3}
& &0&2 \\
& &\mathllap{-}&0 \\ \cline{4-4}
& & &2&4\\
& &\mathllap{-}&2&4\\ \cline{4-5}
& & & &0\rlap{.} % "\rlap{.}" is optional
\\ \cline{5-5} % optional
\end{array}
\qquad
\begin{array}[t]{@{} C @{} *{4}{c} CcC *{4}{c} @{}}
&7&2&6&0 &:&4&=& 1&8&1&5\\
-&4 \\ \cline{2-2}
&3&2 \\
-&3&2 \\ \cline{2-3}
& &0&6 \\
& &\mathllap{-}&4 \\ \cline{4-4}
& & &2&0\\
& &\mathllap{-}&2&0\\ \cline{4-5}
& & & &0\rlap{.} % "\rlap{.}" is optional
\\ \cline{5-5} % optional
\end{array}
\]
\end{document}