In reply to ksjs:
Well, the first bit of me says "get a wider door", but I guess that's not an option or you would have?
Can't see any particular reason against that plan, apart from the sides will be a long length with no solid fixing, so the catch will flex the door frame every time you open/close the door.
I'd be inclined to screw a piece of solid timber into each side of the door opening to fill the gap (or several short bits, if it's that irregular) and then screw the sides of the door into these. Then you can cover over the timber over.