using groff macros
Giorgos Keramidas
keramida at ceid.upatras.gr
Sat May 7 13:46:08 PDT 2005
On 2005-05-07 16:03, Steven Friedrich <FreeBSD at 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
More information about the freebsd-questions
mailing list