# Linebreak of words in math mode

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?

• @LudovicC. why "no"? linebrreaking is allowed inline math. – David Carlisle Sep 13 '13 at 9:22
• @DavidCarlisle Yes it is but I answered no maybe too fast thinking of automatic linebreaking and not manual one. And I also considered that mathematical equations should not be spread on two lines when in in-line maths mode, but why not for some other maths expressions. – Ludovic C. Sep 13 '13 at 9:38
• @LudovicC. This is automatic (more or less) in that you can add the breakpoint everywhere, and then let the automatic line break algorithm pick it if it wants. – David Carlisle Sep 13 '13 at 9:44
• Sure for this part but you will have to add this in all your in-line maths expressions to make sure not to have overfull hbox in your entire document. I agree it is the solution for a specific case but it might not be as convenient for an entire thesis full of maths expression. – Ludovic C. Sep 13 '13 at 9:48

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.

\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}

• Thanks. Generally a broken word is indicated by a dash. Here the dash is not there when breaking the 'word'. Is it acceptable in a thesis? – cosmicraga Sep 13 '13 at 9:27
• @cosmicraga you almost certainly never want to introduce a symbol into math mode, too many possibilities of confusion with - . It's better not to break really. Given the effort to write a thesis, the effort to reword the paragraph or to use display math is not that great. It is different if you are doing automated typesetting of thousands of pages – David Carlisle Sep 13 '13 at 9:42

LaTeX has the command \* for a "discretionary multiplication sign"; using David's sample text, here it is:

\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\*B_y\*C_z$ and $D_x\*E_y\*C_z$ three four five six seven
eight none ten eleven twelve.

\end{document}


Don't indiscriminately add this command, do it only in the final revision stage, when no other remedy (such as rewording, first of all) seems to work.

If you prefer a centered dot rather than the \times symbol, add

\renewcommand{\*}{%
\discretionary {\thinspace\the\textfont2\char1}{}{}%
}