[Tex/LaTex] Linebreak of words in math mode

line-breaking

I have some texts in math mode which does not break during justifications.

For example,

$A_xB_yC_z$ and $D_xE_yC_z$

The above two 'words' if at the end of a line, do not break and disrupts paragraph justification.

Any way to fix this apart from reconstructing the sentence?

Best Answer

Please always supply a complete test document, not just a fragment. You can add a potential break point using \linebreak where the optional argument gives the strength of the hint to break, 0 here.

enter image description here

\documentclass{article}

\setlength\textwidth{7cm}

\begin{document}

 x\hspace{4cm}x one two $A_xB_yC_z$ and $D_xE_yC_z$ three four five six seven eight none ten eleven twelve.


 x\hspace{4cm}x one two $A_x\linebreak[0]B_y\linebreak[0]C_z$ and $D_x\linebreak[0]E_y\linebreak[0]C_z$ three four five six seven eight none ten eleven twelve.



\end{document}
Related Question