Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Linux

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 06-08-2007, 01:20 PM
Ian Smith
Newsgroup Contributor
 
Posts: n/a
Editor which will justify plain text.

OK, stupid question time. I would like to "justify" some plain text so
that the left and right edges of paragraphs are all nice and neat. Normal
word processors appear to achieve this by shifting words at pixel level,
but then it has to be saved as a formatted document. For plain text, I'm
looking for something which will automatically insert space characters to
pad the words out, so the result can be saved as ".txt".

Ideally it should be possible to do dynamically (or triggered manually),
so frequent editing can allow tidying up of the text as often as required.
Is there an editor which will do this under linux? My text can be up to
hundreds of lines long. Sorry if this has been discussed before ad
infinitum (or nauseum). Some editors will happily word-wrap on the fly,
e.g. this Pan newsreader ("Rewrap" button), but haven't found one with the
magic justify.

Anyway, recently new to linux. Currently running SimplyMEPIS and enjoying
the "breath of fresh air" it is compared to MS.

Regards to all,

Ian (Clydebank, Scotland).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 06-08-2007, 01:20 PM
  #2 (permalink)  
Old 06-08-2007, 02:00 PM
Chris F.A. Johnson
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

On 2007-06-08, Ian Smith wrote:
> OK, stupid question time. I would like to "justify" some plain text so
> that the left and right edges of paragraphs are all nice and neat. Normal
> word processors appear to achieve this by shifting words at pixel level,
> but then it has to be saved as a formatted document. For plain text, I'm
> looking for something which will automatically insert space characters to
> pad the words out, so the result can be saved as ".txt".


I'm sure there is one (if there isn't that capability in the basic
emacs, for example, I'm sure someone has written a module to do
it).

However, I strongly recommend against doing that; it makes text
much harder to read in a monospaced font. If you are not using a
monospaced font, the result will not be justified.


--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 06-08-2007, 04:50 PM
sk8r-365
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

Ian Smith said:
> OK, stupid question time. I would like to "justify" some plain text so
> that the left and right edges of paragraphs are all nice and neat. Normal
> word processors appear to achieve this by shifting words at pixel level,
> but then it has to be saved as a formatted document. For plain text, I'm
> looking for something which will automatically insert space characters to
> pad the words out, so the result can be saved as ".txt".

<snip>

vi, vim , cream (which easier on a noob) all do so.
I L/R justified your text above using cream.

For vi, vim there's more here http://tinyurl.com/kvp7n

Quote:

Formatting:

# Mark a block of text at the top line and bottom line of the block.
i.e. "mt" and "mb" on two separate lines.

# Example: ":'t,'b !nroff"

# You can insert nroff commands i.e.:

.ce 3 Center the next three lines
.fi Fill text - left and right justify (default)
.nf No Fill
.ls 2 Double line spacing
.sp Single line space
.sv 1.0i Vertical space at top of page space
.ns Turn off spacing mode
.rs Restore spacing mode
.ll 6.0i Line length = 6 inches
.in 1.0i Indent one inch
.ti 1.0i Temporarily one time only indent one inch
.pl 8.0i Page length = 8 inches
.bp Page break
--
sk8r-365

http://goodbye-microsoft.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 06-08-2007, 06:40 PM
Linonut
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

After takin' a swig o' grog, sk8r-365 belched out this bit o' wisdom:

> Ian Smith said:
>> OK, stupid question time. I would like to "justify" some plain text so
>> that the left and right edges of paragraphs are all nice and neat. Normal
>> word processors appear to achieve this by shifting words at pixel level,
>> but then it has to be saved as a formatted document. For plain text, I'm
>> looking for something which will automatically insert space characters to
>> pad the words out, so the result can be saved as ".txt".

> <snip>
>
> vi, vim , cream (which easier on a noob) all do so.
> I L/R justified your text above using cream.
>
> For vi, vim there's more here http://tinyurl.com/kvp7n
>
> # Example: ":'t,'b !nroff"


Thanks!

Also for hex editing in vim:

:%!xxd

and

:%!xxd -r

Pipes rock!

--
Tux rox!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 06-09-2007, 03:40 AM
Mike
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

Jun 9: Responding to Linonut...

[...]
> Pipes rock!


Mine don't. They just stay right where I type them.

Is there a flag for this "rock" function?

Or is the "!" there to cancel any "rocking"?

--

Yellow Submarine?
Nah. Its a TeaPot!
www.tinyurl.com/382gmp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #6 (permalink)  
Old 06-09-2007, 04:20 PM
Ian Smith
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

