diff options
author | Karl Berry <karl@freefriends.org> | 2014-10-28 22:36:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-10-28 22:36:45 +0000 |
commit | 675c2b874dcbe2c6cea060f7667f9619ae64ee3b (patch) | |
tree | fdaee6c968ac30affcb7348f2289aa2c39861217 | |
parent | 31ae0d507c9b43a68b2b4e2f44f41a756b23b8c9 (diff) |
basicarith (28oct14)
git-svn-id: svn://tug.org/texlive/trunk@35460 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/basicarith/CHANGES | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/basicarith/basicarith.pdf | bin | 211857 -> 212889 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/basicarith/basicarith.dtx | 80 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/basicarith/basicarith.sty | 19 |
4 files changed, 59 insertions, 43 deletions
diff --git a/Master/texmf-dist/doc/latex/basicarith/CHANGES b/Master/texmf-dist/doc/latex/basicarith/CHANGES index 070d4e3b8b0..fb715636b8c 100644 --- a/Master/texmf-dist/doc/latex/basicarith/CHANGES +++ b/Master/texmf-dist/doc/latex/basicarith/CHANGES @@ -1,2 +1,5 @@ 19 October 2014: Version 1.0, with all basic functionality complete. +27 October 2014: Version 1.1, fixed a problem with styling + when macros (specifically dozenal's \x and \e) were used + as digits. Also beefed up the implementation text a bit. diff --git a/Master/texmf-dist/doc/latex/basicarith/basicarith.pdf b/Master/texmf-dist/doc/latex/basicarith/basicarith.pdf Binary files differindex 2ae377f3098..2d2b3d45af0 100644 --- a/Master/texmf-dist/doc/latex/basicarith/basicarith.pdf +++ b/Master/texmf-dist/doc/latex/basicarith/basicarith.pdf diff --git a/Master/texmf-dist/source/latex/basicarith/basicarith.dtx b/Master/texmf-dist/source/latex/basicarith/basicarith.dtx index a710be9f64f..949d4c7fd96 100644 --- a/Master/texmf-dist/source/latex/basicarith/basicarith.dtx +++ b/Master/texmf-dist/source/latex/basicarith/basicarith.dtx @@ -25,7 +25,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] -%<package>\ProvidesPackage{basicarith}[2015/01/01 v1.0 support for typesetting basic arithmetic in the American fashion] +%<package>\ProvidesPackage{basicarith}[2015/01/01 v1.1 support for typesetting basic arithmetic in the American fashion] %<*driver> \documentclass{ltxdoc} @@ -37,6 +37,7 @@ \renewcommand{\LettrineFontHook}{\color{red}} \usepackage{url} \usepackage{spverbatim} +\usepackage[nocounters]{dozenal} \usepackage[noshowdivwork]{basicarith} \usepackage[colorlinks]{hyperref} \usepackage{makeidx} @@ -70,15 +71,16 @@ \divide,\multiply,\advance,\edef,\expandafter,\f@size,\ifx,\fi, \ifshowdivisionwork,\fi,\linewidth,\newdimen,\next,\nil, \wd,\xx,\hbox,\vbox,\vtop,\hrule,\vrule,\hskip,\hss,\footnotesize, - \downarrow} + \downarrow,\leavevmode,\settowidth} +\tracingmacros=3 \begin{document} \DocInput{basicarith.dtx} \end{document} %</driver> % \fi % -% \title{The |basicarith| Package, v1.0} +% \title{The |basicarith| Package, v1.1} % \author{Donald P.\ Goodman III} % \date{\today} % @@ -417,16 +419,17 @@ % \soluline{521}% % \end{spverbatim}} % }\hfil% -% \vbox{\linestyle{1}{\color{blue}}% +% \vbox{% +% \linestyle{1}{\color{blue}}% % \linestyle{2}{\color{red}}% % \linestyle{3}{\color{green}}% % \digstyle{3}{\color{black}\itshape}% % \vskip-1em% % \LARGE % \problembox{ -% \probline{4}{548}% +% \probline{6}{21;\x48}% % \opline{$-$}{27}% -% \soluline{521}% +% \soluline{5;21}% % }}% % \hfil% % } @@ -517,7 +520,6 @@ % }% % \end{center} % -% % \section{Configuration Commands} % % There are a variety of other bits and pieces of @@ -714,7 +716,8 @@ % \end{macrocode} % Now we define the macros that are used for counting the % number of characters in various strings; these are adapted -% from macros by ``Florent'' at \url{tex-and-stuff.blogspot.com}. +% from macros by ``Florent'' at +% \url{tex-and-stuff.blogspot.com}. % \begin{macrocode} \def\gobblechar{\let\char= } \def\assignthencheck{\afterassignment\checknil\gobblechar} @@ -724,13 +727,13 @@ \let\next=\auxcountchar% \advance\b@charcount by1% \fi% - \ifx\char; \advance\b@charcount by-1\fi% + \ifx\char;\advance\b@charcount by-1\fi% \next% }% \def\auxcountchar{% \afterassignment\countunlessnil\gobblechar% }% -\def\countchar#1{\edef\xx{#1}\b@charcount=0 \expandafter\auxcountchar\xx\nil} +\def\countchar#1{\def\xx{#1}\b@charcount=0 \expandafter\auxcountchar\xx\nil} % \end{macrocode} % Now we define some macros for splitting a string into % individual characters and putting them in boxes; these are @@ -750,10 +753,10 @@ \rlap{\hbox to0pt{\hss#1\hss}}% \else% \hbox to\b@digitwid{\hfil{% - \csname - speciallinestyle\romannumeral\b@linenum\endcsname% - \csname - specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% + \csname speciallinestyle\romannumeral\b@linenum\endcsname% + \csname specialdigitstyle\romannumeral\b@colnum\endcsname% + #1% + }\hfil}% \fi% \expandafter\b@xloop% \fi% @@ -854,7 +857,6 @@ }% \advance\b@divisorlen by\b@divparenlen% }% - \def\ldsoluline#1#2{% \advance\b@fulldivlen by\b@divisorlen% \advance\b@fulldivlen by\b@topdivline% @@ -868,14 +870,21 @@ }% \vskip\baselineskip% }% -% get the width of a box +% \end{macrocode} +% This is an interesting little trick which gets the width +% of a box; we use this to determine the placement of the +% drop arrows when we're showing our long division work. +% \begin{macrocode} \newdimen\b@droparrowwidth \def\getdroparrowwidth{% \setbox\@tempboxa\hbox{$\downarrow$}% \b@droparrowwidth=\wd\@tempboxa% }% -% subsequent long division line; first is number of digits -% of the dividend to cut off, second is number +% \end{macrocode} +% Now we get back to long division macros (yes, these do +% take a rather long time). We start with the macro for +% subsequent long division lines. +% \begin{macrocode} \def\nextldline#1#2{% \advance\b@linenum by1% \b@ldrowlen=\b@digitwid% @@ -901,9 +910,12 @@ \fi% }% }% - -% style lines of digits; user-level command; first arg is -% row number, second is style +% \end{macrocode} +% Now we move on to the styling macros; this requires a lot +% of looping and other weirdities (weirdities for \TeX\ +% programming, anyway). First we style lines; then we style +% columns. +% \begin{macrocode} \def\linestyle#1#2{% \b@loopi=0% \loop\ifnum\the\b@loopi<\the\b@maxrows% @@ -913,9 +925,6 @@ \fi \repeat }% - -% style individual digits; user-level command; first arg is -% column number, second is style \def\digstyle#1#2{% \b@loopi=0% \loop\ifnum\the\b@loopi<\the\b@maxcols% @@ -925,7 +934,10 @@ \fi \repeat }% -% called to reset all the special line formatting +% \end{macrocode} +% Now we get our commands to clear the styling; again, first +% lines, then columns. +% \begin{macrocode} \def\clearlinestyles{% \b@loopi=0% \loop\ifnum\the\b@loopi<\the\b@maxrows% @@ -933,7 +945,6 @@ \expandafter\def\csname speciallinestyle\romannumeral\b@loopi\endcsname{}% \repeat }% -% called to reset all the special digit commands \def\cleardigitstyles{% \b@loopi=0% \loop\ifnum\the\b@loopi<\the\b@maxcols% @@ -941,23 +952,30 @@ \expandafter\def\csname specialdigitstyle\romannumeral\b@loopi\endcsname{}% \repeat }% - -% simple problem box; unites a problem +% \end{macrocode} +% A few miscellanies; a box for binding together problems, +% so that they can be positioned on the page more easily; a +% macro for doing strikethroughts, quite useful in the +% carries; and macros for showing or not showing our long +% division work. +% \begin{macrocode} \def\problembox#1{% \leavevmode\vbox{#1}% }% -% for striking out carries or borrowing \def\strike#1{% {\rlap{\bf---}#1}% } -% for showing division work \def\showdivwork{% \showdivisionworktrue% } \def\noshowdivwork{% \showdivisionworkfalse% } +% \end{macrocode} +% Now, finally, we clear all the digit styles (so that they +% at least exist), and then we're done. Thanks for reading; +% happy \TeX{}ing! +% \begin{macrocode} \cleardigitstyles % \end{macrocode} - % \PrintIndex diff --git a/Master/texmf-dist/tex/latex/basicarith/basicarith.sty b/Master/texmf-dist/tex/latex/basicarith/basicarith.sty index a91f1328e94..c5568a5f599 100644 --- a/Master/texmf-dist/tex/latex/basicarith/basicarith.sty +++ b/Master/texmf-dist/tex/latex/basicarith/basicarith.sty @@ -26,7 +26,7 @@ %% derived files basicarith.sty and basicarith.pdf. \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{basicarith}[2015/01/01 v1.0 support for typesetting basic arithmetic in the American fashion] +\ProvidesPackage{basicarith}[2015/01/01 v1.1 support for typesetting basic arithmetic in the American fashion] \newif\ifshowdivisionwork % switch for drop arrows \showdivisionworktrue \DeclareOption{noshowdivwork}{\showdivisionworkfalse} @@ -71,13 +71,13 @@ \let\next=\auxcountchar% \advance\b@charcount by1% \fi% -\ifx\char; \advance\b@charcount by-1\fi% +\ifx\char;\advance\b@charcount by-1\fi% \next% }% \def\auxcountchar{% \afterassignment\countunlessnil\gobblechar% }% -\def\countchar#1{\edef\xx{#1}\b@charcount=0 \expandafter\auxcountchar\xx\nil} +\def\countchar#1{\def\xx{#1}\b@charcount=0 \expandafter\auxcountchar\xx\nil} \def\b@expandloop#1{% \hbox{% \b@xloop#1\relax @@ -91,10 +91,10 @@ \rlap{\hbox to0pt{\hss#1\hss}}% \else% \hbox to\b@digitwid{\hfil{% -\csname -speciallinestyle\romannumeral\b@linenum\endcsname% -\csname -specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% +\csname speciallinestyle\romannumeral\b@linenum\endcsname% +\csname specialdigitstyle\romannumeral\b@colnum\endcsname% +#1% +}\hfil}% \fi% \expandafter\b@xloop% \fi% @@ -189,7 +189,6 @@ specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% }% \advance\b@divisorlen by\b@divparenlen% }% - \def\ldsoluline#1#2{% \advance\b@fulldivlen by\b@divisorlen% \advance\b@fulldivlen by\b@topdivline% @@ -233,7 +232,6 @@ specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% \fi% }% }% - \def\linestyle#1#2{% \b@loopi=0% \loop\ifnum\the\b@loopi<\the\b@maxrows% @@ -243,7 +241,6 @@ specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% \fi \repeat }% - \def\digstyle#1#2{% \b@loopi=0% \loop\ifnum\the\b@loopi<\the\b@maxcols% @@ -267,7 +264,6 @@ specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% \expandafter\def\csname specialdigitstyle\romannumeral\b@loopi\endcsname{}% \repeat }% - \def\problembox#1{% \leavevmode\vbox{#1}% }% @@ -281,7 +277,6 @@ specialdigitstyle\romannumeral\b@colnum\endcsname#1}\hfil}% \showdivisionworkfalse% } \cleardigitstyles - \endinput %% %% End of file `basicarith.sty'. |