So why is my console on Ubuntu doesn't render according to the man
manual? If I type in man man
in the console I get a manual for man
. And for example, it points out that italic text replace with appropriate argument.
But what I can see is a string italic text which is underscored. Why the example is not in italics and why it is underscored? Is it like this or is it because my console renders text in another way than others, so someone may see text in italics?
-
You probably can't have man with formatted text in console, you don't have bold either. but on web you can see it man7.org/linux/man-pages/man1/man.1.html– admstgMar 22 at 10:01
2 Answers
It is not man
who does not print italic, it is a formatter roff
which is to blame. By historical reasons.
the text modes were developed in the ancient times, long before graphics was available, and for compatibility, these text modes are inherited by modern video cards as is... And these modes (still used by the actual console) do not have the italic capabilities at all.
So text formatters roff
/groff
/troff
/nroff
do the substitution italic-underscore, when they do printout to text console. If you specify the html as target format, the italic texts in documentation would be italic.
At the same time, almost all modern terminals (xterm
, gnome-terminal
, etc) working in GUI are capable to draw italic font. Just execute:
echo -e "\e[3mabcd\e[23m"
You should see italicized text.
And the terminfo has the proper codes for italic:
infocmp $TERM | grep -e sitm -e ritm
You most likely will see a sitm=\E[3m
and ritm=\E[23m
.
Probably, in the distant future, when the text video modes would become obsolete and disappear from video cards - in a decade or two after that, we will see a change in groff
... maybe...
-
-
@Juandev In the real console, no. There was (is) a possibility to redefine font in text mode, but it was usually used for national fonts. Adding bold or italic variations - possible only by complete overriding existing font. In the time of DOS there were even art of "demo" where people draw pictures in text modes by redefining fonts. But they also had to limit themselves to just 256 glyphs. That just how textmode is - a byte array in memory, where one byte correspond to one glyph on screen. Mar 23 at 15:08
As has been explained you don't get italics by default for historical reasons. However, if you are using a terminal (emulator) that understands italics you can define a function iman
that uses a pipeline like this:
iman() {
zcat -f $(command man -w "$1") |
tbl |
groff -man -Tutf8 -P-i |
"${PAGER:-less}"
}
And then invoke it as
iman ls
On my *xterm
emulators I get italic where previously I would have been shown underline.