Move a tag
[latex2e.git] / latex2e-20160201 / required / tools / testfiles / tlb3726.lvt
blob767de33b7460cd84059526b365fb36bcc923b47a
1 \iffalse
3 Subject:
4 tools/3726: bug in calc package
6 Description of bug:
7 \setlength and friends do not allow syntax allowed by LaTeX.
9 \fi
11 \input{test2e}
12 \documentclass{article}
13 \START
14 \AUTHOR{Hendri Adriaens}
15 \PACKAGE{2005/08/06 v4.2 Infix arithmetic (KKT,FJ)}
16 \OMIT
18 \usepackage{calc}
19 \newcommand*\xxx{5pt}
20 \newcommand*\yyy{+}
21 \newcommand*\zzz{\yyy}
22 % this one doesn't work with calc v4.1b
23 \def\testcasedim{%
24   \ifcase 1
25     1pt
26   \or
27     \lengthB
28   \fi    
30 % some hidden commands with spurious spaces.
31 \def\fakeminof{ \minof}
32 \def\fakemaxof{ \maxof}
33 \def\fakewidthof{ \widthof}
34 \def\hiddenmacro{       
35   \totalheightof{\rule{10pt}{%
36     \totalheightof{\rule{11pt}{2pt}}}}
39 \newlength\lengthA
40 \newlength\lengthB
41 \newcounter{countA}
42 \newcounter{countB}
43 \newcommand\testsetlength[2]{\setlength#1{#2}\typeout{\the#1}}
44 \newcommand\testaddtolength[2]{\addtolength#1{#2}\typeout{\the#1}}
45 \newcommand\testsetcounter[2]{\setcounter{#1}{#2}\typeout{\the\value{#1}}}
46 \newcommand\testaddtocounter[2]{\addtocounter{#1}{#2}\typeout{\the\value{#1}}}
47 \begin{document}
48 \TIMO
50 \settototalheight\lengthA{\rule{11pt}{2pt}}
51 \typeout{\the\lengthA}
54 \testsetlength\lengthA{\totalheightof{\rule{11pt}{2pt}}}
56 % Nesting:
57 \testsetlength\lengthA{
58   \totalheightof{\rule{10pt}{\totalheightof{\rule{11pt}{2pt}}}}}
60 \testsetlength\lengthA{ \hiddenmacro}
62 \setlength\lengthB{ 5pt }
63 \testsetlength\lengthA{ 3pt - \testcasedim}
65 \testsetlength\lengthA{ \testcasedim +3pt }
67 \testsetlength\lengthA{ 
68   5pt + \maxof{ 5pt -10pt }{ \maxof{ 5pt -10pt }{0pt+1pt} } 
71 \testsetlength\lengthA{ 
72   5pt + \maxof{ 5pt -10pt }{ \minof{ 5pt -10pt }{0pt+1pt} } 
75 \testsetlength\lengthA{ 
76   5pt + \maxof{ 5pt -10pt }
77   { \minof{ 5pt -10pt }{0pt+1pt}*\ratio{1pt+1pt}{2pt} } 
78  }
80 \testsetlength\lengthA{ 
81   5pt + \maxof{ 5pt -10pt }
82   { \minof{ 5pt -10pt }{0pt+1pt}*\minof{3+4}{1+1-1} } 
85 \testsetlength\lengthA{ 
86   5pt + \minof{ 5pt }
87   { \maxof{ -5pt }{1pt}/\minof{3+4}{1+1-1} } 
88  }
90 \testsetlength\lengthA{ 
91   (5pt) \zzz  \fakeminof{ \xxx }
92   { \fakemaxof{ -5pt }{1pt}/\fakeminof{3+4}{1+1-1} } 
93  }
95 \testsetlength\lengthA{ 
96   (5pt) \zzz  \fakeminof{ \fakewidthof{\rule{10pt}{10pt}}*\real{-1}  }
97   { \fakemaxof{ -5pt }{1pt}/\fakeminof{3+4}{1+1-1} } 
98  }
100 \testaddtolength\lengthA{5pt+\minof{100pt}{200pt}*\real{0}}
102 % counters
103 \testsetcounter{countA}{\maxof{4+4*-2}{3*3}}
105 \testsetcounter{countB}{\minof{4+4*-2}{3*3}}
107 \testsetcounter{countB}{\fakemaxof{ \value{countA}-\value{countB}}{0}}
109 \testsetcounter{countB}{
110   \fakemaxof{ 
111     \value{countA} - 
112     \minof{ \value{countB} }{ -10 * \real{2.5} } 
113   }
114   {0}
117 \testsetcounter{countA}{
118   34 / \maxof{ \value{countA} }{ \value{countB} *\real{.5} }}
120 \testsetcounter{countA}{\value{countB}/\real{.2}}
122 \testsetcounter{countA}{\value{countA}*\real{-.5}}
124 \testaddtocounter{countB}{\value{countA}/5}
126 \end{document}