Updated script to handle LaTex formatted titles