更改xlop包中的显示样式

更改xlop包中的显示样式

我最近发现了这个包脫位自动排版小学计算。例如,将其用于除法,输出结果如下。

\documentclass{article}

\usepackage{xlop}

\begin{document}   

\opdiv[period=true,voperation=top,displayintermediary=all,decimalsepsymbol={,},shiftdecimalsep=none,maxdivstep=30]{54.60}{28}

\end{document}

xlop 的输出

但是我想要这样的显示风格:

所需显示样式

我手动标记的部分很重要,即“:28 = 1,95”,而不是 xlop 显示除数和结果的方式。此外,我希望 xlop 输出中的垂直线和右侧水平线消失。

我猜测 xlop 中没有这个开关,所以我检查了 xlop 的源代码并想修改其中的一部分(在我的文档中的 amakeatlettermakeatotherpair 之间)。

我设法意识到显示操作是在宏中完成的\op@divdisplayone。让我在这里引用它(我在似乎相关的行中添加了注释):

\def\op@divdisplayone{%
  \begingroup
    \op@count@z=\z@\relax
    \op@count@i=\OP@a@w
    \loop
    \ifnum\@nameuse{OP@a@\the\op@count@i}=0
      \advance\op@count@i by-1
      \advance\op@count@z by1
    \repeat
    \op@count@i=\op@firstlength
    \advance\op@count@i by\op@count@z
    \xdef\op@firstlength{\the\op@count@i}%
    \setbox2=\vbox{%
      \op@count@i=\op@firstlength
      \advance\op@count@i by1
      \hbox{%
        \ifx\op@displayintermediary\op@string@none\else
% add 0.25
          \ifx\op@displayintermediary\op@string@None\else
% end add 0.25
            \kern\opcolumnwidth
            \advance\op@count@i by1
% add 0.25
          \fi
% end add 0.25
        \fi
        \ifop@dividendbridge
          \vrule width0pt depth0pt height\oplineheight
          \opvline(0,1){0.4}%
          \ophline(0,1){\op@firstlength}%
          \opvline(\op@firstlength,1){0.4}%
        \fi
        \op@display{operandstyle.1}{a}%
        \ifnum\op@shift=0\relax\else
          \op@count@v=\op@shift
          \advance\op@count@v by\OP@a@d
          \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}%
        \fi
      }%
      \op@count@z=\OP@q@w
      \op@count@ii=1\relax
      \ifx\op@displayintermediary\op@string@none
        \advance\op@count@i by-1\relax
% add 0.25
      \else\ifx\op@displayintermediary\op@string@None
        \advance\op@count@i by-1\relax
% end add 0.25
      \else
        \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax
        \op@count@iii=\op@count@i
        \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
        \hbox{%
          \ifx\op@voperator\op@string@center
            \oplput(0,0.5){\op@subsymbol}%
          \else\ifx\op@voperator\op@string@top
            \oplput(0,1){\op@subsymbol}%
          \else
            \oplput(0,0){\op@subsymbol}%
          \fi\fi
          \ophline(1,-0.25){\op@firstlength}%
          \advance\op@count@ii by1
          \kern\op@count@iii\opcolumnwidth
          \op@display{intermediarystyle.1}%
                     {T\the\op@count@iv}%
        }%
% modif 0.25
      \fi\fi
% end modif 0.25
      {\global\setbox4=\hbox{}\setbox4=\box4}%
      \loop
        \advance\op@count@z by-1
        \advance\op@count@i by1\relax
      \ifnum\op@count@z>0\relax
        \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax
        \ifnum\op@count@iv=0
          \ifx\op@displayintermediary\op@string@all
            \op@count@v=\op@count@i
            \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \op@display{remainderstyle.\the\op@count@ii}%
                         {R\the\op@count@ii}%
            }%
            \op@count@iii=\op@count@i
            \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \ifx\op@voperator\op@string@center
                \oplput(-1,0.5){\op@subsymbol}%
              \else\ifx\op@voperator\op@string@top
                \oplput(-1,1){\op@subsymbol}%
              \else
                \oplput(-1,0){\op@subsymbol}%
              \fi\fi
              \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}%
              \kern-\op@count@v\opcolumnwidth
              \kern\op@count@iii\opcolumnwidth
              \op@display{intermediarystyle.\the\op@count@ii}%
                         {T\the\op@count@iv}%
            }%
          \else
            \ifnum\@nameuse{OP@R\the\op@count@ii @w}=2
              \ifnum\@nameuse{OP@R\the\op@count@ii @2}=0
                \op@makebox{1}{0}{remainderstyle.\the\op@[email protected]}{zero}%
                \setbox4=\hbox to\opcolumnwidth{\hss\box0\hss}%
              \fi
            \fi
          \fi
          \advance\op@count@ii by1\relax
        \else
          \op@count@v=\op@count@i
          \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}%
          \ifvoid4\relax\else
            \advance\op@count@v by-1
          \fi
          \hbox{%
            \kern\op@count@v\opcolumnwidth\copy4
            \op@display{remainderstyle.\the\op@count@ii}%
                       {R\the\op@count@ii}%
          }%
          \advance\op@count@ii by1\relax
          \ifx\op@displayintermediary\op@string@none
