Remove duplicated code from the LaTeXML class

Change-Id: I61645196aa1d69db6a25781330e34f64d8616de7