jsarbour
jsarbour

Reputation: 1148

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.

Upvotes: 0

Views: 153

Answers (2)

meuh
meuh

Reputation: 12255

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)

Upvotes: 1

jsarbour
jsarbour

Reputation: 1148

This can be achieved using the \fI <text> \fR in line style tags in place of the .I tags at the start of the line. In your code,

.\" filename.man

The filepath is /file/path/[\fIoption\fR], and it contains files.

I don't know why, and would appreciate comments or edits explaining the difference or linking to useful documentation.

Upvotes: 0

Related Questions