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\,\}$
5
  • Squished together... in what way? Could you post an image of the output?
    – Werner
    Apr 19, 2015 at 18:11
  • I tend to use this construction instead of manually add the builder symbol: tex.stackexchange.com/a/150516/3929
    – daleif
    Apr 19, 2015 at 18:15
  • 1
    Use \text{ does not interfere with } - note the space at the beginning and end.
    – Werner
    Apr 19, 2015 at 18:17
  • @Werner that still leaves the spacing on the other side. A better symbol or construction is better
    – daleif
    Apr 19, 2015 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. Apr 21, 2015 at 16:48

1 Answer 1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .