3

I'd like to define a new command that prints man pages to PostScript, but using a page size different than the default. For example, on Mac OS X you can run

man -t ls | open -f -a Skim

to open the man page for ls as a PDF, which is almost exactly what I'd like. In fact, the only change I want to make is to print to a different page size. Since I'm never actually going to print these out on real paper, it would be nice to have the PDF sized to fit more neatly on my monitor. But I haven't been able to figure out how to do this in a simple way. The man page for man says that the -t switch will

Use /usr/bin/groff -Tps -mandoc -c to format the manual page, passing the output to stdout.

To get a different page size it would appear that you need to change the arguments to groff to something like groff -Tps -P-pa4, so it looks like the straightforward way to do this is to give man a different command to use for formatting the man page. But there doesn't seem to be a command line switch or an environment variable that allows you to do this. Is there a way to invoke man so that it uses a command that I specify to format the man page?

(I would prefer to avoid doing something like

groff -Tps -P-pa4 -mandoc -c `man -w ls`

because sometimes the man pages are compressed as .gz files and sometimes they aren't, and presumably man could be making some other decisions about how to preprocess man pages.)

1 Answer 1

0

According to this page, the default paper size is read from the PAGE environment variable.

But for on-screen viewing of manpages, have you considered something like man2html?

3
  • I have thought about man2html, but this isn't installed by default on OS X. I keep thinking that there must be a simple, one-liner solution that doesn't depend on extra software, but maybe there isn't.
    – DGrady
    Oct 24, 2012 at 0:14
  • Checking out your tip, it doesn't seem to have any effect on my installation. Running PAGE=A4; man -t ls produces the same thing as PAGE=letterpaper; man -t ls.
    – DGrady
    Oct 24, 2012 at 0:36
  • I was hoping to find an answer to the question "How can you change the format command used by man?"
    – cryptarch
    Aug 10 at 7:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .