manpagegroff

Avoid space before comma after macro


I'm trying to write a manpage by using the man macro package of Groff. Specifically, I would like to write some text like the following:

The daemon can be configured by means of a configuration file. The default location of such file is /etc/trolls.conf, and this is quite nice.

Desired text proprieties:

It is incredibly hard to get a text which satisfies such proprieties! For example, the following will result in an Italic comma:

.SH DESCRIPTION
The daemon can be configured by means of a configuration file. The default
location of such file is
.I /etc/trolls.conf,
and this is quite nice.

Result 1

On the other hand, this second attempt will put a space between /etc/trolls.conf and the roman comma:

.SH DESCRIPTION
The daemon can be configured by means of a configuration file. The default
location of such file is
.I /etc/trolls.conf
, and this is quite nice.

Result 2

Is there some way to get this to work?


Solution

  • This typesetting language is incredibly hard (well, it's also incredibly old), and eventually I solved this by looking at existing manpages!

    The solution follows:

    .SH DESCRIPTION
    The daemon can be configured by means of a configuration file. The default
    location of such file is
    .IR /etc/trolls.conf ,
    and this is quite nice.
    

    The .IR macro will in fact alternate between Italic (I) and Roman (R), resulting in the correct rendering effect: good result