summaryrefslogtreecommitdiff
path: root/macros/generic/xlop/tex/xlop.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/xlop/tex/xlop.tex')
-rw-r--r--macros/generic/xlop/tex/xlop.tex236
1 files changed, 189 insertions, 47 deletions
diff --git a/macros/generic/xlop/tex/xlop.tex b/macros/generic/xlop/tex/xlop.tex
index ef3360dd43..e6f922a580 100644
--- a/macros/generic/xlop/tex/xlop.tex
+++ b/macros/generic/xlop/tex/xlop.tex
@@ -1,12 +1,12 @@
-\def\fileversion{0.26}
-\def\filedate{2017/01/07}
+\def\fileversion{0.27}
+\def\filedate{2020/04/28}
%%
%% xlop.tex:
%% eXtra Large OPeration macros for Generic TeX.
-%% See `user.pdf' for documentation;
-%% `hacker.pdf' for explanation.
+%% See `xlop-doc.pdf' for documentation;
+%% `xlop-doc-fr.pdf' for french documentation.
%%
-%% Copyright 2005,2017, by Jean-C\^ome Charpentier
+%% Copyright 2005-2020, by Jean-C\^ome Charpentier
%% Jean-Come.Charpentier@wanadoo.fr
%%
%% This program may be distributed and/or modified under the
@@ -28,6 +28,9 @@
\newcount\op@count@iv
\newcount\op@count@v
\newcount\op@count@vi
+% add 0.27
+\newcount\op@nbop
+% end add 0.27
\newtoks\op@currentstyle
\expandafter\ifx\csname @latexerr\endcsname\relax
\long\def\@ifundefined#1#2#3{%
@@ -143,7 +146,13 @@
\def\op@string@american{american}
\def\op@string@both{both}
\def\op@string@bottom{bottom}
+% add 0.27
+\def\op@string@Bottom{Bottom}
+% end add 0.27
\def\op@string@center{center}
+% add 0.27
+\def\op@string@Center{Center}
+% end add 0.27
\def\op@string@decimal{decimal}
\def\op@string@delete{delete}
\def\op@string@display{display}
@@ -165,6 +174,9 @@
\def\op@string@strike{strike}
\def\op@string@text{text}
\def\op@string@top{top}
+% add 0.27
+\def\op@string@Top{Top}
+% end add 0.27
\def\op@string@true{true}
\def\op@string@warning{warning}
@@ -217,6 +229,29 @@
{Value must be `top', `center', or `bottom'}%
\fi\fi\fi
}
+% add 0.27
+\def\pOP@vmanyoperator#1{\edef\@tempa{#1}%
+ \ifx\@tempa\op@string@top
+ \let\op@vmanyoperator\op@string@top
+ \else\ifx\@tempa\op@string@bottom
+ \let\op@vmanyoperator\op@string@bottom
+ \else\ifx\@tempa\op@string@center
+ \let\op@vmanyoperator\op@string@center
+ \else\ifx\@tempa\op@string@Top
+ \let\op@vmanyoperator\op@string@Top
+ \else\ifx\@tempa\op@string@Bottom
+ \let\op@vmanyoperator\op@string@Bottom
+ \else\ifx\@tempa\op@string@Center
+ \let\op@vmanyoperator\op@string@Center
+ \else
+ \op@error{Parameter vmanyoperator accept only `top', `center',
+ `bottom', ^^J \space
+ `Top', `Center', and `Bottom'. Here, the value is `#1'}%
+ {Value must be `top', `center', `bottom', `Top', `Center',
+ or `Bottom'}%
+ \fi\fi\fi\fi\fi\fi
+}
+% end add 0.27
\def\pOP@hfactor#1{\edef\@tempa{#1}%
\ifx\@tempa\op@string@right
\let\op@hfactor\op@string@right
@@ -473,7 +508,11 @@
hrulewidth=0.4pt,vrulewidth=0.4pt,
behaviorsub=silent,country=french,
operandstyle=,resultstyle=,remainderstyle=,
- intermediarystyle=}
+ intermediarystyle=,
+ % add 0.27
+ vmanyoperator=center%
+ % end add 0.27
+}
\expandafter\ifx\csname @latexerr\endcsname\relax
\opset{carrystyle=\sevenrm}
\else
@@ -1575,6 +1614,107 @@
\fi
\endgroup
}
+% add 0.27
+\def\opmanyadd{\@ifnextchar[{\op@manyadd}{\op@manyadd[nil]}}
+\def\op@manyadd[#1]{%
+ \begingroup
+ \opset{#1}%
+ \op@nbop \z@
+ \opcopy{0}{OMA@result}%
+ \op@@manyadd
+}
+\def\op@@manyadd#1{%
+ \advance \op@nbop \@ne
+ \op@split{#1}{OMA@op\the\op@nbop}%
+ \ifop@deletezero
+ \op@unzero{OMA@op\the\op@nbop}%
+ \fi
+ \opadd*{OMA@result}{#1}{OMA@result}%
+ \op@split{OMA@result}{OMA@result}%
+ \@ifnextchar\bgroup{\op@@manyadd}{\op@manyaddend}%
+}
+\def\op@manyaddend{%
+ \op@count@i = \csname OP@OMA@op1@i\endcsname
+ \count@ \@ne
+ \loop
+ \ifnum\count@ < \op@nbop
+ \advance\count@ \@ne
+ \op@count@i = \op@max{\the\op@count@i}
+ {\csname OP@OMA@op\the\count@ @i\endcsname}%
+ \repeat
+ \op@count@i = \op@max{\the\op@count@i}{\OP@OMA@result@i}%
+ \advance\op@count@i \@ne
+ \op@count@ii = \csname OP@OMA@op1@d\endcsname
+ \count@ \@ne
+ \loop
+ \ifnum\count@ < \op@nbop
+ \advance\count@ \@ne
+ \op@count@ii = \op@max{\the\op@count@ii}
+ {\csname OP@OMA@op\the\count@ @d\endcsname}%
+ \repeat
+ \op@count@ii = \op@max{\the\op@count@ii}{\OP@OMA@result@d}%
+ \op@count@z = \op@count@i
+ \advance\op@count@z \op@count@ii
+ \setbox1=\hbox to\op@count@z\opcolumnwidth{%
+ \ophline(0,0.75){\the\op@count@z}%
+ \ifx\op@vmanyoperator\op@string@Top
+ \oplput(0,\the\op@nbop){\op@addsymbol}%
+ \else\ifx\op@vmanyoperator\op@string@Bottom
+ \oplput(0,1){\op@addsymbol}%
+ \else\ifx\op@vmanyoperator\op@string@Center
+ \count@ \op@nbop
+ \divide \count@ \tw@
+ \ifodd\op@nbop
+ \advance\count@ \@ne
+ \oplput(0,\the\count@){\op@addsymbol}%
+ \else
+ \oplput(0,\the\count@.5){\op@addsymbol}%
+ \fi
+ \fi\fi\fi
+ \count@ \tw@
+ \op@count@iii \@ne
+ \loop
+ \ifx\op@vmanyoperator\op@string@top
+ \oplput(0,\the\count@){\op@addsymbol}%
+ \else\ifx\op@vmanyoperator\op@string@bottom
+ \oplput(0,\the\op@count@iii){\op@addsymbol}%
+ \else\ifx\op@vmanyoperator\op@string@center
+ \oplput(0,\the\op@count@iii.5){\op@addsymbol}%
+ \fi\fi\fi
+ \ifnum \count@ < \op@nbop
+ \advance \count@ \@ne
+ \advance \op@count@iii \@ne
+ \repeat
+ \vbox{%
+ \count@ \@ne
+ \loop
+ \op@makebox{\the\op@count@i}
+ {\the\op@count@ii}
+ {operandstyle.\the\count@}
+ {OMA@op\the\count@}%
+ \hbox{\box0}%
+ \ifnum \count@ < \op@nbop
+ \advance \count@ \@ne
+ \repeat
+ \op@makebox{\the\op@count@i}
+ {\the\op@count@ii}
+ {resultstyle}
+ {OMA@result}%
+ \hbox{\box0}%
+ }%
+ }%
+ \leavevmode
+ \dimen0=\op@nbop\oplineheight
+ \ifx\op@voperation\op@string@center
+ \lower0.5\dimen0\box1
+ \else\ifx\op@voperation\op@string@top
+ \lower\dimen0\box1
+ \else
+ \box1
+ \fi\fi
+ \endgroup
+}
+% end add 0.27
\def\opmul{\@ifnextchar*{\op@mulstar}{\op@mulnostar}}
\def\op@mulstar*#1#2#3{%
\begingroup
@@ -1881,16 +2021,14 @@
\opset{#1}
\op@split{#2}{a}%
\op@split{#3}{b}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Ajout du 20/11/2006 %%%
-%%% Sur indication de Christophe Poulain %%%
+ % add 20/11/2006
+ % Thanks to Christophe Poulain
\op@cmp{b}{zero}%
\ifopeq
\op@error{divisor must be nonzero}%
{You have to learn some math}%
\fi
-%%% Fin ajout %%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % end add
\ifop@error
\op@errorwrite
\else
@@ -1934,16 +2072,14 @@
\opset{#1}%
\op@split{#2}{a}%
\op@split{#3}{b}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Ajout du 20/11/2006 %%%
-%%% Sur indication de Cristophe Poulain %%%
+ % add 20/11/2006
+ % thanks to Christophe Poulain
\op@cmp{b}{zero}%
\ifopeq
\op@error{divisor must be nonzero}%
{You have to learn some math}%
\fi
-%%% Fin ajout %%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % end add
\ifop@error
\op@errorwrite
\else
@@ -2118,16 +2254,14 @@
\begingroup
\op@split{#1}{a}%
\op@split{#2}{b}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Ajout du 20/11/2006 %%%
-%%% Sur indication de Cristophe Poulain %%%
+ % add 20/11/2006
+ % thanks to Christophe Poulain
\op@cmp{b}{zero}%
\ifopeq
\op@error{divisor must be nonzero}%
{You have to learn some math}%
\fi
-%%% Fin ajout %%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % end add
\ifop@error
\op@errorwrite
\else
@@ -2170,16 +2304,14 @@
\let\op@shiftdecimalsep\op@string@both
\op@split{#2}{a}%
\op@split{#3}{b}%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Ajout du 20/11/2006 %%%
-%%% Sur indication de Cristophe Poulain %%%
+ % add 20/11/2006
+ % thanks to Christophe Poulain
\op@cmp{b}{zero}%
\ifopeq
\op@error{divisor must be nonzero}%
{You have to learn some math}%
\fi
-%%% Fin ajout %%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % end add
\ifop@error
\op@errorwrite
\else
@@ -3031,11 +3163,13 @@
\ifop@error
\op@errorwrite
\else
- \ifnum\@nameuse{OP@a@w}>#2\relax
- \@namexdef{Op@#3}{\@nameuse{OP@a@#2}}%
- \else
+ % modif 0.27
+ \ifnum\OP@a@w<#2\relax
\@namexdef{Op@#3}{0}%
+ \else
+ \@namexdef{Op@#3}{\@nameuse{OP@a@#2}}%
\fi
+ % end modif 0.27
\fi
}
\def\opsetdigit#1#2#3{%
@@ -3072,11 +3206,13 @@
\else
\op@count@z=\OP@a@d
\advance\op@count@z by#2\relax
- \ifnum\OP@a@w>\op@count@z\relax
- \@namexdef{Op@#3}{\@nameuse{OP@a@\the\op@count@z}}%
- \else
+ % modif 0.27
+ \ifnum\OP@a@w<\op@count@z\relax
\@namexdef{Op@#3}{0}%
+ \else
+ \@namexdef{Op@#3}{\@nameuse{OP@a@\the\op@count@z}}%
\fi
+ % end modif 0.27
\fi
\endgroup
}
@@ -3127,7 +3263,9 @@
\def\opsetdecimaldigit#1#2#3{%
\begingroup
\op@split{#1}{a}%
- \op@split{#3}{b}%
+ % modif 0.27
+ \op@split{#2}{b}%
+ % end modif 0.27
\ifop@error
\op@errorwrite
\else
@@ -3135,9 +3273,9 @@
\ifnum\OP@a@d<\Op@@b\relax
\op@count@z=\Op@@b
\advance\op@count@z by-\OP@a@d
-%%% [2006/10/06] Bug find by Dave Jarvis.
-% \advance\op@count@z by1\relax
-%%% end bug fixing
+ % [2006/10/06] Bug find by Dave Jarvis.
+ % \advance\op@count@z by1\relax
+ % end bug fixing
\op@count@i=\OP@a@w
\advance\op@count@i by\op@count@z\relax
\op@count@z=\OP@a@w
@@ -3154,21 +3292,25 @@
\@namexdef{OP@a@\the\op@count@i}{0}%
\advance\op@count@i by-1
\repeat
-%%% [2006/10/06] Bug find by Dave Jarvis.
-% \@namexdef{OP@a@1}{\Op@@b}%
- \@namexdef{OP@a@1}{#2}%
-%%% end bug fixing
+ % [2006/10/06] Bug find by Dave Jarvis.
+ % \@namexdef{OP@a@1}{\Op@@b}%
+ % modif 0.27
+ \@namexdef{OP@a@1}{#3}%
+ % end modif 0.27
+ % end bug fixing
\else
\op@count@z=\OP@a@d
-%%% [2006/10/06] Bug find by Dave Jarvis.
-% \advance\op@count@z by-#2\relax
+ % [2006/10/06] Bug find by Dave Jarvis.
+ % \advance\op@count@z by-#2\relax
\advance\op@count@z by-\Op@@b\relax
-%%% end bug fixing
+ % end bug fixing
\advance\op@count@z by1
-%%% [2006/10/06] Bug find by Dave Jarvis.
-% \@namexdef{OP@a@\the\op@count@z}{\Op@@b}%
- \@namexdef{OP@a@\the\op@count@z}{#2}%
-%%% end bug fixing
+ % [2006/10/06] Bug find by Dave Jarvis.
+ % \@namexdef{OP@a@\the\op@count@z}{\Op@@b}%
+ % modif 0.27
+ \@namexdef{OP@a@\the\op@count@z}{#3}%
+ % end modif 0.27
+ % end bug fixing
\fi
\op@unsplit{a}{#1}%
\fi