# How does \delimiter work? How does it convert its argument into character(s?) and why?

studying the definition of \lvert (which just made me finally understand what does mean \@xp\@gobble and how it works \o/), I found the \delimiter command, with a numeric argument advanced by 0x1000000… So if I well understood delimiter translates into one character according its numerical argument… with something depending wether we’re inside mathmode or not… Well how does this number translate into something (where’s the translation table?), how is it related with mathmode and what does thi advancement by 0x1000000 mean/implies? And finally what’s the purpose of \delimiter?

\vert in latex is defined by

\DeclareMathDelimiter{\vert}
{\mathord}{symbols}{"6A}{largesymbols}{"0C}


which says that it is an ordinary delimiter (not open or close) that at its natural size is taken from the symbol fonts (starting at) position hex 6A with larger sizes taken from the largesymbol font (starting at) position hex 0C.

We can look at the plain TeX definition of the same.

\def\vert{\delimiter"26A30C }


which is more compact but perhaps less readable.

\delimiter is a number which packs a bit code which we can decode by splitting up the hex digits

0 (not shown) = \mathord

2 = symbol font

6A = symbol font slot

3 = extension (large symbol) font

0C = Slot in large symbol font.

amsmath defines lvert to be an "opening" version of vert which could have been

\DeclareMathDelimiter{\lvert}
{\mathopen}{symbols}{"6A}{largesymbols}{"0C}


but to allow for possible different font encodings it uses the primitive syntax and just adds "4000000 so the leading hex digit is 4 not 0 denoting a mathopen.

the tfm font metrics associate with the math fonts specify how delimiters stretch, starting from the specified slots the metrics chain together a sequence of larger glyphs then finally how to build an arbitrarily large character by stacking top bottom (possibly middle, for {) and repeatable segments.

To see the metric information taking an example and the plain tex versions the 3 means \fam3 which is defined by

\textfont3=\tenex


which says fam3 is \tenex which is defined by

\font\tenex=cmex10 % math extension


so we can look at the metrics of cmex10 using the comand

 tftopl cmex10.tfm > cmex10.pl


the .pl property list being a readable form of the font metrics.

hex OC is Octal 12 and in the pl file you see

(CHARACTER O 12
(CHARWD R 0.472224)
(CHARHT R 0.039999)
(CHARDP R 1.160013)
(NEXTLARGER O 104)
)


which tells you, apart from the usual height, depth, width, that this character is part of a chain of characters implementing an extendable delimiter and if this one is too small try character octal 104.

• @galex-713 no \delimiter takes a following integer as a pointer into the existing font metrics. You can only use it to access characters that are already specified by the font metrics to be part of an extendable character sequence. – David Carlisle Mar 1 '16 at 0:49
• @galex-713 I added some extra information about font metrics – David Carlisle Mar 1 '16 at 1:06
• @galex-713 -- the font-related commands you cite are only used in that form by plain tex. for latex, an entirely different mechanism has been defined. although it boils down to being able to access the same fonts and characters, it's not at all easy to untangle the latex code that does it. – barbara beeton Mar 1 '16 at 3:39
• @galex-713 you tagged the question tex-core so mostly I answered in terms of tex primitives only giving the latex macro wrappers as illustration if they were more readable. – David Carlisle Mar 1 '16 at 8:07
• @galex-713 "what does mean 6A" it's hex for the number 106 which just happens to be the slot where the large vert character is in the cmex10 font. – David Carlisle Mar 1 '16 at 8:11