[texhax] Migrating from Windows to Mac

Tom Backer Johnsen backer at psych.uib.no
Mon Dec 14 19:33:19 CET 2009


Frank Shute wrote:
> On Mon, Dec 14, 2009 at 02:53:22PM +0100, Tom Backer Johnsen wrote:
>   
>> Oleg Katsitadze wrote:
>>     
>>> Hi Tom,
>>>
>>> On Sun, 13 Dec 2009 20:34:31 +0100, Tom Backer Johnsen 
>>> <backer at psych.uib.no> said:
>>>  
>>>       
>>>> I am in the process of migrating from Windows XP to a MacBook Pro
>>>> (Snow Leopard), and have simply copied a number of files from the
>>>> Windows XP machine to the Mac Via an external hard disk and a memory
>>>> stick. I then find that files which compile (to PDF) perfectly OK on
>>>> the Windows machine give me an error message on the very first line,
>>>> the \documentclass one gives me an error message: undefined control
>>>> sequence.
>>>>    
>>>>         
>>> This is probably a line endings problem.  There must be a program on
>>> your system which converts the line endings, try fromdos, dos2unix,
>>> flip, toix.
>>>
>>> HTH,
>>> Oleg
>>>  
>>>       
>> Yes, it is some conversion issue.  If I enter a trivial document using 
>> the keyboard, it compiles all right, but it does not work with files 
>> coming from the Windows machine. 
>>
>>     
>
> You can convert your files by opening a terminal in OSX and doing:
>
> $ tr -d '\r' < inputfile > outputfile
>
> which removes the return present at the end of each line in a Windows file.
> (Windows has linefeed + return, unix has just linefeed).
>
> I'm pretty sure OSX has tr.
>
> If you want to convert a whole load of tex files:
>
> $ cd <your tex files dir>
> $ mkdir unix
>
> $ for file in $(ls | grep 'tex');do
> tr -d '\r' < $file > ./unix/$file
> done
>
> Regards,
>   
Yes 'tr' is there on OS X, i've checked.  But when I tried the command 
in a terminal, I only got a feedback on usage for the command rather 
than a converted file.

Tom

Tom



More information about the texhax mailing list