# \dimexpr \numexpr & calc package

Why doesn't this work? I use Windows, TeX Live 2012 and pdfLaTeX

\documentclass{article}

\usepackage{calc}

\newlength{\perclenght}

\setlength{\perclenght}{%
\dimexpr%
((((336pt*675pt)*(100-7.5))/100)/\textwidth)-\textheight%
\relax%
}%

\begin{document}
\the\perclenght
\end{document}

-
Even though the result is a length unit, I believe that calc does not allow multiplication of lengths. In other words: it does not work because it is not featured. –  tohecz Aug 20 '12 at 14:40
@tohecz thanks how can i solve? i want to put this code into a .sty file package –  FormlessCloud Aug 20 '12 at 14:42
@FormlessCloud You have to write a proper dimension expression, which this is not. For example, 336pt*675pt would be an area, not a length. –  Joseph Wright Aug 20 '12 at 14:42
As well, I'm not sure if you really wish to call the length \perclengHT with the typo (it should be lengTH). –  tohecz Aug 20 '12 at 14:44
@tohecz It's not a dimension expression as defined by the e-TeX manual, which is what is important here. There are many things which would give a dimension 'at the end' which will fail to parse correctly. For example \dimexpr 10*5 pt\relax is invalid but \dimexpr 5pt*10\relax is valid, as the dimension has to 'come first'. –  Joseph Wright Aug 20 '12 at 14:47

    \RequirePackage{pgf}%