0

This question already has an answer here:

It is not a good idea to break mathematical insertions in text.

It happens in this example:

\documentclass{report}
\begin{document}
dfasfsd asdfsdafds asdfsdfds gdsds sfsdd ssfsd  wwer sfdsf ggfh dh dgfdd $r=0.1$ sdfsd sdfdsf asgg sdfsdf a a sfsdf.
\end{document}

ext

How to do our best to preserve mathematical insertions on one line? Is there anything more handy than manually wrapping the troubled place in mbox?

marked as duplicate by user156344, David Carlisle line-breaking Apr 22 at 16:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
\documentclass{report}
\begin{document}
dfasfsd asdfsdafds asdfsdfds gdsds sfsdd ssfsd wwer sfdsf ggfh dh
dgfdd $r=0.1$ sdfsd sdfdsf asgg sdfsdf a a sfsdf.

\bigskip

\begin{sloppypar}
\relpenalty=10000
dfasfsd asdfsdafds asdfsdfds gdsds sfsdd ssfsd wwer sfdsf ggfh dh
dgfdd $r=0.1$ sdfsd sdfdsf asgg sdfsdf a a sfsdf.
\end{sloppypar}


\end{document}

TeX only breaks after relations or binary operators, with penalty \relpenalty and binoppenalty, but as seen here in order not to break the math you need to excessively stretch the white space, and in this case no penalty less than the 10000 maximum value prevents a break.

  • will it work placing \sloppy and \relpenalty=10000 in the preamble to avoid chasing down individual paragraphs? – Viesturs Apr 22 at 16:31
  • 2
    @Viesturs yes, but the document will look horrible:-) – David Carlisle Apr 22 at 16:33
  • 2
    note that if you have inline math longer than a line it will not break if you set relpenalty and binoppenalty to 10000 so it will necessarily make an over full box @Viesturs – David Carlisle Apr 22 at 16:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.