Fork me on GitHub


This module deals with creating delimiters of various sizes. The TeXbook discusses these routines on page 441-442, in the "Another subroutine sets box x to a specified variable delimiter" paragraph.

There are three main routines here. makeSmallDelim makes a delimiter in the normal font, but in either text, script, or scriptscript style. makeLargeDelim makes a delimiter in textstyle, but in one of the Size1, Size2, Size3, or Size4 fonts. makeStackedDelim makes a delimiter out of smaller pieces that are stacked on top of one another.

The functions take a parameter center, which determines if the delimiter should be centered around the axis.

Then, there are three exposed functions. sizedDelim makes a delimiter in one of the given sizes. This is used for things like \bigl. customSizedDelim makes a delimiter with a given total height+depth. It is called in places like \sqrt. leftRightDelim makes an appropriate delimiter which surrounds an expression of a given height an depth. It is used in \left and \right.


makeCustomSizedDelim(type: string, delim: string, height: number, center: boolean, context: Context.Context, classes: Array.<string>)privatestatic

Make a delimiter of a given height+depth, with optional centering. Here, we traverse the sequences, and create a delimiter that the sequence tells us to.

type string

'mopen' or 'mclose'

delim string
height number
center boolean
context Context.Context
classes Array.<string>


Make an inner span with the given offset and in the given font. This is used in makeStackedDelim to make the stacking pieces for the delimiter.



Makes a large delimiter. This is a delimiter that comes in the Size1, Size2, Size3, or Size4 fonts. It is always rendered in textstyle.



Make a delimiter for use with \left and \right, given a height and depth of an expression that the delimiters surround. See tex.web:14994


makeNullFence(context: *, typeopt: string)privatestatic

context *
type string optional

either 'mopen', 'mclose' or null



Used to create a delimiter of a specific size, where size is 1, 2, 3, or 4.



Makes a small delimiter. This is a delimiter that comes in the Main-Regular font, but is restyled to either be in textstyle, scriptstyle, or scriptscriptstyle.



Make a stacked delimiter out of a given delimiter, with the total height at least heightTotal. This routine is mentioned on page 442 of the TeXbook.


traverseSequence(delim:: string)privatestatic

Traverse a sequence of types of delimiters to decide what kind of delimiter should be used to create a delimiter of the given height+depth.

delim: string

a character value (not a command)