Search code examples
linuxmanpagegrofftroff

extraneous space around italics and bolds in manpage?


I am writing a man page. I am displaying only with man -l filename.man.

I am running into an issue where my text is displaying as:

file/path/[ option ]

Where I would like it to display as:

file/path/[option].

The offending lines of text (code?) look like:

.\" filename.man

The filepath is /file/path/[
.I option
], and it contains files.

I am extremely new to formatting with [gnt]roff, and appreciate any pointers or recommended readings.


Solution

  • A definite guide to groff is gnu.org. I recommend the pdf for easy searching. It includes chapter 5.17.1 Changing Fonts that explains \f. Note there are at least 2 alternatives. The first uses \c to stop further output at the end of a line:

    The filepath is /file/path/[\c
    .I option\c
    ], and it contains files.
    

    but the following is the preferred method, using a macro RI (roman-italic) provided specially for the purpose of joining "words" in an alternating roman then italic font:

    The filepath is 
    .RI /file/path/[ option ],
    and it contains files.
    

    See the pdf chapter 4.1.3 Macros to set fonts, or the man page for groff_man (the man macros, also at gnu.org)