Ways Cats Show Their Love #10. He is jealous
There are some cats that are jealous for example of computers that steal time from their masters, taking away their cuddles. For that, on the web, there are lots of photographs of cats elegantly sitting on PC keyboards.
If your cat slips between your legs, regardless of the fact that you are carrying a tray in precarious balance, it is not spite, but a gesture of affection, so do not scold him but think that he would not do so with anyone else.