groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] extended font macro


From: Bernd Warken
Subject: [Groff] extended font macro
Date: Sat, 26 Jan 2013 15:44:55 +0100 (CET)

In man-pages I you the following macro definition:

.\" --------------------------------------------------------------------
.\" .FONT ([<font name> <text> ...])
.\"
.\" Print in different fonts: R, I, B, CR, CI, CB
.\"
.de1 FONT
.  if (\\n[.$] = 0) \{\
.       nop \&\f[]\&
.       return
.  \}
.  ds result \&
.  while (\\n[.$] >= 2) \{\
.       as result \,\f[\\$1]\\$2\f[]
.       shift 2
.  \}
.  if (\\n[.$] = 1) .as result \,\f[\\$1]
.  nop \\*[result]\&
..

With 1 argument it works like ".ft font", without argument it works like ".ft".

With 2 or more arguments, it gets really interesting.  Then the odd arguments
are font names and the even arguments are text.

Examples:

.FONT I text1 R text2 I text3 R text4
is equivalent to .IR text1 text2 text3 text4

But more then the font macros of man, you can use the fonts CR, CI, and CB.

.FONT CB file. CI extension . R .
This is
\f[CB]file.\f[]\f[CI]extension\f[]\f[R].\f[]
The .FONT macro is much more readable.

Maybe we could rename .FONT or .FT and add it to the man macros in an-old.tmac.
We could even extend .ft, but I do not know how to do this.

Bernd Warken



reply via email to

[Prev in Thread] Current Thread [Next in Thread]