This is a minimal workable code of my code



\def\prism{\pspolygon[](0.62,0.62)(4.62,0.62)(4,0)(0,0)} % prism




As you can see, I'm defining a pspolygon before the \begin{document} and then I'm calling it inside the pspicture with a rput command. This allows me to draw the polygon only once and then use it as many times as I want in the picture. I will have to place several of them in my code, some rotated, some translated and the way my code is now I can do it without problem.

The problem is that I want some of the polygons to be larger than others. How can I rescale an object like this \prism inside the pspicture? If, for example, I would like the polygon to be half its size, I'd like a command like


Can you help me with this?

Thank you.

2 Answers 2


You can use \psscalebox{<scale>}{<stuff>} to scale <stuff> to the <scale> of your choice:

enter image description here



\def\prism{\pspolygon(0.62,0.62)(4.62,0.62)(4,0)(0,0)} % prism





Note the difference between scaling something (which also scales the line width) and adjusting the unit to be 50% of the original unit (maintaining the same line width).

You could define your own macro for adjusting the content. Below I've used xkeyval to define a number of keys for a single macro called \psaction[<options>]{<object>}:


    orotate={(0,0)}, % Default origin of rotation
    rotangle=0, % Default angle of rotation
    scale=1, % Default scale factor
    put={(0,0)}, % Default location for \rput
    #1 % Local modifications

For example, you could use

  % Similar to \rput(2,2){\psrotate(0,0){0}{\prism}}:
  % Similar to \rput(2,4){\psscalebox{0.5}{\psrotate(0,0){30}{\prism}}}:

Use the optional argument unit=...

    \pspolygon[#1](0.62,0.62)(4.62,0.62)(4,0)(0,0)} % prism    



enter image description here

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.