TROFF macros

TROFF Macros


I may do my own macro processor since I don't like the man2html output. These are my notes on the macros I need to support.


Macro lines normally start with a period. If they start with a single backquote, there should be no spacing before/after the command.

Macro Notes
.AB Abort: dump to stdout and stop
.AM Append macro
.AR Argument (i)
.B Bold (b)
.BI Alternating bold then italic
.BP Break page
.BR Alternating bold then roman
Actually: line break
.CE Center
.CF Copy file
.DA Divert append: like .DI but appends
.DD Define date
.DE Define macro
.DI Divert text to macro
.DS Define string
.DT Default tabstops
Actually Document Title
1: doc title
2: section name
3: volume
.EE Example End
.EL Else (second part of .IE)
.EX Example
.FAM Font family
.FL Flush output
.FP Font position (for downloaded fonts)
.FT Font
.FTR Font translate
.HCODE Hyphenation code
.HLA Hyphenation language
.HLM Hyphenated line max
.HP Hanging paragraph
.HPF Hyphenation pattern file
.HW Hyphenation word
.HY Enable hyphenation
.HYM Hyphenation margin
.HYS Hyphenation space
.I Italic
.IB Alternating italic then bold
.IE If/else conditional (first part)
.IF If conditional
.IN Indent
.IP Indented paragraph
.IR Alternating italic then roman
.LL Line length
.LP Paragraph
.LS Line spacing
.MSO Macro source
.NA No adjust
.NE ??? next entry ??? vertical space?
.NF No-fill: line breaks in source are preserved
.NH No hyphenation
.NM Line numbers
Actually: name
.NN No line numbers
.NR Number register
.NX Next record
.OP Option (surround with []), also macro-expand params
.OS Operating System
.P Paragraph (p)
.PD Paragraph distance
.PL Page length
.PM Print macro: dumps symbol table
.PN Page number
.PNR Print number register: dumps defined registers
.PO Page offset
.PP Paragraph (p)
.PTR Print trap: dumps defined traps
.R Roman
.RB Alternating roman then bold
.RD Read into stdin
.RE Relative index end (/blockquote)
.RI Alternating roman then italic
.RS Relative indent start (blockquote)
.SB Small bold
.SH Section header (h2)
.SHC Soft hyphen character
.SM Small text
.SO Source: reads from external file
.SP Space (blank lines)
.SS Sub-subhead (h3)
.SY System command
.TE Table end (/table)
.TH Table header (h1 and title)
.TI Temporary indent
.TL Title line
.TM dump output to stdout for debugging
.TP Tagged paragraph
.TRF Text read file
.TS Table start (table)
.VB Verbatim begin
.VE Verbatim end
.WH When (calls macro at page position)
.WHILE While flow control
.XR Cross-reference
Symbol Notes
\*R Registered mark
\*S type size (ignored)
\*(lq Left quotation mark
\*(rq Right quotation mark
\*(Tm Trademark symbol
\& zero-width space


  • Parsed vs not-parsed:
  • Especially the escape sequences:
  • Tables: