How to automatically linebreak an inline math formula?

The general recommendation I give is to avoid long textual set builder notation: readers will be very tired when looking at the text and they'll have a hard time in isolating the closing brace.

A set $T$ consisting of comparison triplets $(i,j,l)$ such that $z_i$ 
is more similar to $z_j$ than $z_l$ is given.

However, if you use the set builder notation, it is not a set, but the set:

The set $T$ consisting of all comparison triplets $(i,j,l)$ such that $z_i$ 
is more similar to $z_j$ than $z_l$ is given.

If you insist in using the set builder notation, go back and forth in and out of math mode:

The set of comparison triplets $T=\{(i,j,l)\mid z_i$ 
is more similar to $z_j$ than $z_l\}$ is given.

enter image description here

I used twocolumn in order to emulate your problem. Note \mid and not the simple | that has wrong spacing around it.

Alternative way: define a symbol.

\documentclass[twocolumn]{article}

\newcommand{\MST}{\mathrm{MST}}

\begin{document}

Define the ternary relation ``is more similar to than'' on the positive integers
by stipulating that $\MST(i,j,l)$ holds if and only if $z_i$ is more similar
to $z_j$ than $z_l$ and set
\[
T=\{(i,j,l)\mid \MST(i,j,l)\}
\]

\end{document}

enter image description here


You can just put text in textmode.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\begin{document}

\parbox{100pt}{A set of comparison triplets $T=\{(i,j,l) | z_i$ is more similar to $z_j$ than $z_l\}$ is given.}

\end{document}

enter image description here