0

In my works I normally use

\{x\mid\varphi(x)\}

as a set forming operator. Its disadvantage, from my point of view, is that the vertical stroke is always the same, irrespective of the context. Is there any package that would make \mid context sensitive? In the sense that when I for example use

\Bigl\{x\mid\varphi\}\Bigr

the height of \mid is adjusted to the height of the brackets? If not, could you please give me a hint how can I define it to work in this way?

  • 1
    There's plenty of material on the subject on the site. Anyway, \Bigl\{x\Bigm|\varphi\Bigr\} will do – egreg May 12 '16 at 11:23
  • @egreg Thanks a lot. But what about displayed formulas? BTW, I asked the question because I had not been able to find anything (which only means that I hadn't delved deep enough, it seems). – Mad Hatter May 12 '16 at 11:30
  • \DeclarePairedDelimiterX\set[1]{\lbrace}{\rbrace}{\def\given{\mathrel{}\mathclose{}\delimsize|\mathopen{}\mathrel{}}#1} and then use \set{x\given\phi}, \set[\big]{x\given\phi}, \set[\Big]{x\given\phi}, \set[\bigg]{x\given\phi}, \set[\Bigg]{x\given\phi}, \set*{x\given\phi}. – Manuel May 12 '16 at 11:45
  • 2
    Here is the construction I tend to recommend to my users: tex.stackexchange.com/a/125024/3929, it hides the actual set builder symbol in \given such that if you later on decide of a different symbol, you only have to change it once, no search'n'replace – daleif May 12 '16 at 11:49
  • @manuel, might be an idea to make your version allow a line break after the | (my version does) – daleif May 12 '16 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.