nroff text processing
CSC137 Louis Taber October 10, 1999
nroff and troff are used to produce the online
documentation or man pages. There are several
macro sets that can be used with nroff and troff.
Without them both are difficult to use. You can
think of the macro sets as being analogous to a
style sheet in Microsoft Word.
1. Use a text editor to produce a file for
processing with nroff, a text processing
program. This document will need to have
centered text:
Like this line.
And, underlined text like this word.
Also print out the day, month, and year:
3/26/96
Also:
Center and underline.
2. Use the spell-check program to check for
misspelled words.
3. Turn in three items: your formatted docu-
ment, your original source file, and your
spelling list from spell.
The following example is the input file for the assignment sheet:
Summary information about.ad l .ll 50 .nf nroff text processing .br CSC137 Louis Taber October 10, 1999 .fi .sp nroff and troff are used to produce the online documentation or man pages. There are several macro sets that can be used with nroff and troff. Without them both are difficult to use. You can think of the macro sets as being analogous to a style sheet in Microsoft Word. .sp .in .8i .ti -.8i 1. Use a text editor to produce a file for processing with nroff, a text processing program. This document will need to have centered text: .sp .ce Like this line. .sp And, underlined text like this .ul 1 word. .sp Also print out the day, month, and year: \n(mo/\n(dy/\n(yr .sp Also: .sp .ce 1 .ul 1 Center and underline. .sp .ad l .ti -.8i 2. Use the spell-check program to check for misspelled words. .sp .ti -.8i 3. Turn in three items: your formatted document, your original source file, and your spelling list from spell. .ex
nroff
troff.
nroff to be useful.
To invoke with standard macro files use options:
On gort these load the macro file-man for manual pages -ms for (Scientific papers - e.g..ABfor Abstract) -me for (Books - e.g..+cfor Begin chapter)
/usr/lib/groff/tmac/tmac.Xan, s, or e.
(There are additional macro options.)
FONT CONTROL .bd bold font .ft font CHARACTER SIZE .ps n point size PAGE CONTROL .bp begin page .pl set page length .pn set page number .rt return - vertical - for columns TEXT FILLING / ADJUSTING / CENTERING .ad x (l,r,c,b,n)adjust .br break .ce center .fi fill .na no adjust .nf no fill VERTICAL SPACING .ls line spacing .sp space <blank line> break and space LINE LENGTH and INDENTING .in indent .ll line length .ti temporary indent
% page number dw day of week (1-7) dy day of month ln current line mo month yr year .c current line from input .f current font .i current indent .j current adjustment mode .l line length
.nr R v [i] define numeric variable R with
value v with optional increment i
.af R c set format to numeric variable
(1,01,i,I,a,A)
\nx use register x
\n(xy use register xy - two letters
\n+x add increment and then use
\n-(xy subtract increment and then use
.ds R str define variable R to contain str .as R str append str to string variable R \*x use register x \*(xy use register xy - two letters \w'string' width of string
\" comment
Macro usage:.de xx \"begin macro definition Today is \\$1 the \\$2. .. \"end of macro definition
Produces:.xx Monday 14th
Today is Monday the 14th.