11

Possible Duplicate:
variable-sized “such that” pipe

I currently have this LaTeX code:

\text{Aff}(M) := \left \{ \sum_{i=1}^k \lambda_i p_i | p_i \in M, \lambda_i \in \mathbb{K}, \sum_{i=1}^k \lambda_i = 1\right \}

Which produces this:

enter image description here

But I would like to get a long pipe for my set, not this "|" short one. How can I make it long?

Martin Thoma
  • 18,799

2 Answers2

12

You can use \middle|:

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}

\begin{document}

$\mathrm{Aff}(M) := \left \{ \sum_{i=1}^k \lambda_i p_i \, \middle| \, p_i \in M, \lambda_i \in \mathbb{K}, \sum_{i=1}^k \lambda_i = 1\right \}$

\end{document}

enter image description here

Notice the two fine spaces I introduced (before and after the vertical bar) and the change from \text to \mathrm.

If instead of the \left\{...\right\} delimiters, some of the commands in the \big..., \Big... family is being used, then one can use the corresponding \bigm,\Bigm,... command:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\bigm\lvert\quad\Bigm\lvert\quad\biggm\lvert\quad\Biggm\lvert$

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • Thanks for your answer, but it doesn't work in Wikipedia. But I've found this work-around: $\mathrm{Aff}(M) := \left {\left. \sum_{i=1}^k \lambda_i p_i \ \right|\ p_i \in M, \lambda_i \in \mathbb{K}, \sum_{i=1}^k \lambda_i = 1\right }$ – Martin Thoma Aug 24 '12 at 20:59
  • Somebody mentioned that I should not use \text{} and nod \mathrm{} but \operatorname{}. – Martin Thoma Aug 24 '12 at 21:16
  • 1
    @moose that depends on whether you want "Aff" to behave as an operator or not. – Gonzalo Medina Aug 24 '12 at 21:19
  • 1
    The answer with $\bigm\lvert\quad\Bigm\lvert\quad\biggm\lvert\quad\Biggm\lvert$ works with markups in Jupyter. – iperetta Sep 18 '20 at 22:20
7

The braket package provides this functionality for creating sets using the notation \Set{...|...}:

enter image description here

\documentclass{article}
\usepackage{amssymb,amsmath}% http://ctan.org/pkg/{amssymb,amsmath}
\usepackage{braket}% http://ctan.org/pkg/braket

\begin{document}

$\mathrm{Aff}(M) := \Set{ \sum_{i=1}^k \lambda_i p_i | 
  p_i \in M, \lambda_i \in \mathbb{K}, \sum_{i=1}^k \lambda_i = 1 }$

\end{document}​
Werner
  • 603,163