TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to shrink and expand the canvas based on the 2 variables \Base and \Angle. The following code still use a hard-coded value for the ordinate of pspicture, which is equal to 6, for example.

I want to avoid using such a hard-coded value. I want to replace it by something that equals to Angle tan Base mul. Is there any idea to do so?




    /Base \Base\space def
    /Angle \Angle\space def

    \pspolygon[fillcolor=yellow,fillstyle=solid](!Base 0)(!0 Angle tan Base mul)

enter image description here

share|improve this question
up vote 6 down vote accepted

Here is a quick hack:


    \pstVerb{/#1 \csname#1\endcsname\space def}%

% User defined constants


    \pspolygon(!Base 0)(!0 Height)

share|improve this answer
see my edit, I used fp, but it is also possible without the fp package – Herbert Jul 11 '12 at 17:14
that was only for testing, makes it easier to see if everthing works well – Herbert Jul 11 '12 at 18:05

Your Answer


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.