[Tex/LaTex] variable-sized “such that” pipe


I am looking for a pipe symbol that can be made to vary in height automatically.

One of the common ways of writing "such that" in mathematics is with the pipe symbol (|). The pipe can be represented in LaTeX directly as the character | or as \vert, but neither of these expands vertically in math presentation mode. I can adjust it manually this way:

\[\mathcal{H}=\left\lbrace h(x)=\sum_{i=0}^{k-1}a_{i}x_{i}\mod m\ \Bigg\vert
     \ a_{i}\in\mathbb{Z}_{m^{k}}\right\rbrace\]

Using \Bigg\vert

but I am looking for a true variable-sized option, parallel to \lbrace etc.

The amsmath package provides \lvert and \rvert, but I do not find them expanding as expected, and the amsmath documentation specifies that they should be used as binary delimiters (one on each side of something else), rather than alone.

Best Answer

You can use the braket package for this kind of thing.


\mathcal{H}=\Set{ h(x)=\sum_{i=0}^{k-1}a_{i}x_{i}\mod m\ |
     \ a_{i}\in\mathbb{Z}_{m^{k}}}


It defines a \Set macro which automatically puts its contents in variable sized braces, and any instance of the | symbol inside will adjust accordingly. This solution also has the advantage of making your source code more semantic.

output of code