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

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

share|improve this question
up vote 3 down vote accepted

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
share|improve this answer
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 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.