[Tex/LaTex] Inline equation doesn’t fit in page

line-breakingmath-mode

I have an inline equation that I don't want to split in lines.

If I use

foo bar foo bar foo bar foo bar foo bar foo bar foo bar ${ B = A \cap \{ T \leq n \} }$

It doesn't fit in the page's width and there's a part of the equation that can't be seen.

If I use

foo bar foo bar foo bar foo bar foo bar foo bar foo bar $B = A \cap \{ T \leq n \}$

it is split like:

output

I could do something like:

foo bar foo bar foo bar foo bar foo bar foo bar foo bar \\
$B = A \cap \{ T \leq n \}$

To keep it in only one line, but I wonder if there is an standard way to tell latex:
"Keep it in only one line and if it doesn't fit in the page's width then start in a new line".

This headers are important in order to reproduce the issue:

\documentclass[a5paper,oneside]{amsart}
\usepackage[scale={.8,.85}]{geometry}

Best Answer

enter image description here

Your choices include (1) leaving it as it is or (2) Preventing line breaking and letting it stick out (not really an option) or (3) allowing the break only at some places eg after the = (but that makes no difference in this case) or (4) use an glue/penalty combination that allows the line to fall short (which is like manually adding \\ but as in that case not really visually acceptable) or (5) using \sloppy or sloppypar.

\documentclass{article}

\parskip=2\baselineskip
\newcommand\possiblebreak{\ifhmode\unskip\space\hfil\penalty0\hfilneg\fi}
\begin{document}

1 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
$B = A \cap \{ T \leq n \}$
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar

2 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
${B = A \cap \{ T \leq n \}}$
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar

3 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
${B = {A \cap \{ T \leq n \}}}$
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar

4 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar\possiblebreak
${B = A \cap \{ T \leq n \}}$
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar


\begin{sloppypar}
5 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
${B = A \cap \{ T \leq n \}}$
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
\end{sloppypar}


\end{document}