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}
  • 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' Aug 20 '12 at 14:40
  • @tohecz thanks how can i solve? i want to put this code into a .sty file package – Aurelius 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). – yo' 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
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%
                                                   }%
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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