I'm trying to print a list of sets inline to illustrate some definitions. My code is something like:

```
$\descendantsplus{\texttt{A}} = \{ \texttt{A}, \texttt{B}, \texttt{C} \},\ \descendantsplus{\texttt{B}} = \{ \texttt{B} \}$
```

and it produces:

I don't like that `descendants(C) = { C }`

is split on two different lines. I tried to add $~$ like this:

```
$\descendantsplus{\texttt{A}}~=~\{~\texttt{A},~\texttt{B},~\texttt{C}~\},\ \descendantsplus{\texttt{B}}~=~\{~\texttt{B}~\}$
```

The result is the following:

So the line doesn't break at all and creates an infinitely long line.

I read the answer to this question: What does the tilde character (~) do in math mode?, and it seems that ~ is not what I want to use as separator, but I find that the solution the answer offers to properly split the line is not satisfactory:

However, something like

`the set $N_n(R)=\{\,x\in R: x^{n-1}\ne 0\ \text{and}\ x^{n}=0\,\}$`

is more properly written as

`the set $N_n(R)=\{\,x\in R: x^{n-1}\ne 0$ and~$x^{n}=0\,\}$`

so as to give TeX more chances to properly break the line.

Is there any neat way to handle non-breaking spaces in math mode?

## Best Answer

I can reproduce your first image with

Using

`microtype`

gives a smaller amount of overfull. Note that, differently from your code, this issixdifferent formulas. A single one is wrong and gives TeX even less chances to split a line, because breaking at commas inside formulas is disallowed, so only binary relations are feasible break points.There is little chance to typeset this paragraph without splitting after

`=`

anyhow, unless you're able to move “we have:” to the line above.You can disallow breaking after a particular

`=`

sign by usingbut this wouldn't help in the first two cases of the following tests, because there's no way to fit

`\{\mathtt{C}\}`

in the line. Try it in the second example.By the way,

`\texttt`

is wrong, because it only changes the font family, but not other attributes, so you'd get italic letters in a theorem statement.