_                    _
  ___ | |__   __ _ _______ | |_
 / _ \| '_ \ / _` |_  / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
 \___/|_| |_|\__,_/___\___/ \__|

roffcheatsheet

Document about roff macros that are currently supported by mandoc and compatible with both mdoc/man output with examples.

(back to top)

als: create alias for request,string, macro, diversion
als newname oldname
am: append to a macro definition
am macroname
as: append to string
as stringname
br: break line
break: break loop
de: define a macro
ds: define user string
ds stringname string
el: else
el body
fi: switch to fill mode
ft: font selection
ft font
ie: if/else if if
if: conditional statement
ig: ignore input
nf: switch to no-fill mode
nr: define a numeric register
nr s 0
po: horizontal page offset
po +/-offset
rj: justify the next N lines to the right
rj N
rm: remove a request, macro or string
rm item
rr: remove a register
rr register
shift: shift macro arguments
shift N
so: source file
so oh_header.7
sp: break output line and emit vertical space
sp height
ta: set tab stop, use without arguments to remove it
ta width
ti: indent the next output line by width
ti +/-width
tr: translate glyph
tr input output
while: while loop

(back to top)

.ds string text
.string

text

This is the \*[string] , shows text.
This is the text , shows text.

.as string newtext
.string

textnewtext

.als newstring string
.newstring

textnewtext

.de m
.Em macrodef
..
.m

macrodef

.de m
.Em macrodef \\$1
..
.m test
macrodef test

.am m
.Em macroappend
..

macrodef

.ft BI
.text in bold italic
.ft P

text in bold italic

.nr r 1

.rr r

.if ( \nr == 1 ) \{\
.Em is 1
.\}
..

.ie ( \nr == 1 ) \{\
.Em nr is 1
.\}
.el .Em nr is 0

nr is 1 nr is 0

.ig
text
..

.rm string

(back to top)

(back to top)

documentation , openbsd , mdoc , mandoc

- OpenBSD manpages: roff(7)

- The GNU troff Manual (roff reference, not necessarily compatible with mdoc)

(back to top)

ohazot | about | ohazot.com <admin@ohazot.com>

This document applies to: OpenBSD 7.7| Created:2025-10-03|Updated:2026-04-09|