We address a variant of the train timetabling problem where choices involve not only defining the schedules of trains but also their routes (among a given set of alternatives) as well as which trains to plan, and where the goal is to obtain a conflict-free timetable as close as possible to a given ideal timetable. To our knowledge, such variant of the problem has not yet been fully addressed in the literature. We propose a MaxSAT approach using order encoding to solve this NP-hard problem. We evaluate the approach with real-world problem instances from Swiss Federal Railways and with realistic problem instances from Washington Metro. Results, presented for different time granularities, show that instances with more than 2000 trains can be solved efficiently.