2

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}
10
  • 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.
    – yo'
    Commented Aug 20, 2012 at 14:40
  • @tohecz thanks how can i solve? i want to put this code into a .sty file package
    – Aurelius
    Commented Aug 20, 2012 at 14:42
  • 5
    @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
    Commented Aug 20, 2012 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).
    – yo'
    Commented Aug 20, 2012 at 14:44
  • 3
    @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
    Commented Aug 20, 2012 at 14:47

1 Answer 1

3

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%
                                                   }%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .