3

I have

$$(1+x+x^2+x^3+x^4+x^5+x^6)(1+x^2+x^4+x^6+x^8+x^{10})(1+x^5+x^{10}+x^{15}+x^{20})$$

but is too long to fit the page. How to break this?

4 Answers4

12

First: Don't use $$/$$.

The following fits in a book with a text width of 7 inches:

\documentclass{book}

\usepackage[textwidth = 7in]{geometry}
\usepackage{mathtools}

\begin{document}

\begin{gather*}
\begin{split}
  &(1 + x + x^{2} + x^{3} + x^{4} + x^{5} + x^{6})\\
  &\cdot (1 + x^{2} + x^{4} + x^{6} +x^{8} + x^{10})\\
  &\cdot (1 + x^{5} + x^{10} + x^{15} + x^{20})
\end{split}
\end{gather*}
\begin{gather*}
\begin{split}
  \MoveEqLeft (1 + x + x^{2} + x^{3} + x^{4} + x^{5} + x^{6})\\
  &\cdot (1 + x^{2} + x^{4} + x^{6} +x^{8} + x^{10})\\
  &\cdot (1 + x^{5} + x^{10} + x^{15} + x^{20})
\end{split}
\end{gather*}

\end{document}

output

Notice the use of \MoveEqLeft (from the mathtools package) in the second example, which is equivalent to &\quad.

4
\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
The product is
\begin{multline*}
(1+x+x^2+x^3+x^4+x^5+x^6)(1+x^2+x^4+x^6+x^8+x^{10})\\
  \times(1+x^5+x^{10}+x^{15}+x^{20})
\end{multline*}
and some text.
\end{document}
egreg
  • 1,121,712
  • What is the problem? It fits on a single line. (Also, please update your question instead of posting an answer.) – Svend Tveskæg Dec 30 '14 at 22:24
  • 1
    No, it isn't. No for a book of 7". And I'm new and writing with a mobile phone in the countryside, I promise to learn the rules of this forum. Regards. – Joan Tarrasso Dec 30 '14 at 23:14
  • Once again: Tell us something like this when you post your question! It's vital to the answer(s). – Svend Tveskæg Dec 30 '14 at 23:25
  • OK Svend. I promise learn at home in my laptop with a better connection. – Joan Tarrasso Dec 30 '14 at 23:36
  • I'm going to confront Mathematics into Type when I come back at home. Good night. – Joan Tarrasso Dec 31 '14 at 01:25
  • 2
    @JoanTarrasso -- "math into type" is good for general layout and formatting advice, but it's not going to give you much help translating that into latex input. there are other sources for that information. the amsmath users guide (texdoc amsmath) goes part of the way, but you'll need more than that. some people recommend the latex wiki; i'd like to reserve judgment on that, but you might find it useful. – barbara beeton Dec 31 '14 at 22:23
3

Using a right-aligned stack. I did it with two lines, but an extra \\ and \times can be used if you prefer 3 lines. The horizontal line show the margin extent. The 16pt is the distance between baselines in the math expression.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\noindent\hrulefill
\setstackgap{L}{16pt}
\[\Longstack[r]{
  (1 + x + x^{2} + x^{3} + x^{4} + x^{5} + x^{6})
  (1 + x^{2} + x^{4} + x^{6} +x^{8} + x^{10})\qquad{}\\
  \times (1 + x^{5} + x^{10} + x^{15} + x^{20})
}
\]
\end{document}

enter image description here

3

You've mentioned in a comment that the page width of your document is 7", but you haven't mentioned how wide the text block is. Assuming a text block width of 4.5" (i.e., combined left- and right-hand margins of 2.5"), a font size of 10pt, and use of the Computer Modern font family, TeX can make the entire expression fit on a single line. This is possible because the width parameter around the + symbols is shrinkable as well as stretchable.

If you do not want to make TeX apply so much shrinkage to the spacing around the + symbols, or if your basic font size is larger than 10pt and hence if the entire polynomial can't fit on one line, you could use a multline* environment to typeset the entire expression across three lines in a staggered fashion. (If you don't like the \times symbol, consider using \cdot instead.)

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'multline*' environment
\usepackage[textwidth=4.5in]{geometry} % just for this example
\begin{document}
\noindent
The following line is 4.5" wide:
\hrule
\[
(1+x+x^2+x^3+x^4+x^5+x^6)
(1+x^2+x^4+x^6+x^8+x^{10})
(1+x^5+x^{10}+x^{15}+x^{20})
\]
\begin{multline*}
(1+x+x^2+x^3+x^4+x^5+x^6)\\
\times(1+x^2+x^4+x^6+x^8+x^{10})\\
\times(1+x^5+x^{10}+x^{15}+x^{20})
\end{multline*}
\end{document}
Mico
  • 506,678