[OS X TeX] %^M in Mac-produced .tex file

Chris Goedde cgg.lists at gmail.com
Wed Jan 16 16:04:39 EST 2008

On Jan 16, 2008, at 1:44 PM, David Romano wrote:

> A colleague sent me a  collection of files (produced in a Mac  
> environment) that make up a book he's writing, but I can't get my  
> tex setup to produce the right output.  I'm not exaclty sure where  
> to begin, but I'll try with this:  I'm on a linux machine reading  
> his source file
> for the first chapter in Emacs, and I find the entire file is in  
> one line, littered with %^M and ^M throughout.  This is very  
> difficult to navigate, and so -- assuming  that these characters  
> must be some kind of end of line characters from the Mac-- I  
> removed one and created a newline, but then TeX balked, claiming a  
> $ was missing somewhere.
> If I simply remove the ^M without introducing a newline, then all  
> is well, but the file is still humanly unreadable.  I'm loath to  
> include any snippets of the file since I don't know if I'll include  
> the right one, but if anyone has any insight into what is going on,  
> it would be much appreciated!

You're on some form of linux/unix I take it? My first suggestion  
would be to make a copy of the file, then in emacs do a global  
replace of ^M with return (which shows up as ^J). It's been a long  
time since I've done this, but there's a way. Invoke "query-replace",  
then type "ctrl-q ctrl-m ctrl-j" (no quotes and holding down the ctrl  
key) to tell emacs to search for ^M, then type "ctrl-q ctrl-j ctrl-j"  
to replace all the ^M characters with line returns.

Chris Goedde

More information about the MacOSX-TeX mailing list