[texhax] Migrating from Windows to Mac

Herbert Schulz herbs at wideopenwest.com
Mon Dec 14 21:04:11 CET 2009


On Dec 14, 2009, at 1:36 PM, Tom Backer Johnsen wrote:

> Tom Schneider wrote:
>>>> 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.
>>>    
>> 
>> I use this script:
>> ********************************************************************************
>> #!/bin/csh -f
>> #(ie run the cshell on this but don't read the .cshrc)
>> 
>> # nom: no ^M: remove control M's from a file!
>> 
>> #    version = 1.01 of nom 2009 nov 21
>> # 2009 nov 21, 1.01: avoid illegal byte sequence problem
>> # 2009 Jul 11 origin
>> 
>> # avoid Illegal byte problem on Macs:
>> setenv LC_ALL en_US.ISO8859-1
>> 
>> tr -d '^M' < $1 > $2
>> 
>> ********************************************************************************
>> 
>> where the ^M is a control-M.  You will have to do this in vi or vim
>> by replacing the two characters with a control M.  One types:
>> /\^M[return]c2l[control-v][control-m]:wq
>> \r should work too though.
>> 
>> Note the setenv that makes tr on a Mac happy with unicode characters
>> that would otherwise crash it.  This should not be an issue for tex
>> files but can be for others.
>> 
>> Tom (yet another!)
>> 
>>  Dr. Thomas D. Schneider
>>  National Institutes of Health
>>  schneidt at mail.nih.gov
>>  toms at alum.mit.edu (permanent)
>>  http://alum.mit.edu/www/toms (permanent)
>>  
> Thank you for the information.  The command you recommended worked, or at least without yielding an error message.  However, I had the same error message as before:
> 
> This is pdfTex, Version 3 ...
> entering extended mode
> (.second.tex
> ! Undefined control sequence.
> 1.5 \documentclass
>   [10pt,a4paper]{article}
> 
> So, assuming that your command worked, it cannot be the line endings.
> 
> Tom

Howdy,

It is clear that you are trying to process the file using pdftex rather than pdflatex! No... not because of the

This is pdfTex, Version 3 ...

line because you'd see that with pdflatex also but there are clearly no packages being loaded, etc.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)





More information about the texhax mailing list