[OS X TeX] Wrapping and formatting paragraphs in Texshop (and other misc.)
mark oilcan
markoilcan at yahoo.com
Thu Jan 13 17:21:36 CET 2005
--- David Arnold <darnold at northcoast.com> wrote:
> All,
>
> I've noted that some of my files differ in Texshop. What I am working
>
> on came from the windows environment text system (Emacs + Miktex).
>
> Some times Ctrl+k will kill a single line, sometimes a whole
> paragraph.
> Thus, even though it looks like a nicely wrapped paragraph onscreen,
> it
> is really one long line. Even inverse search with pdfsync selects a
> "paragraph" indicating it is one long line.
>
> How can I reformat my document in Texshop so that one long line
> becomes
> a paragraph with line endings? So that when I hit Ctrl+k, I delete to
>
> the end of the line and not the whole paragraph?
I don't use Texshop, so I can't tell you whether it's possible to
reformat the document within the application. In fact, as someone else
said, it may not be possible outside of hitting return within Texshop
every time you want to start a new line. This may be fine for new
documents as you write (as long as you remember). If you have documents
that need to be wrapped at a certain line length you could do this with
perl. Below is a script I wrote which makes a backup copy of your
original file by appending .bak to the file name and then wraps all
lines to be no more than 74 characters long. You can use the command
line argument -c N to wrap at N characters also. Just save the file to
either a directory in your path or the directory which has the document
you want wrapped and name it lwrap.pl (or something else if you
prefer). Make it executable (in Terminal type 'chmod +x lwrap.pl').
Then, in Terminal type
lwrap.pl yourfile.tex
or, if lwrap.pl is in your current directory
./lwrap.pl yourfile.tex
MarkA
#! /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 . $_
}
print wrap("\n","",$line);
}
else {
print "Usage: $0 [-c wrapcol] file.\n";
}
__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250
--------------------- 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 macostex-archives
mailing list