the following code snippet doesn't work as expected






        5 x le { x } if 



Especially with regard to the PostScript-code

 5 x le { x } if

Simple postscripts without conditional executions or loops work fine. I have the sense that i might have to escape the curly braces, but escaping them with a slash doesn't work either.

Maybe someone of you experts can me help to solve my little problem!?

Let the wisdom be with you and best regards


You don't have to escape the braces, they are correctly passed to the DVI file. However, psplot expects the function to leave a value on the operand stack for each x. The expression

5 x le { x } if

doesn't create any value if the condition evaluates to false. Thus, you should replace it with some kind of ifelse construct instead, e.g. something like

5 x le {x} {0} ifelse
  • Thanks a lot for your fast reply! You solved my problem... – user1146332 May 1 '12 at 17:35
  • I'm glad to hear you could solve your issue. If this answer was helpful to you, please think about accepting it. – Martin May 3 '12 at 18:45

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.