[OS X TeX] Wrapping and formatting paragraphs in Texshop (and other misc.)

mark oilcan markoilcan at yahoo.com
Fri Jan 14 10:58:09 EST 2005


--- Herb Schulz <herbs at wideopenwest.com> wrote:

> 
> Howdy,
> 
> This would be quite handy. It seems to output to stdout though; the
> new
> file.tex.bak is indeed the original file.tex but the new file.tex is
> empty
> and the (wrapped?) contents seems to scroll by on the screen.
> 

Oops. Sorry, I had removed a couple of critical parts when I was using
the  script to test a couple of things. Here's the correct version
which works as advertised. Thanks for the feedback.

Mark A

#! /usr/bin/perl -i.bak

# Edit a file so that long lines are wrapped. By default the wrapping
# occurs at column (ie character) 74, but can be set to N by using the
# -c N command line argument.

use Getopt::Std;
use Text::Wrap;

if ( getopts('c:') ) {
  $col = $opt_c;
  $col = 74 unless ($col);
  $Text::Wrap::columns = $col;

  while(<>) {
    $line = $line . $_
  }
  open(OUTFL, ">$ARGV");
  print OUTFL wrap("\n","",$line);
}
else {
  print "Usage: $0 [-c wrapcol] file.\n";
}



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list