On Fri, 08 Jun 2007 16:47:09 -0400, Chris F.A. Johnson wrote:

> On 2007-06-08, Ian Smith wrote:
>> OK, stupid question time. I would like to "justify" some plain text so
>> that the left and right edges of paragraphs are all nice and neat.
>> Normal word processors appear to achieve this by shifting words at
>> pixel level, but then it has to be saved as a formatted document. For
>> plain text, I'm looking for something which will automatically insert
>> space characters to pad the words out, so the result can be saved as
>> ".txt".

>
> I'm sure there is one (if there isn't that capability in the basic
> emacs, for example, I'm sure someone has written a module to do it).
>
> However, I strongly recommend against doing that; it makes text much
> harder to read in a monospaced font. If you are not using a
> monospaced font, the result will not be justified.


Thank you for that advice. Perhaps I will leave the text as is, but if
going down the justification route, would check readability with friends
anyway.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 06-09-2007, 04:30 PM
Ian Smith
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

On Fri, 08 Jun 2007 17:39:10 -0600, sk8r-365 wrote:

> Ian Smith said:
>> OK, stupid question time. I would like to "justify" some plain
>> text so that the left and right edges of paragraphs are all nice
>> and
>> neat. Normal word processors appear to achieve this by shifting
>> words at pixel level, but then it has to be saved as a formatted
>> document. For plain text, I'm looking for something which will
>> automatically insert space characters to
>> pad the words out, so the result can be saved as
>> ".txt".

> <snip>
>
> vi, vim , cream (which easier on a noob) all do so. I L/R justified your
> text above using cream.
>
> For vi, vim there's more here http://tinyurl.com/kvp7n
>
>
Quote:
>
> Formatting:
>
> # Mark a block of text at the top line and bottom line of the
> block. i.e. "mt" and "mb" on two separate lines.
>
> # Example: ":'t,'b !nroff"
>
> # You can insert nroff commands i.e.:
>
> .ce 3 Center the next three lines
> .fi Fill text - left and right justify (default) .nf No
> Fill .ls 2 Double line spacing
> .sp Single line space
> .sv 1.0i Vertical space at top of page space .ns Turn off
> spacing mode
> .rs Restore spacing mode
> .ll 6.0i Line length = 6 inches
> .in 1.0i Indent one inch
> .ti 1.0i Temporarily one time only indent one inch .pl 8.0i
> Page length = 8 inches
> .bp Page break
>


Thank you for all that information. I have used vim before to edit some
startup options in Knoppix (USB flash install), but didn't realise it has
this justify function. Will give it a try anyway.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 06-09-2007, 05:50 PM
sk8r-365
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

Ian Smith said:
>
> Thank you for all that information. I have used vim before to edit some
> startup options in Knoppix (USB flash install), but didn't realise it has
> this justify function. Will give it a try anyway.


Good. You're welcome. BTW, cream is super easy and has spell check
built-in.
--
sk8r-365

http://goodbye-microsoft.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 06-10-2007, 12:21 AM
Robert Newson
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

Ian Smith wrote:

> On Fri, 08 Jun 2007 17:39:10 -0600, sk8r-365 wrote:

....
>>For vi, vim there's more here http://tinyurl.com/kvp7n
>>
>>[quote]
>>
>>Formatting:
>>
>> # Mark a block of text at the top line and bottom line of the
>> block. i.e. "mt" and "mb" on two separate lines.
>>
>> # Example: ":'t,'b !nroff"

....
> Thank you for all that information. I have used vim before to edit some
> startup options in Knoppix (USB flash install), but didn't realise it has
> this justify function. Will give it a try anyway.


Technically vim doesn't!

What's you've actually done is supplied the marked lines as the input to
another (*nix) command and then replaced those lines with the output of that
command.

This is what the shriek (!) command does.

If you use a double shriek (!!) when editing a file, vi[m] takes the current
input line and then supplies it as input (stdin) to whatever command you
then type (visible on the status line at the bottom of the screen) and then
uses the output (stdout) from this command to replace that input line.

Using the colon (:) (ex(?) command prefix) you can specify a range of lines
to be specified for the shriek (!) command, as in
:<start>,<finish>!<*nix_command>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #10 (permalink)  
Old 06-10-2007, 06:50 AM
sk8r-365
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

Robert Newson said:

>
> Technically vim doesn't!
>
> What's you've actually done is supplied the marked lines as the input to
> another (*nix) command and then replaced those lines with the output of that
> command.
>

