Change display style in xlop package
This may have broken some other constructs in the package but....
\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}
Here's another option, producing the desired alignment (with the same warning as in David's answer: "This may have broken some other constructs in the package, but..."). Since the code uses \tikzmark
, two (or three) runs are needed for the code to stabilize:
\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}