[Tex/LaTex] Avoid line break in title

line-breakingtitles

How do I stop the following title wrapping, so that it extends slightly into the margin instead? I don’t want to change the font size or squeeze the text.enter image description here

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\section*{\raggedright A rather long title that I would prefer on one line}
\lipsum[2]
\end{document}

Best Answer

You could place the argument of \section* in an \mbox:

enter image description here

Speaking for myself, I don't think that suppressing a line break is a good idea here. In its stead, I'd recommend re-writing (i.e., shortening) the argument of \section*.

\documentclass{article}
\begin{document}
\hrule % just to illustrate width of textblock
\section*{\mbox{A rather long title that I would prefer on one line}}
\hrule
\end{document}