summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tools/calc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/tools/calc.dtx')
-rw-r--r--Master/texmf-dist/source/latex/tools/calc.dtx140
1 files changed, 70 insertions, 70 deletions
diff --git a/Master/texmf-dist/source/latex/tools/calc.dtx b/Master/texmf-dist/source/latex/tools/calc.dtx
index 50e6620cc17..1534e542cb7 100644
--- a/Master/texmf-dist/source/latex/tools/calc.dtx
+++ b/Master/texmf-dist/source/latex/tools/calc.dtx
@@ -3,22 +3,22 @@
% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005
% 2006 2008 2009
% The LaTeX3 Project and any individual authors listed elsewhere
-% in this file.
-%
+% in this file.
+%
% This file is part of the Standard LaTeX `Tools Bundle'.
% -------------------------------------------------------
-%
+%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
-% and version 1.3c or later is part of all distributions of LaTeX
+% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
-%
+%
% The list of all files belonging to the LaTeX `Tools Bundle' is
% given in the file `manifest.txt'.
-%
+%
% \fi
% \iffalse
%% File `calc.dtx'.
@@ -96,7 +96,7 @@
% Instead of a simple value, these commands now accept an infix
% notation expression.
% \end{abstract}
-%
+%
% \section{Introduction}
%
% Arithmetic in \TeX\ is done using low-level operations such as
@@ -189,9 +189,9 @@
% `\texttt{/}' with their usual meaning) using the familiar infix
% notation; parentheses may be used to override the usual precedences
% (that multiplication/division have higher precedence than
-% addition/subtraction).
+% addition/subtraction).
%
-% Expressions must be properly typed. This means, e.g., that a dimen
+% Expressions must be properly typed. This means, e.g., that a dimen
% expression must be a sum of dimen terms: i.e., you cannot say
% `\texttt{2cm+4}' but `\texttt{2cm+4pt}' is valid.
%
@@ -219,7 +219,7 @@
% real value to be used for multiplication/division. The first form has
% the obvious meaning, and the second form denotes the number obtained
% by dividing the value of the first expression by the value of the
-% second expression.
+% second expression.
%
% A later addition to the package (in June 1998) allows an additional
% method of specifying a factor of type dimen by setting some text
@@ -237,12 +237,12 @@
%\begin{quote}
% |\totalheightof{|\<text>|}|
%\end{quote}
-% This command does exactly what you'd expect from its name.
+% This command does exactly what you'd expect from its name.
% Additionally the package also provides the command
%\begin{quote}
% |\settototalheight{|\<cmd>|}{|\<text>|}|
-%\end{quote}
-%
+%\end{quote}
+%
%
% Note that there is a small difference in the usage of these two
% methods of accessing text dimensions. After
@@ -255,7 +255,7 @@
%\begin{verbatim}
% \setlength{\parskip}{\widthof{Some text} * \real{0.68}}
%\end{verbatim}
-%
+%
% \TeX\ discards the stretch and shrink components of glue when glue
% is multiplied by a real number. So, for example,
%\begin{verbatim}
@@ -298,17 +298,17 @@
%
%
% Another new feature introduced in August 2005 was $\max$ and $\min$
-% operations with associated macros
+% operations with associated macros
%\begin{quote}
% |\maxof{|\<\textit{type} expression>|}{|\<\textit{type} expression>|}|
% \\
% |\minof{|\<\textit{type} expression>|}{|\<\textit{type} expression>|}|
%\end{quote}
-% When \textit{type} is either \meta{glue} or \meta{dimen} these macros
-% are allowed only as part of addition or subtraction but when
+% When \textit{type} is either \meta{glue} or \meta{dimen} these macros
+% are allowed only as part of addition or subtraction but when
% \textit{type} is \meta{integer} they can also be used when
-% multiplying and dividing. In the latter case they follow the
-% same syntax rules as |\ratio| and |\real| which means they must come
+% multiplying and dividing. In the latter case they follow the
+% same syntax rules as |\ratio| and |\real| which means they must come
% after the |*| or the |/|. Thus
%\begin{verbatim}
% \setcounter{x}{3*\maxof{4+5}{3*4}+\minof{2*\real{1.6}}{5-1}}
@@ -363,7 +363,7 @@
% |{| \<\textit{type} expression> |}|^^A
% |{| \<\textit{type} expression> |}|
%
-% \<$\max$ or $\min$ command> \is |\maxof|^^A
+% \<$\max$ or $\min$ command> \is |\maxof|^^A
% \alt |\minof|
%
% \<text dimen factor>^^A
@@ -418,11 +418,11 @@
% on the catcode of syntax characters as \TeX\ and b)~tries to expand
% its argument fully. a)~means that implicit characters for the tokens
% |*|$_{12}$, |/|$_{12}$, |(|$_{12}$, and |)|$_{12}$ will not
-% work\footnote{e\TeX\ also assumes these catcodes when parsing a
+% work\footnote{e\TeX\ also assumes these catcodes when parsing a
% \cs{numexpr}, \cs{dimexpr}, \cs{glueexpr}, or \cs{muglueexpr} and
% does not allow implicit characters.} but because of~b), the
% expansion should allow you to use macros that expand to explicit
-% syntax characters.
+% syntax characters.
%
%
% \StopEventually{
@@ -450,7 +450,7 @@
% An expression $E$ is a sum of terms: $T_1+\cdots+T_n$; a term is a
% product of factors: $F_1*\cdots*F_m$; a factor is either a simple
% numeric quantity~$f$ (like \<number> as described in the \TeX book),
-% or a parenthesized expression~$(E')$.
+% or a parenthesized expression~$(E')$.
%
% Since the \TeX\ engine can only execute arithmetic operations in a
% machine-code like manner, we have to find a way to translate the
@@ -519,7 +519,7 @@
% \{\savecode{B\lassign A}\,\s{F_1}\,\} \quad
% \{\savecode{B\lassign B*A}\,\s{F_2}\,\}\\
% &&\qquad \ldots \quad \{\savecode{B\lassign B*A}\,\s{F_m}\,\}
-% \quad A\gassign B
+% \quad A\gassign B
% \end{eqnarray*}
% By structural induction, it is easily seen that the stated property
% is attained.
@@ -556,7 +556,7 @@
% (1)~`$*$' always initiates an \<integer factor>, (2)~all
% \<numeric>s in an expression, except those which are part of an
% \<integer factor>, are of the same type as the whole expression, and
-% all \<numeric>s in an \<integer factor> are \<number>s.
+% all \<numeric>s in an \<integer factor> are \<number>s.
%
% We have to ensure that $A$ and~$B$ always have an appropriate type
% for the \<numeric>s they manipulate. We can achieve this by having
@@ -580,7 +580,7 @@
%
% Now we have enough insight to do the actual implementation in \TeX.
% First, we announce the macro package.\footnote{Code moved to top of file}
-% \begin{macrocode}
+% \begin{macrocode}
%<*package>
%\NeedsTeXFormat{LaTeX2e}
%\ProvidesPackage{calc}[\filedate\space\fileversion]
@@ -591,7 +591,7 @@
% \begin{macro}{\calc@assign@generic}
% \changes{v4.2}{2005/08/06}{Removed a few redundant \cs{expandafter}s}
% The |\calc@assign@generic| macro takes four arguments: (1~and~2) the
-% registers to be used
+% registers to be used
% for global and local manipulations, respectively; (3)~the lvalue
% part; (4)~the expression to be evaluated.
%
@@ -609,13 +609,13 @@
% |\let|-assignments.
%
% As discovered in Section~\ref{evaluation:scheme}, we have to
-% generate code as
+% generate code as
% if the expression is parenthesized. As described below,
% |\calc@open| is the macro that replaces a left parenthesis by its
% corresponding \TeX\ code sequence. When the scanning process sees
% the exclamation point, it generates an |\endgroup| and stops. As we
% recall from Section~\ref{evaluation:scheme}, the correct expansion
-% of a right
+% of a right
% parenthesis is ``$\}A\gassign B\}A\gassign B$''. The remaining
% tokens of this expansion are inserted explicitly, except that the
% last assignment has been replaced by the lvalue part (i.e.,
@@ -659,7 +659,7 @@
% \begin{macro}{\setlength}
% \begin{macro}{\addtolength}
% As promised, we redefine the following standard \LaTeX\ commands:
-% |\setcounter|,
+% |\setcounter|,
% |\addtocounter|, |\setlength|, and |\addtolength|.
% \begin{macrocode}
\def\setcounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}%
@@ -679,7 +679,7 @@
\let\@elt\@stpelt \csname cl@#1\endcsname
\endgroup}}%
% \end{macrocode}
-% If the \texttt{amstext} package is loaded we must add the
+% If the \texttt{amstext} package is loaded we must add the
% |\iffirstchoice@| switch as well. We patch the commands this
% way since it's good practice when we know how many arguments they take.
% \begin{macrocode}
@@ -735,14 +735,14 @@
% illegal will simply generate a \TeX-level error, often a
% reasonably comprehensible one!
%
-% The |\romannumeral-`\a| part is a little trick which forces expansion
-% in case |#1| is a normal macro, something that occurs from time to
-% time. A conditional test inside will possibly leave a trailing
+% The |\romannumeral-`\a| part is a little trick which forces expansion
+% in case |#1| is a normal macro, something that occurs from time to
+% time. A conditional test inside will possibly leave a trailing
% \cs{fi} but this remnant is removed later when \cs{calc@post@scan}
% performs the same trick.
%
% The many |\expandafter|s are needed to efficiently end the nested
-% conditionals so that |\calc@textsize| and |\calc@maxmin@addsub| can
+% conditionals so that |\calc@textsize| and |\calc@maxmin@addsub| can
% process their argument.
% \changes{v4.1a}{1998/06/07}
% {Added code for text sizes: CAR}
@@ -779,7 +779,7 @@
% This parenthesis is replaced by \TeX\ code corresponding to the code
% sequence ``$\{\savecode{B\lassign A}\{\savecode{B\lassign A}$''
% derived in Section~\ref{evaluation:scheme}. Finally,
-% |\calc@pre@scan| is
+% |\calc@pre@scan| is
% called again.
% \begin{macrocode}
\def\calc@open({\begingroup\aftergroup\calc@initB
@@ -816,21 +816,21 @@
%
% As we have to check for these commands explicitly we must ensure
% that our definition wins. Using \cs{newcommand} gives an error when
-% loading \texttt{calc} and may be mildly surprising. This should be
+% loading \texttt{calc} and may be mildly surprising. This should be
% a little more informative.
% \begin{macrocode}
\@for\reserved@a:=widthof,heightof,depthof,totalheightof,maxof,minof\do
{\@ifundefined{\reserved@a}{}{%
\PackageError{calc}{%
- The\space calc\space package\space reserves\space the\space
+ The\space calc\space package\space reserves\space the\space
command\space name\space `\@backslashchar\reserved@a'\MessageBreak
but\space it\space has\space already\space been\space defined\space
- with\space the\space meaning\MessageBreak
+ with\space the\space meaning\MessageBreak
`\expandafter\meaning\csname\reserved@a\endcsname'.\MessageBreak
This\space original\space definition\space will\space be\space lost}%
- {If\space you\space need\space a\space command\space with\space
- this\space definition,\space you\space must\space use\space a\space
- different\space name.}}%
+ {If\space you\space need\space a\space command\space with\space
+ this\space definition,\space you\space must\space use\space a\space
+ different\space name.}}%
}
\let\widthof\ignorespaces
\let\heightof\ignorespaces
@@ -881,7 +881,7 @@
\calc@post@scan}
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\calc@post@scan}
% \begin{macro}{\@calc@post@scan}
% \changes{v4.2}{2005/08/06}{Added macro and force expansion}
@@ -895,14 +895,14 @@
% corresponding \TeX\ code (except when we detect the
% end-of-expression marker: then scanning ends, and control is
% returned to |\calc@assign@generic|).
-%
+%
% This macro may be optimized by selecting a different order of
% |\ifx|-tests. The test for `\texttt{!}' (end-of-expression) is
% placed first as it will always be performed: this is the only test
% to be performed if the expression consists of a single \<numeric>.
% This ensures that documents that do not use the extra expressive
% power provided by the \texttt{calc} package only suffer a minimum
-% slowdown in processing time.
+% slowdown in processing time.
% \begin{macrocode}
\def\calc@post@scan#1{%
\expandafter\@calc@post@scan\romannumeral-`\a#1}
@@ -912,7 +912,7 @@
\ifx#1-\let\calc@next\calc@subtract \else
\ifx#1*\let\calc@next\calc@multiplyx \else
\ifx#1/\let\calc@next\calc@dividex \else
- \ifx#1)\let\calc@next\calc@close \else
+ \ifx#1)\let\calc@next\calc@close \else
\ifx#1\relax\let\calc@next\calc@post@scan \else
\def\calc@next{\calc@error#1}%
\fi
@@ -956,10 +956,10 @@
% \begin{macro}{\calc@ratio@x}
% \begin{macro}{\calc@real@x}
% The multiplicative operators, `\texttt{*}' and `\texttt{/}', may be
-% followed by a |\real|, |\ratio|, |\minof|, or |\maxof| token. The
+% followed by a |\real|, |\ratio|, |\minof|, or |\maxof| token. The
% last two of these control sequences are defined by \texttt{calc} as
-% they are needed by the scanner for addition or subtraction while the
-% first two are not defined (at least not by the \texttt{calc}
+% they are needed by the scanner for addition or subtraction while the
+% first two are not defined (at least not by the \texttt{calc}
% package); this,
% unfortunately, leaves them highly non-robust. We therefore
% equate them to |\relax| but only if they have not already been
@@ -973,7 +973,7 @@
\ifx\real\@undefined\let\real\relax\fi
\ifx\ratio\@undefined\let\ratio\relax\fi
% \end{macrocode}
-% In order to test for |\real| or |\ratio|, we define these
+% In order to test for |\real| or |\ratio|, we define these
% two.\footnote{May not need the extra names, CAR?}
% \begin{macrocode}
\def\calc@ratio@x{\ratio}
@@ -983,7 +983,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \begin{macro}{\calc@multiplyx}
+% \begin{macro}{\calc@multiplyx}
% \changes{v4.2}{2005/08/06}
% {Added $\protect\max$ and $\protect\min$ operations}
% \begin{macro}{\calc@dividex}
@@ -1047,7 +1047,7 @@
% |\calc@close| generates code for a right parenthesis (which was
% derived to be ``$\}A\gassign B\}A\gassign B$'' in
% Section~\ref{evaluation:scheme}). After this code, the control is
-% returned to
+% returned to
% |\calc@post@scan| in order to look for another right parenthesis or
% a binary operator.
% \begin{macrocode}
@@ -1095,7 +1095,7 @@
% \end{macro}
% \begin{macro}{\calc@ratio@evaluate}
% Here is the macro that handles the actual evaluation of ratios. The
-% procedure is
+% procedure is
% this: First, the two expressions are evaluated and coerced to
% integers. The whole procedure is enclosed in a group to be able to
% use the registers |\calc@numerator| and |\calc@denominator| for temporary
@@ -1110,7 +1110,7 @@
% and/or denominator; note that \TeX\ interprets two minus signs the
% same as a plus sign. Then, we calculate the integer part.
% The minus sign(s), the integer part, and a decimal point, form the
-% initial expansion of the |\calc@the@ratio| macro.
+% initial expansion of the |\calc@the@ratio| macro.
% \begin{macrocode}
\gdef\calc@the@ratio{}%
\ifnum\calc@numerator<0 \calc@numerator-\calc@numerator
@@ -1136,7 +1136,7 @@
% Now we have the ratio represented (as the expansion of the global
% macro |\calc@the@ratio|) in the syntax \<decimal constant>
% \cite[page~270]{texbook}. This is fed to |\calc@multiply@by@real|
-% that will
+% that will
% perform the actual multiplication. It is important that the
% multiplication takes place at the correct grouping level so that the
% correct instance of the $B$ register will be used. Also note that
@@ -1196,14 +1196,14 @@
% \end{macro}
%
% \subsection{$\max$ and $\min$ operations}
-%
+%
% \begin{macro}{\maxof}
% \begin{macro}{\minof}
% \changes{v4.2}{2005/08/06}
% {Added macros}
% With version 4.2, the $\max$ and $\min$ operators were
% added to \texttt{calc}. The user functions for them are \cs{maxof} and
-% \cs{minof} respectively.
+% \cs{minof} respectively.
% These macros are internally similar to \cs{widthof} etc.\ in that they
% are unexpandable and easily recognizable by the scanner.
% \begin{macrocode}
@@ -1216,8 +1216,8 @@
%
% \begin{macro}{\calc@Cskip}
% \begin{macro}{\ifcalc@count@}
-% The $\max$ and $\min$ operations take two arguments so we need an extra
-% \<skip> register. We also add a switch for determining when to perform
+% The $\max$ and $\min$ operations take two arguments so we need an extra
+% \<skip> register. We also add a switch for determining when to perform
% a \<skip> or a \<count> assignment.
% \begin{macrocode}
\newskip\calc@Cskip
@@ -1228,9 +1228,9 @@
% \begin{macro}{\calc@maxmin@addsub}
% \begin{macro}{\calc@maxmin@generic}
% \changes{v4.2}{2005/08/06}{Macros added}
-% When doing addition or subtraction with a $\max$ or $\min$ operator, we
-% first check if |\calc@A| is a \<count> register or not and then set the
-% switch. Then call the real function which sets |\calc@A| to the desired
+% When doing addition or subtraction with a $\max$ or $\min$ operator, we
+% first check if |\calc@A| is a \<count> register or not and then set the
+% switch. Then call the real function which sets |\calc@A| to the desired
% value and continue as usual with |\calc@post@scan|.
% \begin{macrocode}
\def\calc@maxmin@addsub#1#2#3{\begingroup
@@ -1244,9 +1244,9 @@
\calc@post@scan
}
% \end{macrocode}
-% Check the switch and do either \<count> or \<skip> assignments. Note that
-% |\maxof| and |\minof| are not set to |>| and |<| until after the
-% assignments, which ensures we can nest them without problems. Then set
+% Check the switch and do either \<count> or \<skip> assignments. Note that
+% |\maxof| and |\minof| are not set to |>| and |<| until after the
+% assignments, which ensures we can nest them without problems. Then set
% |\calc@A| to the correct one.
% \begin{macrocode}
\def\calc@maxmin@generic#1#2#3{%
@@ -1274,11 +1274,11 @@
% \begin{macro}{\calc@maxmin@multiply}
% \begin{macro}{\calc@maxmin@divide}
% \changes{v4.2}{2005/08/06}{Macros added}
-% When doing division or multiplication we must be using \<count> registers
-% so we set the switch. Other than that it is almost business as usual when
-% multiplying or dividing. |#1| is the instruction to either multiply or
-% divide |\calc@B| by |\calc@A|, |#2| is either |\maxof| or |\minof| which
-% is waiting in the input stream and |#3| and |#4| are the calc expressions.
+% When doing division or multiplication we must be using \<count> registers
+% so we set the switch. Other than that it is almost business as usual when
+% multiplying or dividing. |#1| is the instruction to either multiply or
+% divide |\calc@B| by |\calc@A|, |#2| is either |\maxof| or |\minof| which
+% is waiting in the input stream and |#3| and |#4| are the calc expressions.
% We end it all as usual by calling |\calc@post@scan|.
% \begin{macrocode}
\def\calc@maxmin@divmul#1#2#3#4{%