[Tex/LaTex] How to create a new extensible symbol

delimitersmath-modesymbols

Given an arbitrary thin vertical symbol, can I create a new math delimiter from it (and if so, how)?

Edit: Ideally, I would like to be able to create an extensible symbol, either built out an existing normal symbol, or even made from scratch.

Edit 2: I am pretty sure that what I am after is an explanation of how to create a .tfm file for an extensible symbol (which Werner's answer describes the general structure of, but not how to make one).


For example, let's say I wanted to use the \dagger (enter image description here) or \wr (enter image description here) symbol as a delimiter, and write expressions like

\[\left\ldagger \sum_{n=1}^\infty a_n \right\rdagger\]

where the symbol scaled appropriately. Would there be any distinction between declaring a symmetric delimiter (like \vert), as opposed to one that has inherently different "left" and "right" versions like [ and ]?

Now, even being unaware of the inner workings of TeX, I imagine that there has to be lots of information in the fonts for how a delimiter is to be scaled in different situations, and if I try to make my own delimiter, this information won't be present. Would I need to get deep into FontForge or equivalent to achieve my custom delimiters, or is there an easier way?

Best Answer

Scott Pakin's Comprehensive LaTeX Symbol List identifies the structure of extensible delimiters in section 8.2 Resizing symbols (p 100-102):

All variable-sized delimiters are defined (by the corresponding .tfm file) in terms of up to five segments, as illustrated by FigureĀ 1 on pageĀ 102. The top, middle, and bottom segments are of a fixed size. The top-middle and middle-bottom segments (which are constrained to be the same character) are repeated as many times as necessary to achieve the desired height.

enter image description here

This is merely informative since I am unfamiliar with the procedure of how to create these things in a .tfm file.

Conveniently, scalerel provides \scaleleftright[<max width>]{<left obj>}{<stuff>}{<right obj>} (and a comparable \stretchleftright) for scaling/stretching both <left obj> and <right obj> to the height of <stuff> (constrained, if required and optional, to a width of <max width>). Here's a quick example:

enter image description here

\documentclass{article}
\usepackage{scalerel}% http://ctan.org/pkg/scalerel
\begin{document}
\[ \stretchleftright{\dagger}{\displaystyle\sum_{i=1}^n i}{\dagger} \]
\[ \scaleleftright{\dagger}{\displaystyle\sum_{i=1}^n i}{\dagger} \]
\end{document}