Added function for reading a file and rewriting a new one with specified format (latex friendly)