Getting Help

Lab Schedule

Home > Help Files > Unix > Text Formatting > nroff

Nroff


                Originally Written by Eric Moore (1986)
            Edited and Revised by Prof. A. P. Pisano (1989)


COMMON nroff macros-- 	rearranged for easy use  from   man ms(1) 
			
     nroff  -ms  [ options ]  file  | lpr
     nroff  -ms  [ options ]  filein  >  fileout
		   -nN		number first generated page N
					

SEE ALSO
	"nroff/troff user's manual"  -- includes defining your own macros
	"Document formatting on UNIX using -ms macros"
	eqn(1),  refer(1), tbl(1), troff(1), 
	style(1), diction(1), and spell(1) 
	

printer controls:
          .ls n  	line spacing: n=1 single, n=2 double space, n=3 triple
	  .nr LL n	line length
          .nr NA	no alignment of right margin
	  .nr PO n i 	set left margin, N=line length, i=offset from left
	
	  .pl n		page length = n
	  .pn n		set page number n
          .bp    	begin new page
          .bp +N        begin new page with page number incremented by n
          .bp -N        begin new page with page number decremented by n
          .br    	break output line
	  .fi	 	fill
	  .nf	 	nofill	
          .sp n  	insert n spacing lines
          .ce n  	center next n lines

title page and titles:
macro 	initial	break?
name	value	reset?


.TM     off       n      UC Berkeley thesis mode
.RP x   -         n      released paper format; x=no stops title on 1st page

.RP x   -         n      cover sheet; x=no stops title on 1st page
.TL     -         y      title in underline and caps.; can also use .LP
.AU     -         y      author's name
.AI     -         y      author's institution /author info.
.AB x   -         y      begin abstract; if   x=no don't label abstract
.AE     -         y      end abstract
.PP			 used here to separate title page and main text

.PT     - % -     n      page title, printed at head of page
.BT     date      n      bottom title, printed at foot of page
.CT     -         y,y    chapter title: page number moved to CF (.TM only)
.tl 'x'y'z'		 prints x left justified, y @ center, z right justified

.TC x   -         y      print table of contents at end; x=no suppresses title

displays 
macro 	initial	break?
name	value	reset?


.KS	-	-	keep text between .KS and .KE on same page
.KE	-	-	.KF instead of .KS will place kept text on top of next
.KF	-	-	 page and following text on current page. good for figs.

.DS x y I       y      begin display with keep; x=I,L,C,B; y=indent
.DE     -       y      end display (unfilled text) of any kind

.ID y   8n,.5i    y      indented display with no keep; y=indent
.LD     -         y      left display with no keep
.CD     -         y      centered display with no keep
.BD     -         y      block display; center entire block

.RS     5n        y,y    right shift: start level of relative indentation
.RE     5n        y,y    retreat: end level of relative indentation

paragraphs
macro 	initial	break?
name	value	reset?


.PP     -         y,y    paragraph with first line indented
.IP x y -         y,y    indented paragraph, with hanging tag x; y=indent
.LP     -         y,y    left (block) paragraph.
.XP     -         y,y    paragraph with first line exdented, others indented
.QP     -         y,y    quote paragraph (indented and shorter)


headers and footers
macro 	initial	break?
name	value	reset?


.DA x   if n      n      force date x at bottom of page; today if no x
.ND x   if t      n      no date in page footer; x is date on cover

.EF x   -         n      even page footer x (3 part as for .tl)
.OF x   -         n      odd page footer x (3 part as for .tl)

.NH x y -         y,y    numbered header; x=level, x=0 resets, x=S sets to y
.SH     -         y,y    section header, in underline

.OH x   -         n      odd page header x (3 part as for .tl)
.EH x   -         n      even page header x (3 part as for .tl)

.HD x	-	  n      optional page header below header margin
.P1     if TM     n      print header on 1st page

footnotes
macro 	initial	break?
name	value	reset?


.FS x   -         n      start footnote; x is optional footnote label
.FE     -         n      end footnote to be placed at bottom of page
.FP     -         n      numbered footnote paragraph; may be redefined
\**			 auto. number footnote in text

references
macro 	initial	break?
name	value	reset?


.]      -                beginning of refer reference
.]      -                end of refer reference
.]-     -         n      beginning of refer reference (alternate form)
.[0     -         n      end of unclassifiable type of reference
.[N     -         n      N= 1:journal-article, 2:book, 3:book-article, 4:report
                         (non-refer format)

tables
macro 	initial	break?
name	value	reset?


.TS x   -         y,y    begin table; if x=H table has multi-page header
.TE     -         y      end of table processed by tbl
.TH     -         y      end multi-page header of table

indexes
macro 	initial	break?
name	value	reset?

.XA x y -         y      another index entry; x=page or no for none; y=indent
.XE     -         y      end index entry (or series of .IX entries)
.XS x y -         y      begin index entry; x=page or no for none; y=indent
.IX x y -         y      index words x y and so on (up to 5 levels)
.PX x   -         y      print index (table of contents); x=no suppresses title

columns,  margins  and tabs
macro 	initial	break?
name	value	reset?

.1C     on        y,y    one column format, begins  on a new page
.2C     -         y,y    begin two column format
.MC x   -         y,y    multiple columns; x=column width
.TA     8n,5n     n      set tabs to 8n 16n ... (nroff) 5n 10n ... (troff)

 page formatting
		  this sets the line length to 6.5 inches: 
			.nr  LL  6.5i

     Here is a table of number registers and their default
     values:

          Name Register Controls  Takes Effect Default

          LL   line length        paragraph    6i
          LT   title length       next page    same as LL
          VS   vertical spacing   paragraph    12

          PD   paragraph distance paragraph    1v (if n), .3v (if t)
          DD   display distance   displays     1v (if n), .5v (if t)
          PI   paragraph indent   paragraph    5n
          QI   quote indent       next .QP     5n
          PO   page offset        next page    0 (if n), 9~81i (if t)

          HM   header margin      next page    1i
          FM   footer margin      next page    1i

          FL   footnote length    next .FS     5.5i
          FI   footnote indent    next .FS     2n
          FF   footnote format    next .FS     0 (1, 2, 3 available)
		Setting FF to 1 suppresses footnote superscripting; setting
    	 	it to 2 also suppresses indentation of the first line; and
     		setting it to 3 produces an .IP-like footnote paragraph.
		

 


Comments to consult@newton.berkeley.edu
© 1998-2020 UC Regents