0

If you look at the documentation source for man(1) (probably at /usr/share/man/man1/man.1.gz) using, you'll notice lines like this one -

.IR page [.\| section \|]\ \|.\|.\|.\|]\ \.\|.\|.\&

This gets rendered by man 2.8.3 to

page[.section] ...] ... 
----  -------

where the - denotes underlining. The way I understand this works is that unescaped spaces are stripped, and IR alternates between I (since italics are unavailable maybe it does underlining) and R (which is the normal roman font), and the font gets toggled using \|. Based on this, I would expect the rendering to look like -

page[.section] ...] ... 
----  -------  - -  ?-

Why is that not the case though?

3

The problem is with misunderstanding what the character codes actually do. If you look at the Ossanna and Kernighan's Troff user's manual, you'll see -

\|     1/6 em narrow space character (zero width in nroff)

So it is not actually alternating the fonts by itself, it only introduces thin spaces. The font alternation is happening because of spaces in the text (see man(7)) -

.IR page [.\| section \|]\ \|.\|.\|.\|]\ \.\|.\|.\&

This gets broken up into 4 chunks

page
[.\|
section
\|]\ \|.\|.\|.\|]\ \.\|.\|.\&

where the fonts alternates between them, giving the rendering that you see, where page and section are underlined, and the other chunks are not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.