[OS X TeX] line breaks \n vs. \r ???

Charilaos Skiadas cskiadas at gmail.com
Mon Dec 17 15:12:42 EST 2007

On Dec 17, 2007, at 2:51 PM, Steffen Wolfrum wrote:

> Am 17.12.2007 um 19:52 schrieb Maarten Sneep:
>> On 17 dec 2007, at 18:36, Aaron Jackson wrote:
>>> On Dec 17, 2007, at 12:05 PM, Steffen Wolfrum wrote:
>>>> Hi,
>>>> when editing in TextWrangler a line break is found when using  
>>>> Grep and search for \r.
>>>> In TeXShop  a line break is found when using Regular Expressions  
>>>> and searching for \n: \r gives no result!
>>>> Now, I thought there are "More Options" ... "Serach syntax" can  
>>>> be changed.
>>>> But when I change here also to "Grep" then \r doesn't find line- 
>>>> breaks but the letter r !!
>>>> Is this a bug in TeXShop 2.14 ?
>>> Not a bug.  In Mac text files lines end in \r.  In Unix text  
>>> files lines end in \n.  In windows text files lines end in \r\n.   
>>> TextWrangler must save files in mac format while TeXShop saves  
>>> them in Unix format.  You can do a search for (\r(\n)?|\n) and  
>>> that will find end of lines in all of the text file types.
>> Not quite: TextWrangler (and BBedit) will use \r for a linebreak,  
>> no matter what the file is set to use when saving.
> Right, that's exactly the problem! As I need to perform the same  
> regex search/replace actions sometimes with TextWrangler, sometimes  
> with TeXShop I need to have the same syntax, i.e. line- ending syntax.
> Just, how do I gap the distance between TS's UNIX and TW's Mac  
> format ?

I have to say I don't see why you feel the need to be able to do the  
same thing in two different systems. Why have the two systems then?  
Presumably you need both because there are some thing one can do that  
the other can't, but in that case you could consider this as one of  
those things. But I guess I don't have any idea what your workflow is  
In any case, doesn't Aaron's suggestion of using (\r(\n)?|\n) work? I  
would expect that to work in both systems.

> Steffen

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

More information about the MacOSX-TeX mailing list