[Tex/LaTex] Create a resizable symbol

delimitersmath-modesymbols

Some symbols can be resized automatically with \middle when placed between a \left. and a \right.
They can usually also be resized using \big or \bigg. Examples of such symbols are |and / and pretty much all the brackets; (, [, \{, \langle, and so on. I have never seen a complete list of symbols which can be resized this way. Are they special in some way or is it possible to create new resizable symbols? If it is possible: What is the "correct" way to create a new resizable symbol? By that, I mean a symbol \mysymbol such that, e.g.

\left( \somethinghuge \middle\mysymbol b \right)

will have the "correct" size. Of course, bear in mind that one would usually want to apply this to already existing symbols which do not resize. Like the \# symbol, for instance.

Best Answer

Using \scalerel, one can make one argument match the vertical extent of another argument. The optional argument is a max-width constraint (in this case, I chose 2ex). Here's an example of the same code working on two different \somethinghuge arguments. In this case, I chose \mysymbol as a / sign.

\documentclass{article}
\usepackage{scalerel}
\def\mysymbol{/}
\begin{document}
\def\somethinghuge{\rule[-2.2ex]{2ex}{6ex}}
$\left( \somethinghuge \scalerel*[2ex]{\mysymbol}{\somethinghuge} b \right)$
\def\somethinghuge{\rule[-3.2ex]{2ex}{8ex}}
$\left( \somethinghuge \scalerel*[2ex]{\mysymbol}{\somethinghuge} b \right)$
\end{document}

enter image description here

Here's an equivalent syntax that would allow you to avoid typing \somethinghuge twice.

$\left( \scaleleftright[2ex]{.}{\somethinghuge}{\mysymbol} b \right)$