mandoc_char(7) mandoc special characters

DESCRIPTION

This page documents the roff(7) escape sequences accepted by mandoc(1) to represent special characters in mdoc(7) and man(7) documents.

The rendering depends on the mandoc(1) output mode; in ASCII output, most characters are completely unintelligible. For that reason, using any of the special characters documented here, except those discussed in the DESCRIPTION, is strongly discouraged; they are supported merely for backwards compatibility with existing documents.

In particular, in English manual pages, do not use special-character escape sequences to represent national language characters in author names; instead, provide ASCII transcriptions of the names.

Dashes and Hyphens

In typography there are different types of dashes of various width: the hyphen (-), the minus sign (-), the en-dash (-), and the em-dash (---).

Hyphens are used for adjectives; to separate the two parts of a compound word; or to separate a word across two successive lines of text. The hyphen does not need to be escaped:


blue-eyed lorry-driver

The mathematical minus sign is used for negative numbers or subtraction. It should be written as '\-':


a = 3 \- 1; b = \-2;

The en-dash is used to separate the two elements of a range, or can be used the same way as an em-dash. It should be written as '\(en':


pp. 95\(en97. Go away \(en or else!

The em-dash can be used to show an interruption or can be used the same way as colons, semi-colons, or parentheses. It should be written as '\(em':


Three things \(em apples, oranges, and bananas. This is not that \(em rather, this is that.

Note: hyphens, minus signs, and en-dashes look identical under normal ASCII output. Other formats, such as PostScript, render them correctly, with differing widths.

Spaces

To separate words in normal text, for indenting and alignment in literal context, and when none of the following special cases apply, just use the normal space character (' ').

When filling text, output lines may be broken between words, i.e. at space characters. To prevent a line break between two particular words, use the unpaddable non-breaking space escape sequence ('\ ') instead of the normal space character. For example, the input string Lqnumber\ 1Rq will be kept together as Lqnumber 1Rq on the same output line.

On request and macro lines, the normal space character serves as an argument delimiter. To include whitespace into arguments, quoting is usually the best choice; see the MACRO SYNTAX section in roff(7). In some cases, using the non-breaking space escape sequence ('\ ') may be preferable.

To escape macro names and to protect whitespace at the end of input lines, the zero-width space ('\&') is often useful. For example, in mdoc(7), a normal space character can be displayed in single quotes in either of the following ways:

.Sq " "
.Sq \ \&

Quotes

On request and macro lines, the double-quote character ('"') is handled specially to allow quoting. One way to prevent this special handling is by using the '\(dq' escape sequence.

Note that on text lines, literal double-quote characters can be used verbatim. All other quote-like characters can be used verbatim as well, even on request and macro lines.

Periods

The period ('.') is handled specially at the beginning of an input line, where it introduces a roff(7) request or a macro, and when appearing alone as a macro argument in mdoc(7). In such situations, prepend a zero-width space ('\&.') to make it behave like normal text.

Do not use the '\.' escape sequence. It does not prevent special handling of the period.

Backslashes

To include a literal backslash ('\') into the output, use the ('\e') escape sequence.

Note that doubling it ('\\') is not the right way to output a backslash. Because mandoc(1) does not implement full roff(7) functionality, it may work with mandoc(1), but it may have weird effects on complete roff(7) implementations.

SPECIAL CHARACTERS

Special characters are encoded as '\X' (for a one-character escape), '\(XX' (two-character), and '\[N]' (N-character). For details, see the Special Characters subsection of the roff(7) manual.

Spacing:

InputDescription
'\ 'unpaddable non-breaking space
\~paddable non-breaking space
\0unpaddable, breaking digit-width space
\|one-sixth \(em narrow space, zero width in nroff mode
\^one-twelfth \(em half-narrow space, zero width in nroff
\&zero-width space
\%zero-width space allowing hyphenation

Lines:

InputRenderedDescription
\(ba|bar
\(br|box rule
\(ul_underscore
\(rn¯overline
\(bb|broken bar
\(sl/forward slash
\(rs\backward slash

Text markers:

InputRenderedDescription
\(cicircle
\(bubullet
\(dd=double dagger
\(dg-dagger
\(lzlozenge
\(sqwhite square
\(psparagraph
\(sc§section
\(lhleft hand
\(rhright hand
\(at@at
\(sh#hash (pound)
\(CRcarriage return
\(OKOKcheck mark

Legal symbols:

InputRenderedDescription
\(co©copyright
\(rg®registered
\(tmtrademarked

Punctuation:

InputRenderedDescription
\(em---em-dash
\(en-en-dash
\(hy-hyphen
\e\back-slash
\..period
\(r!¡upside-down exclamation
\(r?¿upside-down question

Quotes:

InputRenderedDescription
\(BqBqright low double-quote
\(bqbqright low single-quote
\(lq"left double-quote
\(rq"right double-quote
\(oq'left single-quote
\(cq'right single-quote
\(aq'apostrophe quote (text)
\(dq"double quote (text)
\(Fo«left guillemet
\(Fc»right guillemet
\(foleft single guillemet
\(fcright single guillemet

Brackets:

InputRenderedDescription
\(lB[left bracket
\(rB]right bracket
\(lC{left brace
\(rC}right brace
\(la<left angle
\(ra>right angle
\(bv|brace extension
\[braceex]exbrace extension
\[bracketlefttp]tptop-left hooked bracket
\[bracketleftbt]btbottom-left hooked bracket
\[bracketleftex]exleft hooked bracket extension
\[bracketrighttp]tptop-right hooked bracket
\[bracketrightbt]btbottom-right hooked bracket
\[bracketrightex]exright hooked bracket extension
\(ltlttop-left hooked brace
\[bracelefttp]tptop-left hooked brace
\(lk{mid-left hooked brace
\[braceleftmid]idmid-left hooked brace
\(lb[bottom-left hooked brace
\[braceleftbt]btbottom-left hooked brace
\[braceleftex]exleft hooked brace extension
\(rtrttop-left hooked brace
\[bracerighttp]tptop-right hooked brace
\(rk}mid-right hooked brace
\[bracerightmid]idmid-right hooked brace
\(rbrbbottom-right hooked brace
\[bracerightbt]btbottom-right hooked brace
\[bracerightex]exright hooked brace extension
\[parenlefttp]tptop-left hooked parenthesis
\[parenleftbt]btbottom-left hooked parenthesis
\[parenleftex]exleft hooked parenthesis extension
\[parenrighttp]tptop-right hooked parenthesis
\[parenrightbt]btbottom-right hooked parenthesis
\[parenrightex]exright hooked parenthesis extension

Arrows:

InputRenderedDescription
\(<-left arrow
\(->right arrow
\(<>left-right arrow
\(dadown arrow
\(uaup arrow
\(vavaup-down arrow
\(lAleft double-arrow
\(rAright double-arrow
\(hAleft-right double-arrow
\(uAup double-arrow
\(dAdown double-arrow
\(vAvAup-down double-arrow

Logical:

InputRenderedDescription
\(ANANlogical and
\(ORORlogical or
\(no¬logical not
\[tno]nological not (text)
\(teteexistential quantifier
\(fafauniversal quantifier
\(ststsuch that
\(tftherefore
\(3d3dtherefore
\(or|bitwise or

Mathematical:

InputRenderedDescription
\(pl+plus
\(mi-minus
\--minus (text)
\(-+-+minus-plus
\(+-±plus-minus
\[t+-]+-plus-minus (text)
\(pcpccenter-dot
\(mu×multiply
\[tmu]mumultiply (text)
\(c*circle-multiply
\(c+circle-plus
\(di÷divide
\[tdi]didivide (text)
\(f/fraction
\(***asterisk
\(<=less-than-equal
\(>=greater-than-equal
\(<<much less
\(>>>>much greater
\(eq=equal
\(!=not equal
\(==equivalent
\(nenenot equivalent
\(aptilde operator
\(|=|=asymptotically equal
\(=~approximately equal
\(~~~~almost equal
\(~=~=almost equal
\(ptptproportionate
\(esØempty set
\(momoelement
\(nmnmnot element
\(sbsbproper subset
\(nbnbnot subset
\(spspproper superset
\(ncncnot superset
\(ibibreflexive subset
\(ipipreflexive superset
\(cacaintersection
\(cucuunion
\(/_/_angle
\(ppppperpendicular
\(isIntegralintegral
\[integral]alintegral
\[sum]umsummation
\[product]ctproduct
\[coproduct]ctcoproduct
\(grgrgradient
\(srsrsquare root
\[sqrt]rtsquare root
\(lcleft-ceiling
\(rc¯|right-ceiling
\(lf|_left-floor
\(rf_|right-floor
\(ifinfinity
\(Ah&alepfsym;aleph
\(ImImimaginary
\(ReRereal
\(pddpartial differential
\(-h-hPlanck constant over 2π
\[12]½one-half
\[14]¼one-fourth
\[34]¾three-fourths

Ligatures:

InputRenderedDescription
\(ffffff ligature
\(fififi ligature
\(flflfl ligature
\(Fiffiffi ligature
\(Flfflffl ligature
\(AEÆAE
\(aeæae
\(OEŒOE
\(oeœoe
\(ssßGerman eszett
\(IJIJIJ ligature
\(ijijij ligature

Accents:

InputRenderedDescription
\(a"a"Hungarian umlaut
\(a-a-macron
\(a.a.dotted
\(a^a^circumflex
\(aa´acute
\''acute
\(ga`grave
\``grave
\(ababbreve
\(acaccedilla
\(adaddieresis
\(ahahcaron
\(aoaoring
\(a~~tilde
\(hohoogonek
\(hahahat (text)
\(ti~tilde (text)

Accented letters:

InputRenderedDescription
\('AÁacute A
\('EÉacute E
\('IÍacute I
\('OÓacute O
\('UÚacute U
\('aáacute a
\('eéacute e
\('iíacute i
\('oóacute o
\('uúacute u
\(`AÀgrave A
\(`EÈgrave E
\(`IÌgrave I
\(`OÒgrave O
\(`UÙgrave U
\(`aàgrave a
\(`eègrave e
\(`iìgrave i
\(`oìgrave o
\(`uùgrave u
\(~AÃtilde A
\(~NÑtilde N
\(~OÕtilde O
\(~aãtilde a
\(~nñtilde n
\(~oõtilde o
\(:AÄdieresis A
\(:EËdieresis E
\(:IÏdieresis I
\(:OÖdieresis O
\(:UÜdieresis U
\(:aädieresis a
\(:eëdieresis e
\(:iïdieresis i
\(:oödieresis o
\(:uüdieresis u
\(:yÿdieresis y
\(^AÂcircumflex A
\(^EÊcircumflex E
\(^IÎcircumflex I
\(^OÔcircumflex O
\(^UÛcircumflex U
\(^aâcircumflex a
\(^eêcircumflex e
\(^iîcircumflex i
\(^oôcircumflex o
\(^uûcircumflex u
\(,CÇcedilla C
\(,cçcedilla c
\(/LŁstroke L
\(/lłstroke l
\(/OØstroke O
\(/oøstroke o
\(oAÅring A
\(oaåring a

Special letters:

InputRenderedDescription
\(-DÐEth
\(Sdðeth
\(TPÞThorn
\(Tpþthorn
\(.iıdotless i
\(.j.jdotless j

Currency:

InputRenderedDescription
\(Do$dollar
\(ct¢cent
\(EuEuro symbol
\(euEuro symbol
\(Ye¥yen
\(Po£pound
\(Cs¤Scandinavian
\(FnFnflorin

Units:

InputRenderedDescription
\(de°degree
\(%0per-thousand
\(fm´minute
\(sdsdsecond
\(mcµmicro

Greek letters:

InputRenderedDescription
\(*AΑAlpha
\(*BΒBeta
\(*GΓGamma
\(*DΔDelta
\(*EΕEpsilon
\(*ZΖZeta
\(*YΗEta
\(*HΘTheta
\(*IΙIota
\(*KΚKappa
\(*LΛLambda
\(*MΜMu
\(*NΝNu
\(*CΞXi
\(*OΟOmicron
\(*PΠPi
\(*RΡRho
\(*SΣSigma
\(*TΤTau
\(*UΥUpsilon
\(*FΦPhi
\(*XΧChi
\(*QΨPsi
\(*WΩOmega
\(*aαalpha
\(*bβbeta
\(*gγgamma
\(*dδdelta
\(*eεepsilon
\(*zζzeta
\(*yηeta
\(*hθtheta
\(*iιiota
\(*kκkappa
\(*lλlambda
\(*mμmu
\(*nνnu
\(*cξxi
\(*oοomicron
\(*pπpi
\(*rρrho
\(*sσsigma
\(*tτtau
\(*uυupsilon
\(*fφphi
\(*xχchi
\(*qψpsi
\(*wωomega
\(+h+htheta variant
\(+f+fphi variant
\(+p+ppi variant
\(+e+eepsilon variant
\(tsssigma terminal

PREDEFINED STRINGS

Predefined strings are inherited from the macro packages of historical troff implementations. They are not recommended for use, as they differ across implementations. Manuals using these predefined strings are almost certainly not portable.

Their syntax is similar to special characters, using '\*X' (for a one-character escape), '\*(XX' (two-character), and '\*[N]' (N-character). For details, see the Predefined Strings subsection of the roff(7) manual.

InputRenderedDescription
\*(Ba|vertical bar
\*(Nenot equal
\*(Gegreater-than-equal
\*(Leless-than-equal
\*(Gt>greater-than
\*(Lt<less-than
\*(Pm±plus-minus
\*(Ifinfinityinfinity
\*(Pipipi
\*(NaNaNNaN
\*(Am&ampersand
\*R®restricted mark
\*(Tm(Tm)trade mark
\*q"double-quote
\*(Rq"right-double-quote
\*(Lq"left-double-quote
\*(lp(right-parenthesis
\*(rp)left-parenthesis
\*(lq"left double-quote
\*(rq"right double-quote
\*(uaup arrow
\*(vavaup-down arrow
\*(<=less-than-equal
\*(>=greater-than-equal
\*(aa´acute
\*(ga`grave
\*(PxPOSIXPOSIX standard name
\*(AiANSIANSI standard name

UNICODE CHARACTERS

The escape sequences

\[uXXXX] and \C'uXXXX'

are interpreted as Unicode codepoints. The codepoint must be in the range above U+0080 and less than U+10FFFF. For compatibility, the hexadecimal digits 'A' to 'F' must be given as uppercase characters, and points must be zero-padded to four characters; if greater than four characters, no zero padding is allowed. Unicode surrogates are not allowed.

NUMBERED CHARACTERS

For backward compatibility with existing manuals, mandoc(1) also supports the

\N'number'

escape sequence, inserting the character number from the current character set into the output. Of course, this is inherently non-portable and is already marked as deprecated in the Heirloom roff manual. For example, do not use \N'34', use \(dq, or even the plain '"' character where possible.

COMPATIBILITY

This section documents compatibility between mandoc and other troff implementations, at this time limited to GNU troff ("groff").
-
The \N'' escape sequence is limited to printable characters; in groff, it accepts arbitrary character numbers.
-
In -Tascii, the \(ss, \(nm, \(nb, \(nc, \(ib, \(ip, \(pp, \[sum], \[product], \[coproduct], \(gr, \(-h, and \(a. special characters render differently between mandoc and groff.
-
In -Thtml and -Txhtml, the \(~=, \(nb, and \(nc special characters render differently between mandoc and groff.
-
The -Tps and -Tpdf modes format like -Tascii instead of rendering glyphs as in groff.
-
The \[radicalex], \[sqrtex], and \(ru special characters have been omitted from mandoc either because they are poorly documented or they have no known representation.

AUTHORS

The mandoc_char manual page was written by Kristaps Dzonsons <[email protected]>.

CAVEATS

The predefined string '\*(Ba' mimics the behaviour of the '|' character in mdoc(7); thus, if you wish to render a vertical bar with no side effects, use the '\(ba' escape.