Richard Fearn
Richard Fearn

Reputation: 25491

Prevent word wrap after a hyphen in a man page

I have included the text "c<change-num>" in the DESCRIPTION section of a man page I am writing. Depending on the width of my terminal, the text is wrapped after the hyphen, like this:

   Blah blah blah blah blah blah "c<change-
   num>" blah blah blah...

How can I prevent the text wrapping after the hyphen, ensuring that "c<change-num>" is always displayed as a single word?

Upvotes: 1

Views: 219

Answers (1)

Richard Fearn
Richard Fearn

Reputation: 25491

From "Writing manual pages" (emphasis mine):

An unfortunate bit of arcane syntax is that dashes in options should be prefixed by backslashes. Thus, write \-\-bits, not just --bits. The Debian and Ubuntu implementation of man treats them the same, for terminal output, but this is not portable. Technically a naked - means a hyphen, whereas \- means a minus sign. Typographically these are distinct, and they are also distinct in Unicode. The typesetter is free to break a line at a hyphen, but not at a minus. For dashes in options, you should thus use minuses, but in normal text, for normal words, the hyphen.

So "c<change-num>" contains a hyphen, and the typesetter can break the line there.

"c<change\-num>" instead contains a minus, and the typesetter will not break the line there.

Upvotes: 1

Related Questions