guess we don't want the build dir
[latex2e.git] / trunk / required / tools / testfiles / tlb2793.lvt
blob0b7b5a06184d7111666ad00543cc283c4b75bb5b
1 \iffalse
3 Subject:
4 tools/2793: calc extensions
6 Description of bug:
7 Add commands \widthof etc.
9 \fi
11 \input{test2e}
12 \documentclass{article}
13 \START
14 \AUTHOR{Donald Arseneau}
15 \PACKAGE{1998/07/07 v4.1b Infix arithmetic (KKT,FJ)}
16 \OMIT
18 \usepackage{calc}
19 \newlength\lengthA
20 \newlength\lengthB
21 \newcounter{countA}
22 \newcounter{countB}
23 \newcommand\testsetlength[2]{\setlength#1{#2}\typeout{\the#1}}
24 \newcommand\testaddtolength[2]{\addtolength#1{#2}\typeout{\the#1}}
25 \newcommand\testsetcounter[2]{\setcounter{#1}{#2}\typeout{\the\value{#1}}}
26 \newcommand\testaddtocounter[2]{\addtocounter{#1}{#2}\typeout{\the\value{#1}}}
27 \begin{document}
28 \TIMO
29 % simple
30 \testsetlength\lengthA{ 5pt }
32 % subtraction and addition
33 \testsetlength\lengthB{ 5pt - 2pt }
35 \testsetlength\lengthA{ 5pt + - \lengthB }
37 % multiplication and division
38 \testsetlength\lengthA{ 5pt * 7 }
40 \testsetlength\lengthA{ 5pt / 7 }
42 \testsetlength\lengthA{ 5pt + 5pt * 7 }
44 % add grouping
45 \testsetlength\lengthA{ ( 5pt - 1pt ) * 7 }
47 % ratio
48 \testsetlength\lengthA{ 
49   5pt + 5pt * \ratio{ 1.0pt * \real{1.0} }{ 5pt } 
52 % real
53 \testsetlength\lengthA{ 5pt + 5pt * \real{.2} }
55 % a few hidden expressions
56 \def\hiddenexpr{ 5pt + 5pt * 7 }
57 \testsetlength\lengthA{ \hiddenexpr }
59 \def\hiddenexpr{ \widthof{\rule{10pt}{10pt}} * 7 }
60 \testsetlength\lengthA{\hiddenexpr}
62 \def\hiddenexpr{\widthof{%
63   \rule{10pt/\ratio{2000pt}{1000pt}*2}{10pt*\ratio{1pt}{2pt}}}* 7 }
64 \testsetlength\lengthA{\hiddenexpr}
66 \def\hiddenplus{+}
67 \def\hiddenminus{-}
68 \testsetlength\lengthA{4pt \hiddenplus (\hiddenminus 5pt)}
71 % heightof etc.
72 \testsetlength\lengthA{\widthof{\rule[-4pt]{10pt}{10pt}}}
74 \testsetlength\lengthA{\heightof{\rule[-4pt]{10pt}{10pt}}}
76 \testsetlength\lengthA{\depthof{\rule[-4pt]{10pt}{10pt}}}
78 \testsetlength\lengthA{\widthof{\rule[-4pt]{10pt}{10pt}}
79   -\heightof{\rule[-4pt]{10pt}{10pt}}
80   -\depthof{\rule[-4pt]{10pt}{10pt}}}
82 \testsetlength\lengthA{\widthof{\rule{\heightof{\rule{11pt}{2pt}}}{10pt}}}
84 \testaddtolength\lengthA{\widthof{\rule{\heightof{\rule{11pt}{2pt}}}{10pt}}}
86 % error message
87 \testsetlength\lengthA{4pt+2ptt}
89 % Now for counters:
91 \testsetcounter{countA}{4}
93 \testsetcounter{countB}{-4+8}
95 \testsetcounter{countB}{(-4+8)*-2}
97 % truncation
98 \testsetcounter{countA}{\value{countB}/-3}
100 \testsetcounter{countA}{\value{countB}/\real{.2}}
102 \testsetcounter{countA}{\value{countA}*\real{-.5}}
104 \testaddtocounter{countA}{\value{countA}*\real{-.5}}
106 \end{document}