Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 May 2005 23:36:13 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Steven Friedrich <FreeBSD@InsightBB.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: using groff macros
Message-ID:  <20050507203612.GB9298@gothmog.gr>
In-Reply-To: <200505071603.32606.FreeBSD@InsightBB.com>
References:  <200505071603.32606.FreeBSD@InsightBB.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-05-07 16:03, Steven Friedrich <FreeBSD@InsightBB.com> wrote:
> I'm experimenting with groff macros and I've placed '.B some text'
> into a file.  I don't know what command line options to get groff to
> spit it out as bold text.
>
> I've tried groff -man -T ascii filename | more
>
> but it just swallows the text.  I've read many man pages but I'm not
> getting a thread to follow.

Just a plain .B is not enough for groff to make text bold.  The -man macros
require other troff requests too, before they output any text on a page.

Try the following two examples, for instance, and see the difference in the
output they produce:

1.	Bold text shouldn't be visible (but it's still there).

	cat <<EOF | groff -Tascii -man
	.TH foo 1
	.SH DEMO
	.LP
	.B bold
	text demo.
	EOF

2.	more(1) and less(1) know about groff output and show bold.

	cat <<EOF | groff -Tascii -man | less
	.TH foo 1
	.SH DEMO
	.LP
	.B bold
	text demo.
	EOF

> About ten years ago I used nroff on a Gould UTX-32 (Unix) system,
> but I can't remember much. I believe I simply used 'nroff -man
> filename'.
>
> What I'm actually trying to do is create fortunes with bold, italic,
> and underlined words.  I redirected man pages into a file and
> discovered that S backspace S will produce a bold S, and _ backspace
> S will produce S in reverse video.  I added sequences like this to
> my fortune file, but then it's a bear to read. So I was hoping to
> use something from the roff family and their macros.

You don't really need groff for that.  Plain terminal escape sequences
can yield better output than groff-formatted material:

	$ echo -e '\033[1mfoo\033[0m: an example of \033[4mbar\033[0m.'

- Giorgos



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050507203612.GB9298>