text format

Robert Bonomi bonomi at mail.r-bonomi.com
Tue Jun 12 20:10:33 UTC 2012

> From owner-freebsd-questions at freebsd.org  Tue Jun 12 14:39:59 2012
> Date: Tue, 12 Jun 2012 20:40:23 +0000
> From: pwnedomina <pwnedomina at gmail.com>
> To: Polytropon <freebsd at edvax.de>
> Cc: freebsd-questions at freebsd.org
> Subject: Re: text format
> On 12-06-2012 08:22, Polytropon wrote:
> > On Tue, 12 Jun 2012 09:06:07 +0100, i pwn wrote:
> >> on groff i've used this cmd to format the text
> >> groff -Tascii<  normal.txt | sed 's/^/   /'$1>  formatted.txt
> >> on nroff what would be the cmd?
> > Depending on your input data, I'd say the same command:
> > groff -Tascii<  normal.txt>  formatted.txt. But you need
> > to test this yourself with your input text format.
> >
> > See "man nroff" for details.
> >
> > For using roff macros, "man 7 mdoc" has a nice summary.
> >
> >
> >
> im only asking what cmd should i use to format an ascii text to be 
> identical to that one, centered and aligned..

There *ISN'T* any simple command-line tool that will do what you want,
all "automatically".

You have to take the 'plain text' ASCII file, and embed 'mark-up' codes
in it that describe *what* the desired actions are, and =where= the are
to be applied.

Then, and -ONLY- then, can you run the 'marked up' file through a 'formatter'
function to produce the "pretty-printed', centered/aligned, output.

There are basically -two- approaches to this kind of problem.  

One approach is a 'word processor', where you _interactively_ select` the 
visual effects you desire, and where to apply then.  This includes programs 
like MS-Word, WordPerfect, OpenOffice, etc.

The other approach is a 'text formatter' -- less intuitive than a 'word
processor', but much better for large, _structured_, documents.  In this
situation, you embed codes that identify 'logical' units/sub-divisions of 
the document, and provide a 'style' specification as to how those various
types of units should be rendered.  A command-line program then takes the 
'marked up' text, and the 'style' specification, and creates the 'formatted'
output file.

More information about the freebsd-questions mailing list