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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Following the lead of this answer and the interface of mathtools.sty's \DeclarePairedDelimiter macro, I've made a \setof<*|[<size>]|>#1#2 that uses setbuilder notation for a set. But I cannot for the life of me understand why the third setbuilder lines up with the first one rather than the second one.

\def\setof@S#1#2{\left\lbrace #1 \midrel\setbuilder #2 \right\rbrace}
\def\setof@B[#1]#2#3{\mathopen #1\lbrace #2 \mathcrel{#1\setbuilder} #3 \mathclose #1\rbrace}
\def\setof@N#1#2{\lbrace #1 \mathcrel\setbuilder #2\rbrace}

\def\CC{\mathbf C}\def\NN{\mathbf N}
\ell^\infty &= \setof{(x_n) \in \CC^\NN}{\sup_{n\in\NN} |x_n| < \infty}. \\
\ell^\infty &= \setof[\bigg]{(x_n) \in \CC^\NN}{\sup_{n\in\NN} |x_n| < \infty}. \\
\ell^\infty &= \setof*{(x_n) \in \CC^\NN}{\sup_{n\in\NN} |x_n| < \infty}.
share|improve this question
The spacing is excessive: \def\mathcrel#1{\mathrel{#1}} and \def\midrel#1{\nonscript\;\middle#1\nonscript\;} are sufficient. – egreg May 2 '12 at 11:36
Just change \mathcrel to \def\mathcrel#1{\mathrel{}\mathclose{}#1\mathopen{}\mathrel{}}. That's necessary because, with your code, #1 might not be a relation so you must kill the spacing using mathopen/mathclose. @egreg: what you propose will not always give the same spacing as a mathrel. – Philippe Goutet May 2 '12 at 12:02
@PhilippeGoutet Why not? It is a \mathrel no matter what #1 is. – egreg May 2 '12 at 12:14
@egreg: \mathcrel yes, but not \midrel. – Philippe Goutet May 2 '12 at 13:04
@PhilippeGoutet It depends on which contexts it's used. The vertical bar in the set notation should always be surrounded by thick spaces (in text or display style), so it's not really a relation in TeXnical sense. – egreg May 2 '12 at 13:21
up vote 5 down vote accepted

the second two lines line up if you change the definition to

share|improve this answer

What is wrong with


or similar spacing around the \vert

share|improve this answer
As much as I like \DeclarePairedDelimiter I'm trying to move away from it because it does "wrong" things such as this: \DeclarePairedDelimiter\abs\lvert\rvert \def\amsabs#1{\left\lvert#1\right\rvert} \[ \sup_{x \in X} |f(x)| \text{ versus } \sup_{y\in Y} \abs{f(y)} \text{ versus } \sup_{z \in Z} \amsabs{f(z)} \] - it kills the spacing between the modulus and the "sup". – kahen May 2 '12 at 10:46
As it should, the space produced by \sub\bigl( and \sub\left( should be the same for consistency. Besides |...| is wrong anyways \lvert-1\rvert \neq |-1| – daleif May 2 '12 at 10:59
I agree that |...| is wrong, but it's still the case that $\sup_{z\in Z} \left\lvert f(z)\right\rvert$ produces a small space between the modulus and the "sup" and the same thing made with \DeclarePairedDelimiter doesn't and that just looks wrong to me – kahen May 3 '12 at 6:01
That is not \DeclarePairedDelimiters fault, it is \left not producing an opening fence. In \DeclarePairedDelimiter we make sure it does produce something that validates as an opening fence. – daleif May 3 '12 at 11:19

Your Answer


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.