1

Latex is formatting this formula all squished together. How do I format it properly?

$\varphi' \gets \left\{ C_n \setminus C_i \middle| C_n \textrm{does not interfere with} C_i\right\}$

enter image description here

EDIT: Here's my solution, which produces exactly what I want. However, this spacing should be done automatically, not manually. Are there any packages that define macros for this easily?

$\varphi' \gets \{\, C_n \setminus C_i \,|\, C_n \textrm{ does not interfere with }  C_i\,\}$
  • Squished together... in what way? Could you post an image of the output? – Werner Apr 19 '15 at 18:11
  • I tend to use this construction instead of manually add the builder symbol: http://tex.stackexchange.com/a/150516/3929 – daleif Apr 19 '15 at 18:15
  • 1
    Use \text{ does not interfere with } - note the space at the beginning and end. – Werner Apr 19 '15 at 18:17
  • @Werner that still leaves the spacing on the other side. A better symbol or construction is better – daleif Apr 19 '15 at 18:32
  • all "implicit" spacing (i.e., using the space bar) in math is ignored; this is by design. so if you want an actual space, you need to put it within a \text string or specify an explicit space such as "backslash space" or \quad. – barbara beeton Apr 21 '15 at 16:48

1 Answers1

1

Here are some suggestions:

enter image description here

\documentclass{article}

\usepackage{mathtools}
\DeclarePairedDelimiter{\setbuildernotation}{\lbrace}{\rbrace}
\newcommand{\setbuilder}{\setbuildernotation}
\begin{document}

$\varphi' \gets \left\{ C_n \setminus C_i \middle| C_n \textrm{does not interfere with} C_i\right\}$

\medskip

$\varphi' \gets \{\, C_n \setminus C_i \,|\, C_n \textrm{ does not interfere with } \, C_i\,\}$

\medskip

$\varphi' \gets \setbuilder{C_n \setminus C_i \mid C_n \text{ does not interfere with }  C_i}$

\medskip

% https://tex.stackexchange.com/q/2184/5764
$\varphi' \gets \setbuilder[\big]{C_n \setminus C_i \bigm\vert C_n \text{ does not interfere with }  C_i}$

\end{document}

Declaring a paired delimiter allows you to scale the contents to suit your needs. Using \left...\right outright sometimes doesn't make for good spacing. However, alternatives exist that improves on this.

Werner
  • 603,163