_ _ ___ | |__ __ _ _______ | |_ / _ \| '_ \ / _` |_ / _ \| __| | (_) | | | | (_| |/ / (_) | |_ \___/|_| |_|\__,_/___\___/ \__|
| ohazot | docs | links | dev | conf | txt |
| es | en (only, es pending / solamente en, es pendiente) |
| mdoc file |
| search |
roff —
cheatsheet
DESCRIPTION
Document about roff macros that are currently supported by mandoc and compatible with both mdoc/man output with examples.
MACROS
| ig | : ignore input. |
| break | : break loop. |
| br | : break line. |
| fi | : switch to fill mode. |
| nf | : switch to no-fill mode. |
| while | : while loop. |
| als | : alias request, string, macro, diversion | : .als <newname> <oldname> |
| am | : append to a macro definition | : .am <macroname> |
| as | : append to string | : .as <stringname> |
| de | : define a macro | : .de macroname {..} |
| ds | : define string | : .ds <stringname> <text> |
| el | : else | : .el <body> |
| ft | : font selection | : .ft [B|BI|CB|CI|CR|CW|I|P|R] |
| ie | : if/else | : .ie <condition> |
| if | : conditional statement | : .if <condition> |
| nr | : define numeric register | : .nr <register_name> <INTEGER> |
| rm | : remove request, macro, string | : .rm <request> |
| rr | : remove a register | : .rr <register> |
| po | : horizontal page offset | : .po +/-offset |
| rj | : justify the next N lines to the right | : .rj N |
| so | : source file | : .so <filename> |
| sp | : break output line and emit vertical space | : .sp [height] |
| ta | : 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>r |
EXAMPLES
ds
.ds string text .string
text
This is the \*[string] , shows text.
as
.as string newtext .string
textnewtext
als
.als newstring string .newstring
textnewtext
de
.de m .Em macrodef .. .m
macrodef
.de m .Em macrodef \\$1 .. .m test
am
.am m .Em macroappend ..
macrodef macroappend
ft
.ft BI .text in bold italic .ft P
text in bold italic
nr
.nr r 1
rr
.rr r
if
.if ( \nr == 1 ) \{\
.Em is 1
.\}
..
el
ie
.ie ( \nr == 1 ) \{\
.Em nr is 1
.\}
.el .Em nr is 0
nr is 1 nr is 0
ig
.ig text ..
rm
.rm string
TODO
| - Translate to Spanish. |
| - Add missing examples. |
| - Review and update. |
| - Define whether this doc needs to be split into roff and roff_examples. |
| - Review nr to create a macro for Bl -column simulating Bl -enum. |
| - Review als. |
| - Review on OpenBSD 7.9. |
SEE ALSO
| documentation, openbsd, mdoc, mandoc |
| OpenBSD manpages: roff(7) |
| links |
| - The GNU troff Manual (roff reference, not necessarily compatible with mdoc) |
HISTORY
| 2026-04-11 | : added string interpolation and gnu roff reference. |
| 2025-10-03 | : Created. |