Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having the following code:

\documentclass[11pt]{article}
\usepackage{amssymb,amsthm,amsmath}
\newcommand{\abs}[1]{\lvert #1 \rvert}
\newcommand{\N}{\mathbb N}
\newcommand{\K}{\mathbb K}

\begin{document}
\begin{displaymath}
l^2 = \{x \doteqdot (x_n)_n \in \K^{\N_0}\mid \sum_{n=1}^{\infty}\abs{x_n}^2 < +\infty\}
\end{displaymath}
\end{document}

I'd like the curly braces and the mid bar to become bigger (they should have the same height as the sum), but they don't want to enlarge.

What did I do wrong?

share|improve this question
1  
Use \left\{ and \right\} for the first part. I dunno about the \mid :-) Related: tex.stackexchange.com/q/12773/32374 –  darthbith May 25 at 17:26
    
@darthbith \middle. –  Manuel May 25 at 17:28
    
@darthbith: Thanks, I thought I should use \left{, but of course that didn't work. You thus solved the first part of my question! –  Jeroen May 25 at 17:31
    
@Jeroen \left\{ A \middle| B \right\}. –  Manuel May 25 at 17:37

3 Answers 3

up vote 5 down vote accepted

Here's a solution that doesn't rely on \left, \middle, and \right (since they produce "fences" that are too large for the equation at hand). Instead, I suggest using \biggl\{, \biggm|, and \biggr\}. Observe that the spacing around the \biggm| symbol is the same as for the small \mid symbol.

For more on when not to use automatically-sized fences see, e.g., Is it ever bad to use \left and \right?.

enter image description here

\documentclass[11pt]{article}
\usepackage{amssymb,amsthm,amsmath}
\newcommand{\abs}[1]{\lvert #1 \rvert}
\newcommand{\N}{\mathbb N}
\newcommand{\K}{\mathbb K}
\begin{document}
\begin{displaymath}
l^2 = \biggl\{ x \doteqdot (x_n)_n \in \K^{\N_0} \biggm| 
          \sum_{n=1}^{\infty}\abs{x_n}^2 < +\infty \biggr\}
\end{displaymath}
\end{document}

Addendum: From the point of view of LaTeX design philosophy, rather than engage in quasi-visual formatting by using macros such as \biggl\{, \biggm|, and \biggr\} directly in one's code, it's far better to set up macros named, say, \Set and \given, which define the look of a "set" (curly braces...) and of the symbol that indicates conditioning information (a vertical bar). It's straightforward to do so with the tools of the mathtools package (pun intended; see p. 26 of the user guide). Observe that a line break is permitted after the \given symbol. (No screenshot is provided since the resulting is the same as the one shown above; it's just the input syntax that's quite different and, I would claim, much easier to parse.)

\documentclass[11pt]{article}
\usepackage{mathtools} % mathtools loads amsmath in the background
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert} % a modified definition of \abs
\usepackage{amssymb}
\newcommand{\N}{\mathbb N}
\newcommand{\K}{\mathbb K}

%% See p. 26 of the user guide of the mathtools package for the next few macros
\providecommand\given{}  % just to make sure it exists
\newcommand\SetSymbol[1][]{\nonscript\:#1\vert\nonscript\:\allowbreak}
\DeclarePairedDelimiterX\Set[1]\lbrace\rbrace{%
  \renewcommand\given{\SetSymbol[\delimsize]}#1}

\begin{document}
\[
l^2 = \Set[\bigg]{ x \doteqdot (x_n)_n \in \K^{\N_0} \given
                   \sum_{n=1}^{\infty}\abs{x_n}^2 < +\infty }
\]
\end{document}
share|improve this answer
    
BTW: Mico is referring to the very latest version of the mathtools manual, corresponding to version 1.14. The syntax is also very useful for probabilities with build in support for conditionals. (though in this case I usually do not use an external macro for the \given symbol) –  daleif May 25 at 21:33
1  
In general a lot can actually be done to hide away especially stuff that are only of typographic importance, and thus getting a source code much closer to the actual meaning of the mathematical expression. –  daleif May 25 at 21:41

For braces, you want to use \left\{ and \right\} ... the brace itself still needs to be escaped.

The middle conditional bar can be given with the newcommand \relmiddle from here.

For example:

\documentclass[11pt]{article}
\usepackage{amssymb,amsthm,amsmath}
\newcommand{\abs}[1]{\lvert #1 \rvert}
\newcommand{\N}{\mathbb N} %Natuurlijke getallen
\newcommand{\K}{\mathbb K} %Reële of complexe getallen

\newcommand{\relmiddle}[1]{\mathrel{}\middle#1\mathrel{}}

\begin{document}
\begin{displaymath}
l^2 = \left\{x \doteqdot (x_n)_n \in \K^{\N_0} \relmiddle|  \sum_{n=1}^{\infty}\abs{x_n}^2 < +\infty\right\}
\end{displaymath}
\end{document}

equation

share|improve this answer
    
Thanks for your answer. The middle bar is bigger now, but the spacing before and behind it is gone. I'd like to get it back. Any idea how I can do that? –  Jeroen May 25 at 17:34
1  
@Jeroen Perhaps also see tex.stackexchange.com/questions/5502/… for a new command that solves the problem in probably the best way possible... answer edited to match. –  cslstr May 25 at 17:46

A solution based on the \DeclarePairedDelimiter from the mathtools package. I also use xparse to have a very simple syntax: the set of x such that P(x) is typeset with a \Set{x;P(x)} command. For a fine tuning of the delimiter size, you can use \setwith an optional argument: \big, \Big , \bigg or \Bigg.

I also recall a definition of \abs and norm as defined in the mathtoolsdocumentation. They have an optional argument, and therere is sim![enter image description here][1]ilarly anAbsand a\Norm` command.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{fourier}
\usepackage{array}
\usepackage{mathtools}
\newcommand{\N}{\mathbb N}
\newcommand{\K}{\mathbb K}

\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}%% variable sized absolute value
\def\Abs{\abs*}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}%% variable sized norm
\def\Norm{\norm*}

\usepackage{xparse}
%
\DeclarePairedDelimiterX{\set}[1]{\{}{\}}{\setargs{#1}}
\NewDocumentCommand{\setargs}{>{\SplitArgument{1}{;}}m}
{\setargsaux#1}
\NewDocumentCommand{\setargsaux}{mm}
{\IfNoValueTF{#2}{#1} {#1\,\delimsize|\,#2}}%{#1\:;\:#2}
\def\Set{\set*}%

\begin{document}

\begin{center}
\renewcommand{\arraystretch}{2}
 \begin{tabular}{r >{$\displaystyle}l<{$}}%
\verb+ \Set, \Abs+ : &l^2 = \Set{x \doteqdot (x_n)_n \in \K^{\N_0} ; \sum_{n=1}^{\infty}\Abs{x_n}^2 < +\infty} \\
\verb+ \set, \abs+ : & l^2 = \set{x \doteqdot (x_n)_n \in \K^{\N_0} ; \sum_{n=1}^{\infty}\abs{x_n^2} < +\infty} \\
\verb+ \set[\big]+ : & l^2 = \set[\big]{x \doteqdot (x_n)_n \in \K^{\N_0} ; \sum_{n=1}^{\infty}\abs[big]{x_n}^2 < +\infty} \\
\verb+ \set[\Big]+ : & l^2 = \set[\Big]{x \doteqdot (x_n)_n \in \K^{\N_0} ; \sum_{n=1}^{\infty}\abs[\Big]{x_n}^2 < +\infty} \\
\verb+ \set[\bigg]+ : & l^2 = \set[\bigg]{x \doteqdot (x_n)_n \in \K^{\N_0} ; \sum_{n=1}^{\infty}\abs[\bigg]{x_n}^2 < +\infty} \\
\verb+ \set[\Bigg]+ : & l^2 = \set[\Bigg]{x \doteqdot (x_n)_n \in \K^{\N_0} ; \sum_{n=1}^{\infty}\abs[\Bigg]{x_n}^2 < +\infty} \\
 & \Set{\Abs{\dfrac{a}{b}}}_{b\neq 0}
\end{tabular}
\end{center}

\end{document}

enter image description here

share|improve this answer
    
@Mico: you're right, it was just to give a feeling how it works. I correct the typo at once. –  Bernard May 25 at 22:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.