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.dtx42
1 files changed, 29 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/tools/calc.dtx b/Master/texmf-dist/source/latex/tools/calc.dtx
index b49f228f192..50e6620cc17 100644
--- a/Master/texmf-dist/source/latex/tools/calc.dtx
+++ b/Master/texmf-dist/source/latex/tools/calc.dtx
@@ -1,6 +1,7 @@
% \iffalse meta-comment
%
-% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006
+% 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.
%
@@ -23,7 +24,7 @@
%% File `calc.dtx'.
%% Copyright (C) 1992--1995
%% Kresten Krab Thorup and Frank Jensen.
-%% Copyright (C) 1997--2005
+%% Copyright (C) 1997--2007
%% Kresten Krab Thorup, Frank Jensen and the LaTeX3 Project.
%%
%% The original authors (fj@hugin.dk and krab@daimi.aau.dk) have
@@ -39,7 +40,7 @@
%<driver> \ProvidesFile{calc.drv}
% \fi
% \ProvidesFile{calc.dtx}
- [2005/08/06 v4.2 Infix arithmetic (KKT,FJ)]
+ [2007/08/22 v4.3 Infix arithmetic (KKT,FJ)]
%
% \iffalse
%<*driver>
@@ -54,7 +55,7 @@
% \fi
%
% \GetFileInfo{calc.dtx}
-% \CheckSum{667}
+% \CheckSum{676}
%
% \title{The \texttt{calc} package\\Infix notation
% arithmetic in \LaTeX\thanks{We thank Frank Mittelbach for his
@@ -261,8 +262,13 @@
% \setlength{\parskip}{3pt plus 3pt * \real{1.5}}
%\end{verbatim}
% will set the paragraph separation to 4.5pt with no stretch or
-% shrink. (Incidentally, note how spaces can be used to enhance
-% readability.)
+% shrink. Incidentally, note how spaces can be used to enhance
+% readability. When \TeX\ is scanning for a \<number> etc.\ it is
+% common to terminate the scanning with a space token or by inserting
+% \cs{relax}. As of version~4.3 \textsf{calc} allows \cs{relax} tokens
+% to appear in places where they would usually be used for terminating
+% \TeX's scanning. In short this is just before any of \texttt{+-*/)}
+% or at the end of the expression being evaluated.
%
% When \TeX\ performs arithmetic on integers, any fractional part of
% the results are discarded. For example,
@@ -333,11 +339,17 @@
% \alt \<\textit{type} expression> \<plus or minus> \<\textit{type} term>
%
% \<\textit{type} term>^^A
-% \is \<\textit{type} factor>^^A
+% \is \<\textit{type} term> \<\textit{type} scan stop>
+% \alt \<\textit{type} factor>^^A
% \alt \<\textit{type} term> \<multiply or divide> \<integer>^^A
% \alt \<\textit{type} term> \<multiply or divide> \<real number>^^A
% \alt \<\textit{type} term> \<multiply or divide>^^A
-% \<$\max$ or $\min$ integer>
+% \<$\max$ or $\min$ integer>^^A
+%
+% \<\textit{type} scan stop>^^A
+% \is \<empty>^^A
+% \alt \<optional space>^^A
+% \alt |\relax|
%
% \<\textit{type} factor>^^A
% \is \<\textit{type}>^^A
@@ -873,14 +885,16 @@
% \begin{macro}{\calc@post@scan}
% \begin{macro}{\@calc@post@scan}
% \changes{v4.2}{2005/08/06}{Added macro and force expansion}
+% \changes{v4.3}{2007/08/22}{Discard terminating \cs{relax} tokens and
+% avoid extra error message from \cs{calc@next}}
% The macro |\calc@post@scan| is called right after a value has been
% read. At this point, a binary operator, a sequence of right
-% parentheses, and the end-of-expression mark (`|!|') is
-% allowed.\footnote{Is \texttt{!} a good choice, CAR?}
+% parentheses, an optional \cs{relax}, and the end-of-expression mark
+% (`|!|') is allowed.\footnote{Is \texttt{!} a good choice, CAR?}
% Depending on our findings, we call a suitable macro to generate the
% corresponding \TeX\ code (except when we detect the
-% end-of-expression marker: then scanning ends, and
-% control is returned to |\calc@assign@generic|).
+% 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
@@ -899,7 +913,9 @@
\ifx#1*\let\calc@next\calc@multiplyx \else
\ifx#1/\let\calc@next\calc@dividex \else
\ifx#1)\let\calc@next\calc@close \else
- \calc@error#1%
+ \ifx#1\relax\let\calc@next\calc@post@scan \else
+ \def\calc@next{\calc@error#1}%
+ \fi
\fi
\fi
\fi