<snip>

You're right, Robert. I was pointing him to a page, which I included
some text for the purpose of showing OP where it is there, to get him
started. Thank you for expanding on it.

--
sk8r-365

http://goodbye-microsoft.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #11 (permalink)  
Old 06-10-2007, 03:50 PM
roodwriter@ureach.com
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

Ian Smith <ianinhoose@btinternet.naespam.com> writes:

Although you seem to be happy doing it in Vim, and that's fine, be
aware that Emacs also will justify. The command is [alt]-x
set-justification-full.

Just for the record.


--Rod
______________________
Author of "Linux for Non-Geeks--Clear-eyed Answers for Practical
Consumers" and "Boring Stories from Uncle Rod." To reply by e-mail
take the second "o" out of the e-mail address.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #12 (permalink)  
Old 06-10-2007, 09:50 PM
HASM
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

roodwriter@ureach.com writes:

> Although you seem to be happy doing it in Vim, and that's fine, be aware
> that Emacs also will justify. The command is [alt]-x
> set-justification-full.


Or, to justify the current paragraph (i.e. holding point) use C-u M-q.

-- HASM


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #13 (permalink)  
Old 06-11-2007, 07:40 AM
birre
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

On 2007-06-08 22:04, Ian Smith wrote:
>OK, stupid question time. I would like to "justify" some
>plain text so that the left and right edges of paragraphs
>are all nice and neat. Normal word processors appear to
>achieve this by shifting words at pixel level, but then it
>has to be saved as a formatted document. For plain text, I'm
>looking for something which will automatically insert space
>characters to pad the words out, so the result can be saved
>as ".txt".


>Ideally it should be possible to do dynamically (or trig-
>gered manually), so frequent editing can allow tidying up of
>the text as often as required. Is there an editor which
>will do this under linux? My text can be up to hundreds of
>lines long. Sorry if this has been discussed before ad
>infinitum (or nauseum). Some editors will happily word-wrap
>on the fly, e.g. this Pan newsreader ("Rewrap" button), but
>haven't found one with the magic justify.


>Anyway, recently new to linux. Currently running SimplyMEPIS
>and enjoying the "breath of fresh air" it is compared to MS.


>Regards to all,


>Ian (Clydebank, Scotland).



I use the editor vi , or vim when using linux.

Ok, the editor don't have all features, but that is
the unix way, since no program can have ALL features anyway.

The command :%!nroff will send the contents to nroff, that
do the work, and send it back to the editor, just as you can
use any other software that can filter text.

If you later learn nroff, you can add commands to your text,
so you get the format yop like.

/birre

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #14 (permalink)  
Old 06-11-2007, 03:50 PM
Ian Smith
Newsgroup Contributor
 
Posts: n/a
Re: Editor which will justify plain text.

On Fri, 08 Jun 2007 21:04:41 +0100, Ian Smith wrote:

> OK, stupid question time. I would like to "justify" some plain text so
> that the left and right edges of paragraphs are all nice and neat. Normal
> word processors appear to achieve this by shifting words at pixel level,
> but then it has to be saved as a formatted document. For plain text, I'm
> looking for something which will automatically insert space characters to
> pad the words out, so the result can be saved as ".txt".
>
> Ideally it should be possible to do dynamically (or triggered manually),
> so frequent editing can allow tidying up of the text as often as required.
> Is there an editor which will do this under linux? My text can be up to
> hundreds of lines long. Sorry if this has been discussed before ad
> infinitum (or nauseum). Some editors will happily word-wrap on the fly,
> e.g. this Pan newsreader ("Rewrap" button), but haven't found one with the
> magic justify.
>
> Anyway, recently new to linux. Currently running SimplyMEPIS and enjoying
> the "breath of fresh air" it is compared to MS.
>
> Regards to all,
>
> Ian (Clydebank, Scotland).


Many thanks to all who responded. I'm trying out "Cream" at the moment.
Seems quite a user-friendly package.

Cheers,

Ian

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying PDF as plain/text Bach Le Internet Explorer 5 11-21-2007 08:40 AM
Signatures in html, plain text? nikj_dk Microsoft Office 0 10-31-2007 04:50 AM
How do I justify text from a clipping dropped into OneNote? C. A. Gueits Microsoft OneNote 1 09-23-2007 06:30 AM
Re: justify text in One Note DaComboMan Microsoft OneNote 1 09-09-2007 12:00 PM
How do you get text to justify right? DP Microsoft OneNote 3 01-07-2007 12:17 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 12:10 AM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0