changes to latex and topological_sort