man – Fix ‘man’ Page Too Narrow in Terminal

bashmanrhel

I'm making my first 'man' page and I'm using groff to do it. However, when I "compile" it and view it, it only takes up a certain amount of columns in my terminal. I've tried viewing other man pages just in case and they stretch with the width of my terminal. For a visual exmaple:

---------------------------------------
| stuff(1)             stuff(1)         |
|                                       |
| NAME                                  |
|       a tool to do stuff but          |
|       it isn't really working         |
|                                       |
| DESCRIPTION                           |
|       yadadyadyadyadyadyadydy         |
|       segfwefwefwefwe                 |
|                                       |
|       srgswrgwrg                      |
 ---------------------------------------

… and so on, hopefully you get the idea. Most man pages take the full width.

Right now, after writing my man page in a text file (using the groff/nroff "syntax"), I make it like this:

groff -Tascii -man ./path/to/man | more

Best Answer

I checked what groff call is executed when I invoke man man (which uses the full width):

$ strace -o log -f -v -s 1024 -e trace=process man man

Looking for the groff call results in the following:

$ grep groff log | sed 's/\], \[.*//' 
28721 execve("/usr/bin/groff", ["groff", "-mtty-char", "-Tutf8", "-mandoc",
                                         "-rLL=171n", "-rLT=171n"

Now I resize my xterm:

$ strace -o log2 -f -v -s 1024 -e trace=process  man man
$ grep groff log2 | sed 's/\], \[.*//'
28852 execve("/usr/bin/groff", ["groff", "-mtty-char", "-Tutf8", "-mandoc",
                                         "-rLL=119n", "-rLT=119n"

Thus, I assume that the -rLL and -rLT arguments influence what terminal width is used by groff during compiling.

Related Question