# Preventing a line break at the end of a sentence

If I want to prevent a line break between two words, then I insert a ~ like this:

Lorem~impsum.


But what if I want to prevent a line break between the end of a sentence and the first word of the new sentence. If I do it like this

Lorem ipsum.~Dolor sit amet.


then the spacing is not correct after the full stop. I can think of

Lorem \mbox{ipsum. Dolor} sit amet.


but this would prevent Dolor from breaking into two lines if necessary. What other options do I have?

• zzz.\nolinebreak\space This Aug 18 at 14:54

You can use \nolinebreak to add a penalty to prevent breaking at that point.

\documentclass{article}

\begin{document}

\setlength\xspaceskip{25pt}% for effect

1 Lorem ipsum.~Dolor sit amet.

2 Lorem ipsum. Dolor sit amet.

3 Lorem ipsum.\nolinebreak\space Dolor sit amet.

\vrule\parbox{2.7cm}{%
1 Lorem ipsum.~Dolor sit amet.

2 Lorem ipsum. Dolor sit amet.

3 Lorem ipsum.\nolinebreak\space Dolor sit amet.
}\vrule

\end{document}