Fixing problem with latex formating in layout