[Tex/LaTex] Sizing for ‘given that’ symbol – vertical bar

math-modescalingsymbols

I want to write an equation with $\mid$, but it is too small, can i make it bigger in any way?

I am kinda new to TeX so i have no idea how to do it.

Best Answer

2017 Update: Since \mid is a relation, under normal circumstances the spaces manually inserted around \middle| should be thick \; instead of thin \,. See table on p.170 of the TEXbook.


Instead of \mid, you can use \middle command to enlarge vertical delimiter and insert spaces manually, here is an example:

\documentclass{article}

\usepackage{mathtools}

\begin{document}
\[S=\left(\frac{\sum_{i=1}^{n}X_i}{n}\;\middle|\;X_i\sim\chi^2(k)\right)\]
\[\left.\frac{\sum_{i=1}^{n}X_i+Y_i}{n}\;\middle|\;X\sim\chi^2_k\;\middle|\;Y\sim\mathcal{N}(\mu,\sigma^2)\right.\]

\end{document}

Result:

enter image description here

Better yet, we can make a custom command for our conveniences:

\makeatletter
\newcommand{\@giventhatstar}[2]{\left(#1\;\middle|\;#2\right)}
\newcommand{\@giventhatnostar}[3][]{#1(#2\;#1|\;#3#1)}
\newcommand{\giventhat}{\@ifstar\@giventhatstar\@giventhatnostar}
\makeatother

It works sorta like \DeclarePairedDelimiter in mathtools, for example:

\[\giventhat{f(x)=\frac{x^2}{2}}{x=1,2,3,\dotsc}\]
\[\giventhat[\big]{f(x)=\frac{x^2}{2}}{x=1,2,3,\dotsc}\]
\[\giventhat[\Big]{f(x)=\frac{x^2}{2}}{x=1,2,3,\dotsc}\]
\[\giventhat*{f(x)=\frac{x^2}{2}}{x=1,2,3,\dotsc}\]

will give you: