Well, I think the best thing to do is this: bring someone you enjoy being with with you (friend, partner or family), enjoy the ride, enjoy the cities and don't care about the rest of the world (that means, your fellow passengers)... after all, you don't need to worry about hotels or where to get your breakfast
If the train is not a luxury one, but an adventure, you can do the same... although you'll probably discover lots of things that are not included in guidebooks!