[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Escape characters in -man output
From: |
Keith MARSHALL |
Subject: |
Re: [Groff] Escape characters in -man output |
Date: |
Fri, 8 Jul 2005 10:39:54 +0100 |
Zvezdan Petkovic wrote:
> Setting GROFF_NO_SGR seems cleaner than calling groff with -P-c all
> the time (or even aliasing it).
>
> However, it uses the old way of backspacing for bold.
> There is a better way that uses ASCII escape sequences.
> Try
> MANPAGER="more -R"
> export MANPAGER
That works fine, when your system *properly* supports SGR, (and when
"more" really means "less" -- as yours does -- or it otherwise has
"less" compatible support for the "-R" option). It isn't a viable
solution for a Win32 console, because, if SGR works at all, it most
likely isn't adequately emulated -- the MSYS implementation, which I
use, can switch on the bold and italic highlighting features, but it
doesn't recognise the escape sequences to individually switch them
off again!
However, if you use "nroff" rather than "groff" to format manpages
for display on the console, then it is sufficient to specify just
the "-c" option -- "nroff" takes care of passing the "-P-c" option
to "grotty", in this case. Thus, my Win32 "man.conf" says
PAGER d:/path/to/less -is
NROFF d:/path/to/nroff -Tlatin1 -mandoc -c
which, without exporting GROFF_NO_SGR, is sufficient to make
man foo
display the manpage for "foo" correctly, whereas
PAGER d:/path/to/less -isR
NROFF d:/path/to/groff -Tlatin1 -mandoc
results in an untidy mess of inappropriate highlighting, and needs
the addition of the "-c" and "-P-c" options on the NROFF line, and
removal of "-R" from the PAGER, to fix it.
BTW, "man.conf" also specifies a TROFF configuration, such as
TROFF d:/path/to/groff -Tps -mandoc
This is used *only* when the "-t" option is given to "man", which
indicates that the manpage should be typeset for hardcopy printing;
"man" *always* selects the formatter specified by NROFF, to format
any manpage for viewing through the PAGER.
HTH.
Regards,
Keith.