BBEdit and TeXShop files [was: Re: [OS X TeX] Mac OS X 10.2 permissions]

Bruno Voisin Bruno.Voisin at
Mon Sep 9 04:00:55 EDT 2002

Le dimanche, 8 sep 2002, à 19:40 Europe/Paris, Holger Frauenrath a 
écrit :

> Speaking of which ... I tried to view TeX files I had already created 
> with TeXShop with BBEdit. BBEdit did not recognize the line endings. 
> They were replaced with some special character that just showed up as 
> a rectangle. The same character was inserted at a few other places, 
> which made it difficult to fix the problem with search&replace. Also, 
> their was additional white space inserted at some places ...
> Playing with the options in the Open dialog in BBEdit did not help 
> (selecting an encoding, checking/unchecking translate line breaks).
> Does anybody know what is going wrong and how to fix this?

I have also seen this. My interpretation (possibly wrong): TextEdit and 
the TeXShop editor are based on the same Apple classes, which deal 
transparently with any kind of end-of-line character (Carriage Return 
on Mac OS Classic, New Line on Unix and Mac OS X, Carriage Return + New 
Line on DOS/Windows).

Thus, if you use a file created in Classic and edited in TeXShop, the 
file will contain a mixture of Mac-style end-of-line characters (from 
the time it was edited under Mac OS Classic) and Unix end-of-line 
characters (from the modifications added under OS X).

Now BBEdit does not work like this: it reads the file and decides once 
and for good that it's Mac, Unix or Windows. Suppose the first 
end-of-line characters are Mac-style: BBEdit will think the file is 
Mac-style, and display all subsequent Unix-style end-of-lines as 

The solution: use "Find" and "Replace All" to convert all end-of-lines 
to one style only (\r is Carriage Return, \n is New Line). Once it's 
done, you can change all end-of-lines to any style in one go, using one 
of the pull-down menus (fifth one from the left).

I had to cope with this not only for TeXShop, but also for importing 
mailboxes between mailers: Eudora uses mixtures of different 
end-of-lines in the mailbox files, and preliminary treatment is 
necessary before successful import into other applications (Mail and 
Netscape/Mozilla maybe, I don't remember); similarly, Mail uses Unix 
end-of-lines and Netscape/Mozilla uses DOS/Windows end-of-lines, 
preliminary conversion is mandatory before successful import.

Bruno Voisin

Mac TeX info, resources, and news can be found at:
List archives can be found at:
Threaded list archives can be found at:
See message headers for list info.

More information about the MacOSX-TeX mailing list