Printing MAN pages

Erik Trulsson ertr1013 at student.uu.se
Thu Sep 8 14:40:05 PDT 2005


On Thu, Sep 08, 2005 at 04:50:29PM -0400, Bob Johnson wrote:
> On 9/8/05, Stijn Hoop <stijn at win.tue.nl> wrote:
> > On Thu, Sep 08, 2005 at 07:55:19PM +0200, Erik Trulsson wrote:
> > > On Thu, Sep 08, 2005 at 07:36:46PM +0200, Stijn Hoop wrote:
> > > > On Thu, Sep 08, 2005 at 07:53:28PM +0300, Giorgos Keramidas wrote:
> > > > > Gerard Seibert wrote:
> > > > > > I am trying to figure out how to print 'man' pages. If I try a
> > simple
> > > > > > redirect, such as: "man foo > foo.txt" the new file is loaded with
> > > > > > control symbols, etc. that are not really printable. I want to save
> > > > > > the files if possible, and print them out at a later date. It that
> > is
> > > > > > not possible, how would I go about printing them out in real time?
> > > > > 
> > > > > 	man -t foo > foo.ps
> > > > > 
> > > > > will generate Postscript output, which is a lot better for printing.
> > > > 
> [...]
> > > > This does not exactly spell 'output postscript' to me...
> > > 
> > > It does if you know that postscript is the default output format of
> > > groff.   If one doesn't know what format groff outputs by default, it is
> > > easily learned by reading the groff(1) manpage.
> > 
> > True. I'm all in favor of a little bit more userfriendliness in man pages
> > as long as it's not overkill though.
> > 
> > How about:
> > 
> > 	-t	Generate a Postscript version of the manpage, intended for
> > 		printing, by using /usr/bin/groff -S -man to format the manual
> > 		page, passing the output to stdout.  The output from
> > 		/usr/bin/groff -S -man may need to be passed through some
> > 		filter or another before being printed.
> > 
> > That way I can do /print in less and still get some useful hint.

Except that it does not explicitly create a Postscript version of the
mapage, but it rather generates a version in whatever format groff outputs
as default.  This happens to be Postscript normally, but as I describe
further down the default can be changed.


> > 
> 
> In make.conf(5) it says
> 
> 
>      PRINTERDEVICE
>                    (str) The default format for system documentation, depends
>                    on your printer.  This can be set to ``ascii'' for simple
>                    printers, or ``ps'' for postscript or graphics printers
>                    with a ghostscript filter, or both.
> 
> 
> So does PRINTERDEVICE change the default output for groff, or does it
> do something else, or nothing at all, and how does it affect your
> proposed change?

PRINTERDEVICE changes how groff is invoked when formatting the documents
normally installed under /usr/share/doc.  It is not used otherwise, and in
particular is not used at all by man(1).


The GROFF_TYPESETTER environment variable however does change the default
output for groff.  Another option is of course to invoke groff directly and
use the -T option to set the output format directly.  All of this is also
easily discovered by reading the groff(1) manpage.



-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-questions mailing list