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.
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.
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:
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:
\usepackage{mathtools} \makeatletter \newcommand{@giventhatstar}[2]{\ensuremath{\left({#1};\middle|;{#2}\right)}} \newcommand{@giventhatnostar}[3][]{#1(#2;#1|;#3#1)} \newcommand{\giventhat}{@ifstar@giventhatstar@giventhatnostar} \makeatother
– David Alvarez Aug 15 '18 at 11:47Sounds like conditional probability. In that case I usually recommend our students to use something similar to
\newcommand\given[1][]{\:#1\vert\:}
Which will be manually scalled via, say
\given[\Big]
Then the code makes sense when read
ADDITION. Building further on Francis' suggestion \given can be build into his macros such that the macros only takes one argument.
\documentclass[a4paper]{memoir}
\usepackage{mathtools}
\newcommand\givenbase[1][]{\:#1\lvert\:}
\let\given\givenbase
\newcommand\sgiven{\givenbase[\delimsize]}
\DeclarePairedDelimiterX\Basics[1](){\let\given\sgiven #1}
\newcommand\Average{E\Basics}
\begin{document}
\begin{align*}
\Basics{X} \qquad \Basics[\Big]{ X \given Y}\\
\Average{X} \qquad \Average[\Big]{ X \given Y}\\
\end{align*}
\end{document}

f(x), i.e. just a function. Some people use an upright E, some people even use \mathbb{E}. Depends on the tradition.
– daleif
Nov 01 '13 at 09:45
This uses features of the scalerel package.
\documentclass{article}
\usepackage{scalerel}
\begin{document}
\noindent You can stretch it to a size:\\
$A \mid
\mathrel{\stretchto{\mid}{3ex}}
\mathrel{\stretchto{\mid}{4ex}}
B$\\
or you can stretch it to fit something else:\\
$ \stretchrel{\mid}{\displaystyle\frac{A}{B}} $\\
\end{document}

\leftand\right? can help... not sure about the usage of\midin your case. More detail? – Werner Oct 31 '13 at 04:36\Bigm|would help? And what exactly do you need it for (because there're at least 5 different meanings of|)? Maybe you can help us in helping you by providing a Minimal (non-)Working Example... – yo' Oct 31 '13 at 07:37\mid(which is usually used to such that meaning) or do you want a vertical bar to denote the absolute value, for example, on a fraction? If you want the second option, use\left|...\right|. – Sigur Oct 31 '13 at 10:57