% add 0.25
          \else\ifx\op@displayintermediary\op@string@None
% end add 0.25
          \else
            \op@count@iii=\op@count@i
            \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \ifx\op@voperator\op@string@center
                \oplput(-1,0.5){\op@subsymbol}%
              \else\ifx\op@voperator\op@string@top
                \oplput(-1,1){\op@subsymbol}%
              \else
                \oplput(-1,0){\op@subsymbol}%
              \fi\fi
              \advance\op@count@ii by-1
              \ifvoid4\relax
                \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}%
              \else
                \ophline(0,-0.25){\@nameuse{OP@T\the\op@count@iv @w}}%
                \ophline(\@nameuse{OP@T\the\op@count@iv @w},-0.25){1}%
                {\setbox4=\box4}%
              \fi
              \advance\op@count@ii by1
              \kern-\op@count@v\opcolumnwidth
              \kern\op@count@iii\opcolumnwidth
              \op@display{intermediarystyle.\the\op@count@ii}%
                         {T\the\op@count@iv}%
            }%
% modif 0.25
          \fi\fi
% end modif 0.25
        \fi
      \repeat
      \advance\op@count@i by-1
      \op@count@iii=\op@count@i
      \advance\op@count@iii by-\@nameuse{OP@R\the\op@count@ii @w}%
      \hbox{%
        \kern\op@count@iii\opcolumnwidth
        \op@display{remainderstyle.\the\op@count@ii}%
                   {R\the\op@count@ii}%
      }%
    }%
    \setbox3=\vbox{%
      \op@count@v=\op@max{\OP@qq@w}{\OP@b@w}
      \hbox{\ophline(-0.5,-0.25){\the\op@[email protected]}%
            \op@display{operandstyle.2}{b} %%This seems to be the divisor
        \ifnum\op@shift=0\relax\else
          \op@count@v=\op@shift
          \advance\op@count@v by\OP@b@d
          \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}%
        \fi}
      \hbox{\op@display{resultstyle}{qq}} %%This seems to be the result
    }%
    \dimen0=\ht2
    \ifdim\dimen0>\ht3
      \ht3=\ht2
    \else
      \ht2=\ht3
    \fi
    \ifx\op@voperation\op@string@top
      \dimen0=\ht2
      \advance\dimen0 by-0.5\oplineheight
      \ht2=0.75\oplineheight
      \ht3=0.75\oplineheight
      \dp2=\dimen0
      \dp2=\dimen0
    \fi
    \setbox1=\hbox{%
      \box2
      \kern0.5\opcolumnwidth
      \kern-0.5\op@hrulewidth
      \ifx\voperation\op@string@top
        \vrule width\op@hrulewidth
      \else
        \vrule width\op@hrulewidth
      \fi
      \kern0.5\opcolumnwidth
      \kern-0.5\op@hrulewidth
      \box3
    }%
    \ifx\op@voperation\op@string@center
      \setbox1=\hbox{$\vcenter{\box1}$}%
    \fi
    \leavevmode\box1
  \endgroup
}
\def\op@div#1#2#3#4#5{%
  \begingroup
    \def\op@divmode{#1}%
    \op@copy{#2}{da}%
    \op@copy{#3}{db}%
    \op@count@iv=0
    \op@count@iii=\op@max{\OP@da@d}{\OP@db@d}\relax
    \op@powten{da}{\the\op@count@iii}%
    \op@powten{db}{\the\op@count@iii}%
% add 0.23
    \op@unzero{da}%
    \op@unzero{db}%
% end 0.23
    \ifnum\op@divmode=1
      \op@cmp{da}{maxinteger}%
      \ifopgt
        \op@warning{I can't deal period with such great dividend
                    (max = 2147483647).^^J
                    Use of maxdivstep instead period.}%
        \def\op@divmode{0}%
      \else \op@cmp{db}{maxdivperiod}%
      \ifopgt
        \op@warning{I can't deal period with such great divisor
                    (max = 214748363).^^J
                    Use of maxdivstep instead period.}%
        \def\op@divmode{0}%
      \else
        \op@unsplit{da}{@a}%
        \op@unsplit{db}{@b}%
        \op@divperiod{\Op@@a}{\Op@@b}{op@lengthperiod}%
        \ifnum\op@lengthperiod>\op@safedivstep
          \op@warning{Period of division is too big
                      (\op@lengthperiod\space > safedivstep).^^J
                      \space\space\space Division will stop
                      before reach it.}%
        \fi
      \fi\fi
    \fi
    \op@multable{db}%
    \op@copy{da}{R}%
    \op@cmp{da}{db}%
    \ifople
      \op@count@i=\OP@da@w
    \else
      \xdef\OP@R@d{0}%
      \xdef\OP@R@s{0}%
      \op@count@i=\@nameuse{OP@db@w}%
      \op@leftdividend{\the\op@count@i}%
      \op@cmp{R}{db}%
      \ifoplt
        \ifnum\OP@da@w>\op@count@i
          \advance\op@count@i by1
          \op@leftdividend{\the\op@count@i}%
        \fi
      \fi
    \fi
    \xdef\op@firstlength{\the\op@count@i}%
    \op@count@i=-\op@count@i
    \advance\op@count@i by\OP@da@w
    \op@copy{R}{R0}%
    \op@copy{zero}{dq}%
    \op@count@ii=0
    \op@againtrue
    \loop
    \ifop@again
      \op@tableextract{R}%
      \op@multen{dq}%
      \@namexdef{OP@dq@1}{\op@k}%
      \op@sub{R}{T\op@k}{dr}%
      \op@unzero{T\op@k}%
      \op@multen{dr}%
      \ifnum\op@count@i>0
        \@namexdef{OP@dr@1}{\@nameuse{OP@da@\the\op@count@i}}%
      \fi
      \advance\op@count@i by-1\relax
      \op@unzero{dr}%
      \ifnum\OP@dr@w=1
        \xdef\OP@dr@w{2}%
        \xdef\OP@dr@i{2}%
        \@namexdef{OP@dr@2}{0}%
      \fi
      \advance\op@count@ii by1\relax
      \op@copy{dr}{R\the\op@count@ii}%
      \op@copy{dr}{R}%
      \ifcase\op@divmode\relax
        \ifnum\op@count@ii<\op@maxdivstep\relax\else
          \op@againfalse
        \fi
        \ifnum\op@count@i<0\relax%
          \op@cmp{zero}{R}%
          \ifopeq
            \op@againfalse
          \fi
        \fi
      \or
        \ifnum\op@count@ii<\op@safedivstep\relax\else
          \op@againfalse
        \fi
        \ifnum\op@count@i<-\op@lengthperiod\relax
          \op@count@iv=\op@count@ii
          \advance\op@count@iv by-\op@lengthperiod
          \op@cmp{R\the\op@count@iv}{R\the\op@count@ii}%
          \ifopeq
            \op@againfalse
          \fi
        \fi
      \or
        \ifnum\op@count@i=-1
          \op@againfalse
        \fi
      \fi
    \repeat
    \op@copy{zero}{T0}%
    \advance\op@count@i by1\relax
    \ifnum\op@count@i<0
      \xdef\OP@dq@d{-\the\op@count@i}%
      \op@count@z=\OP@dq@w
      \advance\op@count@z by\op@count@i
      \xdef\OP@dq@i{\the\op@count@z}%
    \fi
    \op@unzero{dq}%
    \op@copy{dq}{#4}%
    \op@unzero{dr}%
    \op@copy{dr}{R}%
    \op@rshift{1}{dr}%
    \op@copy{dr}{R\the\op@count@ii}%
    \op@count@i=\op@count@iii
    \advance\op@count@i by1
    \advance\op@count@i by\OP@dq@d\relax
    \op@count@ii=\op@count@i
    \advance\op@count@ii by\OP@R@w
    \op@format{\the\op@count@ii}{0}{R}%
    \op@count@z=\OP@R@w
    \advance\op@count@z by-\op@count@i
    \xdef\OP@R@i{\the\op@count@z}%
    \xdef\OP@R@d{\the\op@count@i}%
    \op@unzero{R}%
    \op@copy{R}{#5}%
  \endgroup
}

但是我只是一个 LaTeX 用户,对 TeX 本身并不太了解。不过对于我来说,对于了解 TeX 的人来说,这似乎只是一个小修改,所以我希望有人可以告诉我如何实现所需的显示样式。

答案1

这是另一个选项,可产生所需的对齐(带有与 David 的回答相同的警告:“这可能破坏了包中的其他一些构造,但是……”)。由于代码使用\tikzmark,因此需要运行两次(或三次)才能使代码稳定:

\documentclass{article}
\usepackage{xlop}
\usepackage{tikz}

\newcommand\tikzmark[1]{%
  \tikz[remember picture,overlay] \node[inner xsep=0pt,outer sep=0pt,anchor=base,yshift=0.5ex] (#1) {};}

\makeatletter
\def\op@divdisplayone{%
  \begingroup
    \op@count@z=\z@\relax
    \op@count@i=\OP@a@w
    \loop
    \ifnum\@nameuse{OP@a@\the\op@count@i}=0
      \advance\op@count@i by-1
      \advance\op@count@z by1
    \repeat
    \op@count@i=\op@firstlength
    \advance\op@count@i by\op@count@z
    \xdef\op@firstlength{\the\op@count@i}%
    \setbox2=\vbox{%
      \op@count@i=\op@firstlength
      \advance\op@count@i by1
      \hbox{%
        \ifx\op@displayintermediary\op@string@none\else
% add 0.25
          \ifx\op@displayintermediary\op@string@None\else
% end add 0.25
            \kern\opcolumnwidth
            \advance\op@count@i by1
% add 0.25
          \fi
% end add 0.25
        \fi
        \ifop@dividendbridge
          \vrule width0pt depth0pt height\oplineheight
          \opvline(0,1){0.4}%
          \ophline(0,1){\op@firstlength}%
          \opvline(\op@firstlength,1){0.4}%
        \fi
        \op@display{operandstyle.1}{a}\tikzmark{a}%
        \ifnum\op@shift=0\relax\else
          \op@count@v=\op@shift
          \advance\op@count@v by\OP@a@d
          \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}%
        \fi
      }%
      \op@count@z=\OP@q@w
      \op@count@ii=1\relax
      \ifx\op@displayintermediary\op@string@none
        \advance\op@count@i by-1\relax
% add 0.25
      \else\ifx\op@displayintermediary\op@string@None
        \advance\op@count@i by-1\relax
% end add 0.25
      \else
        \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax
        \op@count@iii=\op@count@i
        \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
        \hbox{%
          \ifx\op@voperator\op@string@center
            \oplput(0,0.5){\op@subsymbol}%
          \else\ifx\op@voperator\op@string@top
            \oplput(0,1){\op@subsymbol}%
          \else
            \oplput(0,0){\op@subsymbol}%
          \fi\fi
          \ophline(1,-0.25){\op@firstlength}%
          \advance\op@count@ii by1
          \kern\op@count@iii\opcolumnwidth
          \op@display{intermediarystyle.1}%
                     {T\the\op@count@iv}%
        }%
% modif 0.25
      \fi\fi
% end modif 0.25
      {\global\setbox4=\hbox{}\setbox4=\box4}%
      \loop
        \advance\op@count@z by-1
        \advance\op@count@i by1\relax
      \ifnum\op@count@z>0\relax
        \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax
        \ifnum\op@count@iv=0
          \ifx\op@displayintermediary\op@string@all
            \op@count@v=\op@count@i
            \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \op@display{remainderstyle.\the\op@count@ii}%
                         {R\the\op@count@ii}%
            }%
            \op@count@iii=\op@count@i
            \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \ifx\op@voperator\op@string@center
                \oplput(-1,0.5){\op@subsymbol}%
              \else\ifx\op@voperator\op@string@top
                \oplput(-1,1){\op@subsymbol}%
              \else
                \oplput(-1,0){\op@subsymbol}%
              \fi\fi
              \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}%
              \kern-\op@count@v\opcolumnwidth
              \kern\op@count@iii\opcolumnwidth
              \op@display{intermediarystyle.\the\op@count@ii}%
                         {T\the\op@count@iv}%
            }%
          \else
            \ifnum\@nameuse{OP@R\the\op@count@ii @w}=2
              \ifnum\@nameuse{OP@R\the\op@count@ii @2}=0
                \op@makebox{1}{0}{remainderstyle.\the\op@[email protected]}{zero}%
                \setbox4=\hbox to\opcolumnwidth{\hss\box0\hss}%
              \fi
            \fi
          \fi
          \advance\op@count@ii by1\relax
        \else
          \op@count@v=\op@count@i
          \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}%
          \ifvoid4\relax\else
            \advance\op@count@v by-1
          \fi
          \hbox{%
            \kern\op@count@v\opcolumnwidth\copy4
            \op@display{remainderstyle.\the\op@count@ii}%
                       {R\the\op@count@ii}%
          }%
          \advance\op@count@ii by1\relax
          \ifx\op@displayintermediary\op@string@none
% add 0.25
          \else\ifx\op@displayintermediary\op@string@None
% end add 0.25
          \else
            \op@count@iii=\op@count@i
            \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \ifx\op@voperator\op@string@center
                \oplput(-1,0.5){\op@subsymbol}%
              \else\ifx\op@voperator\op@string@top
                \oplput(-1,1){\op@subsymbol}%
              \else
                \oplput(-1,0){\op@subsymbol}%
              \fi\fi
              \advance\op@count@ii by-1
              \ifvoid4\relax
                \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}%
              \else
                \ophline(0,-0.25){\@nameuse{OP@T\the\op@count@iv @w}}%
                \ophline(\@nameuse{OP@T\the\op@count@iv @w},-0.25){1}%
                {\setbox4=\box4}%
              \fi
              \advance\op@count@ii by1
              \kern-\op@count@v\opcolumnwidth
              \kern\op@count@iii\opcolumnwidth
              \op@display{intermediarystyle.\the\op@count@ii}%
                         {T\the\op@count@iv}%
            }%
% modif 0.25
          \fi\fi
% end modif 0.25
        \fi
      \repeat
      \advance\op@count@i by-1
      \op@count@iii=\op@count@i
      \advance\op@count@iii by-\@nameuse{OP@R\the\op@count@ii @w}%
      \hbox{%
        \kern\op@count@iii\opcolumnwidth
        \op@display{remainderstyle.\the\op@count@ii}%
                   {R\the\op@count@ii}%
      }%
    }%
    \setbox3=\vbox{%
      \op@count@v=\op@max{\OP@qq@w}{\OP@b@w}
      \hbox{%\ophline(-0.5,-0.25){\the\op@[email protected]}%
            :\op@display{operandstyle.2}{b}=\op@display{resultstyle}{qq} %%This seems to be the divisor
        \ifnum\op@shift=0\relax\else
          \op@count@v=\op@shift
          \advance\op@count@v by\OP@b@d
          \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}%
        \fi}
      %\hbox{\op@display{resultstyle}{qq}} %%This seems to be the result
    }%
    \dimen0=\ht2
    \ifdim\dimen0>\ht3
      \ht3=\ht2
    \else
      \ht2=\ht3
    \fi
    \ifx\op@voperation\op@string@top
      \dimen0=\ht2
      \advance\dimen0 by-0.5\oplineheight
      \ht2=0.75\oplineheight
      \ht3=0.75\oplineheight
      \dp2=\dimen0
      \dp2=\dimen0
    \fi
    \setbox1=\hbox{%
      \box2
%      \kern0.5\opcolumnwidth
%      \kern-0.5\op@hrulewidth
%      \ifx\voperation\op@string@top
%        \vrule width\op@hrulewidth
%      \else
%        \vrule width\op@hrulewidth
%      \fi
%      \kern0.5\opcolumnwidth
%      \kern-0.5\op@hrulewidth
      \begin{tikzpicture}[remember picture,overlay]
         \node[anchor=west,inner xsep=0pt] at (a) {\box3};
      \end{tikzpicture}
    }%
    \ifx\op@voperation\op@string@center
      \setbox1=\hbox{$\vcenter{\box1}$}%
    \fi
    \leavevmode\box1
  \endgroup
}
\makeatother

\begin{document}   

\opdiv[period=true,voperation=top,displayintermediary=all,decimalsepsymbol={,},shiftdecimalsep=none,maxdivstep=30]{54.63}{28}

\opdiv[period=true,voperation=top,displayintermediary=all,decimalsepsymbol={,},shiftdecimalsep=none,maxdivstep=30]{54.60}{1}

\end{document}

在此处输入图片描述

答案2

在此处输入图片描述

这可能破坏了包中的一些其他构造,但是......

\documentclass{article}

\usepackage[]{xlop}

\makeatletter

\def\op@divdisplayone{%
  \begingroup
    \op@count@z=\z@\relax
    \op@count@i=\OP@a@w
    \loop
    \ifnum\@nameuse{OP@a@\the\op@count@i}=0
      \advance\op@count@i by-1
      \advance\op@count@z by1
    \repeat
    \op@count@i=\op@firstlength
    \advance\op@count@i by\op@count@z
    \xdef\op@firstlength{\the\op@count@i}%
    \setbox2=\vbox{%
      \op@count@i=\op@firstlength
      \advance\op@count@i by1
      \hbox{%
        \ifx\op@displayintermediary\op@string@none\else
% add 0.25
          \ifx\op@displayintermediary\op@string@None\else
% end add 0.25
            \kern\opcolumnwidth
            \advance\op@count@i by1
% add 0.25
          \fi
% end add 0.25
        \fi
        \ifop@dividendbridge
          \vrule width0pt depth0pt height\oplineheight 
          \opvline(0,1){0.4}%
          \ophline(0,1){\op@firstlength}%
          \opvline(\op@firstlength,1){0.4}%
        \fi
        \op@display{operandstyle.1}{a}%
        \ifnum\op@shift=0\relax\else
          \op@count@v=\op@shift
          \advance\op@count@v by\OP@a@d
          \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}%
        \fi
      }%
      \op@count@z=\OP@q@w
      \op@count@ii=1\relax
      \ifx\op@displayintermediary\op@string@none
        \advance\op@count@i by-1\relax
% add 0.25
      \else\ifx\op@displayintermediary\op@string@None
        \advance\op@count@i by-1\relax
% end add 0.25
      \else
        \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax
        \op@count@iii=\op@count@i
        \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
        \hbox{%
          \ifx\op@voperator\op@string@center
            \oplput(0,0.5){\op@subsymbol}%
          \else\ifx\op@voperator\op@string@top
            \oplput(0,1){\op@subsymbol}%
          \else
            \oplput(0,0){\op@subsymbol}%
          \fi\fi
          \ophline(1,-0.25){\op@firstlength}%
          \advance\op@count@ii by1
          \kern\op@count@iii\opcolumnwidth
          \op@display{intermediarystyle.1}%
                     {T\the\op@count@iv}%
        }%
% modif 0.25
      \fi\fi
% end modif 0.25
      {\global\setbox4=\hbox{}\setbox4=\box4}%
      \loop
        \advance\op@count@z by-1
        \advance\op@count@i by1\relax
      \ifnum\op@count@z>0\relax
        \op@count@iv=\@nameuse{OP@q@\the\op@count@z}\relax
        \ifnum\op@count@iv=0
          \ifx\op@displayintermediary\op@string@all
            \op@count@v=\op@count@i
            \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \op@display{remainderstyle.\the\op@count@ii}%
                         {R\the\op@count@ii}%
            }%
            \op@count@iii=\op@count@i
            \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \ifx\op@voperator\op@string@center
                \oplput(-1,0.5){\op@subsymbol}%
              \else\ifx\op@voperator\op@string@top
                \oplput(-1,1){\op@subsymbol}%
              \else
                \oplput(-1,0){\op@subsymbol}%
              \fi\fi
              \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}%
              \kern-\op@count@v\opcolumnwidth
              \kern\op@count@iii\opcolumnwidth
              \op@display{intermediarystyle.\the\op@count@ii}%
                         {T\the\op@count@iv}%
            }%
          \else
            \ifnum\@nameuse{OP@R\the\op@count@ii @w}=2
              \ifnum\@nameuse{OP@R\the\op@count@ii @2}=0
                \op@makebox{1}{0}{remainderstyle.\the\op@[email protected]}{zero}%
                \setbox4=\hbox to\opcolumnwidth{\hss\box0\hss}%
              \fi
            \fi
          \fi
          \advance\op@count@ii by1\relax
        \else
          \op@count@v=\op@count@i
          \advance\op@count@v by-\@nameuse{OP@R\the\op@count@ii @w}%
          \ifvoid4\relax\else
            \advance\op@count@v by-1
          \fi
          \hbox{%
            \kern\op@count@v\opcolumnwidth\copy4
            \op@display{remainderstyle.\the\op@count@ii}%
                       {R\the\op@count@ii}%
          }%
          \advance\op@count@ii by1\relax
          \ifx\op@displayintermediary\op@string@none
% add 0.25
          \else\ifx\op@displayintermediary\op@string@None
% end add 0.25
          \else
            \op@count@iii=\op@count@i
            \advance\op@count@iii by-\@nameuse{OP@T\the\op@count@iv @w}%
            \hbox{%
              \kern\op@count@v\opcolumnwidth
              \ifx\op@voperator\op@string@center
                \oplput(-1,0.5){\op@subsymbol}%
              \else\ifx\op@voperator\op@string@top
                \oplput(-1,1){\op@subsymbol}%
              \else
                \oplput(-1,0){\op@subsymbol}%
              \fi\fi
              \advance\op@count@ii by-1
              \ifvoid4\relax
                \ophline(0,-0.25){\@nameuse{OP@R\the\op@count@ii @w}}%
              \else
                \ophline(0,-0.25){\@nameuse{OP@T\the\op@count@iv @w}}%
                \ophline(\@nameuse{OP@T\the\op@count@iv @w},-0.25){1}%
                {\setbox4=\box4}%
              \fi
              \advance\op@count@ii by1
              \kern-\op@count@v\opcolumnwidth
              \kern\op@count@iii\opcolumnwidth
              \op@display{intermediarystyle.\the\op@count@ii}%
                         {T\the\op@count@iv}%
            }%
% modif 0.25
          \fi\fi
