# Overfull hbox too wide (how to break lines)?

I'm trying to list examples of weak compositions of 4, and my code looks like the following:

Weak compositions of $4$ into three parts are: $(4,0,0), (0,4,0),(0,0,4),(3,1,0),(3,0,1),(0,1,3)\linebreak(0,3,1),(1,0,3),(1,3,0),(2,2,0),(2,0,2),(0,2,2),\linebreak(2,1,1),(1,2,1),(1,1,2)$


However, the line break is not working and the list is overflowing from the page. Is there any fix/convention when this happens?

• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Commented May 23, 2023 at 21:29
• The fundamental problem is that the {equation} environment (and $...$ is {environment*}) doesn't allow line breaks. The answers propose two alternatives from the amsmath package. Commented Oct 21, 2023 at 2:18

I broke the lines where you indicated but I think breaking after a comma would be more natural

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Weak compositions of $4$ into three parts are:
\begin{multline*}
(4,0,0), (0,4,0),(0,0,4),(3,1,0),(3,0,1),(0,1,3)\\
(0,3,1),(1,0,3),(1,3,0),(2,2,0),(2,0,2),(0,2,2),\\
(2,1,1),(1,2,1),(1,1,2)
\end{multline*}

\end{document}

• Thank you very much! This solves it Commented May 24, 2023 at 2:19

You have 15 triples, so you can order them five per line (in your order) or lexicographically

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Weak compositions of $4$ into three parts are:
\begin{align*}
&(4,0,0),(0,4,0),(0,0,4),(3,1,0),(3,0,1),\\
&(0,1,3),(0,3,1),(1,0,3),(1,3,0),(2,2,0),\\
&(2,0,2),(0,2,2),(2,1,1),(1,2,1),(1,1,2)
\end{align*}

Weak compositions of $4$ into three parts are:
\begin{align*}
&(0,0,4),(0,1,3),(0,2,2),(0,3,1),(0,4,0),\\
&(1,0,3),(1,1,2),(1,2,1),(1,3,0),\\
&(2,0,2),(2,1,1),(2,2,0),\\
&(3,0,1),(3,1,0),\\
&(4,0,0)
\end{align*}

\end{document}


• Thank you very much! This is very helpful Commented May 24, 2023 at 2:19