# Using discretionary linebreaks in centering environment

I am having trouble with the interaction between discretionary line breaks and centering.

I have defined macros for math mode that contain discretionary line breaks to help TeX lay out inline formulas without overrunning the paragraph margins. However, in a centering environment, lines always break, even if there is plenty of room to make a longer line. The following is a complete example showing an unnecessary line break in a very short line.

\documentclass{article}
\newcommand{\qlambda}[1]{\lambda#1.\linebreak[1]\:}
\begin{document}
\centering
$\qlambda{x} x$ % This would fit in one line but is broken into two
\end{document}


Most of my document is not centered. I noticed the problem when I tried using the following method to center table cells vertically and horizontally.

\begin{tabular}{|m{20em}|}
\centering\arraybackslash
$\qlambda{x} x$ % This would fit in one line but is broken into two
\end{tabular}


How can I make a discretionary line break that doesn't break when a paragraph fits on a single line?

-

\linebreak[1] makes a negative penalty so TeX thinks breaking there is better than doing nothing. In justified text this is counterbalanced by the cost of stretching glue in the short line but when centering (or ragged right or left) stretchable glue fills the short line with no penalty added.
So use \nolinebreak[1] so the break is allowed but discouraged. Or perhaps better instead of using \linebreak tell TeX that the . is being used as a binary operator by using \mathbin{.} which will give different spacing and allow a break.