Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
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
4  
@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
2  
@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

1 Answer 1

THANKS TO PERCUSSE

this is the answer, is right?

    \RequirePackage{pgf}%
\newlength\perclength\pgfmathsetlength{\perclength}{%
                                                   ((((3.36*6.75)*(1-(7.5/100)))/(\textwidth/100))-(\textheight/100))*100%
                                                   }%
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.