% end modif 0.25
        \fi
      \repeat
      \advance\op@count@i by-1
      \op@count@iii=\op@count@i
      \advance\op@count@iii by-\@nameuse{OP@R\the\op@count@ii @w}%
      \hbox{%
        \kern\op@count@iii\opcolumnwidth
        \op@display{remainderstyle.\the\op@count@ii}%
                   {R\the\op@count@ii}%
      }%
    }%
    \setbox3=\vbox{%
      \op@count@v=\op@max{\OP@qq@w}{\OP@b@w}
      \hbox{%\ophline(-0.5,-0.25){\the\op@[email protected]}%
            \op@display{operandstyle.2}{b}%
        \ifnum\op@shift=0\relax\else
          \op@count@v=\op@shift
          \advance\op@count@v by\OP@b@d
          \oplput(-\the\op@count@v,0){\op@strikedecimalsepsymbol}%
        \fi}
      %\hbox{XXX\op@display{resultstyle}{qq}}
    }%
    \dimen0=\ht2
    \ifdim\dimen0>\ht3
      \ht3=\ht2
    \else
      \ht2=\ht3
    \fi
    \ifx\op@voperation\op@string@top
      \dimen0=\ht2
      \advance\dimen0 by-0.5\oplineheight
      \ht2=0.75\oplineheight
      \ht3=0.75\oplineheight
      \dp2=\dimen0
      \dp2=\dimen0
    \fi
    \setbox1=\hbox{%
      \box2
      \kern0.5\opcolumnwidth
      \kern-0.5\op@hrulewidth
      \ifx\voperation\op@string@top
        KKK\vrule width\op@hrulewidth
      \else
        : %\vrule width\op@hrulewidth :@:
      \fi
      \kern0.5\opcolumnwidth
      \kern-0.5\op@hrulewidth
      \box3
      = \hbox{\op@display{resultstyle}{qq}}
    }%
    \ifx\op@voperation\op@string@center
      \setbox1=\hbox{$\vcenter{\box1}$}%
    \fi
    \leavevmode\box1
  \endgroup
}
\makeatother



\begin{document}   

\opdiv
[period=true,voperation=top,displayintermediary=all,decimalsepsymbol={,},shiftdecimalsep=none,maxdivstep=30]
{54.60}{28}

\end{document}

相关内容