Question: I don't know if it's heartless,but when I'm in a situation that is really sad(like a funeral) I always have this urge to laugh.Of course I try not to burst out in laughter but I guess it's how I cope with these things.

Is there a word that can describe this?I don't mind if it would be used for the urge,the behaviour,the feeling.I'm just really interested how to express this kind of thing without having to say that I really,really have to laugh.

Answer: 
**Nervous-laughter** should be a appropriate word. And in a novel I read a word **painful-dimples**, It sounds compatible too. But `painful-dimples` kind of word is not heard or seen usually.
Laughter is a highly complex behavior. One term for what you describe might be *nervous laughter* (if you actually laughed instead of just felt the urge to laugh). But that term is used in various ways, so as far as I know, the best way to describe it is similar to what you did in the question.