more accurate formatting - regex to replace newlines with LaTeX linebreaks