[texhax] Carriage Return key

Tom Schneider toms at ncifcrf.gov
Sun May 14 17:51:50 CEST 2006


> My data files contain 'carriage return' and it is not possible to use 
> an editor to remove them. Tex complains
> 
> Text line contains an invalid character.
> 
> ^^K
> 
> How do I tell TeX to treat 'carriage return' as a space and what 
> character code is 'carriage return' please.

If you can't remove them from the source, you can always copy the
source to another directory and manipulate that.  Under Unix systems
(eg Linux, Mac OSX, Sun) this is pretty easy with the tr and sed
inside a simple script.  I would write a script that did the job.  One
I use, for example is:

------
#!/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!
tr -d ^M < $1 > $2
------

(You need to replace the '^M' above with a real control M.  This
is easy in vi or vim.)

In your case:

cat $1 |\
sed 's/^M/ /' |\
sed 's/^K/something else/' |\
cat > $2

I assume you meant ^K, not ^^K.

Tom

  Dr. Thomas D. Schneider
  National Institutes of Health
  National Cancer Institute
  Center for Cancer Research Nanobiology Program
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  toms at ncifcrf.gov
  permanent email: toms at alum.mit.edu (use only if first address fails)
  http://www.ccrnp.ncifcrf.gov/~toms/


More information about the texhax mailing list