unixmanpagetroffgroff

avoid space in manpage after .BI


I'm attempting to write a somewhat portable manpage, in which I need to describe the format of a particular string. I use the .BI macro to switch between fixed and variable parts, however I have more than six components (which is non-portable), and also parts are optional.

The target formatting is

USBnum::manufacturer::product::serial[::type]

that is, "USB" and the double colons in bold, "num", "manufacturer", "product", "serial" and "type" in italics, and the square brackets without special formatting.

So far, I have

.BI USB num :: manufacturer :: product
.BI :: serial
.RB [ ::
.IB type ]

However this generates spaces after "product", "serial" and the last set of double colons. How can I avoid these, using syntax that is portable to a reasonable subset of roff implementations?


Solution

  • Use the \cescape to "connect" lines of text.

    From the Troff User's Manual (CSTR 54,http://troff.org/54.pdf):

    4.2. Interrupted text. The copying of a input line in nofill (non-fill) mode can be interrupted by terminating the partial line with a \c. The next encountered input text line will be considered to be a continuation of the same line of input text.

    .BI USB num :: manufacturer :: product\c
    .BI :: serial\c
    .RB [ ::\c
    .IB type ]
    

    This should work as long as the formatter is a real *roff and not a script that just recognizes a few common macros.