From owner-freebsd-questions@FreeBSD.ORG Tue Jun 12 20:10:33 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C3B11065670 for ; Tue, 12 Jun 2012 20:10:33 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id DDDAB8FC0C for ; Tue, 12 Jun 2012 20:10:32 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q5CKB557038063; Tue, 12 Jun 2012 15:11:05 -0500 (CDT) Date: Tue, 12 Jun 2012 15:11:05 -0500 (CDT) From: Robert Bonomi Message-Id: <201206122011.q5CKB557038063@mail.r-bonomi.com> To: freebsd@edvax.de, pwnedomina@gmail.com In-Reply-To: <4FD7A937.5030607@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: text format X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:10:33 -0000 > From owner-freebsd-questions@freebsd.org Tue Jun 12 14:39:59 2012 > Date: Tue, 12 Jun 2012 20:40:23 +0000 > From: pwnedomina > To: Polytropon > Cc: freebsd-questions@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.