[Text Selection] Fixed problems with LaTeX containing spaces